logger: Replace -h with -?, -h is reserved in POSIX for remote host

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-21 11:25:04 +02:00
parent 4382136d18
commit d0360f47ed

View File

@ -198,22 +198,22 @@ static int parse_prio(char *arg, int *f, int *l)
static int usage(int code)
{
fprintf(stderr, "Usage: logger [OPTIONS] [MESSAGE]\n"
"\n"
"Write MESSAGE (or stdin) to syslog, or file (with logrotate)\n"
"\n"
" -h This help text\n"
" -p PRIO Priority (numeric or facility.level pair)\n"
" -t TAG Log using the specified tag (defaults to user name)\n"
" -s Log to stderr as well as the system log\n"
"\n"
" -f FILE File to write log messages to, instead of syslog\n"
" -n SIZE Number of bytes before rotating, default: 200 kB\n"
" -r NUM Number of rotated files to keep, default: 5\n"
" -v Show program version\n"
"\n"
"This version of logger is distributed as part of sysklogd.\n"
"Bug report address: %s\n", PACKAGE_BUGREPORT);
printf("Usage: logger [OPTIONS] [MESSAGE]\n"
"\n"
"Write MESSAGE (or stdin) to syslog, or file (with logrotate)\n"
"\n"
" -? This help text\n"
" -p PRIO Priority (numeric or facility.level pair)\n"
" -t TAG Log using the specified tag (defaults to user name)\n"
" -s Log to stderr as well as the system log\n"
"\n"
" -f FILE File to write log messages to, instead of syslog\n"
" -n SIZE Number of bytes before rotating, default: 200 kB\n"
" -r NUM Number of rotated files to keep, default: 5\n"
" -v Show program version\n"
"\n"
"This version of logger is distributed as part of sysklogd.\n"
"Bug report address: %s\n", PACKAGE_BUGREPORT);
return code;
}
@ -228,15 +228,12 @@ int main(int argc, char *argv[])
char *ident = NULL, *logfile = NULL;
char buf[512] = "";
while ((c = getopt(argc, argv, "f:hn:p:r:st:v")) != EOF) {
while ((c = getopt(argc, argv, "?f:n:p:r:st:v")) != EOF) {
switch (c) {
case 'f':
logfile = optarg;
break;
case 'h':
return usage(0);
case 'n':
size = atoi(optarg);
break;
@ -263,7 +260,7 @@ int main(int argc, char *argv[])
return 0;
default:
return usage(1);
return usage(0);
}
}