[CLEANUP] startup: report only the basename in the usage message

Don't write the full path to the program, just the program name.
This commit is contained in:
Willy Tarreau 2011-09-10 19:20:23 +02:00
parent 45a1251515
commit 3bafcdc07e

View File

@ -352,7 +352,6 @@ void init(int argc, char **argv)
{ {
int i; int i;
int arg_mode = 0; /* MODE_DEBUG, ... */ int arg_mode = 0; /* MODE_DEBUG, ... */
char *old_argv = *argv;
char *tmp; char *tmp;
char *cfg_pidfile = NULL; char *cfg_pidfile = NULL;
int err_code = 0; int err_code = 0;
@ -474,7 +473,7 @@ void init(int argc, char **argv)
while (argc > 0) { while (argc > 0) {
oldpids[nb_oldpids] = atol(*argv); oldpids[nb_oldpids] = atol(*argv);
if (oldpids[nb_oldpids] <= 0) if (oldpids[nb_oldpids] <= 0)
usage(old_argv); usage(progname);
argc--; argv++; argc--; argv++;
nb_oldpids++; nb_oldpids++;
} }
@ -483,7 +482,7 @@ void init(int argc, char **argv)
else { /* >=2 args */ else { /* >=2 args */
argv++; argc--; argv++; argc--;
if (argc == 0) if (argc == 0)
usage(old_argv); usage(progname);
switch (*flag) { switch (*flag) {
case 'n' : cfg_maxconn = atol(*argv); break; case 'n' : cfg_maxconn = atol(*argv); break;
@ -500,12 +499,12 @@ void init(int argc, char **argv)
LIST_ADDQ(&cfg_cfgfiles, &wl->list); LIST_ADDQ(&cfg_cfgfiles, &wl->list);
break; break;
case 'p' : cfg_pidfile = *argv; break; case 'p' : cfg_pidfile = *argv; break;
default: usage(old_argv); default: usage(progname);
} }
} }
} }
else else
usage(old_argv); usage(progname);
argv++; argc--; argv++; argc--;
} }
@ -514,7 +513,7 @@ void init(int argc, char **argv)
| MODE_QUIET | MODE_CHECK | MODE_DEBUG)); | MODE_QUIET | MODE_CHECK | MODE_DEBUG));
if (LIST_ISEMPTY(&cfg_cfgfiles)) if (LIST_ISEMPTY(&cfg_cfgfiles))
usage(old_argv); usage(progname);
have_appsession = 0; have_appsession = 0;
global.maxsock = 10; /* reserve 10 fds ; will be incremented by socket eaters */ global.maxsock = 10; /* reserve 10 fds ; will be incremented by socket eaters */