diff options
author | Matthew Booth <mbooth@redhat.com> | 2010-10-01 17:23:11 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-10-01 17:23:11 +0100 |
commit | f6e12eccb65bef3eb57631e54199d8b1610e7c5c (patch) | |
tree | 63131bb05128aa9e5dd9b5eb3629d54fb7fc5549 /helper | |
parent | e7d3f2ca1e2e74438db16bc0e8ed0778d5067653 (diff) | |
download | febootstrap-f6e12eccb65bef3eb57631e54199d8b1610e7c5c.tar.gz febootstrap-f6e12eccb65bef3eb57631e54199d8b1610e7c5c.tar.xz febootstrap-f6e12eccb65bef3eb57631e54199d8b1610e7c5c.zip |
Send usage output to stdout or stderr depending on context.
If usage information is displayed because of an error, it should go to stderr.
If it is displayed because the -h option was given it should go to stdout.
Diffstat (limited to 'helper')
-rw-r--r-- | helper/main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/helper/main.c b/helper/main.c index 4afcb24..f194008 100644 --- a/helper/main.c +++ b/helper/main.c @@ -51,9 +51,10 @@ static const struct option long_options[] = { }; static void -usage (const char *progname) +usage (FILE *f, const char *progname) { - printf ("%s: build the supermin appliance on the fly\n" + fprintf (f, + "%s: build the supermin appliance on the fly\n" "\n" "Usage:\n" " %s [-options] inputs [...] host_cpu kernel initrd\n" @@ -99,7 +100,7 @@ main (int argc, char *argv[]) switch (c) { case HELP_OPTION: - usage (argv[0]); + usage (stdout, argv[0]); exit (EXIT_SUCCESS); case 'f': @@ -119,7 +120,7 @@ main (int argc, char *argv[]) exit (EXIT_SUCCESS); default: - usage (argv[0]); + usage (stderr, argv[0]); exit (EXIT_FAILURE); } } |