From: Francois Fleuret Date: Thu, 9 Jul 2009 06:59:01 +0000 (+0200) Subject: The help is now written to stdout for -h and stderr for an error. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=83474bcbbe7f7a9bf6f21b0e1cb0839564e6ba71;p=selector.git The help is now written to stdout for -h and stderr for an error. --- diff --git a/selector.c b/selector.c index 30f3f19..7dc1848 100644 --- a/selector.c +++ b/selector.c @@ -836,35 +836,43 @@ int main(int argc, char **argv) { } if(show_help || error) { - fprintf(stderr, "Selector version %s-R%s\n", VERSION, REVISION_NUMBER); - fprintf(stderr, "Written by Francois Fleuret .\n"); - fprintf(stderr, "Usage: %s [options] [ [ ...]]\n", argv[0]); - fprintf(stderr, "\n"); - fprintf(stderr, " -h show this help\n"); - fprintf(stderr, " -v inject the selected line in the tty\n"); - fprintf(stderr, " -w quote control characters with ^Qs when using -v\n"); - fprintf(stderr, " -d remove duplicated lines\n"); - fprintf(stderr, " -b remove the bash history line prefix\n"); - fprintf(stderr, " -z remove the zsh history line prefix\n"); - fprintf(stderr, " -i invert the order of lines\n"); - fprintf(stderr, " -e start in regexp mode\n"); - fprintf(stderr, " -a start in case sensitive mode\n"); - fprintf(stderr, " -m monochrome mode\n"); - fprintf(stderr, " -q make a flash instead of a beep on an edition error\n"); - fprintf(stderr, " -- all following arguments are filenames\n"); - fprintf(stderr, " -t \n"); - fprintf(stderr, " add a title in the modeline\n"); - fprintf(stderr, " -c <fg modeline> <bg modeline> <fg highlight> <bg highlight>\n"); - fprintf(stderr, " set the display colors\n"); - fprintf(stderr, " -o <output filename>\n"); - fprintf(stderr, " set a file to write the selected line to\n"); - fprintf(stderr, " -s <pattern separator>\n"); - fprintf(stderr, " set the symbol to separate substrings in the pattern\n"); - fprintf(stderr, " -x <label separator>\n"); - fprintf(stderr, " set the symbol to terminate the label\n"); - fprintf(stderr, " -l <max number of lines>\n"); - fprintf(stderr, " set the maximum number of lines to take into account\n"); - fprintf(stderr, "\n"); + FILE *out; + if(show_help) { + out = stdout; + } else { + out = stderr; + } + + fprintf(out, "Selector version %s-R%s\n", VERSION, REVISION_NUMBER); + fprintf(out, "Written by Francois Fleuret <francois@fleuret.org>.\n"); + fprintf(out, "\n"); + fprintf(out, "Usage: %s [options] [<filename1> [<filename2> ...]]\n", argv[0]); + fprintf(out, "\n"); + fprintf(out, " -h show this help\n"); + fprintf(out, " -v inject the selected line in the tty\n"); + fprintf(out, " -w quote control characters with ^Qs when using -v\n"); + fprintf(out, " -d remove duplicated lines\n"); + fprintf(out, " -b remove the bash history line prefix\n"); + fprintf(out, " -z remove the zsh history line prefix\n"); + fprintf(out, " -i invert the order of lines\n"); + fprintf(out, " -e start in regexp mode\n"); + fprintf(out, " -a start in case sensitive mode\n"); + fprintf(out, " -m monochrome mode\n"); + fprintf(out, " -q make a flash instead of a beep on an edition error\n"); + fprintf(out, " -- all following arguments are filenames\n"); + fprintf(out, " -t <title>\n"); + fprintf(out, " add a title in the modeline\n"); + fprintf(out, " -c <fg modeline> <bg modeline> <fg highlight> <bg highlight>\n"); + fprintf(out, " set the display colors\n"); + fprintf(out, " -o <output filename>\n"); + fprintf(out, " set a file to write the selected line to\n"); + fprintf(out, " -s <pattern separator>\n"); + fprintf(out, " set the symbol to separate substrings in the pattern\n"); + fprintf(out, " -x <label separator>\n"); + fprintf(out, " set the symbol to terminate the label\n"); + fprintf(out, " -l <max number of lines>\n"); + fprintf(out, " set the maximum number of lines to take into account\n"); + fprintf(out, "\n"); exit(error); }