(usage): Don't call close_stdout_status directly,
authorJim Meyering <jim@meyering.net>
Thu, 11 May 2000 07:23:42 +0000 (07:23 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 11 May 2000 07:23:42 +0000 (07:23 +0000)
since that didn't cover --version output.
(main): Instead, call close_stdout_set_status and arrange to
call close_stdout via atexit.

src/date.c

index 2170899..d8c8f8a 100644 (file)
@@ -191,7 +191,6 @@ the following modifiers between `%%' and a numeric directive.\n\
   `_' (underscore) pad the field with spaces\n\
 "));
       puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
-      close_stdout_status (2);
     }
   exit (status);
 }
@@ -320,6 +319,9 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  close_stdout_set_status (2);
+  atexit (close_stdout);
+
   while ((optc = getopt_long (argc, argv, "d:f:I::r:Rs:u", long_options, NULL))
         != -1)
     switch (optc)
@@ -464,8 +466,6 @@ argument must be a format string beginning with `+'."),
       show_date (format, when);
     }
 
-  close_stdout_status (2);
-
   exit (status);
 }