summaryrefslogtreecommitdiff
path: root/src/prog-fprintf.c
diff options
context:
space:
mode:
authorOndřej Vašík <ovasik@redhat.com>2008-03-10 17:03:41 +0100
committerJim Meyering <meyering@redhat.com>2008-03-10 19:47:15 +0100
commit9c393fa1944e5decb2838de7cbcf6b371717fd77 (patch)
tree2231be9b72506005a058543193e659120bb121c6 /src/prog-fprintf.c
parent3c7a6ae340feee50ed6368ff9224aa3a29fff97e (diff)
downloadcoreutils-9c393fa1944e5decb2838de7cbcf6b371717fd77.tar.xz
install, rmdir: write --verbose output to stdout, not to stderr.
* src/install.c (announce_mkdir): Write verbose output to stdout, not to stderr. * src/mkdir.c (announce mkdir): Use prog_fprintf for verbose output. * src/prog-fprintf.c (prog_fprintf): New function and file. * src/prog-fprintf.h: New file. * src/rmdir.c (main): Write verbose output to stdout, not to stderr. Quote directory name in a diagnostic. * src/rmdir.c (remove_parents): Write verbose output to stdout, not to stderr. * doc/coreutils.texi: Mention that shred verbose output is to stderr. * NEWS: Mention the changes. Signed-off-by: Ondřej Vašík <ovasik@redhat.com>
Diffstat (limited to 'src/prog-fprintf.c')
-rw-r--r--src/prog-fprintf.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/prog-fprintf.c b/src/prog-fprintf.c
new file mode 100644
index 000000000..85aceb61f
--- /dev/null
+++ b/src/prog-fprintf.c
@@ -0,0 +1,37 @@
+/* prog-fprintf.c - common formating output functions and definitions
+ Copyright (C) 2008 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <stdarg.h>
+#include <sys/types.h>
+
+#include "prog-fprintf.h"
+
+extern char *program_name;
+
+/* Display program name followed by variable list.
+ Used for e.g. verbose output */
+void
+prog_fprintf (FILE *fp, char const *fmt, ...)
+{
+ va_list ap;
+ fputs (program_name, fp);
+ fputs (": ", fp);
+ va_start (ap, fmt);
+ vfprintf (fp, fmt, ap);
+ va_end (ap);
+ fputc ('\n', fp);
+}