]> err.no Git - util-linux/commitdiff
ldattach: prints help to stdout
authorKarel Zak <kzak@redhat.com>
Mon, 1 Mar 2010 09:51:12 +0000 (10:51 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 1 Mar 2010 09:51:12 +0000 (10:51 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/ldattach.c

index 26cf10a70215cb7ebb7128b91b0b4bc0942aa7a5..4fe5a7bb6cfbdbd5ea6ca48c88f63d658f6bce22 100644 (file)
@@ -145,13 +145,15 @@ static int parse_iflag(char *str, int *set_iflag, int *clr_iflag)
 
 static void __attribute__((__noreturn__)) usage(int exitcode)
 {
-    fprintf(stderr,
+    FILE *out = exitcode == EXIT_SUCCESS ? stdout : stderr;
+
+    fprintf(out,
            _("\nUsage: %s [ -dhV78neo12 ] [ -s <speed> ] [ -i [-]<iflag> ] <ldisc> <device>\n"),
            progname);
-    fputs(_("\nKnown <ldisc> names:\n"), stderr);
-    print_table(stderr, ld_discs);
-    fputs(_("\nKnown <iflag> names:\n"), stderr);
-    print_table(stderr, ld_iflags);
+    fputs(_("\nKnown <ldisc> names:\n"), out);
+    print_table(out, ld_discs);
+    fputs(_("\nKnown <iflag> names:\n"), out);
+    print_table(out, ld_iflags);
     exit(exitcode);
 }