From dc4fd4c43b21e3c7043d963f1ecbae5716f06e61 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 14 Jan 1999 15:36:50 +0000 Subject: [PATCH] Include closeout.h. (main): Use close_stdout_status. --- src/date.c | 7 +++---- src/printenv.c | 6 +++--- src/tty.c | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/date.c b/src/date.c index 79eaf4f..c826d01 100644 --- a/src/date.c +++ b/src/date.c @@ -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 #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); } diff --git a/src/printenv.c b/src/printenv.c index b334d8e..8a85157 100644 --- a/src/printenv.c +++ b/src/printenv.c @@ -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 #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); } diff --git a/src/tty.c b/src/tty.c index 724f213..6e7f180 100644 --- 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 #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); -- 2.7.4