Include "closeout.h".
/* cp.c -- file copying (main routines)
- Copyright (C) 89, 90, 91, 95, 1996, 1997 Free Software Foundation.
+ Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation.
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
#include "backupfile.h"
#include "argmatch.h"
#include "path-concat.h"
+#include "closeout.h"
#include "cp-hash.h"
#include "copy.h"
#include "error.h"
regular file.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("cp (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
exit_status |= do_copy (argc, argv, &x);
+ if (x.verbose)
+ close_stdout ();
exit (exit_status);
}
/* dd -- convert a file while copying it.
- Copyright (C) 85, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 85, 90, 91, 95, 96, 97, 1998 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
#include "human.h"
#include "system.h"
+#include "closeout.h"
#include "error.h"
#ifndef SIGINFO
if (show_version)
{
printf ("dd (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
sync pad every input block with NULs to ibs-size\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
/* df - summarize free disk space
- Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 91, 95, 96, 97, 1998 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
#include "fsusage.h"
#include "system.h"
#include "save-cwd.h"
+#include "closeout.h"
#include "error.h"
#include "human.h"
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("df (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
show_entry (argv[i], &stats[i - optind]);
}
+ close_stdout ();
exit (exit_status);
}
/* dircolors - output commands to set the LS_COLOR environment variable
Copyright (C) 1994, 1995, 1997 H. Peter Anvin
- Copyright (C) 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 96, 97, 1998 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
#include "system.h"
#include "getline.h"
#include "long-options.h"
+#include "closeout.h"
#include "error.h"
#include "obstack.h"
#include "dircolors.h"
For details on the format of these files, run `dircolors --print-database'.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
}
- if (fclose (stdout) == EOF)
- error (EXIT_FAILURE, errno, _("write error"));
+ close_stdout ();
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
/* du -- summarize disk usage
- Copyright (C) 88, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 88, 89, 90, 91, 95, 96, 97, 1998 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
#include "exclude.h"
#include "system.h"
#include "save-cwd.h"
+#include "closeout.h"
#include "error.h"
#include "human.h"
#include "xstrtol.h"
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("du (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
du_files (optind == argc ? cwd_only : argv + optind);
+ close_stdout ();
exit (exit_status);
}
/* install - copy files and set attributes
- Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 95, 96, 97, 1998 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
#include "backupfile.h"
#include "modechange.h"
#include "makepath.h"
+#include "closeout.h"
#include "error.h"
#include "xstrtol.h"
if (show_version)
{
printf ("install (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
}
}
+ if (verbose)
+ close_stdout ();
exit (errors);
}
never, simple always make simple backups\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
/* `ln' program to create links between files.
- Copyright (C) 86, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 86, 89, 90, 91, 95, 96, 97, 1998 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
#include "system.h"
#include "backupfile.h"
+#include "closeout.h"
#include "error.h"
int link (); /* Some systems don't declare this anywhere. */
never, simple always make simple backups\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("ln (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
errors += do_link (argv[optind], to);
}
+ if (verbose)
+ close_stdout ();
exit (errors != 0);
}
/* `dir', `vdir' and `ls' directory listing programs for GNU.
- Copyright (C) 85, 88, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 85, 88, 90, 91, 95, 96, 97, 1998 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
#include "obstack.h"
#include "ls.h"
+#include "closeout.h"
#include "error.h"
#include "human.h"
#include "argmatch.h"
(ls_mode == LS_LS ? "ls"
: (ls_mode == LS_MULTI_COL ? "dir" : "vdir")),
GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (EXIT_SUCCESS);
}
dired_dump_obstack ("//SUBDIRED//", quoting_style, &subdired_obstack);
}
- if (fclose (stdout) == EOF)
- error (EXIT_FAILURE, errno, _("write error"));
-
/* Restore default color before exiting */
if (print_with_color)
{
put_indicator (&color_indicator[C_RIGHT]);
}
+ close_stdout ();
exit (exit_status);
}
to a terminal (tty).\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
/* mkdir -- make directories
- Copyright (C) 90, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 90, 95, 96, 97, 1998 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
#include "system.h"
#include "modechange.h"
#include "makepath.h"
+#include "closeout.h"
#include "error.h"
/* The name this program was run with. */
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("mkdir (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
/* mkfifo -- make fifo's (named pipes)
- Copyright (C) 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 90, 91, 95, 96, 97, 1998 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
#include "system.h"
#include "modechange.h"
+#include "closeout.h"
#include "error.h"
/* The name this program was run with. */
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("mkfifo (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
/* mknod -- make special files
- Copyright (C) 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 90, 91, 95, 96, 97, 1998 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
#include "system.h"
#include "modechange.h"
+#include "closeout.h"
#include "error.h"
#include "xstrtol.h"
p create a FIFO\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("mknod (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
/* mv -- move or rename files
- Copyright (C) 86, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 86, 89, 90, 91, 95, 96, 97, 1998 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
#include "system.h"
#include "path-concat.h"
#include "backupfile.h"
+#include "closeout.h"
#include "error.h"
#ifdef HAVE_LCHOWN
never, simple always make simple backups\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("mv (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
for (; optind < argc - 1; ++optind)
errors |= movefile (argv[optind], argv[argc - 1], dest_is_dir);
+ if (verbose)
+ close_stdout ();
exit (errors);
}
/* `rm' file deletion utility for GNU.
- Copyright (C) 88, 90, 91, 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 88, 90, 91, 94, 95, 96, 97, 1998 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
#include "save-cwd.h"
#include "system.h"
+#include "closeout.h"
#include "error.h"
#include "obstack.h"
#include "hash.h"
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("rm (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
hash_free (active_dir_map);
#endif
+ if (verbose)
+ close_stdout ();
exit (fail);
}
/* rmdir -- remove directories
- Copyright (C) 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 90, 91, 95, 96, 97, 1998 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
#include <sys/types.h>
#include "system.h"
+#include "closeout.h"
#include "error.h"
void strip_trailing_slashes ();
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("rmdir (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}
/* sync - update the super block
- Copyright (C) 94, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 94, 95, 96, 97, 1998 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
#include "system.h"
#include "long-options.h"
+#include "closeout.h"
#include "error.h"
/* The name this program was run with. */
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
/* touch -- change modification and access times of files
- Copyright (C) 87, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 87, 89, 90, 91, 95, 96, 97, 1998 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
#include <sys/types.h>
#include "system.h"
+#include "closeout.h"
#include "error.h"
#include "argmatch.h"
STAMP may be used without -t if none of -drt, nor --, are used.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
+ close_stdout ();
}
exit (status);
}
if (show_version)
{
printf ("touch (%s) %s\n", GNU_PACKAGE, VERSION);
+ close_stdout ();
exit (0);
}