Index: find/find.c
===================================================================
RCS file: /cvsroot/findutils/findutils/find/find.c,v
retrieving revision 1.48
diff -u -p -r1.48 find.c
--- find/find.c	3 Jan 2005 00:41:29 -0000	1.48
+++ find/find.c	7 Jan 2005 12:49:08 -0000
@@ -39,6 +39,7 @@
 #include "../gnulib/lib/xalloc.h"
 #include "../gnulib/lib/human.h"
 #include "../gnulib/lib/canonicalize.h"
+#include "closeout.h"
 #include <modetype.h>
 #include "../gnulib/lib/savedir.h"
 
@@ -279,6 +280,7 @@ main (int argc, char **argv)
 #endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+  atexit (close_stdout);
 
   if (isatty(0))
     {
Index: xargs/xargs.c
===================================================================
RCS file: /cvsroot/findutils/findutils/xargs/xargs.c,v
retrieving revision 1.35
diff -u -p -r1.35 xargs.c
--- xargs/xargs.c	6 Dec 2004 00:38:52 -0000	1.35
+++ xargs/xargs.c	7 Jan 2005 12:49:08 -0000
@@ -166,6 +166,7 @@ typedef int boolean;
 #endif
 
 #include <xalloc.h>
+#include "closeout.h"
 void error PARAMS ((int status, int errnum, char *message,...));
 
 extern char *version_string;
@@ -378,6 +379,7 @@ main (int argc, char **argv)
 #endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+  atexit (close_stdout);
 
   /* IEE Std 1003.1, 2003 specifies that the combined argument and 
    * environment list shall not exceed {ARG_MAX}-2048 bytes.  It also 
Index: locate/bigram.c
===================================================================
RCS file: /cvsroot/findutils/findutils/locate/bigram.c,v
retrieving revision 1.9
diff -u -p -r1.9 bigram.c
--- locate/bigram.c	15 Nov 2004 00:39:07 -0000	1.9
+++ locate/bigram.c	7 Jan 2005 12:49:08 -0000
@@ -47,6 +47,7 @@
 
 #include <getline.h>
 #include <xalloc.h>
+#include "closeout.h"
 
 /* The name this program was run with.  */
 char *program_name;
@@ -73,6 +74,7 @@ main (int argc, char **argv)
 
   program_name = argv[0];
   (void) argc;
+  atexit (close_stdout);
   
   pathsize = oldpathsize = 1026; /* Increased as necessary by getline.  */
   path = xmalloc (pathsize);
Index: locate/frcode.c
===================================================================
RCS file: /cvsroot/findutils/findutils/locate/frcode.c,v
retrieving revision 1.10
diff -u -p -r1.10 frcode.c
--- locate/frcode.c	6 Nov 2004 09:42:40 -0000	1.10
+++ locate/frcode.c	7 Jan 2005 12:49:08 -0000
@@ -102,6 +102,7 @@
 #include "locatedb.h"
 #include <getline.h>
 #include <getopt.h>
+#include "closeout.h"
 
 char *xmalloc PARAMS((size_t));
 
@@ -165,6 +166,7 @@ main (int argc, char **argv)
   int optc;
   
   program_name = argv[0];
+  atexit (close_stdout);
 
   pathsize = oldpathsize = 1026; /* Increased as necessary by getline.  */
   path = xmalloc (pathsize);
Index: locate/code.c
===================================================================
RCS file: /cvsroot/findutils/findutils/locate/code.c,v
retrieving revision 1.12
diff -u -p -r1.12 code.c
--- locate/code.c	21 Nov 2004 12:41:23 -0000	1.12
+++ locate/code.c	7 Jan 2005 12:49:08 -0000
@@ -76,6 +76,7 @@
 
 #include "locatedb.h"
 #include <getline.h>
+#include "closeout.h"
 
 char *xmalloc PARAMS((size_t));
 
@@ -145,6 +146,7 @@ main (int argc, char **argv)
   int line_len;			/* Length of input line.  */
 
   program_name = argv[0];
+  atexit (close_stdout);
 
   bigram[2] = '\0';
 
Index: locate/locate.c
===================================================================
RCS file: /cvsroot/findutils/findutils/locate/locate.c,v
retrieving revision 1.32
diff -u -p -r1.32 locate.c
--- locate/locate.c	3 Jan 2005 10:11:48 -0000	1.32
+++ locate/locate.c	7 Jan 2005 12:49:08 -0000
@@ -110,6 +110,7 @@ extern int errno;
 #include "../gnulib/lib/error.h"
 #include "../gnulib/lib/human.h"
 #include "dirname.h"
+#include "closeout.h"
 
 /* Note that this evaluates C many times.  */
 #ifdef _LIBC
@@ -765,6 +766,7 @@ main (argc, argv)
 #endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+  atexit (close_stdout);
 
   dbpath = getenv ("LOCATE_PATH");
   if (dbpath == NULL)
Index: import-gnulib.sh
===================================================================
RCS file: /cvsroot/findutils/findutils/import-gnulib.sh,v
retrieving revision 1.10
diff -u -p -r1.10 import-gnulib.sh
--- import-gnulib.sh	6 Dec 2004 00:44:50 -0000	1.10
+++ import-gnulib.sh	7 Jan 2005 12:49:08 -0000
@@ -35,7 +35,7 @@ destdir="gnulib"
 
 # Modules needed for findutils itself.
 findutils_modules="\
-alloca  argmatch  dirname error fileblocks  fnmatch-gnu  \
+alloca  argmatch closeout dirname error fileblocks  fnmatch-gnu  \
 getline getopt human idcache  lstat malloc memcmp memset mktime	  \
 modechange   pathmax quotearg realloc regex rpmatch savedir stat  \
 stpcpy strdup strftime  strstr strtol strtoul strtoull strtoumax  \
@@ -132,4 +132,4 @@ printf "%s" "EXTRA_DIST = "
 cd  gnulib/m4
 ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
 echo 
-) > gnulib/m4/Makefile.am
\ No newline at end of file
+) > gnulib/m4/Makefile.am
