Hi all,
Here is a patch to add support for long options name. --help and
--version are kind of a standard way to get help and release. I added
long options name for every possible command line options.
I didn't change the usage message, but it will need a major rewrite. I
can do it and commit the complete patch if you agree on it.
Hope you'll find this interesting.
Regards.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
Index: main.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/main.c,v
retrieving revision 1.45
diff -c -p -r1.45 main.c
*** main.c 5 Feb 2009 00:24:42 -0000 1.45
--- main.c 5 Mar 2009 16:07:19 -0000
*************** char **myargv;
*** 172,183 ****
--- 172,197 ----
int main(int argc, char **argv)
{
int opt;
+ int optindex;
int i;
int pid;
int size;
int retrycnt;
int sys_retrycnt;
+ static struct option long_options[] = {
+ {"hba-file", required_argument, NULL, 'a'},
+ {"clear-cache", no_argument, NULL, 'c'},
+ {"debug", no_argument, NULL, 'd'},
+ {"config-file", required_argument, NULL, 'f'},
+ {"pcp-password-file", required_argument, NULL, 'F'},
+ {"help", no_argument, NULL, 'h'},
+ {"mode", required_argument, NULL, 'm'},
+ {"no-daemon", no_argument, NULL, 'n'},
+ {"version", no_argument, NULL, 'v'},
+ {NULL, 0, NULL, 0}
+ };
+
myargc = argc;
myargv = argv;
*************** int main(int argc, char **argv)
*** 185,191 ****
snprintf(pcp_conf_file, sizeof(pcp_conf_file), "%s/%s", DEFAULT_CONFIGDIR, PCP_PASSWD_FILE_NAME);
snprintf(hba_file, sizeof(hba_file), "%s/%s", DEFAULT_CONFIGDIR, HBA_CONF_FILE_NAME);
! while ((opt = getopt(argc, argv, "a:cdf:F:hm:nv")) != -1)
{
switch (opt)
{
--- 199,205 ----
snprintf(pcp_conf_file, sizeof(pcp_conf_file), "%s/%s", DEFAULT_CONFIGDIR, PCP_PASSWD_FILE_NAME);
snprintf(hba_file, sizeof(hba_file), "%s/%s", DEFAULT_CONFIGDIR, HBA_CONF_FILE_NAME);
! while ((opt = getopt_long(argc, argv, "a:cdf:F:hm:nv", long_options, &optindex)) != -1)
{
switch (opt)
{
_______________________________________________
Pgpool-hackers mailing list
[email protected]
http://pgfoundry.org/mailman/listinfo/pgpool-hackers