Commit 1a7b6c03 authored by Niels Möller's avatar Niels Möller

Send usage message to stderr, rather than stdout, on errors.

parent 90b82481
2012-07-10 Niels Möller <nisse@lysator.liu.se>
* src/testsuite/mini-inetd.c (usage): Take a FILE * as argument.
Called with stdout in response to --help, and stderr otherwise.
* src/testsuite/prgrp-timeout.c: Added missing include of
config.h.
......
......@@ -63,13 +63,19 @@ werror(const char *format, ...)
}
static void
usage (void)
usage (FILE *f)
{
printf("mini-inetd [OPTIONS] [localaddr:]port program [argv0, argv1 ...]\n"
"Options:\n"
" -m max-connections\n"
" --help\n"
" --background\n");
fprintf(f,
/* FIXME: ':' is a bad separator for literal IPv6 addresses.
Support [] around the address? */
"mini-inetd [OPTIONS] [localaddr:]port program [argv0, argv1 ...]\n"
"Options:\n"
" -m max-connections\n"
" --help\n"
" --background\n"
" -4 Only use IPv4.\n"
" -6 Only use IPv6.\n"
" --help Display this help.\n");
}
static void
......@@ -133,7 +139,7 @@ main (int argc, char **argv)
case '?':
return EXIT_FAILURE;
case OPT_HELP:
usage();
usage(stdout);
return EXIT_SUCCESS;
case OPT_BACKGROUND:
background = 1;
......@@ -164,7 +170,7 @@ main (int argc, char **argv)
if (argc < 2)
{
usage();
usage(stderr);
return EXIT_FAILURE;
}
sep = strrchr(argv[0], ':');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment