mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-28 04:24:45 +08:00
mkdir, split: write --verbose output to stdout, not stderr.
* src/mkdir.c (verbose_output): New function. (announce_mkdir): Use it. * src/split.c (usage): Update. * src/split.c (cwrite): Write to stdout, not stderr. * doc/coreutils.texi (split invocation): Remove the mention of --verbose output being printed to stderr. * tests/mkdir/p-v: Redirect stdout, not stderr. * tests/misc/split-a: Likewise. * NEWS: Mention this change. * TODO: Remove this item.
This commit is contained in:
parent
0981b56f26
commit
a09dadf100
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2008-02-06 Steven Schubiger <schubiger@gmail.com>
|
||||
|
||||
mkdir, split: write --verbose output to stdout, not stderr.
|
||||
* src/mkdir.c (verbose_output): New function.
|
||||
(announce_mkdir): Use it.
|
||||
* src/split.c (usage): Update.
|
||||
* src/split.c (cwrite): Write to stdout, not stderr.
|
||||
* doc/coreutils.texi (split invocation): Remove the mention
|
||||
of --verbose output being printed to stderr.
|
||||
* tests/mkdir/p-v: Redirect stdout, not stderr.
|
||||
* tests/misc/split-a: Likewise.
|
||||
* NEWS: Mention this change.
|
||||
* TODO: Remove this item.
|
||||
|
||||
2008-02-04 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
* Makefile.maint (announcement): Remove stale comment.
|
||||
|
4
NEWS
4
NEWS
@ -10,6 +10,10 @@ GNU coreutils NEWS -*- outline -*-
|
||||
"rmdir --ignore-fail-on-non-empty" detects and ignores the failure
|
||||
in more cases when a directory is empty.
|
||||
|
||||
** Consistency
|
||||
|
||||
mkdir and split now write --verbose output to stdout, not stderr.
|
||||
|
||||
|
||||
* Noteworthy changes in release 6.10 (2008-01-22) [stable]
|
||||
|
||||
|
8
TODO
8
TODO
@ -46,14 +46,6 @@ And once that's done, add an exclusion so that `cp --link'
|
||||
no longer incurs the overhead of saving src. dev/ino and dest. filename
|
||||
in the hash table.
|
||||
|
||||
See if we can be consistent about where --verbose sends its output:
|
||||
These all send --verbose output to stdout:
|
||||
head, tail, rm, cp, mv, ln, chmod, chown, chgrp, install, ln
|
||||
These send it to stderr:
|
||||
shred mkdir split
|
||||
shred must write --verbose output to stderr
|
||||
readlink is different
|
||||
|
||||
Write an autoconf test to work around build failure in HPUX's 64-bit mode.
|
||||
See notes in README -- and remove them once there's a work-around.
|
||||
|
||||
|
@ -2838,7 +2838,7 @@ Use digits in suffixes rather than lower-case letters.
|
||||
|
||||
@itemx --verbose
|
||||
@opindex --verbose
|
||||
Write a diagnostic to standard error just before each output file is opened.
|
||||
Write a diagnostic just before each output file is opened.
|
||||
|
||||
@end table
|
||||
|
||||
|
17
src/mkdir.c
17
src/mkdir.c
@ -1,5 +1,5 @@
|
||||
/* mkdir -- make directories
|
||||
Copyright (C) 90, 1995-2002, 2004-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 90, 1995-2002, 2004-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
|
||||
@ -79,6 +79,19 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
exit (status);
|
||||
}
|
||||
|
||||
/* Verbose formatted output of variable count of arguments. */
|
||||
static void
|
||||
verbose_output (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);
|
||||
}
|
||||
|
||||
/* Options passed to subsidiary functions. */
|
||||
struct mkdir_options
|
||||
{
|
||||
@ -105,7 +118,7 @@ announce_mkdir (char const *dir, void *options)
|
||||
{
|
||||
struct mkdir_options const *o = options;
|
||||
if (o->created_directory_format)
|
||||
error (0, 0, o->created_directory_format, quote (dir));
|
||||
verbose_output (stdout, o->created_directory_format, quote (dir));
|
||||
}
|
||||
|
||||
/* Make ancestor directory DIR, whose last component is COMPONENT,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* split.c -- split a file into pieces.
|
||||
Copyright (C) 1988, 1991, 1995-2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988, 1991, 1995-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
|
||||
@ -122,8 +122,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
|
||||
-l, --lines=NUMBER put NUMBER lines per output file\n\
|
||||
"), DEFAULT_SUFFIX_LENGTH);
|
||||
fputs (_("\
|
||||
--verbose print a diagnostic to standard error just\n\
|
||||
before each output file is opened\n\
|
||||
--verbose print a diagnostic just before each\n\
|
||||
output file is opened\n\
|
||||
"), stdout);
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
@ -208,7 +208,7 @@ cwrite (bool new_file_flag, const char *bp, size_t bytes)
|
||||
|
||||
next_file_name ();
|
||||
if (verbose)
|
||||
fprintf (stderr, _("creating file %s\n"), quote (outfile));
|
||||
fprintf (stdout, _("creating file %s\n"), quote (outfile));
|
||||
output_desc = open (outfile,
|
||||
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
|
||||
(S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Show that split -a works.
|
||||
|
||||
# Copyright (C) 2002-2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-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
|
||||
@ -39,7 +39,7 @@ test -f xaz && fail=1
|
||||
rm -f x*
|
||||
|
||||
# With a longer suffix, it must succeed.
|
||||
split --verbose -b 1 -a 2 in 2> err || fail=1
|
||||
split --verbose -b 1 -a 2 in > err || fail=1
|
||||
test -f xaa || fail=1
|
||||
test -f xaz || fail=1
|
||||
test -f xba || fail=1
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Test mkdir -pv.
|
||||
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-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
|
||||
@ -24,7 +24,7 @@ fi
|
||||
. $srcdir/../lang-default
|
||||
. $srcdir/../test-lib.sh
|
||||
|
||||
mkdir -pv foo/a/b/c/d 2>out || exit
|
||||
mkdir -pv foo/a/b/c/d >out || exit
|
||||
|
||||
diff - out <<\EOF
|
||||
mkdir: created directory `foo'
|
||||
|
Loading…
Reference in New Issue
Block a user