diff options
author | Jim Meyering <jim@meyering.net> | 2000-05-20 22:06:38 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-05-20 22:06:38 +0000 |
commit | 24f2bd8c9f62409ef7d7c919c9a53f438ee991cb (patch) | |
tree | 0d30aa82a2c6c12ab2224c5ecffb9ded6a11caaa /src/fold.c | |
parent | ac8180336348bee878584b013d71f84e5d047f21 (diff) | |
download | coreutils-24f2bd8c9f62409ef7d7c919c9a53f438ee991cb.tar.xz |
Arrange to call close_stdout upon exit. Don't close stdout explicitly.
Diffstat (limited to 'src/fold.c')
-rw-r--r-- | src/fold.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/fold.c b/src/fold.c index a9b25f662..14596daf7 100644 --- a/src/fold.c +++ b/src/fold.c @@ -1,5 +1,5 @@ /* fold -- wrap each input line to fit in specified width. - Copyright (C) 91, 1995-1999 Free Software Foundation, Inc. + Copyright (C) 91, 1995-2000 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 +24,7 @@ #include <sys/types.h> #include "system.h" +#include "closeout.h" #include "error.h" #include "xstrtol.h" @@ -242,6 +243,8 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + atexit (close_stdout); + break_spaces = count_bytes = have_read_stdin = 0; /* Turn any numeric options into -w options. */ @@ -302,8 +305,6 @@ main (int argc, char **argv) if (have_read_stdin && fclose (stdin) == EOF) error (EXIT_FAILURE, errno, "-"); - if (fclose (stdout) == EOF) - error (EXIT_FAILURE, errno, _("write error")); exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } |