gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] Where to send usage messages.


From: Gunnar Farnebäck
Subject: [gnugo-devel] Where to send usage messages.
Date: Wed, 14 Sep 2005 23:45:39 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI)

[This is really old.]

Paul wrote on January 25, 2004:
> > P.S. speaking of which, it seems to be standard to write help message
> >      (gnugo --help) to stdout, not stderr; any objections to changing it?
> 
> The patch below changes it for GNU Go and every tool i remembered about.
> You can see that (most) programs (at least GNU programs) write help
> messages to stdout by testing
> 
>         ls --help > /dev/null

Yes, but you can also do "ls --hjelp > /dev/null" to see that it
writes the message

  ls: unrecognised option `--hjelp'
  Try `ls --help' for more information.

to stderr. The patch below reverts usage messages caused by bad input
to be sent to stderr.

- send usage messages caused by bad input to stderr

/Gunnar

Index: patterns/extract_fuseki.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/extract_fuseki.c,v
retrieving revision 1.28
diff -u -r1.28 extract_fuseki.c
--- patterns/extract_fuseki.c   12 Jun 2005 09:34:14 -0000      1.28
+++ patterns/extract_fuseki.c   14 Sep 2005 21:31:55 -0000
@@ -1577,7 +1577,7 @@
   
   /* Check number of arguments. */
   if (argc < 10) {
-    printf(USAGE);
+    fprintf(stderr, USAGE);
     exit(EXIT_FAILURE);
   }
   
Index: patterns/joseki.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/joseki.c,v
retrieving revision 1.26
diff -u -r1.26 joseki.c
--- patterns/joseki.c   12 Jun 2005 09:34:15 -0000      1.26
+++ patterns/joseki.c   14 Sep 2005 21:32:41 -0000
@@ -387,7 +387,7 @@
 
   /* Check number of arguments. */
   if (argc != 3) {
-    printf(USAGE);
+    fprintf(stderr, USAGE);
     exit(EXIT_FAILURE);
   }
 
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.148
diff -u -r1.148 mkpat.c
--- patterns/mkpat.c    14 Sep 2005 18:33:20 -0000      1.148
+++ patterns/mkpat.c    14 Sep 2005 21:32:42 -0000
@@ -3124,7 +3124,7 @@
   }
 
   if (gg_optind >= argc) {
-    fputs(USAGE, stdout);
+    fputs(USAGE, stderr);
     exit(EXIT_FAILURE);
   }
 
Index: patterns/transpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/transpat.c,v
retrieving revision 1.12
diff -u -r1.12 transpat.c
--- patterns/transpat.c 12 Jun 2005 09:34:15 -0000      1.12
+++ patterns/transpat.c 14 Sep 2005 21:32:42 -0000
@@ -133,7 +133,8 @@
   int command = 0;
 
   if (argc < 2 || argc > 4) {
-    printf("usage: %s command patnames [patfilename]\n\
+    fprintf(stderr,
+           "usage: %s command patnames [patfilename]\n\
 where\n\
     command     is one of 'flipleft' or 'normalize'\n\
     patnames    is a standard glob pattern (like EE*)\n\




reply via email to

[Prev in Thread] Current Thread [Next in Thread]