42 lines
977 B
C
42 lines
977 B
C
/*to use *print**/
|
|
#include <stdio.h>
|
|
/*to use struct pq_confo*/
|
|
#include "pqconfo.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
/*read command line*/
|
|
if (argc > 1){
|
|
fprintf(stdout,"main() Started...\n");
|
|
printf("main() argv[1]: %s\n", argv[1]);
|
|
}else{
|
|
fprintf(stderr, "Usage: %s <path to config file>\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
int pqConfoRet;
|
|
const struct pq_confo * pqConfo;
|
|
|
|
/*get Postgresql connection info*/
|
|
/*TODO Validate argv!*/
|
|
pqConfoRet=get_pq_confo(argv[1],&pqConfo);
|
|
if(pqConfoRet){
|
|
fprintf(stderr, "Postgresql connection information are NOT valid\n");
|
|
return 2;
|
|
}else{
|
|
fprintf(stdout,"pqConfoRet: %d\n",pqConfoRet);
|
|
}
|
|
|
|
/*free Postgresql connection info*/
|
|
pqConfoRet=free_pq_confo(&pqConfo);
|
|
if(pqConfoRet){
|
|
fprintf(stderr, "Postgresql connection information are NOT free\n");
|
|
return 3;
|
|
}else{
|
|
fprintf(stdout,"pqConfoRet: %d\n",pqConfoRet);
|
|
}
|
|
|
|
fprintf(stdout,"main() Done.\n");
|
|
return 0;
|
|
}
|