[Refdb-cvs] CVS: refdb/src refdba.c,1.45,1.45.2.1
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-07-12 21:52:09
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25272 Modified Files: Tag: Release_0_9_5_stable refdba.c Log Message: pass help option through to command in batch mode; check for valid command name in batch mode; fixed length of username string Index: refdba.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdba.c,v retrieving revision 1.45 retrieving revision 1.45.2.1 diff -u -U2 -r1.45 -r1.45.2.1 --- refdba.c 1 May 2004 14:56:03 -0000 1.45 +++ refdba.c 12 Jul 2004 21:51:58 -0000 1.45.2.1 @@ -115,5 +115,5 @@ char port_address[PREFS_BUF_LEN] = "9734"; /*+ default port address of refdbd +*/ char the_pager[PREFS_BUF_LEN] = "stdout"; /*+ default "pager" (stdout) +*/ -char username[USERNAME_LENGTH + 1] = ""; /*+ default username (emtpy) +*/ +char username[PREFS_BUF_LEN] = ""; /*+ default username (emtpy) +*/ char passwd[PREFS_BUF_LEN] = "*"; /*+ default password (ask user) +*/ char refdb_timeout[PREFS_BUF_LEN] = "60"; /*+ 60 seconds default timeout +*/ @@ -268,4 +268,8 @@ strncpy(the_cmd, optarg, 31); the_cmd[31] = '\0'; + if (!find_command(optarg, commands)) { + fprintf (stderr, "%s: No such command for refdb.\n", optarg); + exit (1); + } n_batchmode = 1; break; @@ -275,6 +279,17 @@ break; case 'h': - fprintf(stderr, "Usage: refdba [-c pager] [-C command] [-e logdest] [-h] [-i IP_address] [-l loglevel] [-L logfile] [-p port] [-q] [-T time] [-u name] [-v] [-V] [-w password] [-y confdir]\nOptions: -c command to run a pager\n -C run command in batch mode\n -e log destination (0=stderr;1=syslog;2=custom file)\n -h prints this help\n -i set server IP address to address\n -l log level (0<=level<=7)\n -L full path to custom log file\n -p set server port to port\n -q ignore init-file\n -T set timeout to time seconds\n -u set username\n -v show version information\n -V switch to verbose mode\n -w password (use '*' to be asked interactively)\n -y look for configuration files in confdir\n"); - exit (0); + if (!n_batchmode) { + fprintf(stderr, "Usage: refdba [-c pager] [-C command] [-e logdest] [-h] [-i IP_address] [-l loglevel] [-L logfile] [-p port] [-q] [-T time] [-u name] [-v] [-V] [-w password] [-y confdir]\nOptions: -c command to run a pager\n -C run command in batch mode\n -e log destination (0=stderr;1=syslog;2=custom file)\n -h prints this help\n -i set server IP address to address\n -l log level (0<=level<=7)\n -L full path to custom log file\n -p set server port to port\n -q ignore init-file\n -T set timeout to time seconds\n -u set username\n -v show version information\n -V switch to verbose mode\n -w password (use '*' to be asked interactively)\n -y look for configuration files in confdir\n"); + exit (0); + } + else { + if ((new_the_command = mstrcat(the_command, " -h ", &the_command_len, 0)) == NULL) { + fprintf(stderr, "out of memory\n"); + exit (1); + } + else { + the_command = new_the_command; + } + } break; case 'i': |