(usage): Don't call close_stdout directly, since that
authorJim Meyering <jim@meyering.net>
Thu, 11 May 2000 07:21:33 +0000 (07:21 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 11 May 2000 07:21:33 +0000 (07:21 +0000)
didn't cover --version output.
(main):  Arrange to call close_stdout via atexit, instead.

src/sleep.c
src/true.c
src/yes.c

index b00c9f7..c160413 100644 (file)
@@ -81,7 +81,6 @@ point number.\n\
 "),
              program_name, program_name);
       puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
-      close_stdout ();
     }
   exit (status);
 }
@@ -200,6 +199,8 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  atexit (close_stdout);
+
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      AUTHORS, usage);
 
index d28bec3..53c8f77 100644 (file)
@@ -26,7 +26,6 @@ These option names may not be abbreviated.\n\
 ")
          , program_name, program_name);
   puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
-  close_stdout ();
   exit (status);
 }
 
@@ -38,6 +37,8 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  atexit (close_stdout);
+
   /* Recognize --help or --version only if it's the only command-line
      argument and if POSIXLY_CORRECT is not set.  */
   if (argc == 2 && getenv ("POSIXLY_CORRECT") == NULL)
index 33ca609..59aa17b 100644 (file)
--- a/src/yes.c
+++ b/src/yes.c
@@ -54,7 +54,6 @@ Repeatedly output a line with all specified STRING(s), or `y'.\n\
   --version   output version information and exit\n"));
       puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
     }
-  close_stdout ();
   exit (status);
 }
 
@@ -66,6 +65,8 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  atexit (close_stdout);
+
   /* Don't recognize --help or --version if POSIXLY_CORRECT is set.  */
   if (getenv ("POSIXLY_CORRECT") == NULL)
     parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,