Include closeout.h. (main): Use close_stdout_status.
authorJim Meyering <jim@meyering.net>
Thu, 14 Jan 1999 15:36:50 +0000 (15:36 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 14 Jan 1999 15:36:50 +0000 (15:36 +0000)
src/date.c
src/printenv.c
src/tty.c

index 79eaf4f..c826d01 100644 (file)
@@ -1,6 +1,5 @@
 /* date - print or set the system date and time
-   Copyright (C) 89, 90, 91, 92, 93, 94, 95, 96, 1997
-   Free Software Foundation, Inc.
+   Copyright (C) 1989-1999 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,6 +23,7 @@
 #include <sys/types.h>
 
 #include "system.h"
+#include "closeout.h"
 #include "getline.h"
 #include "error.h"
 #include "getdate.h"
@@ -357,8 +357,7 @@ argument must be a format string beginning with `+'."),
       show_date (format, when);
     }
 
-  if (fclose (stdout) == EOF)
-    error (2, errno, _("write error"));
+  close_stdout_status (2);
 
   exit (status);
 }
index b334d8e..8a85157 100644 (file)
@@ -1,5 +1,5 @@
 /* printenv -- print all or part of environment
-   Copyright (C) 89,90,91,92,93,94,95,96,1997 Free Software Foundation, Inc.
+   Copyright (C) 89,90,91,92,93,94,95,96,1997, 1999 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@
 #include <getopt.h>
 
 #include "system.h"
+#include "closeout.h"
 #include "error.h"
 
 /* The name this program was run with. */
@@ -136,8 +137,7 @@ main (int argc, char **argv)
       exit_status = (matches != argc - optind);
     }
 
-  if (ferror (stdout) || fclose (stdout) == EOF)
-    error (2, errno, _("standard output"));
+  close_stdout_status (2);
 
   exit (exit_status);
 }
index 724f213..6e7f180 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -1,5 +1,5 @@
 /* tty -- print the path of the terminal connected to standard input
-   Copyright (C) 90,91,92,93,94,95,96,1997 Free Software Foundation, Inc.
+   Copyright (C) 1990-1999 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 
 #include "system.h"
+#include "closeout.h"
 #include "error.h"
 
 static void usage PARAMS ((int status));
@@ -102,8 +103,7 @@ main (int argc, char **argv)
       else
        puts (_("not a tty"));
 
-      if (ferror (stdout) || fclose (stdout) == EOF)
-       error (3, errno, _("standard output"));
+      close_stdout_status (3);
     }
 
   exit (isatty (0) ? 0 : 1);