Compare commits

...

525 Commits

Author SHA1 Message Date
Jim Meyering
c0d85f7e45 . 2000-09-09 08:58:58 +00:00
Jim Meyering
fdd7f15c6e *** empty log message *** 2000-09-09 08:58:42 +00:00
Jim Meyering
88fec8763a . 2000-09-09 08:56:38 +00:00
Jim Meyering
80fe6fbd20 *** empty log message *** 2000-09-09 08:55:48 +00:00
Jim Meyering
ca10098c93 *** empty log message *** 2000-09-09 08:53:37 +00:00
Jim Meyering
e336878a5b *** empty log message *** 2000-09-09 08:42:34 +00:00
Jim Meyering
6f98f91fad *** empty log message *** 2000-09-09 08:27:52 +00:00
Jim Meyering
a2e3399aa2 *** empty log message *** 2000-09-09 08:25:33 +00:00
Jim Meyering
f3643f7edd (TESTS_ENVIRONMENT): Propagate $MAKE into environment, for special-bits. 2000-09-09 08:24:41 +00:00
Jim Meyering
108783401d *** empty log message *** 2000-09-09 08:22:54 +00:00
Jim Meyering
88cd90df1e *** empty log message *** 2000-09-09 08:22:19 +00:00
Jim Meyering
f6c0c0ee16 *** empty log message *** 2000-09-09 08:18:10 +00:00
Jim Meyering
bb4904c751 (TESTS): Add special-bits. 2000-09-09 08:17:33 +00:00
Jim Meyering
6fdcba1097 *** empty log message *** 2000-09-09 07:32:43 +00:00
Jim Meyering
7ce4ee180b (copy_internal): Call chmod also if we've made the
preceding chown call and we're supposed to preserve some special
permission bit(s) that would have been reset by chown.
Reported by Greg Louis.
2000-09-09 07:32:36 +00:00
Jim Meyering
84d9e6f35b (SAME_OWNER, SAME_GROUP, SAME_OWNER_AND_GROUP): Define.
(copy_internal): Avoid calling chown if we know it's not necessary.
2000-09-09 07:29:38 +00:00
Jim Meyering
5e333bb8b8 *** empty log message *** 2000-09-09 07:20:54 +00:00
Jim Meyering
7d5c9847aa Don't use atoi.
Include sys/param.h and limits.h.
Include xstrtol.h.
(CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
(UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
(parse_user_spec): Use xstrtoul, not atoi when converting numeric
UID, GID.  Check range.
2000-09-09 07:20:46 +00:00
Jim Meyering
116698bb24 *** empty log message *** 2000-09-08 09:03:05 +00:00
Jim Meyering
93fe4a3b72 (S_IRWXUGO): Define here, instead. 2000-09-08 09:01:32 +00:00
Jim Meyering
3a66ad8dcd (S_IRWXUGO): Remove definition. 2000-09-08 09:01:02 +00:00
Jim Meyering
b12b63eced *** empty log message *** 2000-09-07 13:23:52 +00:00
Jim Meyering
5f44c5626b . 2000-09-07 13:22:26 +00:00
Jim Meyering
829258e77c Update from master repository. 2000-09-07 13:22:14 +00:00
Jim Meyering
d9a1527093 *** empty log message *** 2000-09-07 07:08:50 +00:00
Jim Meyering
bd5a2dc9e1 (cut invocation): Note that when using -f, lines with no delimiters are
also printed.
2000-09-07 07:08:39 +00:00
Jim Meyering
95ed06eb09 (usage): Note that when using -f, lines with no delimiters are also printed. 2000-09-07 07:08:17 +00:00
Jim Meyering
19ee58e090 Remove obsolete comment block. 2000-09-07 07:01:11 +00:00
Jim Meyering
b61f6618aa *** empty log message *** 2000-09-06 20:04:17 +00:00
Jim Meyering
7ed190837a (_getopt_internal): Update from glibc. 2000-09-06 20:04:06 +00:00
Jim Meyering
812dc8da17 *** empty log message *** 2000-09-05 12:15:38 +00:00
Jim Meyering
b150de0a99 Redirect stdout to stderr before trying to
remove the temp directory.  Otherwise, the `rm -rf' would get an
error because the output file wouldn't be closed and the directory
wouldn't be `empty'.
2000-09-05 12:15:30 +00:00
Jim Meyering
2757680bbf . 2000-09-05 12:04:29 +00:00
Jim Meyering
9fecbb3105 Remove the `cp -bdl symlink foo' case.
since it's no longer portable (hard link to a symlink).
2000-09-05 12:02:40 +00:00
Jim Meyering
b0126126d2 Remove the `cp -dl sl1 sl2' case,
since it's no longer portable (hard link to a symlink).
2000-09-05 11:53:03 +00:00
Jim Meyering
3260d507f5 *** empty log message *** 2000-09-05 10:41:18 +00:00
Jim Meyering
537879ee7d . 2000-09-05 10:22:35 +00:00
Jim Meyering
0c483136cf . 2000-09-04 20:51:43 +00:00
Jim Meyering
106eedf2a8 Remove declaration of lstat, now that it's in copy.h. 2000-09-04 20:51:29 +00:00
Jim Meyering
cec4418796 Move declaractions of lstat, stat, and rpl_lstat
as well as the definition of lstat from cp.c to this file.
2000-09-04 20:51:12 +00:00
Jim Meyering
25e0824d28 Move declaractions of lstat, stat, and rpl_lstat
as well as the definition of lstat from here to copy.h.
2000-09-04 20:50:45 +00:00
Jim Meyering
739a268735 *** empty log message *** 2000-09-04 17:01:23 +00:00
Jim Meyering
7c5d2581a0 . 2000-09-04 16:58:38 +00:00
Jim Meyering
9f99fca934 mv's --force (-f) option is no longer needed for
this test, now that all it does is cancel --interactive (-i).
2000-09-04 16:58:25 +00:00
Jim Meyering
d7dfef329f *** empty log message *** 2000-09-04 16:56:17 +00:00
Jim Meyering
daaa56f985 Add new tests using cp's --rem option.
Reflect the fact that cp's -f option no longer causes cp to remove the
destination file before trying to open it.
Reflect the fact that `cp -bdl' now makes a backup when copying a
symlink onto the file it points to (FIXME: look into this, and why
cp -bl does *not* do so).
2000-09-04 16:56:09 +00:00
Jim Meyering
143be7ea2d *** empty log message *** 2000-09-04 15:22:08 +00:00
Jim Meyering
4cb0cadf96 (do_link): Tweak diagnostics. 2000-09-04 15:22:00 +00:00
Jim Meyering
b5545e03db (same_file_ok): Hoist a test. 2000-09-04 14:49:30 +00:00
Jim Meyering
4dfe280c99 *** empty log message *** 2000-09-04 14:46:18 +00:00
Jim Meyering
616d9920c0 factor out backup/same test, put it after if-else. 2000-09-04 14:45:42 +00:00
Jim Meyering
65a185d754 (same_file_ok): factor some more. improve -- now passes all tests.
checkpoint
2000-09-04 14:42:32 +00:00
Jim Meyering
5dcb9b11aa *** empty log message *** 2000-09-04 08:16:16 +00:00
Jim Meyering
fbc1b0b06f *** empty log message *** 2000-09-04 08:03:56 +00:00
Jim Meyering
1f64389cd5 *** empty log message *** 2000-09-04 07:27:49 +00:00
Jim Meyering
e2017655a1 *** empty log message *** 2000-09-04 07:25:10 +00:00
Jim Meyering
09af7ed5f7 *** empty log message *** 2000-09-04 07:09:08 +00:00
Jim Meyering
2c663e070c *** empty log message *** 2000-09-03 18:50:55 +00:00
Jim Meyering
799114aa8c (cp_option_init): Initialize new members. 2000-09-03 18:50:49 +00:00
Jim Meyering
8ed20d830e . 2000-09-03 18:50:14 +00:00
Jim Meyering
a513c6c10e . 2000-09-03 18:49:37 +00:00
Jim Meyering
35640da77d tweak comment 2000-09-03 15:25:11 +00:00
Jim Meyering
b8fbc41536 Remove obsolete comment block.
(cp_option_init): Initialize new members.
(usage): Reflect the fact that --force (-f) relates only to whether
mv prompts.
(main): Remove uses of old `force' option member.
2000-09-03 14:36:50 +00:00
Jim Meyering
475fb2e732 (enum): Add UNLINK_DEST_BEFORE_OPENING.
[long_options]: Add an entry for --remove-destination.
(usage): Describe --remove-destination.
(do_copy): Use unlink_dest_after_failed_open member, not `force.'
(cp_option_init): Initialize new members.
(main): Handle UNLINK_DEST_BEFORE_OPENING (aka --remove-destination).
2000-09-03 14:09:23 +00:00
Jim Meyering
b1bf91b67d correct description of unlink_dest_after_failed_open 2000-09-03 13:56:15 +00:00
Jim Meyering
e2a422b8ef comment 2000-09-03 13:18:22 +00:00
Jim Meyering
81ab1beb52 Use strcoll (not strcmp) when comparing file names. 2000-09-03 13:06:41 +00:00
Jim Meyering
c199939348 (struct cp_options) [force]: Remove member.
[unlink_dest_before_opening]: Add member.
[unlink_dest_after_failed_open]: Add member.
2000-09-03 13:04:44 +00:00
Jim Meyering
76685fb1e9 (same_file_ok): New function, extracted from copy_internal,
and partially rewritten.
(copy_internal): Unlink destination file when unlink_dest_before_opening
option is set, and when the source is neither a regular file nor a directory.
2000-09-03 13:01:49 +00:00
Jim Meyering
3e8dff57b2 *** empty log message *** 2000-09-02 09:44:47 +00:00
Jim Meyering
1207fe6788 *** empty log message *** 2000-09-02 09:32:01 +00:00
Jim Meyering
24946d8604 *** empty log message *** 2000-09-02 09:30:03 +00:00
Jim Meyering
aa8f9f7e67 *** empty log message *** 2000-09-02 09:28:31 +00:00
Jim Meyering
9136c97143 *** empty log message *** 2000-09-02 09:08:31 +00:00
Jim Meyering
976d5c8a3f add basic test 2000-09-02 07:55:32 +00:00
Jim Meyering
3b023926b1 *** empty log message *** 2000-08-30 07:58:05 +00:00
Jim Meyering
048aa98ba8 Merge in changes from GNU libc. 2000-08-30 07:58:01 +00:00
Jim Meyering
3c5e612fce declare __fpending only if necessary 2000-08-28 14:55:18 +00:00
Jim Meyering
92452ed0a0 check for __fpending declaration 2000-08-28 14:53:10 +00:00
Jim Meyering
edc1ebe9e7 include stdio_ext.h 2000-08-28 14:50:37 +00:00
Jim Meyering
96719d7999 *** empty log message *** 2000-08-27 09:50:08 +00:00
Jim Meyering
739185ba74 . 2000-08-27 09:30:11 +00:00
Jim Meyering
6bf3479c9f (copy_reg): New parameters: X and NEW_DST.
Remove the SPARSE_MODE parameter.  Update caller.
Perform POSIX-mandated (for cp) open-with-O_WRONLY|O_TRUNC when
the regular destination file exists;  upon failure, unlink
that existing file, then open again, but with O_WRONLY|O_CREAT.
(copy_internal): `force' in not related to interactive; remove
the conjunct.
Remove the entire `else if (x->force)' block;  justifying
removal of the non-directory part is easy:  POSIX requires we try
to open an existing regular file, so we can't unlink it beforehand.
The part that changes the mode on a directory to allow overwriting
isn't necessary.
2000-08-27 09:30:00 +00:00
Jim Meyering
2c8881fa4e (copy_internal): Set `new_dst' when the move_mode rename fails,
since we then unlink the destination file.
2000-08-27 08:46:21 +00:00
Jim Meyering
a246888987 (copy_reg): Rename two goto labels. 2000-08-27 08:33:35 +00:00
Jim Meyering
5f4e35a42a . 2000-08-26 22:24:50 +00:00
Jim Meyering
004fa32b78 (usage): --force is independent of --interactive. 2000-08-26 22:24:31 +00:00
Jim Meyering
b679f078af . 2000-08-26 15:40:01 +00:00
Jim Meyering
64c38128cb . 2000-08-26 15:39:39 +00:00
Jim Meyering
47ffae51d2 *** empty log message *** 2000-08-26 12:05:55 +00:00
Jim Meyering
dc93e67305 Include "__fpending.h".
(close_stdout_status): Return right away if there's nothing to flush.
2000-08-26 12:05:50 +00:00
Jim Meyering
04b3f8c73f *** empty log message *** 2000-08-26 12:04:46 +00:00
Jim Meyering
15da58e940 *** empty log message *** 2000-08-26 12:04:13 +00:00
Jim Meyering
2c45ec8870 (noinst_HEADERS): Add __fpending.h. 2000-08-26 12:04:01 +00:00
Jim Meyering
b0a76138e8 *** empty log message *** 2000-08-26 11:59:55 +00:00
Jim Meyering
f48d309e1f *** empty log message *** 2000-08-26 11:58:08 +00:00
Jim Meyering
9f29c127ad Use jm_FUNC_FPENDING. 2000-08-26 11:56:54 +00:00
Jim Meyering
4edc4fdd20 *** empty log message *** 2000-08-26 11:56:20 +00:00
Jim Meyering
bf25ff5686 *** empty log message *** 2000-08-26 11:55:12 +00:00
Jim Meyering
5dee541de5 *** empty log message *** 2000-08-26 11:46:21 +00:00
Jim Meyering
9ca4b0ce4c *** empty log message *** 2000-08-26 11:44:00 +00:00
Jim Meyering
86d77d28f6 *** empty log message *** 2000-08-26 11:26:11 +00:00
Jim Meyering
5fec9dcd63 *** empty log message *** 2000-08-26 11:25:48 +00:00
Jim Meyering
5cd332146d *** empty log message *** 2000-08-25 07:43:45 +00:00
Jim Meyering
f35a629b10 *** empty log message *** 2000-08-25 07:39:22 +00:00
Jim Meyering
2115d8b251 *** empty log message *** 2000-08-24 11:39:14 +00:00
Jim Meyering
44256afd61 Put back the kluge. It's necessary after all.
(buggy_lseek_support): New function.
(skip): Use it.
Frank Adler reported that although _llseek returns 0, lseek
erroneously returns an offset suggesting the operation succeeded
even though it fails.
2000-08-24 11:39:08 +00:00
Jim Meyering
078fb9958e *** empty log message *** 2000-08-24 11:36:28 +00:00
Jim Meyering
10d2bd9fe1 . 2000-08-24 08:40:47 +00:00
Jim Meyering
d5f68c636f . 2000-08-24 08:40:08 +00:00
Jim Meyering
fc5b8b497f *** empty log message *** 2000-08-24 08:37:06 +00:00
Jim Meyering
399ca3007b *** empty log message *** 2000-08-24 08:36:47 +00:00
Jim Meyering
69450c7b8e (skip): Assume lseek failed if it returned zero, since a zero return is
impossible and some buggy drivers return zero.

Use SEEK_CUR rather than SEEK_SET; this fixes a bug when the
file descriptor is not currently rewound.
2000-08-24 08:34:33 +00:00
Jim Meyering
2abb1fd55d *** empty log message *** 2000-08-23 16:26:55 +00:00
Jim Meyering
5679351226 Include <config.h> unconditionally, to be consistent
with all the other programs in this directory.
2000-08-23 16:26:39 +00:00
Jim Meyering
52d06428c4 *** empty log message *** 2000-08-23 07:54:41 +00:00
Jim Meyering
9fa18193a8 *** empty log message *** 2000-08-23 07:54:23 +00:00
Jim Meyering
c5a36496a9 longer input 2000-08-23 07:54:06 +00:00
Jim Meyering
89f0eb153f redir dd's stderr 2000-08-23 07:49:05 +00:00
Jim Meyering
0816398823 change PROG from ls to dd 2000-08-23 07:48:11 +00:00
Jim Meyering
2ca0198ba4 (TESTS): Add not-rewound. 2000-08-23 07:47:52 +00:00
Jim Meyering
441d42d262 *** empty log message *** 2000-08-23 07:45:59 +00:00
Jim Meyering
47635579b0 use better trap 2000-08-23 07:38:21 +00:00
Jim Meyering
ed034dc2fb *** empty log message *** 2000-08-23 07:35:22 +00:00
Jim Meyering
d704481d1f back out last change 2000-08-23 07:33:28 +00:00
Jim Meyering
9445f3be05 *** empty log message *** 2000-08-22 11:12:06 +00:00
Jim Meyering
ba9af72e94 Don't even try to use lseek on character devices.
(buggy_lseek_support): New function.
(skip): Use it.
Reported by Martin Gallant via Michael Stone.
2000-08-22 11:12:01 +00:00
Jim Meyering
f2f8c736c9 *** empty log message *** 2000-08-22 11:05:47 +00:00
Jim Meyering
3ee1d2075c Clean up traps. Create files in a subdir. 2000-08-21 09:45:52 +00:00
Jim Meyering
4ff47b028e remove `dir' in trap, too 2000-08-21 09:41:56 +00:00
Jim Meyering
6d622fcb6b use better trap 2000-08-21 09:39:59 +00:00
Jim Meyering
dfdd08e943 *** empty log message *** 2000-08-21 05:29:32 +00:00
Jim Meyering
bcb31e6df5 *** empty log message *** 2000-08-21 05:15:55 +00:00
Jim Meyering
e37426d44c *** empty log message *** 2000-08-20 22:48:42 +00:00
Jim Meyering
5344a40bc2 remove blank line 2000-08-20 22:46:16 +00:00
Jim Meyering
f79086fbd3 *** empty log message *** 2000-08-20 22:46:05 +00:00
Jim Meyering
3944f9acc9 *** empty log message *** 2000-08-20 22:35:52 +00:00
Jim Meyering
5f69a51188 . 2000-08-20 21:16:36 +00:00
Jim Meyering
fc27421c82 New file. From J. David Anglin. 2000-08-20 21:12:36 +00:00
Jim Meyering
3581b3cf77 *** empty log message *** 2000-08-20 21:04:38 +00:00
Jim Meyering
9f425a515b *** empty log message *** 2000-08-20 21:04:26 +00:00
Jim Meyering
b4721f8c6e (TESTS): Add cp-HL. 2000-08-20 21:04:20 +00:00
Jim Meyering
59bf576f46 *** empty log message *** 2000-08-20 21:03:48 +00:00
Jim Meyering
1d0ba16702 *** empty log message *** 2000-08-20 21:03:03 +00:00
Jim Meyering
c4c4106e8b *** empty log message *** 2000-08-20 20:50:26 +00:00
Jim Meyering
d7af479281 *** empty log message *** 2000-08-20 20:49:58 +00:00
Jim Meyering
5b55669c7a (cp_option_init): Initialize to DEREF_ALWAYS, not `1'. 2000-08-20 20:49:44 +00:00
Jim Meyering
94d34806bd (cp_option_init): Initialize to DEREF_NEVER, not `0'. 2000-08-20 20:49:34 +00:00
Jim Meyering
c93a607f05 (long_opts): Add --dereference, -L.
(usage): Describe -L and -H.
(cp_option_init): Initialize to DEREF_UNDEFINED, not `1'.
(main): Add `H' and `-L' to getopt spec string.
[case 'a']: Initialize `dereference' to DEREF_NEVER, not 0.
[case 'd']: Likewise.
[case 'H']: New case.
[case 'L']: New case.
[case 'R']: Don't set dereference to `0' here.
If it's not yet defined, set x.dereference to DEREF_NEVER
if -R was specified, else set it to DEREF_ALWAYS.
Set x.xstat accordingly for -H.
2000-08-20 20:48:57 +00:00
Jim Meyering
7b1d35af90 Declare lstat.
(copy_dir): Set `xstat' member to lstat so that with `-H' we don't
follow symlinks found via recursive traversal.
Update uses of `dereference' to compare against new enum member names.
2000-08-20 20:48:45 +00:00
Jim Meyering
33db1748a0 (enum Dereference_symlink): Define.
(struct cp_options) [dereference]: Change type to Dereference_symlink.
2000-08-20 20:35:25 +00:00
Jim Meyering
9c55b67dd4 . 2000-08-20 16:48:02 +00:00
Jim Meyering
74a00a63a0 . 2000-08-20 15:56:43 +00:00
Jim Meyering
f801837d6c . 2000-08-20 15:56:11 +00:00
Jim Meyering
55692e275e *** empty log message *** 2000-08-20 12:45:35 +00:00
Jim Meyering
5bf6f179da Include utmp.h `#if HAVE_UTMP_H', rather than
`#if !HAVE_UTMPX_H'.  The latter would lose on systems with neither
utmp.h nor utmpx.h.  Reported by Eli Zaretskii.
2000-08-20 12:45:31 +00:00
Jim Meyering
f9850882f1 (print_totals): Rename global from opt_combined_arguments. 2000-08-20 09:55:23 +00:00
Jim Meyering
5d0d80fc27 fix my grammar error in last change 2000-08-19 11:09:03 +00:00
Jim Meyering
c055d35869 *** empty log message *** 2000-08-19 11:07:46 +00:00
Jim Meyering
61a8f5b321 *** empty log message *** 2000-08-19 11:07:37 +00:00
Jim Meyering
0dd04df27f (writeline): Correct comments.
From Bruno Haible.
2000-08-19 11:07:32 +00:00
Jim Meyering
dde8f61f1c *** empty log message *** 2000-08-18 07:08:34 +00:00
Jim Meyering
1696188993 (DO_CHOWN): Do not make a special case for non-root.
POSIX.2 requires that cp -p and mv attempt to set the uid of the
destination file, even if you're not root.  This affects behavior
only on hosts that let you give files away via chmod.
2000-08-18 07:08:04 +00:00
Jim Meyering
3804c0288a *** empty log message *** 2000-08-15 13:12:57 +00:00
Jim Meyering
70b951593e Add tests for just-fixed bug. 2000-08-15 13:12:48 +00:00
Jim Meyering
614723b9c1 *** empty log message *** 2000-08-15 13:08:31 +00:00
Jim Meyering
849d512ee9 *** empty log message *** 2000-08-15 13:08:06 +00:00
Jim Meyering
c4e4ba9607 *** empty log message *** 2000-08-15 13:07:40 +00:00
Jim Meyering
5f52473b9c *** empty log message *** 2000-08-15 13:05:21 +00:00
Jim Meyering
f0a4b95c58 (count_entry): Remember the current directory also for `.'
and `..'.  Reported by Stephen Smoogen, based on a patch from H.J. Lu.
2000-08-15 13:05:03 +00:00
Jim Meyering
d5d043c57a *** empty log message *** 2000-08-14 21:42:45 +00:00
Jim Meyering
5f14914c49 remove incorrect FIXME comment. 2000-08-14 21:40:30 +00:00
Jim Meyering
8c446739e7 *** empty log message *** 2000-08-14 09:58:58 +00:00
Jim Meyering
0f8dd3a954 (copy_reg): Move declaration of local, `n_read', into
the scope where it's used.
(copy_internal): In calling copy_reg, pass not the raw `src_mode',
but the possibly-umask-relative mode, `get_dest_mode (x, src_mode)'.
2000-08-14 09:58:25 +00:00
Jim Meyering
d927d60b36 (copy_reg): Add comment. 2000-08-13 13:13:25 +00:00
Jim Meyering
bed2ded78f *** empty log message *** 2000-08-13 13:05:16 +00:00
Jim Meyering
406f1dcb0f *** empty log message *** 2000-08-13 13:04:52 +00:00
Jim Meyering
fc0b4f7672 *** empty log message *** 2000-08-13 13:04:27 +00:00
Jim Meyering
262dbfe2f6 *** empty log message *** 2000-08-13 13:03:41 +00:00
Jim Meyering
27289e8b53 *** empty log message *** 2000-08-13 13:03:13 +00:00
Jim Meyering
8656b00f6d (get_dest_mode): Rename from new_nondir_mode.
Honor the umask for `cp', but not for `mv' or `cp -p'.
(copy_reg): New 4th parameter, dst_mode.  Pass it as 3rd arg. to open.
(copy_internal): Change type of locals `src_mode' and `src_type' from
int to mode_t.
Remove unnecessary local `fix_mode'.
Combine two if-stmts into one.
Pass `src_mode' as 4th arg to copy_reg.
If we've just created a new regular file, return early, skipping the
chmod step.  copy_reg now sets permissions of such files upon creation.
Use get_dest_mode, so there's just one chmod call here.
2000-08-13 13:03:07 +00:00
Jim Meyering
ce9d58029c Use jm_FUNC_UNLINK_BUSY_TEXT. 2000-08-12 13:27:29 +00:00
Jim Meyering
c187c5884b *** empty log message *** 2000-08-12 13:25:33 +00:00
Jim Meyering
ae8efa7087 . 2000-08-12 13:24:44 +00:00
Jim Meyering
13a7e4caf8 (TESTS): Add perm. 2000-08-12 13:24:31 +00:00
Jim Meyering
00874a5dad *** empty log message *** 2000-08-12 13:23:18 +00:00
Jim Meyering
52f1830329 Remove test for the VERSION_CONTROL and/or
SIMPLE_BACKUP_SUFFIX envvars.  Source ../envvar-check instead.
2000-08-12 13:22:59 +00:00
Jim Meyering
af77319c56 Remove test for the VERSION_CONTROL and/or
SIMPLE_BACKUP_SUFFIX envvars.  Source ../envvar-check instead.
2000-08-12 13:22:19 +00:00
Jim Meyering
60d7a8e772 Remove test for the VERSION_CONTROL and/or
SIMPLE_BACKUP_SUFFIX envvars.  Source ../envvar-check instead.
2000-08-12 13:21:47 +00:00
Jim Meyering
e37768067a Remove test for the VERSION_CONTROL and/or
SIMPLE_BACKUP_SUFFIX envvars.  Source ../envvar-check instead.
2000-08-12 13:21:13 +00:00
Jim Meyering
47e19fb368 *** empty log message *** 2000-08-12 13:19:27 +00:00
Jim Meyering
f2893678eb *** empty log message *** 2000-08-12 07:24:27 +00:00
Jim Meyering
1a27d41352 . 2000-08-12 06:17:33 +00:00
Jim Meyering
9099ba78e2 *** empty log message *** 2000-08-12 05:50:21 +00:00
Jim Meyering
017ee79337 *** empty log message *** 2000-08-12 05:16:40 +00:00
Jim Meyering
44d3e01da9 tweak the `whether...' message 2000-08-12 04:59:31 +00:00
Jim Meyering
52d20e4420 (jm_FUNC_UNLINK_BUSY_TEXT): New file/macro.
From J. David Anglin.
2000-08-12 04:57:18 +00:00
Jim Meyering
04d18f430c *** empty log message *** 2000-08-11 20:59:57 +00:00
Jim Meyering
c2177b12b3 Portable shell scripts should specify global options before key fields.
Move global LC_CTYPE remark to each sort option that depends on LC_CTYPE.

sort -g depends on LC_NUMERIC.

Add @vindex where it's missing.

"radix character" -> "decimal-point character", to match Standard C
terminology, which is easier for most people to follow.

"comm" does not consider trailing newlines to be significant.
2000-08-11 20:59:49 +00:00
Jim Meyering
7c032c04b9 *** empty log message *** 2000-08-11 09:20:36 +00:00
Jim Meyering
19d6aed760 Add support for multi-byte locales.
(iswprint, mbrtowc, wcwidth): Provide default definitions.
(total_bytes): New variable.
(print_bytes): New variable.
(longopts): Change abbreviation for --chars from 'c' to 'm'.
(usage): Update.
(write_counts): Add `bytes' argument.
(wc): New variables `bytes', `count_bytes', `count_chars',
`count_complicated'. The old code determines `bytes', not `chars'.
New case for MB_CUR_MAX > 1. A non-printable non-space character does
not increment the line position or start a word. Update `total_bytes'.
(main): Initialize `print_bytes' and `total_bytes' to 0. Accept 'm'
option. Pass `total_bytes' to write_counts.
2000-08-11 09:20:31 +00:00
Jim Meyering
c14f06f708 *** empty log message *** 2000-08-11 09:13:00 +00:00
Jim Meyering
5018ccfb7e (usage): Describe -d and -i in a locale-independent way. 2000-08-11 09:12:47 +00:00
Jim Meyering
d0c8664700 (usage): Don't describe System V syntax, as it doesn't always work. 2000-08-11 09:12:05 +00:00
Jim Meyering
2ed0078725 Recommend against the System V syntax
for tr ranges, and don't use it in examples.  Use POSIX
classes rather than ranges, for portability.
2000-08-11 09:11:20 +00:00
Jim Meyering
f64320db7b (wc invocation): Update accordingly. 2000-08-11 09:10:22 +00:00
Jim Meyering
f253241fa6 *** empty log message *** 2000-08-08 10:53:28 +00:00
Jim Meyering
129ede91ad (movefile): Invoke xalloc_die instead of printing our own message. 2000-08-08 10:53:23 +00:00
Jim Meyering
c5e73d1f4a *** empty log message *** 2000-08-08 07:16:45 +00:00
Jim Meyering
543cd52e60 *** empty log message *** 2000-08-08 07:13:46 +00:00
Jim Meyering
a9a5efd77b (remove_cwd_entries, rm): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:13:36 +00:00
Jim Meyering
b99ee65d9f (main): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:12:24 +00:00
Jim Meyering
b2557211cb (do_link): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:11:46 +00:00
Jim Meyering
6fa66b8414 (main): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:11:30 +00:00
Jim Meyering
13587cf0ec (xstrndup): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:11:12 +00:00
Jim Meyering
deffd164df *** empty log message *** 2000-08-08 07:10:22 +00:00
Jim Meyering
8b6882e5e9 (cut_fields): Invoke xalloc_die instead of printing our own message.
(cut_fields): Check for I/O error as well as end-of-file.
2000-08-08 07:09:31 +00:00
Jim Meyering
1899efe4f6 (copy_dir, copy_internal): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:08:17 +00:00
Jim Meyering
8180fd9209 (main): Invoke xalloc_die instead of printing our own message. 2000-08-08 07:07:55 +00:00
Jim Meyering
d681dd7524 (quotearg_colon, xmalloc): "virtual memory exhausted" -> "memory exhausted" 2000-08-08 07:03:41 +00:00
Jim Meyering
c64d3aaf18 (usage, main): For cp -P messages, mention the new behavior as well as the old. 2000-08-08 06:55:47 +00:00
Jim Meyering
b6bacc5dcf Invoke xalloc_die instead of printing our own message. 2000-08-08 06:53:14 +00:00
Jim Meyering
3424a30611 *** empty log message *** 2000-08-07 17:07:19 +00:00
Jim Meyering
045b33aaef (xalloc_msg_memory_exhausted): Now char const[],
not char *const and pointing to a constant array.
(xrealloc): Comment fix.
2000-08-07 17:06:38 +00:00
Jim Meyering
1fdeee96e2 (print_and_abort): Use "memory exhausted", not "virtual memory exhausted". 2000-08-07 17:05:37 +00:00
Jim Meyering
8d381987d0 comment fix 2000-08-07 17:03:20 +00:00
Jim Meyering
1def0627b7 (xalloc_msg_memory_exhausted): Now char const[],
not char *const and pointing to a constant array.
2000-08-07 17:02:15 +00:00
Jim Meyering
cab29a570d (same_name): Invoke xalloc_die instead of printing our own message.
(parse_user_spec):
Don't translate a message until just before returning,
to avoid unnecessary translation.
2000-08-07 16:56:29 +00:00
Jim Meyering
02edb50e8f (same_name): Invoke xalloc_die instead of printing our own message. 2000-08-07 16:55:57 +00:00
Jim Meyering
3190f18d1c *** empty log message *** 2000-08-07 16:50:27 +00:00
Jim Meyering
d8f02c5c3a (xputenv): Invoke xalloc_die instead of printing our own message. 2000-08-07 16:50:11 +00:00
Jim Meyering
8f8f0254b2 *** empty log message *** 2000-08-07 15:51:08 +00:00
Jim Meyering
51b6b653a2 back out Copyright date changes for files with no changes year 2000-08-07 15:48:18 +00:00
Jim Meyering
90fb34362a *** empty log message *** 2000-08-07 13:27:40 +00:00
Jim Meyering
7299626404 *** empty log message *** 2000-08-07 13:27:33 +00:00
Jim Meyering
0ae67ef6a8 (head): Call write_header here.
(head_file): ... not here.
2000-08-07 13:27:24 +00:00
Jim Meyering
fd5da15041 (closeout_func): Remove variable.
(close_stdout_wrapper): Remove unused function.
(main): Remove assignment to closeout_func.
2000-08-07 13:23:44 +00:00
Jim Meyering
0981ef97c0 (fold_file): Remove ferror(stdout) check, already done in close_stdout. 2000-08-07 13:19:52 +00:00
Jim Meyering
eb6e8b63c6 *** empty log message *** 2000-08-07 08:57:11 +00:00
Jim Meyering
0ef1ebe00e (enum) [PARENTS_OPTION]: New member.
(long_opts): Update "parents" and deprecated "path" entries to use
`PARENTS_OPTION', not `P'.
(usage): Update --help output.
(main): Warn that the meaning of `-P' will soon change.
2000-08-07 08:55:50 +00:00
Jim Meyering
56752ea034 *** empty log message *** 2000-08-07 08:18:32 +00:00
Jim Meyering
568f9e0516 *** empty log message *** 2000-08-07 07:15:31 +00:00
Jim Meyering
497785afe5 (AC_MBSTATE_T): Define mbstate_t to be int,
not char, for compatibility with glibc 2.1.3 strftime.c.
2000-08-07 07:15:25 +00:00
Jim Meyering
43fde4395a (usage): Warn more succintly about the effects of
the locale on sort order.
2000-08-07 07:07:00 +00:00
Jim Meyering
aee6ce52e0 *** empty log message *** 2000-08-06 19:54:55 +00:00
Jim Meyering
a64e651230 . 2000-08-06 19:09:08 +00:00
Jim Meyering
4951b1a4b0 *** empty log message *** 2000-08-06 16:12:42 +00:00
Jim Meyering
3110281aad We know nbytes is 0, so remove it from bail-out test. 2000-08-06 15:08:29 +00:00
Jim Meyering
0d9ee9b50c *** empty log message *** 2000-08-06 09:06:22 +00:00
Jim Meyering
496964cdc3 *** empty log message *** 2000-08-06 09:06:00 +00:00
Jim Meyering
9048856887 *** empty log message *** 2000-08-06 09:03:33 +00:00
Jim Meyering
61b0870c41 (pipe_lines): Declare local `cp' to be const. 2000-08-06 09:03:29 +00:00
Jim Meyering
ae9ce08522 *** empty log message *** 2000-08-06 08:45:47 +00:00
Jim Meyering
95b686e751 (pipe_lines): Add variable `nbytes' so we can free
`tmp' immediately after read loop.  Don't process an empty file.
This fixes a buffer-underrun error -- also thanks to bounded pointers.
2000-08-06 08:44:11 +00:00
Jim Meyering
773a575cd5 (main): Rename local t' to tmp_dir' to avoid shadowing
a previous local by that name.
(usage): Warn that GNU sort is now locale-aware, and suggest
people put LC_ALL=POSIX in their environment.
2000-08-05 20:27:49 +00:00
Jim Meyering
8db7ef9e42 *** empty log message *** 2000-08-05 19:36:37 +00:00
Jim Meyering
6b95201b8d . 2000-08-05 19:36:20 +00:00
Jim Meyering
a8fd3f260a . 2000-08-05 19:35:59 +00:00
Jim Meyering
8b39b39763 *** empty log message *** 2000-08-05 19:31:58 +00:00
Jim Meyering
76211dbaeb . 2000-08-05 11:51:10 +00:00
Jim Meyering
1b57516fe2 *** empty log message *** 2000-08-05 11:50:43 +00:00
Jim Meyering
b3197453ad (init_header): Fix buffer-overrun error.
Allocated buffer was sometimes too small.
Reported by Greg McGary (who found this bug using his
bounded-pointers-enabled gcc).
(init_header): Move declarations of several variables into the
inner scope where they are used.
2000-08-05 10:56:12 +00:00
Jim Meyering
f79bc88685 . 2000-08-05 10:51:58 +00:00
Jim Meyering
81b2c3735e (narrow-1): New test, for the above. 2000-08-05 10:51:39 +00:00
Jim Meyering
e69797a267 *** empty log message *** 2000-08-05 08:34:36 +00:00
Jim Meyering
77a40f148f (MAX): Remove definition (It's in sys2.h). 2000-08-05 08:34:25 +00:00
Jim Meyering
26a7265907 *** empty log message *** 2000-08-04 10:18:09 +00:00
Jim Meyering
4e39b59aba *** empty log message *** 2000-08-04 10:13:36 +00:00
Jim Meyering
90d90ce434 (store_columns): Remove conjunct that would dereference
an out-of-bounds pointer.  Reported by Greg McGary (who found this
bug using his bounded-pointers-enabled gcc).
2000-08-04 10:13:30 +00:00
Jim Meyering
a5b5eb21f9 *** empty log message *** 2000-08-03 23:10:28 +00:00
Jim Meyering
641dabb657 (SET_HIGH_BOUND, MOVE_BUFFER_POINTER,
ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros.
(EXTEND_BUFFER): Use them.
2000-08-03 23:10:05 +00:00
Jim Meyering
0037a01cf8 . 2000-08-03 08:00:40 +00:00
Jim Meyering
c60c4a9fdc . 2000-08-03 08:00:00 +00:00
Jim Meyering
1d80882fc0 *** empty log message *** 2000-08-03 07:57:51 +00:00
Jim Meyering
f3e288c470 ($(srcdir)/$x-tests): Use -I$(srcdir), not `-I.'.
(Makefile.am): Likewise.  Reported by Greg McGary.
2000-08-03 07:57:46 +00:00
Jim Meyering
ac4300150a . 2000-08-01 07:52:37 +00:00
Jim Meyering
051a7c856a *** empty log message *** 2000-08-01 07:52:26 +00:00
Jim Meyering
449a130ddb ranges vs ebcdic 2000-08-01 07:39:56 +00:00
Jim Meyering
10798a81c4 *** empty log message *** 2000-08-01 07:11:04 +00:00
Jim Meyering
cf04cc6ec2 (tee): Use SET_BINARY and SET_BINARY2.
From Prashant TR.
2000-08-01 07:10:57 +00:00
Jim Meyering
fe15457dcd *** empty log message *** 2000-08-01 07:10:10 +00:00
Jim Meyering
a55a40b616 (ISSLASH): Define.
(BACKSLASH_IS_PATH_SEPARATOR): Define.
(dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which
both `\' and `/' may be use as path separators.
Based on a patch from Prashant TR.
2000-08-01 07:10:05 +00:00
Jim Meyering
d203fb94d2 *** empty log message *** 2000-07-31 18:30:27 +00:00
Jim Meyering
8baafe1f08 (quotearg_n_options): Don't make the initial
slot vector a constant, since it might get modified.
2000-07-31 18:30:21 +00:00
Jim Meyering
07e0171826 Tweak comments, per Bruno's comments. 2000-07-31 12:31:44 +00:00
Jim Meyering
d034a083ab Tweak comments, per Bruno's comments. 2000-07-31 12:30:24 +00:00
Jim Meyering
cbed17e88a *** empty log message *** 2000-07-31 07:48:05 +00:00
Jim Meyering
ef49ee4777 (quotearg_n_options): Preallocate a slot 0
buffer, so that the caller can always quote one small
component of a "memory exhausted" message in slot 0.
From a suggestion by Jim Meyering.
2000-07-31 07:23:01 +00:00
Jim Meyering
a2e30297d1 *** empty log message *** 2000-07-31 06:50:26 +00:00
Jim Meyering
56d6e5a38a (cut_fields): Use virtual memory exhausted', not Memory exhausted'. 2000-07-31 06:48:43 +00:00
Jim Meyering
4e02f20bd3 Use virtual memory exhausted', not Memory exhausted'. 2000-07-31 06:47:33 +00:00
Jim Meyering
216cc77784 *** empty log message *** 2000-07-31 06:46:33 +00:00
Jim Meyering
6fb996fcc5 [!HAVE_CONFIG_H]: Use virtual memory exhausted', not Memory exhausted'. 2000-07-31 06:46:21 +00:00
Jim Meyering
5a95ad0a73 Use virtual memory exhausted', not Memory exhausted'. 2000-07-31 06:44:51 +00:00
Jim Meyering
5dcaccf5be *** empty log message *** 2000-07-30 20:25:31 +00:00
Jim Meyering
beb983dd07 *** empty log message *** 2000-07-30 19:51:03 +00:00
Jim Meyering
e0be88dd59 (ISPRINT): Undef before defining to avoid warning. 2000-07-30 19:50:58 +00:00
Jim Meyering
456a1ea3ea *** empty log message *** 2000-07-30 18:44:58 +00:00
Jim Meyering
c8a15b9edb Add quote marks to match new behavior. 2000-07-30 18:44:43 +00:00
Jim Meyering
0e1dfa9b8b (remove_file): Quote the file names that are displayed with --verbose. 2000-07-30 18:42:07 +00:00
Jim Meyering
7b79dfe695 (copy_internal): Quote the file names that are displayed
with --verbose and --backup.
2000-07-30 18:41:55 +00:00
Jim Meyering
a53a181821 *** empty log message *** 2000-07-30 17:08:10 +00:00
Jim Meyering
614cf2b06b Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 17:08:05 +00:00
Jim Meyering
a73455fc19 *** empty log message *** 2000-07-30 17:06:49 +00:00
Jim Meyering
87ad4e1dbb . 2000-07-30 16:51:16 +00:00
Jim Meyering
56836dca33 . 2000-07-30 16:50:16 +00:00
Jim Meyering
3048ed8790 . 2000-07-30 16:49:47 +00:00
Jim Meyering
a0947ac542 *** empty log message *** 2000-07-30 16:45:35 +00:00
Jim Meyering
a313a8b995 *** empty log message *** 2000-07-30 16:34:56 +00:00
Jim Meyering
c2c1f42b0b Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:34:48 +00:00
Jim Meyering
381ba4a26a Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:33:08 +00:00
Jim Meyering
8330089910 *** empty log message *** 2000-07-30 16:30:59 +00:00
Jim Meyering
ff6161442d Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:30:43 +00:00
Jim Meyering
7373e3149d Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:29:15 +00:00
Jim Meyering
608cabf1d4 *** empty log message *** 2000-07-30 16:28:30 +00:00
Jim Meyering
76bc5dc396 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:28:25 +00:00
Jim Meyering
fb61cfca00 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:26:43 +00:00
Jim Meyering
1f9d1ea959 *** empty log message *** 2000-07-30 16:25:01 +00:00
Jim Meyering
eb128f8a49 (make_path): Quote the other instance, too. 2000-07-30 16:24:51 +00:00
Jim Meyering
395e6c592a include quote.h. 2000-07-30 16:21:57 +00:00
Jim Meyering
4d617153d5 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:21:39 +00:00
Jim Meyering
222f736378 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-30 16:19:33 +00:00
Jim Meyering
b53d6da640 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
2000-07-30 16:16:16 +00:00
Jim Meyering
d4365673c5 (remove_cwd_entries): Quote one more file name. 2000-07-30 16:03:37 +00:00
Jim Meyering
493d6182eb tweak diagnostic 2000-07-30 16:01:48 +00:00
Jim Meyering
6986c2b9ad *** empty log message *** 2000-07-30 15:32:15 +00:00
Jim Meyering
e15422c3d3 *** empty log message *** 2000-07-30 15:31:20 +00:00
Jim Meyering
ec739a978b *** empty log message *** 2000-07-30 15:29:27 +00:00
Jim Meyering
b9e891771e *** empty log message *** 2000-07-30 15:28:36 +00:00
Jim Meyering
3b18fcfb6a *** empty log message *** 2000-07-30 15:24:27 +00:00
Jim Meyering
ae3ec5f069 *** empty log message *** 2000-07-30 15:23:55 +00:00
Jim Meyering
02b4fede5b moved from ../src 2000-07-30 15:17:34 +00:00
Jim Meyering
74fe479350 (do_move): Fix typo. 2000-07-30 15:01:11 +00:00
Jim Meyering
048017b39c (dir_name): Use __MSDOS__ in favor of MSDOS. 2000-07-29 17:11:33 +00:00
Jim Meyering
734d411884 *** empty log message *** 2000-07-29 17:06:53 +00:00
Jim Meyering
4524bbcaf8 (diacrit_diac): Use __MSDOS__ in favor of MSDOS. 2000-07-29 17:06:00 +00:00
Jim Meyering
70c58e8192 (base_name): Use ISSLASH rather than comparing against `/'. 2000-07-29 16:45:30 +00:00
Jim Meyering
ce49687fac fix spelling error in comment: s/squirelled/squirreled/. 2000-07-29 14:55:51 +00:00
Jim Meyering
7ddc6c5927 *** empty log message *** 2000-07-29 08:15:37 +00:00
Jim Meyering
043c4958de remove prematurely-added ISSLASH definition 2000-07-29 08:15:01 +00:00
Jim Meyering
3819c2d7cb (dir_name): Assert that there are no trailing slashes. 2000-07-29 08:10:46 +00:00
Jim Meyering
ba8620bf01 *** empty log message *** 2000-07-29 08:00:17 +00:00
Jim Meyering
e32586114e (dir_name) [MSDOS]: Declare `lim' to be const. 2000-07-29 08:00:11 +00:00
Jim Meyering
7102df4dd3 *** empty log message *** 2000-07-29 06:17:27 +00:00
Jim Meyering
586254e713 Include <limits.h>, <stdlib.h>, <wchar.h>, <wctype.h>.
(quote_name): Use mbrtowc to step through the filename string while
replacing nonprintables with question marks. Return the screen width,
not the strlen length. Do no output if the out stream is NULL.
(length_of_file_name_and_frills): Use the quote_name return value.
2000-07-29 06:17:02 +00:00
Jim Meyering
cbcd5929c1 *** empty log message *** 2000-07-29 06:09:43 +00:00
Jim Meyering
e6db9876a0 tweak comments 2000-07-29 06:09:22 +00:00
Jim Meyering
f247c7bd44 (mbswidth): Add a flags argument.
(mbswidth): New declaration.
(MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
2000-07-29 06:02:28 +00:00
Jim Meyering
e7a7601ef4 . 2000-07-29 05:47:42 +00:00
Jim Meyering
3330c7dab7 *** empty log message *** 2000-07-29 05:42:14 +00:00
Jim Meyering
d0f57e1004 (temp_dir): Remove.
(temp_dirs, temp_dir_count, temp_dir_alloc): New vars.
(process_id): New var.
(usage): Describe new use of -T.
(add_temp_dir): New function.
(tempname): Use new temp_dirs array.
Do not discard information from the process-id or sequence
number, unless we have short file names.
(sighandle): Use process_id instead of getpid.
(main): Initialize process_id.
Add support for the new use of -T.
2000-07-29 05:41:55 +00:00
Jim Meyering
9b14de28be sort's -T option can now appear multiple times. 2000-07-29 05:31:44 +00:00
Jim Meyering
9133ae8f15 *** empty log message *** 2000-07-29 05:25:34 +00:00
Jim Meyering
d86f9d40a5 (change_file_owner): Save errno from a possibly failed chown,
and use that later.  Otherwise, errno itself could be clobbered before used.
2000-07-25 22:23:05 +00:00
Jim Meyering
ebd74667bc (change_file_mode): Save errno from a possibly failed chown,
and use that later.  Otherwise, errno itself could be clobbered before used.
2000-07-25 22:22:52 +00:00
Jim Meyering
d3938d3118 (change_file_group): Save errno from a possibly failed chown,
and use that later.  Otherwise, errno itself could be clobbered before used.
2000-07-25 22:22:29 +00:00
Jim Meyering
c0186d3cbb Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
2000-07-25 13:06:31 +00:00
Jim Meyering
289dacfa49 tweak diagnostic 2000-07-25 12:28:33 +00:00
Jim Meyering
1bfc7036c0 *** empty log message *** 2000-07-25 12:27:01 +00:00
Jim Meyering
cb1df652a7 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
2000-07-25 12:26:52 +00:00
Jim Meyering
135a310ca1 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
2000-07-25 12:18:06 +00:00
Jim Meyering
01bd168259 (main): Remove unnecessary "%s" argument. 2000-07-25 12:16:16 +00:00
Jim Meyering
50631d7b81 *** empty log message *** 2000-07-24 16:30:03 +00:00
Jim Meyering
18051fbbb3 (mbswidth): Add a flags argument.
(mbsnwidth): New function.
2000-07-24 16:29:57 +00:00
Jim Meyering
ddc825a0f0 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
2000-07-24 09:32:07 +00:00
Jim Meyering
2071a4054e *** empty log message *** 2000-07-24 06:42:26 +00:00
Jim Meyering
80dbd557de (jm_PREREQ_MBSWIDTH): Check for wcwidth declaration. 2000-07-24 06:42:17 +00:00
Jim Meyering
b083f93482 *** empty log message *** 2000-07-24 06:42:04 +00:00
Jim Meyering
66a0218c1a (_XOPEN_SOURCE): Don't define; this causes problems on Solaris 7.
(wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
2000-07-24 06:41:58 +00:00
Jim Meyering
50c130325e *** empty log message *** 2000-07-24 06:14:32 +00:00
Jim Meyering
1978f56515 Include <wchar.h> even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX),
so that mbstate_t is always defined.

Do not inspect MB_LEN_MAX, since it's incorrectly defined to
be 1 in at least one GCC installation, and this configuration
error is likely to be common.  Ignoring MB_LEN_MAX hurts
performance on hosts that have mbrtowc but have only unibyte
locales, but I assume these hosts are rare.
2000-07-24 06:14:19 +00:00
Jim Meyering
d53f7b9a5d *** empty log message *** 2000-07-23 21:48:28 +00:00
Jim Meyering
d565aeb336 Streamline by invoking multibyte code only if needed.
<wchar.h>: Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX.
(MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX).
(quotearg_buffer_restyled): If a unibyte locale, don't bother to
invoke multibyte primitives.
2000-07-23 21:48:17 +00:00
Jim Meyering
5294c10e84 *** empty log message *** 2000-07-23 21:06:22 +00:00
Jim Meyering
64eece7c53 fix typos (missing commas) 2000-07-23 18:44:35 +00:00
Jim Meyering
894d51af47 *** empty log message *** 2000-07-23 18:29:44 +00:00
Jim Meyering
6407eda7df *** empty log message *** 2000-07-23 16:27:38 +00:00
Jim Meyering
e67940b416 Include <sys/param.h> if HAVE_SYS_PARAM_H is defined,
rather than if _POSIX_VERSION is defined.  Remove declarations of
getpwuid, getgrgid, and getuid, now that they're in sys2.h.
2000-07-23 16:27:13 +00:00
Jim Meyering
57a16fe8c1 . 2000-07-23 15:36:43 +00:00
Jim Meyering
62ab4baa06 (main): Give a better diagnostic for e.g.,
`dd if=/dev/fd0 seek=100000000000'.
Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add many, more precise diagnostics.
2000-07-23 15:36:34 +00:00
Jim Meyering
00652253f7 *** empty log message *** 2000-07-23 15:28:29 +00:00
Jim Meyering
6a3f36dacb [!HAVE_DECL_GETPWUID]: Declare getpwuid.
[!HAVE_DECL_GETGRGID]: Declare getgrgid.
[!HAVE_DECL_GETUID]: Declare getuid.
2000-07-23 15:28:24 +00:00
Jim Meyering
dafbd8d26d *** empty log message *** 2000-07-23 15:27:19 +00:00
Jim Meyering
0c96a22ac7 (jm_CHECK_DECLS): Check for declarations of these, too:
getgrgid, getpwuid, getuid.
2000-07-23 15:27:11 +00:00
Jim Meyering
3091cce80a *** empty log message *** 2000-07-23 13:58:48 +00:00
Jim Meyering
a83726fb4e *** empty log message *** 2000-07-23 11:07:09 +00:00
Jim Meyering
2bfbe02e2f Rename tests (and hence files) to have a short
enough prefix so that they're not truncated on 8+3 file systems.
Reported by Eli Zaretskii.
2000-07-23 11:07:05 +00:00
Jim Meyering
92d2c54ae9 *** empty log message *** 2000-07-23 11:01:19 +00:00
Jim Meyering
ff8e66a907 . 2000-07-23 10:59:53 +00:00
Jim Meyering
ecf44d1a0e *** empty log message *** 2000-07-23 10:58:52 +00:00
Jim Meyering
9993d4141c Fix cp so that `cp -r DIR1/ DIR2' works once again.
(ASSIGN_BASENAME_STRDUPA): New macro.
(do_copy): Use it here (so we always strip trailing slashes before
calling base_name).
2000-07-23 10:54:01 +00:00
Jim Meyering
e66e1f94bb (ASSIGN_STRDUPA): Remove macro definition. 2000-07-23 10:52:05 +00:00
Jim Meyering
418ae892b1 (ASSIGN_STRDUPA): New macro (moved here from remove.c). 2000-07-23 10:49:59 +00:00
Jim Meyering
2eb0dc10c3 *** empty log message *** 2000-07-23 09:25:19 +00:00
Jim Meyering
2546495dab (base_name): Add an assertion. 2000-07-23 09:25:14 +00:00
Jim Meyering
dbca6b183b *** empty log message *** 2000-07-23 09:02:29 +00:00
Jim Meyering
6d26d7c908 *** empty log message *** 2000-07-23 09:00:22 +00:00
Jim Meyering
8038df09a5 (TESTS): Add dir-slash. 2000-07-23 09:00:17 +00:00
Jim Meyering
b03e65037c *** empty log message *** 2000-07-23 08:38:30 +00:00
Jim Meyering
e62f7a5962 When the system forces us to redefine mbstate_t, shadow its mbsinit function. 2000-07-23 08:38:25 +00:00
Jim Meyering
a121532512 *** empty log message *** 2000-07-19 21:01:16 +00:00
Jim Meyering
fde07e7f99 (batch_convert): Free `initial_TZ' only if it was set. 2000-07-19 21:00:20 +00:00
Jim Meyering
6fcabe7b2b *** empty log message *** 2000-07-19 21:00:03 +00:00
Jim Meyering
271249026d . 2000-07-17 20:48:36 +00:00
Jim Meyering
24d24529f4 *** empty log message *** 2000-07-17 20:48:00 +00:00
Jim Meyering
c950ce2982 (WGET): Define.
(ftp-gnu): Define.
(wget-update): New rule, based on the one in autoconf.
2000-07-17 20:47:53 +00:00
Jim Meyering
fd2d83d617 . 2000-07-17 20:46:35 +00:00
Jim Meyering
46fb83f548 *** empty log message *** 2000-07-17 20:45:03 +00:00
Jim Meyering
a9027c8afd (libfetish_a_SOURCES): Add mbswidth.c.
(noinst_HEADERS): Add mbswidth.h.
2000-07-17 20:45:00 +00:00
Jim Meyering
d1316a4669 *** empty log message *** 2000-07-17 20:43:18 +00:00
Jim Meyering
c00612504b from Bruno Haible. 2000-07-17 20:42:46 +00:00
Jim Meyering
d0192db8ac from Bruno Haible. 2000-07-17 20:42:12 +00:00
Jim Meyering
365bcc959c *** empty log message *** 2000-07-17 20:41:10 +00:00
Jim Meyering
8ec106f6b1 (jm_PREREQ): Call jm_PREREQ_MBSWIDTH. 2000-07-17 20:40:39 +00:00
Jim Meyering
ef93322b25 *** empty log message *** 2000-07-17 20:40:18 +00:00
Jim Meyering
27e5b4d0c3 *** empty log message *** 2000-07-17 20:07:49 +00:00
Jim Meyering
5c05881f32 (visible): Don't mark `<undef>' for translation.
The standard requires that exact string.
2000-07-17 20:07:33 +00:00
Jim Meyering
5829e323e8 *** empty log message *** 2000-07-17 20:05:40 +00:00
Jim Meyering
0a3e5544ba Add support for FreeBSD. Improve support for HP-UX and IRIX 6. 2000-07-17 20:05:30 +00:00
Jim Meyering
9ef04e4fa6 . 2000-07-17 19:43:38 +00:00
Jim Meyering
e26b531e3b *** empty log message *** 2000-07-17 19:43:14 +00:00
Jim Meyering
6859252584 (usage): Give a little more info.
Remove FIXME comment.
2000-07-17 19:43:05 +00:00
Jim Meyering
870d8663fb Avoid warnings.
(struct bin_str): Declare `string' member to be `const'.
(put_indicator): Declare local `p' to be `const'.
2000-07-17 08:17:12 +00:00
Jim Meyering
f4758f2165 *** empty log message *** 2000-07-15 13:32:16 +00:00
Jim Meyering
b905d7f0b5 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Improve a couple diagnostics.
2000-07-15 13:32:02 +00:00
Jim Meyering
015bcbb713 . 2000-07-15 13:29:01 +00:00
Jim Meyering
a23c477555 *** empty log message *** 2000-07-15 13:27:37 +00:00
Jim Meyering
da8dd781de Include quote.h.
(make_path): Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Give better diagnostics.
2000-07-15 13:27:30 +00:00
Jim Meyering
f6cb183112 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call -- if there's only one.
If there are more than one, then use `quote_n (0, ...),
quote_n (1, ...), ...'.
2000-07-15 10:35:27 +00:00
Jim Meyering
f78d8fcd66 Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call -- if there's only one.
If there are more than one, then use `quote_n (0, ...),
quote_n (1, ...), ...'.
2000-07-15 10:11:47 +00:00
Jim Meyering
7f8c02a4fb Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call -- if there's only one.
If there are more than one, then use `quote_n (0, ...),
quote_n (1, ...), ...'.
2000-07-15 10:11:18 +00:00
Jim Meyering
2b4d177553 *** empty log message *** 2000-07-15 09:58:14 +00:00
Jim Meyering
3e41cabaf2 (libfetish_a_SOURCES): Add quote.c.
(noinst_HEADERS): Add quote.h.
2000-07-15 09:58:10 +00:00
Jim Meyering
48c6c83ef6 *** empty log message *** 2000-07-15 09:57:38 +00:00
Jim Meyering
4ee7d58704 (quote, quote_n): New file. Two functions taken verbatim
from tar's src/misc.c.
2000-07-15 09:57:19 +00:00
Jim Meyering
a956a46792 *** empty log message *** 2000-07-14 21:18:00 +00:00
Jim Meyering
eb25458cd8 (jm_AC_PREREQ_XSTRTOUMAX): Require jm_AC_TYPE_UINTMAX_T. 2000-07-14 21:17:51 +00:00
Jim Meyering
b9e495aafb . 2000-07-14 19:35:13 +00:00
Jim Meyering
84817c5f8c *** empty log message *** 2000-07-14 15:58:39 +00:00
Jim Meyering
1d97735304 (jm_PREREQ_QUOTEARG): s/AC_MBSTATE_T_OBJECT/AC_MBSTATE_T/. 2000-07-14 15:58:34 +00:00
Jim Meyering
a8d048fb4d *** empty log message *** 2000-07-14 15:57:09 +00:00
Jim Meyering
f53d3a9d28 (AC_MBSTATE_T): Renamed from AC_MBSTATE_T_OBJECT. All uses changed.
Change from a two-part test, which defines both HAVE_MBSTATE_T_OBJECT
and mbstate_t, to a single-part test that simply defines mbstate_t.
2000-07-14 15:56:42 +00:00
Jim Meyering
269ecb09d9 *** empty log message *** 2000-07-14 15:55:13 +00:00
Jim Meyering
e4dac83b0d (mbrtowc): Do not use HAVE_WCHAR_H in the definition.
Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT,
to decide whether to define the BeOS workaround macro;
this adjusts to the change to AC_MBSTATE_T.
2000-07-14 13:56:07 +00:00
Jim Meyering
288db81c18 *** empty log message *** 2000-07-14 11:32:47 +00:00
Jim Meyering
19920cfb66 *** empty log message *** 2000-07-14 11:27:06 +00:00
Jim Meyering
5ba7e086e5 (enum quoting style): New enum clocale_quoting_style. 2000-07-14 11:27:00 +00:00
Jim Meyering
83fdbce6a7 (quoting_style_args, quoting_style_vals,
quotearg_buffer_restyled): Add support for
clocale_quoting_style.  Undo previous change to
locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"
and "{RIGHT QUOTATION MARK}" msgids.
2000-07-14 11:26:28 +00:00
Jim Meyering
109fa3946b *** empty log message *** 2000-07-14 11:23:29 +00:00
Jim Meyering
bfc1dacca8 import 1.022 2000-07-11 22:44:26 +00:00
Jim Meyering
b64a0a7a90 from FSF 2000-07-10 14:54:02 +00:00
Jim Meyering
9d9677bd51 Tweak a comment to make it less negative about BeOS.
From Bruno Haible.
2000-07-10 11:41:50 +00:00
Jim Meyering
144d72edd4 *** empty log message *** 2000-07-10 11:30:54 +00:00
Jim Meyering
3bcb0b1bc2 Mirror the correction made in autoconf. 2000-07-10 11:30:50 +00:00
Jim Meyering
0f061bcb2d *** empty log message *** 2000-07-10 08:26:51 +00:00
Jim Meyering
bbb585d782 Output to confdefs.h directly. 2000-07-10 08:26:36 +00:00
Jim Meyering
a3f96e6b80 *** empty log message *** 2000-07-09 20:14:33 +00:00
Jim Meyering
2bf26f848f . 2000-07-09 17:53:14 +00:00
Jim Meyering
173953c503 *** empty log message *** 2000-07-09 17:49:50 +00:00
Jim Meyering
0efaa6792a *** empty log message *** 2000-07-09 17:46:16 +00:00
Jim Meyering
d2269d5c1b (jm_MACROS): Add a test to see if -lm is required
to link seq.  If so, set SEQ_LIBM to -lm.  From Bruno Haible.
2000-07-09 17:46:11 +00:00
Jim Meyering
0fe0294290 . 2000-07-09 17:25:35 +00:00
Jim Meyering
13b24a32fa *** empty log message *** 2000-07-09 17:25:03 +00:00
Jim Meyering
a27a4be2d0 (AC__GNU_SOURCE): New file/macro. 2000-07-09 17:24:41 +00:00
Jim Meyering
07cdecb35d (jm_CHECK_ALL_TYPES): Require it. 2000-07-09 17:24:27 +00:00
Jim Meyering
a6ecdec89c *** empty log message *** 2000-07-09 15:48:11 +00:00
Jim Meyering
96b16428cc The old behavior of quoting `like this' doesn't look good with
newer, ISO-style fonts.  See:
http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

Instead, quote "like this" by default.  Let the translator
tailor the locale-specific quoting behavior by providing
translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}.

(N_): New macro.
(gettext_default): New function.
(quotearg_buffer_restyled): Use
gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and
gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote.
2000-07-09 15:46:46 +00:00
Jim Meyering
f5211a209e . 2000-07-09 15:32:47 +00:00
Jim Meyering
17afffee22 *** empty log message *** 2000-07-09 07:26:44 +00:00
Jim Meyering
50751a7eff (ENAMETOOLONG): Define to an unlikely value if not defined.
(xgethostname): Remove now-unnecessary #ifdef.
Move declaration of `err' into loop where it's used.
2000-07-09 07:26:34 +00:00
Jim Meyering
7a993dd16b update copyright date 2000-07-09 07:24:51 +00:00
Jim Meyering
42d1574ad8 *** empty log message *** 2000-07-09 07:23:19 +00:00
Jim Meyering
fde850f7ad update copyright date 2000-07-09 07:22:43 +00:00
Jim Meyering
23c792f18c update copyright date 2000-07-09 07:14:42 +00:00
Jim Meyering
6d16d92a02 update copyright date 2000-07-09 07:11:28 +00:00
Jim Meyering
3f94561e84 (xgethostname): Protect against the SunOS5.5 bug
by allocating a larger buffer. Test the gethostname return value for
being >= 0, not == 0, for BeOS.  Don't exhaust memory if gethostname
returns an error and ENAMETOOLONG isn't defined.
2000-07-08 21:48:07 +00:00
Jim Meyering
c85595bddf *** empty log message *** 2000-07-06 14:41:14 +00:00
Jim Meyering
d3afffe835 *** empty log message *** 2000-07-06 05:32:12 +00:00
Jim Meyering
8fd16e77e5 *** empty log message *** 2000-07-06 05:22:57 +00:00
Jim Meyering
2cab6f81a0 Include <ctype.h> for use of isalpha. 2000-07-06 05:22:55 +00:00
Jim Meyering
3a2ee9a318 *** empty log message *** 2000-07-06 05:20:18 +00:00
Jim Meyering
d148eef81d (AC_FUNC_STRERROR_R): Pass a reasonably large buffer to strerror_r. 2000-07-06 05:20:15 +00:00
Jim Meyering
082c0a9e23 . 2000-07-06 04:48:11 +00:00
Jim Meyering
24e6e33409 (mbrtowc): Declare returned type, since BeOS doesn't. 2000-07-06 04:47:28 +00:00
Jim Meyering
47566a14a9 *** empty log message *** 2000-07-06 04:46:57 +00:00
Jim Meyering
4f23c0f185 (AC_MBSTATE_T_OBJECT): Test for mbstate_t
only if the test for an object-type mbstate_t fails.  This
prevents us from mistakenly reporting that mbstate_t is a
system object type after we "#define mbstate_t int" to work
around its lack.
2000-07-06 04:46:48 +00:00
Jim Meyering
79ab392196 *** empty log message *** 2000-07-06 04:32:11 +00:00
Jim Meyering
98b348bce8 (struct quoting_options): Simplify quote_these_too dimension. 2000-07-06 04:31:59 +00:00
Jim Meyering
78c7d32c2e . 2000-07-04 20:32:51 +00:00
Jim Meyering
a8494c44a3 *** empty log message *** 2000-07-04 17:37:47 +00:00
Jim Meyering
1954ebfb93 [!HAVE_DECL_STRNLEN]: Declare strnlen. 2000-07-04 17:37:43 +00:00
Jim Meyering
1f05833062 . 2000-07-04 17:35:01 +00:00
Jim Meyering
60b5579ba9 *** empty log message *** 2000-07-04 17:32:00 +00:00
Jim Meyering
3b26158445 Make inclusion of <wchar.h> independent of whether
HAVE_MBRTOWC is set.  Required at least for irix-5.6, which lacks mbrtowc.
2000-07-04 17:31:56 +00:00
Jim Meyering
a9f8981529 *** empty log message *** 2000-07-04 17:19:27 +00:00
Jim Meyering
f03b81fd6f *** empty log message *** 2000-07-04 17:17:30 +00:00
Jim Meyering
02ac23c3e2 (jm_FILE_SYSTEM_USAGE): Use plain old `echo' instead of deprecated AC_CHECKING. 2000-07-04 17:15:45 +00:00
Jim Meyering
673a575a22 *** empty log message *** 2000-07-04 13:07:25 +00:00
Jim Meyering
4bdbf25dee (test_vector): Disable test #2 for all systems,
even though it fails only on SunOS4.
2000-07-04 13:07:21 +00:00
Jim Meyering
030c059d49 (AC_CHECK_DECLS): Add strnlen. 2000-07-04 09:03:26 +00:00
Jim Meyering
286c731efc *** empty log message *** 2000-07-04 09:03:09 +00:00
Jim Meyering
98a94bfb23 *** empty log message *** 2000-07-04 08:44:35 +00:00
Jim Meyering
1358f7c4a8 [HAVE_UTMPX_H]: Include <utmp.h> if HAVE_UTMP_H.
This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20.
From Bob Proulx.
2000-07-04 08:44:28 +00:00
Jim Meyering
93262c2f7f *** empty log message *** 2000-07-04 07:11:55 +00:00
Jim Meyering
5ba976c1b1 (AC_MBSTATE_T_OBJECT): Port to autoconf 2.13.
Add AC_CHECK_HEADERS(stdlib.h), since we use HAVE_STDLIB_H.
2000-07-04 07:11:28 +00:00
Jim Meyering
266adb5302 *** empty log message *** 2000-07-04 07:03:26 +00:00
Jim Meyering
5a6fe4fd57 (mbrtowc): Assign to *pwc, and return 1 only if result is nonzero.
(iswprint): Use ISPRINT when substituting our own mbrtowc.
2000-07-04 07:03:16 +00:00
Jim Meyering
8d765a5946 . 2000-07-02 20:25:43 +00:00
Jim Meyering
b2a05e768c . 2000-07-02 20:21:44 +00:00
Jim Meyering
1eefb25591 Also define mbstate_t, if necessary. 2000-07-02 20:21:30 +00:00
Jim Meyering
b6ceaf9df1 (mbstate_t): Don't define here. 2000-07-02 18:32:05 +00:00
Jim Meyering
c6d5d9624c *** empty log message *** 2000-07-02 18:23:56 +00:00
Jim Meyering
e1919145a5 (SIGCONT): Define if not already defined. 2000-07-02 18:23:51 +00:00
Jim Meyering
591e461818 *** empty log message *** 2000-07-02 16:05:29 +00:00
Jim Meyering
f0b701359a *** empty log message *** 2000-07-02 15:43:22 +00:00
Jim Meyering
767804657c *** empty log message *** 2000-07-02 15:27:08 +00:00
Jim Meyering
f6b360c61f fix typo in last change 2000-07-02 15:14:04 +00:00
Jim Meyering
9cb651e6a5 *** empty log message *** 2000-07-02 12:59:32 +00:00
Jim Meyering
a8a5b983f1 Replace each use of AC_SUBST(LIBOBJS)/LIBOBJS=... with AC_LIBOBJ([function_name]). 2000-07-02 12:58:27 +00:00
Jim Meyering
5d6bc792ac *** empty log message *** 2000-07-02 11:58:18 +00:00
Jim Meyering
b08f9caae1 *** empty log message *** 2000-07-02 11:57:40 +00:00
Jim Meyering
c3259fabe2 *** empty log message *** 2000-07-02 11:49:20 +00:00
Jim Meyering
a3ff3953fc remove extra space 2000-07-01 16:45:31 +00:00
Jim Meyering
1fe03869c8 *** empty log message *** 2000-07-01 15:41:06 +00:00
Jim Meyering
1237bc6c72 Change type of global, field_1_bufsize, from int to size_t. 2000-07-01 15:41:01 +00:00
195 changed files with 6398 additions and 2948 deletions

View File

@@ -142,6 +142,17 @@ writable-files:
done; \
test "$$fail" && exit 1 || :
WGET = wget
ftp-gnu = ftp://ftp.gnu.org/gnu
automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
.PHONY: wget-update
wget-update:
$(WGET) $(ftp-gnu)/texinfo/texinfo.tex -O $(srcdir)/doc/texinfo.tex
$(WGET) $(ftp-gnu)/config/config.guess -O $(srcdir)/config.guess
$(WGET) $(ftp-gnu)/config/config.sub -O $(srcdir)/config.sub
cvs -d $(automake_repo) co -p automake/depcomp > depcomp
alpha: writable-files po-check
$(MAKE) cvs-dist
$(MAKE) -s announcement > /tmp/announce-$(distdir)

21
THANKS
View File

@@ -1,10 +1,16 @@
This is just a start at listing e-mail addresses of contributors.
The rest of the addresses are still in the ChangeLog.
These people have contributed to the GNU fileutils, textutils,
and/or sh-utils packages. Some have reported problems, others have
contributed improvements to the documentation, actual code, and even
complete programs. Those contributions are described in the ChangeLog
files. If your name has been left out, if you'd rather not be listed,
or if you'd prefer a different address be used, please let me know.
Some old names and addresses are still in the ChangeLog.
Achim Blumensath blume@corona.oche.de
Adam Klein aklein@debian.org
Akim Demaille demaille@inf.enst.fr
Alain Magloire alain@qnx.com
Alan Iwi iwi@atm.ox.ac.uk
Alberto Accomazzi alberto@cfa0.harvard.edu
aldomel aldomel@ix.netcom.com
Alen Muzinic zveki@fly.cc.fer.hr
@@ -33,6 +39,7 @@ Bill Peters peters@gaffel.as.arizona.edu
Bjorn Helgaas helgaas@rsn.hp.com
Bob McCracken kerouac@ravenet.com
Bob Proulx rwp@fc.hp.com
Branden Robinson branden@necrotic.deadbeast.net
Brendan O'Dea bod@compusol.com.au
Brian Kimball bfk@footbag.org
Brian Youmans 3diff@gnu.org
@@ -77,6 +84,7 @@ Erik Corry erik@kroete2.freinet.de
Felix Lee flee@teleport.com
Fletcher Mattox fletcher@cs.utexas.edu
Florin Iucha fiucha@hsys.mic.ro
Frank Adler fadler@allesklar.de
Frank T Lofaro ftlofaro@snooks.Egr.UNLV.EDU
François Pinard pinard@iro.umontreal.ca
Fred Fish fnf@ninemoons.com
@@ -89,6 +97,7 @@ Geoff Odhner geoff@franklin.com
Gerhard Poul gpoul@gnu.org
Germano Leichsenring germano@jedi.cs.kobe-u.ac.jp
GOTO Masanori gotom@debian.or.jp
Greg Louis glouis@dynamicro.on.ca
Greg McGary gkm@gnu.org
Greg Troxel gdt@bbn.com
Greg Wooledge gawooledge@sherwin.com
@@ -152,6 +161,7 @@ Lars Hecking lhecking@nmrc.ucc.ie
Lehti Rami rammer@cs.tut.fi
Leonard N. Zubkoff lnz@dandelion.com
Lorne Baker lbaker@nitro.avint.net
Maciej Kwapulinski pikpok@univ.gda.pl
Manas Garg manas@cygsoft.com
Manfred Hollstein manfred@s-direktnet.de
Marc Boucher marc@mbsi.ca
@@ -166,6 +176,7 @@ Mark Kettenis kettenis@phys.uva.nl
Mark W. Eichin eichin@cygnus.com
Markus Demleitner msdemlei@auriga.ari.uni-heidelberg.de
Martin martin@dresden.nacamar.de
Martin Gallant martyg@goodbit.net
Martin Hippe martin.hippe@schlund.de
Martin Mitchell martin@debian.org
Martin P.J. Zinser zinser@decus.de
@@ -182,6 +193,7 @@ Meelis Roos mroos@tartu.cyber.ee
Michael ??? michael@roka.net
Michael Deutschmann michael@talamasca.ocis.net
Michael Hasselberg mikelh@zonta.ping.de
Michael Hohn hohn@math.utah.edu
Michael Stone mstone@debian.org
Michael Stutz stutz@dsl.org
Michael Veksler mveksler@techunix.technion.ac.il
@@ -195,6 +207,7 @@ Niklas Edmundsson nikke@acc.umu.se
Noah Friedman friedman@splode.com
Noel Cragg noel@red-bean.com
Olav Morkrid olav@funcom.com
Ørn E. Hansen oehansen@daimi.aau.dk
Paul Eggert eggert@twinsun.com
Paul Nevai nevai@ops.mps.ohio-state.edu
Paul Sauer paul@alexa.com
@@ -210,7 +223,7 @@ Philippe De Muyter phdm@macqel.be
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
Piergiorgio Sartor sartor@sony.de
Piotr Kwapulinski kwap@univ.gda.pl
Maciej Kwapulinski pikpok@univ.gda.pl
Prashant TR tr@eth.net
Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Ralf W. Stephan stephan@tmt.de
Ralph Loader loader@maths.ox.ac.uk
@@ -234,6 +247,7 @@ Santiago Vila Doncel sanvila@unex.es
Savochkin Andrey Vladimirovich saw@msu.ru
Scott Lurndal slurn@griffin.engr.sgi.com
Stephen Gildea gildea@x.org
Stephen Smoogen ??????????
Steve McConnel steve@acadcomp.sil.org
Stuart Kemp skemp@peter.bmc.com
Tadayoshi Funaba tadf@kt.rim.or.jp
@@ -262,4 +276,3 @@ William Dowling will@franklin.com
William Lewis wiml@omnigroup.com
Wolfram Kleff kleff@cs.uni-bonn.de
Zvi Har'El rl@math.technion.ac.il
Ørn E. Hansen oehansen@daimi.aau.dk

View File

@@ -103,6 +103,7 @@ POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
SEQ_LIBM = @SEQ_LIBM@
SQRT_LIBM = @SQRT_LIBM@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -157,9 +158,11 @@ $(srcdir)/version.texi: stamp-vti
@:
$(srcdir)/stamp-vti: fileutils.texi $(top_srcdir)/configure.in
@echo "@set UPDATED `$(SHELL) $(srcdir)/mdate-sh $(srcdir)/fileutils.texi`" > vti.tmp
@echo "@set EDITION $(VERSION)" >> vti.tmp
@echo "@set VERSION $(VERSION)" >> vti.tmp
@(set `$(SHELL) $(srcdir)/mdate-sh $(srcdir)/fileutils.texi`; \
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
echo "@set VERSION $(VERSION)") > vti.tmp
@cmp -s vti.tmp $(srcdir)/version.texi \
|| (echo "Updating $(srcdir)/version.texi"; \
cp vti.tmp $(srcdir)/version.texi)

View File

@@ -3,9 +3,9 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{1999-09-25.10}
\def\texinfoversion{2000-09-06.09}
%
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
% Free Software Foundation, Inc.
%
% This texinfo.tex file is free software; you can redistribute it and/or
@@ -214,6 +214,9 @@
\normalturnoffactive % \ in index entries must not stay \, e.g., if
% the page break happens to be in the middle of an example.
\shipout\vbox{%
% Do this early so pdf references go to the beginning of the page.
\ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
%
\ifcropmarks \vbox to \outervsize\bgroup
\hsize = \outerhsize
\vskip-\topandbottommargin
@@ -243,8 +246,6 @@
\unvbox\footlinebox
\fi
%
\ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
%
\ifcropmarks
\egroup % end of \vbox\bgroup
\hfil\egroup % end of (centering) \line\bgroup
@@ -891,7 +892,7 @@ where each line of input produces a line of output.}
\fi}
\def\pdfmkdest#1{\pdfdest name{#1@} xyz}
\def\pdfmkpgn#1{#1@}
\let\linkcolor = \Cyan
\let\linkcolor = \Blue % was Cyan, but that seems light?
\def\endlink{\Black\pdfendlink}
% Adding outlines to PDF; macros for calculating structure of outlines
% come from Petr Olsak
@@ -906,7 +907,8 @@ where each line of input produces a line of output.}
\closein 1
\indexnofonts
\def\tt{}
% thanh's hack / proper braces in bookmarks
\let\_ = \normalunderscore
% Thanh's hack / proper braces in bookmarks
\edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
\edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
%
@@ -1670,7 +1672,10 @@ where each line of input produces a line of output.}
}
% Subroutines used in generating headings
% Produces Day Month Year style of output.
% This produces Day Month Year style of output.
% Only define if not already defined, in case a txi-??.tex file has set
% up a different format (e.g., txi-cs.tex does this).
\ifx\today\undefined
\def\today{%
\number\day\space
\ifcase\month
@@ -1679,6 +1684,7 @@ where each line of input produces a line of output.}
\or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
\fi
\space\number\year}
\fi
% @settitle line... specifies the title of the document, for headings.
% It generates no output of its own.
@@ -3149,7 +3155,6 @@ width0pt\relax} \fi
%
% Double the \vsize as well. (We don't need a separate register here,
% since nobody clobbers \vsize.)
\advance\vsize by -\ht\partialpage
\vsize = 2\vsize
}
@@ -3163,6 +3168,7 @@ width0pt\relax} \fi
% previous page.
\dimen@ = \vsize
\divide\dimen@ by 2
\advance\dimen@ by -\ht\partialpage
%
% box0 will be the left-hand column, box2 the right.
\setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
@@ -3170,15 +3176,18 @@ width0pt\relax} \fi
\unvbox255
\penalty\outputpenalty
}
%
% Re-output the contents of the output page -- any previous material,
% followed by the two boxes we just split, in box0 and box2.
\def\pagesofar{%
% Re-output the contents of the output page -- any previous material,
% followed by the two boxes we just split, in box0 and box2.
\unvbox\partialpage
%
\hsize = \doublecolumnhsize
\wd0=\hsize \wd2=\hsize
\hbox to\pagewidth{\box0\hfil\box2}%
}
%
% All done with double columns.
\def\enddoublecolumns{%
\output = {%
% Split the last of the double-column material. Leave it on the
@@ -3203,8 +3212,9 @@ width0pt\relax} \fi
% \endgroup where \vsize got restored).
\pagegoal = \vsize
}
%
% Called at the end of the double column material.
\def\balancecolumns{%
% Called at the end of the double column material.
\setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
\dimen@ = \ht0
\advance\dimen@ by \topskip
@@ -4710,7 +4720,8 @@ width0pt\relax} \fi
\def\deftypeivarheader#1#2#3{%
\dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
\begingroup
\defname{#3}{\putwordInstanceVariableof\ \code{#1}}%
\defname{\defheaderxcond#2\relax$$$#3}
{\putwordInstanceVariableof\ \code{#1}}%
\defvarargs{#3}%
\endgroup
}
@@ -5794,7 +5805,7 @@ should work if nowhere else does.}
% Use @afourwide to print on European A4 paper in wide format.
\def\afourwide{%
\afourpaper
\internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
\internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
%
\globaldefs = 0
}

View File

@@ -1796,32 +1796,34 @@ contents of files.
@pindex wc
@cindex byte count
@cindex character count
@cindex word count
@cindex line count
@code{wc} counts the number of bytes, whitespace-separated words, and
newlines in each given @var{file}, or standard input if none are given
or for a @var{file} of @samp{-}. Synopsis:
@code{wc} counts the number of bytes, characters, whitespace-separated
words, and newlines in each given @var{file}, or standard input if none
are given or for a @var{file} of @samp{-}. Synopsis:
@example
wc [@var{option}]@dots{} [@var{file}]@dots{}
@end example
@cindex total counts
@vindex POSIXLY_CORRECT
@code{wc} prints one line of counts for each file, and if the file was
given as an argument, it prints the file name following the counts. If
more than one @var{file} is given, @code{wc} prints a final line
containing the cumulative counts, with the file name @file{total}. The
counts are printed in this order: newlines, words, bytes.
counts are printed in this order: newlines, words, characters, bytes.
By default, each count is output right-justified in a 7-byte field with
one space between fields so that the numbers and file names line up nicely
in columns. However, @sc{posix} requires that there be exactly one space
separating columns. You can make @code{wc} use the @sc{posix}-mandated
output format by setting the @env{POSIXLY_CORRECT} environment variable.
By default, @code{wc} prints all three counts. Options can specify
that only certain counts be printed. Options do not undo others
previously given, so
By default, @code{wc} prints three counts: the newline, words, byte counts.
Options can specify that only certain counts be printed. Options do not
undo others previously given, so
@example
wc --bytes --words
@@ -1840,12 +1842,16 @@ The program accepts the following options. Also see @ref{Common options}.
@item -c
@itemx --bytes
@itemx --chars
@opindex -c
@opindex --bytes
@opindex --chars
Print only the byte counts.
@item -m
@itemx --chars
@opindex -m
@opindex --chars
Print only the character counts.
@item -w
@itemx --words
@opindex -w
@@ -2137,42 +2143,49 @@ value as the directory for temporary files instead of @file{/tmp}. The
@samp{-T @var{tempdir}} option in turn overrides the environment
variable.
@vindex LC_CTYPE
The following options affect the ordering of output lines. They may be
specified globally or as part of a specific key field. If no key
fields are specified, global options apply to comparison of entire
lines; otherwise the global options are inherited by key fields that do
not specify any special options of their own. The @samp{-b}, @samp{-d},
@samp{-f} and @samp{-i} options classify characters according to
the @env{LC_CTYPE} locale.
not specify any special options of their own. In pre-@sc{posix}
versions of @command{sort}, global options affect only later key fields,
so portable shell scripts should specify global options first.
@table @samp
@item -b
@opindex -b
@cindex blanks, ignoring leading
@vindex LC_CTYPE
Ignore leading blanks when finding sort keys in each line.
The @env{LC_CTYPE} locale determines character types.
@item -d
@opindex -d
@cindex phone directory order
@cindex telephone directory order
@vindex LC_CTYPE
Sort in @dfn{phone directory} order: ignore all characters except
letters, digits and blanks when sorting.
The @env{LC_CTYPE} locale determines character types.
@item -f
@opindex -f
@cindex case folding
@vindex LC_CTYPE
Fold lowercase characters into the equivalent uppercase characters when
sorting so that, for example, @samp{b} and @samp{B} sort as equal.
The @env{LC_CTYPE} locale determines character types.
@item -g
@opindex -g
@cindex general numeric sort
@vindex LC_NUMERIC
Sort numerically, using the standard C function @code{strtod} to convert
a prefix of each line to a double-precision floating point number.
This allows floating point numbers to be specified in scientific notation,
like @code{1.0e-34} and @code{10e100}.
The @env{LC_NUMERIC} locale determines the decimal-point character.
Do not report overflow, underflow, or conversion errors.
Use the following collating sequence:
@@ -2196,7 +2209,9 @@ Use this option only if there is no alternative; it is much slower than
@item -i
@opindex -i
@cindex unprintable characters, ignoring
@vindex LC_CTYPE
Ignore unprintable characters.
The @env{LC_CTYPE} locale determines character types.
@item -M
@opindex -M
@@ -2215,13 +2230,13 @@ determines the month spellings.
Sort numerically: the number begins each line; specifically, it consists
of optional whitespace, an optional @samp{-} sign, and zero or more
digits possibly separated by thousands separators, optionally followed
by a radix character and zero or more digits. The @env{LC_NUMERIC}
locale specifies the radix character and thousands separator.
by a decimal-point character and zero or more digits. The @env{LC_NUMERIC}
locale specifies the decimal-point character and thousands separator.
@code{sort -n} uses what might be considered an unconventional method
to compare strings representing floating point numbers. Rather than
first converting each string to the C @code{double} type and then
comparing those values, sort aligns the radix characters in the two
comparing those values, sort aligns the decimal-point characters in the two
strings and compares the strings a character at a time. One benefit
of using this approach is its speed. In practice this is much more
efficient than performing the two corresponding string-to-double (or even
@@ -2264,6 +2279,17 @@ into fields @w{@samp{ foo}} and @w{@samp{ bar}}. The field separator is
not considered to be part of either the field preceding or the field
following.
@item -T @var{tempdir}
@opindex -T
@cindex temporary directory
@vindex TMPDIR
Use directory @var{tempdir} to store temporary files, overriding the
@env{TMPDIR} environment variable. If this option is given more than
once, temporary files are stored in all the directories given. If you
have a large sort or merge that is I/O-bound, you can often improve
performance by using this option to specify directories on different
disks and controllers.
@item -u
@opindex -u
@cindex uniquifying output
@@ -2542,8 +2568,8 @@ comm [@var{option}]@dots{} @var{file1} @var{file2}
@vindex LC_COLLATE
Before @code{comm} can be used, the input files must be sorted using the
collating sequence specified by the @env{LC_COLLATE} locale, with
trailing newlines significant. If an input file ends in a non-newline
collating sequence specified by the @env{LC_COLLATE} locale.
If an input file ends in a non-newline
character, a newline is silently appended. The @code{sort} command with
no options always outputs a file that is suitable input to @code{comm}.
@@ -3139,6 +3165,8 @@ take up 1 character.
@opindex --fields
Print only the fields listed in @var{field-list}. Fields are
separated by a TAB character by default.
Also print any line that contains no delimiter character, unless
the @samp{--only-delimited} (@samp{-s}) option is specified
@item -d @var{input_delim_byte}
@itemx --delimiter=@var{input_delim_byte}
@@ -3410,11 +3438,23 @@ A backslash.
The notation @samp{@var{m}-@var{n}} expands to all of the characters
from @var{m} through @var{n}, in ascending order. @var{m} should
collate before @var{n}; if it doesn't, an error results. As an example,
@samp{0-9} is the same as @samp{0123456789}. Although GNU @code{tr}
does not support the System V syntax that uses square brackets to
enclose ranges, translations specified in that format will still work as
long as the brackets in @var{string1} correspond to identical brackets
in @var{string2}.
@samp{0-9} is the same as @samp{0123456789}.
GNU @code{tr} does not support the System V syntax that uses square
brackets to enclose ranges. Translations specified in that format
sometimes work as expected, since the brackets are often transliterated
to themselves. However, they should be avoided because they sometimes
behave unexpectedly. For example, @samp{tr -d '[0-9]'} deletes brackets
as well as digits.
Many historically common and even accepted uses of ranges are not
portable. For example, on @sc{ebcdic} hosts using the @samp{A-Z}
range will not do what most would expect because @samp{A} through @samp{Z}
are not contiguous as they are in @sc{ascii}.
If you can rely on a @sc{posix} compliant version of @code{tr}, then
the best way to work around this is to use character classes (see below).
Otherwise, it is most portable (and most ugly) to enumerate the members
of the ranges.
@item Repeated characters
@cindex repeated characters
@@ -3523,6 +3563,9 @@ tr a-z A-Z
tr '[:lower:]' '[:upper:]'
@end example
@noindent
But note that using ranges like @code{a-z} above is not portable.
When @code{tr} is performing translation, @var{set1} and @var{set2}
typically have the same length. If @var{set1} is shorter than
@var{set2}, the extra characters at the end of @var{set2} are ignored.
@@ -3550,6 +3593,14 @@ because it converts only zero bytes (the first element in the
complement of @var{set1}), rather than all non-alphanumerics, to
newlines.
@noindent
By the way, the above idiom is not portable because it uses ranges.
Assuming a @sc{posix} compliant @code{tr}, here is a better way to write it:
@example
tr -cs '[:alnum:]' '[\n*]'
@end example
@node Squeezing
@subsection Squeezing repeats and deleting
@@ -3589,7 +3640,7 @@ non-alphanumeric characters to newlines, then squeezes each string
of repeated newlines into a single newline:
@example
tr -cs 'a-zA-Z0-9' '[\n*]'
tr -cs '[:alnum:]' '[\n*]'
@end example
@item
@@ -4075,7 +4126,7 @@ characters. Normally it is used for things like mapping upper case to
lower case:
@example
$ echo ThIs ExAmPlE HaS MIXED case! | tr '[A-Z]' '[a-z]'
$ echo ThIs ExAmPlE HaS MIXED case! | tr '[:upper:]' '[:lower:]'
this example has mixed case!
@end example
@@ -4134,7 +4185,7 @@ The first step is to change the case of all the letters in our input file
to one case. ``The'' and ``the'' are the same word when doing counting.
@example
$ tr '[A-Z]' '[a-z]' < whats.gnu | ...
$ tr '[:upper:]' '[:lower:]' < whats.gnu | ...
@end example
The next step is to get rid of punctuation. Quoted words and unquoted words
@@ -4142,7 +4193,7 @@ should be treated identically; it's easiest to just get the punctuation out of
the way.
@smallexample
$ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' | ...
$ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \012' | ...
@end smallexample
The second @code{tr} command operates on the complement of the listed
@@ -4157,8 +4208,8 @@ next step is break the data apart so that we have one word per line. This
makes the counting operation much easier, as we will see shortly.
@smallexample
$ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' |
> tr -s '[ ]' '\012' | ...
$ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \012' |
> tr -s ' ' '\012' | ...
@end smallexample
This command turns blanks into newlines. The @samp{-s} option squeezes
@@ -4171,8 +4222,8 @@ We now have data consisting of one word per line, no punctuation, all one
case. We're ready to count each word:
@smallexample
$ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' |
> tr -s '[ ]' '\012' | sort | uniq -c | ...
$ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \012' |
> tr -s ' ' '\012' | sort | uniq -c | ...
@end smallexample
At this point, the data might look something like this:
@@ -4203,8 +4254,8 @@ reverse the order of the sort
The final pipeline looks like this:
@smallexample
$ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' |
> tr -s '[ ]' '\012' | sort | uniq -c | sort -nr
$ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \012' |
> tr -s ' ' '\012' | sort | uniq -c | sort -nr
156 the
60 a
58 to
@@ -4230,16 +4281,16 @@ Now, how to compare our file with the dictionary? As before, we generate
a sorted list of words, one per line:
@smallexample
$ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' |
> tr -s '[ ]' '\012' | sort -u | ...
$ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \012' |
> tr -s ' ' '\012' | sort -u | ...
@end smallexample
Now, all we need is a list of words that are @emph{not} in the
dictionary. Here is where the @code{comm} command comes in.
@smallexample
$ tr '[A-Z]' '[a-z]' < whats.gnu | tr -cd '[A-Za-z0-9_ \012]' |
> tr -s '[ ]' '\012' | sort -u |
$ tr '[:upper:]' '[:lower:]' < whats.gnu | tr -cd '[:alnum:]_ \012' |
> tr -s ' ' '\012' | sort -u |
> comm -23 - /usr/lib/ispell/ispell.words
@end smallexample

View File

@@ -1,3 +1,286 @@
2000-09-09 Jim Meyering <meyering@lucent.com>
Don't use atoi.
* userspec.c: Include sys/param.h and limits.h.
Include xstrtol.h.
(CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Define.
(UID_T_MAX, GID_T_MAX, MAXUID, MAXGID): Define.
(parse_user_spec): Use xstrtoul, not atoi when converting numeric
UID, GID. Check range.
2000-09-06 Jim Meyering <meyering@lucent.com>
* getopt.c (_getopt_internal): Update from glibc.
2000-08-30 Jim Meyering <meyering@lucent.com>
* strftime.c: Merge in changes from GNU libc.
2000-08-26 Jim Meyering <meyering@lucent.com>
* closeout.c: Include "__fpending.h".
(close_stdout_status): Return right away if there's nothing to flush.
* Makefile.am (noinst_HEADERS): Add __fpending.h.
* __fpending.c: New file.
* __fpending.h: New file.
2000-08-07 Paul Eggert <eggert@twinsun.com>
Standardize on "memory exhausted" instead of "Memory exhausted"
or "virtual memory exhausted".
* obstack.c (print_and_abort): Use "memory exhausted", not
"virtual memory exhausted".
* same.c (same_name): Invoke xalloc_die instead of printing
our own message.
* userspec.c (parse_user_spec): Likewise.
* bumpalloc.h: comment fix
* same.c, userspec.c: Include xalloc.h.
* xalloc.h (xalloc_msg_memory_exhausted): Now char const[],
not char *const and pointing to a constant array.
* xmalloc.c (xalloc_msg_memory_exhausted): Likewise.
(xrealloc): Comment fix.
* userspec.c (parse_user_spec):
Don't translate a message until just before returning,
to avoid unnecessary translation.
2000-08-07 Jim Meyering <meyering@lucent.com>
* addext.c, argmatch.c, argmatch.h, backupfile.h, bumpalloc.h,
chown.c, diacrit.h, dirname.h, dup2.c, exclude.h, fileblocks.c,
fnmatch.c, fnmatch.h, fsusage.c, fsusage.h, getdate.h,
getgroups.c, gethostname.c, getopt.h, group-member.c,
hard-locale.c, hash.h, isdir.c, lchown.c, linebuffer.c,
linebuffer.h, long-options.h, malloc.c, md5.c, md5.h, memchr.c,
memcmp.c, memcoll.c, memset.c, mktime.c, modechange.h, obstack.h,
pathmax.h, realloc.c, rmdir.c, safe-read.c, save-cwd.c, stime.c,
stpcpy.c, strcasecmp.c, strcspn.c, strdup.c, stripslash.c,
strstr.c, strtod.c, strtol.c, strtoul.c, strtoull.c, strtoumax.c,
utime.c, version-etc.h, xalloc.h, xstrdup.c, xstrtoumax.c,
yesno.c: Back out Copyright date changes for each file with no change
this year. This eases coordination with other programs using the same
source code modules. From Paul Eggert.
2000-08-03 Greg McGary <greg@mcgary.org>
* regex.c (SET_HIGH_BOUND, MOVE_BUFFER_POINTER,
ELSE_EXTEND_BUFFER_HIGH_BOUND): New macros.
(EXTEND_BUFFER): Use them.
2000-08-01 Jim Meyering <meyering@lucent.com>
* dirname.c (ISSLASH): Define.
(BACKSLASH_IS_PATH_SEPARATOR): Define.
(dir_name) [BACKSLASH_IS_PATH_SEPARATOR]: Handle the case in which
both `\' and `/' may be use as path separators.
Based on a patch from Prashant TR.
2000-07-31 Paul Eggert <eggert@twinsun.com>
* quotearg.c (quotearg_n_options): Don't make the initial
slot vector a constant, since it might get modified.
2000-07-31 Jim Meyering <meyering@lucent.com>
* xmalloc.c: Use `virtual memory exhausted', not `Memory exhausted'.
* obstack.c (print_and_abort): Likewise.
2000-07-30 Paul Eggert <eggert@twinsun.com>
* quotearg.c (quotearg_n_options): Preallocate a slot 0
buffer, so that the caller can always quote one small
component of a "memory exhausted" message in slot 0.
From a suggestion by Jim Meyering.
2000-07-30 Jim Meyering <meyering@lucent.com>
* makepath.c (make_path): Quote the other instance, too.
* quotearg.c (N_STATIC_SLOTVECS): Define.
(STATIC_BUF_SIZE): Define.
(quotearg_n_options): Use only statically allocated storage when
N < N_STATIC_SLOTVECS and the length of the quoted result is smaller
than STATIC_BUF_SIZE.
2000-07-29 Jim Meyering <meyering@lucent.com>
* diacrit.c (diacrit_diac): Use __MSDOS__ in favor of MSDOS.
* dirname.c (dir_name): Likewise.
* basename.c (base_name): Use ISSLASH rather than comparing against `/'.
* dirname.c (dir_name) [MSDOS]: Declare `lim' to be const.
(dir_name): Assert that there are no trailing slashes.
2000-07-18 Bruno Haible <haible@clisp.cons.org>
* mbswidth.h (mbswidth): Add a flags argument.
(mbswidth): New declaration.
(MBSW_ACCEPT_INVALID, MBSW_ACCEPT_UNPRINTABLE): New macros.
* mbswidth.c (mbswidth): Add a flags argument.
(mbsnwidth): New function.
2000-07-24 Jim Meyering <meyering@lucent.com>
* mbswidth.c: Remove useless #else. From Bruno Haible.
2000-07-23 Paul Eggert <eggert@twinsun.com>
* mbswidth.c (_XOPEN_SOURCE):
Don't define; this causes problems on Solaris 7.
(wcwidth) [!HAVE_DECL_WCWIDTH]: Declare.
2000-07-23 Paul Eggert <eggert@twinsun.com>
* quotearg.c:
Include <wchar.h> even if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX),
so that mbstate_t is always defined.
Do not inspect MB_LEN_MAX, since it's incorrectly defined to
be 1 in at least one GCC installation, and this configuration
error is likely to be common. Ignoring MB_LEN_MAX hurts
performance on hosts that have mbrtowc but have only unibyte
locales, but I assume these hosts are rare.
2000-07-23 Paul Eggert <eggert@twinsun.com>
* quotearg.c: Streamline by invoking multibyte code only if needed.
<wchar.h>: Include only if HAVE_MBRTOWC && 1 < MB_LEN_MAX.
(MB_CUR_MAX): Redefine to 1 if ! (HAVE_MBRTOWC && 1 < MB_LEN_MAX).
(quotearg_buffer_restyled): If a unibyte locale, don't bother to
invoke multibyte primitives.
2000-07-23 Jim Meyering <meyering@lucent.com>
* basename.c (base_name): Add an assertion.
2000-07-15 Bruno Haible <clisp.cons.org>
* quotearg.c: When the system forces us to redefine mbstate_t,
shadow its mbsinit function.
2000-07-16 Bruno Haible <haible@clisp.cons.org>
* mbswidth.h: New file.
* mbswidth.c: New file.
* Makefile.am (libfetish_a_SOURCES): Add mbswidth.c.
(noinst_HEADERS): Add mbswidth.h.
2000-07-17 Bruno Haible <haible@clisp.cons.org>
* config.charset: Add support for FreeBSD. Improve support for HP-UX
and IRIX 6.
2000-07-15 Jim Meyering <meyering@lucent.com>
* makepath.c: Include quote.h.
(make_path): Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Give better diagnostics.
* Makefile.am (libfetish_a_SOURCES): Add quote.c.
(noinst_HEADERS): Add quote.h.
* quote.c (quote, quote_n): New file. Two functions taken verbatim
from tar's src/misc.c.
* quote.h: New file. Prototypes for same.
2000-07-10 Paul Eggert <eggert@twinsun.com>
From a suggestion by Bruno Haible.
* quotearg.c (mbrtowc): Do not use HAVE_WCHAR_H in the definition.
Use defined mbstate_t, not HAVE_MBSTATE_T_OBJECT,
to decide whether to define the BeOS workaround macro;
this adjusts to the change to AC_MBSTATE_T.
2000-07-13 Paul Eggert <eggert@twinsun.com>
* quotearg.h (enum quoting style): New enum clocale_quoting_style.
* quotearg.c: (quoting_style_args, quoting_style_vals,
quotearg_buffer_restyled): Add support for
clocale_quoting_style. Undo previous change to
locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"
and "{RIGHT QUOTATION MARK}" msgids.
2000-07-05 Paul Eggert <eggert@twinsun.com>
The old behavior of quoting `like this' doesn't look good with
newer, ISO-style fonts. See:
http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
Instead, quote "like this" by default. Let the translator
tailor the locale-specific quoting behavior by providing
translations for {LEFT QUOTATION MARK} and {RIGHT QUOTATION MARK}.
* quotearg.c (N_): New macro.
(gettext_default): New function.
(quotearg_buffer_restyled): Use
gettext_default ("{LEFT QUOTATION MARK}", "\"") for left quote, and
gettext_default ("{RIGHT QUOTATION MARK}", "\"") for right quote.
2000-07-09 Jim Meyering <meyering@lucent.com>
* Most files: Update copyright dates to include 2000.
2000-07-08 Jim Meyering <meyering@lucent.com>
* xgethostname.c (ENAMETOOLONG): Define to an unlikely value
if not defined.
(xgethostname): Remove now-unnecessary #ifdef.
Move declaration of `err' into loop where it's used.
2000-07-05 Bruno Haible <haible@clisp.cons.org>
* xgethostname.c (xgethostname): Protect against the SunOS5.5 bug
by allocating a larger buffer. Test the gethostname return value for
being >= 0, not == 0, for BeOS. Don't exhaust memory if gethostname
returns an error and ENAMETOOLONG isn't defined.
2000-07-05 Paul Eggert <eggert@twinsun.com>
and Bruno Haible <haible@clisp.cons.org>
* quotearg.c (mbrtowc): Declare returned type, since BeOS doesn't.
2000-07-05 Bruno Haible <haible@clisp.cons.org>
* quotearg.c (struct quoting_options): Simplify quote_these_too
dimension.
2000-07-03 Jim Meyering <meyering@lucent.com>
* strndup.c: [!HAVE_DECL_STRNLEN]: Declare strnlen.
Reported by Bruno Haible.
2000-07-04 Jim Meyering <meyering@lucent.com>
* quotearg.c: Make inclusion of <wchar.h> independent of whether
HAVE_MBRTOWC is set. Required at least for irix-5.6, which
lacks mbrtowc.
2000-07-03 Paul Eggert <eggert@twinsun.com>
and Bruno Haible <haible@clisp.cons.org>
* quotearg.c (mbrtowc):
Assign to *pwc, and return 1 only if result is nonzero.
(iswprint): Use ISPRINT when substituting our own mbrtowc.
2000-07-03 Jim Meyering <meyering@lucent.com>
* readutmp.h: [HAVE_UTMPX_H]: Include <utmp.h> if HAVE_UTMP_H.
This is necessary to get a definition of e.g., UTMP_FILE on HP-UX 10.20.
From Bob Proulx.
2000-07-02 Jim Meyering <meyering@lucent.com>
* quotearg.c (mbstate_t): Don't define here.
2000-07-02 Jim Meyering <meyering@lucent.com>
* nanosleep.c (SIGCONT): Define if not already defined.
2000-06-17 Bruno Haible <haible@clisp.cons.org>
* mountlist.c: Use MOUNTED_FS_STAT_DEV instead of MOUNTED_NEXT_DEV,

View File

@@ -12,8 +12,9 @@ libfetish_a_SOURCES = \
canon-host.c closeout.c diacrit.c dirname.c exclude.c filemode.c \
full-write.c getopt.c getopt1.c getstr.c getugroups.c hard-locale.c hash.c \
human.c idcache.c isdir.c linebuffer.c localcharset.c long-options.c \
makepath.c md5.c memcasecmp.c memcoll.c modechange.c path-concat.c \
quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
makepath.c mbswidth.c md5.c memcasecmp.c memcoll.c modechange.c \
path-concat.c \
quote.c quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
savedir.c stripslash.c unicodeio.c userspec.c version-etc.c xgetcwd.c \
xgethostname.c xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c \
xstrtoumax.c yesno.c
@@ -23,11 +24,12 @@ libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
noinst_HEADERS = \
argmatch.h backupfile.h bumpalloc.h closeout.h diacrit.h dirname.h error.h \
exclude.h filemode.h fnmatch.h fsusage.h getdate.h getline.h getopt.h \
exclude.h filemode.h fnmatch.h __fpending.h fsusage.h \
getdate.h getline.h getopt.h \
getstr.h getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
linebuffer.h long-options.h md5.h memcasecmp.h memcoll.h \
makepath.h modechange.h mountlist.h nanosleep.h obstack.h \
path-concat.h pathmax.h posixtm.h quotearg.h readtokens.h \
linebuffer.h long-options.h mbswidth.h md5.h memcasecmp.h memcoll.h \
makepath.h mbswidth.h modechange.h mountlist.h nanosleep.h obstack.h \
path-concat.h pathmax.h posixtm.h quote.h quotearg.h readtokens.h \
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h \
strverscmp.h unicodeio.h version-etc.h xalloc.h xstrtod.h xstrtol.h

View File

@@ -104,6 +104,7 @@ POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
SEQ_LIBM = @SEQ_LIBM@
SQRT_LIBM = @SQRT_LIBM@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -126,8 +127,9 @@ libfetish_a_SOURCES = \
canon-host.c closeout.c diacrit.c dirname.c exclude.c filemode.c \
full-write.c getopt.c getopt1.c getstr.c getugroups.c hard-locale.c hash.c \
human.c idcache.c isdir.c linebuffer.c localcharset.c long-options.c \
makepath.c md5.c memcasecmp.c memcoll.c modechange.c path-concat.c \
quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
makepath.c mbswidth.c md5.c memcasecmp.c memcoll.c modechange.c \
path-concat.c \
quote.c quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
savedir.c stripslash.c unicodeio.c userspec.c version-etc.c xgetcwd.c \
xgethostname.c xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c \
xstrtoumax.c yesno.c
@@ -138,11 +140,12 @@ libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
noinst_HEADERS = \
argmatch.h backupfile.h bumpalloc.h closeout.h diacrit.h dirname.h error.h \
exclude.h filemode.h fnmatch.h fsusage.h getdate.h getline.h getopt.h \
exclude.h filemode.h fnmatch.h __fpending.h fsusage.h \
getdate.h getline.h getopt.h \
getstr.h getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
linebuffer.h long-options.h md5.h memcasecmp.h memcoll.h \
makepath.h modechange.h mountlist.h nanosleep.h obstack.h \
path-concat.h pathmax.h posixtm.h quotearg.h readtokens.h \
linebuffer.h long-options.h mbswidth.h md5.h memcasecmp.h memcoll.h \
makepath.h mbswidth.h modechange.h mountlist.h nanosleep.h obstack.h \
path-concat.h pathmax.h posixtm.h quote.h quotearg.h readtokens.h \
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h \
strverscmp.h unicodeio.h version-etc.h xalloc.h xstrtod.h xstrtol.h
@@ -175,12 +178,12 @@ argmatch$U.o backupfile$U.o basename$U.o canon-host$U.o closeout$U.o \
diacrit$U.o dirname$U.o exclude$U.o filemode$U.o full-write$U.o \
getopt$U.o getopt1$U.o getstr$U.o getugroups$U.o hard-locale$U.o \
hash$U.o human$U.o idcache$U.o isdir$U.o linebuffer$U.o \
localcharset$U.o long-options$U.o makepath$U.o md5$U.o memcasecmp$U.o \
memcoll$U.o modechange$U.o path-concat$U.o quotearg$U.o readtokens$U.o \
safe-read$U.o same$U.o save-cwd$U.o savedir$U.o stripslash$U.o \
unicodeio$U.o userspec$U.o version-etc$U.o xgetcwd$U.o xgethostname$U.o \
xmalloc$U.o xstrdup$U.o xstrtod$U.o xstrtol$U.o xstrtoul$U.o \
xstrtoumax$U.o yesno$U.o
localcharset$U.o long-options$U.o makepath$U.o mbswidth$U.o md5$U.o \
memcasecmp$U.o memcoll$U.o modechange$U.o path-concat$U.o quote$U.o \
quotearg$U.o readtokens$U.o safe-read$U.o same$U.o save-cwd$U.o \
savedir$U.o stripslash$U.o unicodeio$U.o userspec$U.o version-etc$U.o \
xgetcwd$U.o xgethostname$U.o xmalloc$U.o xstrdup$U.o xstrtod$U.o \
xstrtol$U.o xstrtoul$U.o xstrtoumax$U.o yesno$U.o
libfetish_a_OBJECTS = $(am_libfetish_a_OBJECTS)
AR = ar
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -191,47 +194,48 @@ DIST_SOURCES = $(libfetish_a_SOURCES)
HEADERS = $(noinst_HEADERS)
depcomp = $(SHELL) $(top_srcdir)/depcomp
DEP_FILES = @AMDEP@ $(DEPDIR)/addext$U.Po $(DEPDIR)/alloca.Po \
$(DEPDIR)/argmatch$U.Po $(DEPDIR)/atexit.Po $(DEPDIR)/backupfile$U.Po \
$(DEPDIR)/basename$U.Po $(DEPDIR)/canon-host$U.Po $(DEPDIR)/chown.Po \
$(DEPDIR)/closeout$U.Po $(DEPDIR)/diacrit$U.Po $(DEPDIR)/dirname$U.Po \
$(DEPDIR)/dup2.Po $(DEPDIR)/error.Po $(DEPDIR)/euidaccess.Po \
$(DEPDIR)/exclude$U.Po $(DEPDIR)/fileblocks.Po $(DEPDIR)/filemode$U.Po \
$(DEPDIR)/fnmatch.Po $(DEPDIR)/fsusage.Po $(DEPDIR)/ftruncate.Po \
$(DEPDIR)/full-write$U.Po $(DEPDIR)/getdate$U.Po $(DEPDIR)/getgroups.Po \
$(DEPDIR)/gethostname.Po $(DEPDIR)/getline.Po $(DEPDIR)/getloadavg.Po \
$(DEPDIR)/getopt$U.Po $(DEPDIR)/getopt1$U.Po $(DEPDIR)/getpass.Po \
$(DEPDIR)/getstr$U.Po $(DEPDIR)/getugroups$U.Po \
$(DEPDIR)/getusershell.Po $(DEPDIR)/group-member.Po \
$(DEPDIR)/hard-locale$U.Po $(DEPDIR)/hash$U.Po $(DEPDIR)/human$U.Po \
$(DEPDIR)/idcache$U.Po $(DEPDIR)/isdir$U.Po $(DEPDIR)/lchown.Po \
$(DEPDIR)/linebuffer$U.Po $(DEPDIR)/localcharset$U.Po \
$(DEPDIR)/long-options$U.Po $(DEPDIR)/lstat.Po $(DEPDIR)/makepath$U.Po \
$(DEPDIR)/malloc.Po $(DEPDIR)/md5$U.Po $(DEPDIR)/memcasecmp$U.Po \
DEP_FILES = @AMDEP@ $(DEPDIR)/__fpending.Po $(DEPDIR)/addext$U.Po \
$(DEPDIR)/alloca.Po $(DEPDIR)/argmatch$U.Po $(DEPDIR)/atexit.Po \
$(DEPDIR)/backupfile$U.Po $(DEPDIR)/basename$U.Po \
$(DEPDIR)/canon-host$U.Po $(DEPDIR)/chown.Po $(DEPDIR)/closeout$U.Po \
$(DEPDIR)/diacrit$U.Po $(DEPDIR)/dirname$U.Po $(DEPDIR)/dup2.Po \
$(DEPDIR)/error.Po $(DEPDIR)/euidaccess.Po $(DEPDIR)/exclude$U.Po \
$(DEPDIR)/fileblocks.Po $(DEPDIR)/filemode$U.Po $(DEPDIR)/fnmatch.Po \
$(DEPDIR)/fsusage.Po $(DEPDIR)/ftruncate.Po $(DEPDIR)/full-write$U.Po \
$(DEPDIR)/getdate$U.Po $(DEPDIR)/getgroups.Po $(DEPDIR)/gethostname.Po \
$(DEPDIR)/getline.Po $(DEPDIR)/getloadavg.Po $(DEPDIR)/getopt$U.Po \
$(DEPDIR)/getopt1$U.Po $(DEPDIR)/getpass.Po $(DEPDIR)/getstr$U.Po \
$(DEPDIR)/getugroups$U.Po $(DEPDIR)/getusershell.Po \
$(DEPDIR)/group-member.Po $(DEPDIR)/hard-locale$U.Po \
$(DEPDIR)/hash$U.Po $(DEPDIR)/human$U.Po $(DEPDIR)/idcache$U.Po \
$(DEPDIR)/isdir$U.Po $(DEPDIR)/lchown.Po $(DEPDIR)/linebuffer$U.Po \
$(DEPDIR)/localcharset$U.Po $(DEPDIR)/long-options$U.Po \
$(DEPDIR)/lstat.Po $(DEPDIR)/makepath$U.Po $(DEPDIR)/malloc.Po \
$(DEPDIR)/mbswidth$U.Po $(DEPDIR)/md5$U.Po $(DEPDIR)/memcasecmp$U.Po \
$(DEPDIR)/memchr.Po $(DEPDIR)/memcmp.Po $(DEPDIR)/memcoll$U.Po \
$(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po $(DEPDIR)/memset.Po \
$(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po \
$(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po $(DEPDIR)/path-concat$U.Po \
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quotearg$U.Po \
$(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp.Po $(DEPDIR)/realloc.Po \
$(DEPDIR)/regex.Po $(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po \
$(DEPDIR)/safe-read$U.Po $(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po \
$(DEPDIR)/savedir$U.Po $(DEPDIR)/stat.Po $(DEPDIR)/stime.Po \
$(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po \
$(DEPDIR)/strdup.Po $(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
$(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po $(DEPDIR)/strnlen.Po \
$(DEPDIR)/strpbrk.Po $(DEPDIR)/strstr.Po $(DEPDIR)/strtod.Po \
$(DEPDIR)/strtol.Po $(DEPDIR)/strtoul.Po $(DEPDIR)/strtoull.Po \
$(DEPDIR)/strtoumax.Po $(DEPDIR)/strverscmp.Po $(DEPDIR)/unicodeio$U.Po \
$(DEPDIR)/userspec$U.Po $(DEPDIR)/utime.Po $(DEPDIR)/version-etc$U.Po \
$(DEPDIR)/xgetcwd$U.Po $(DEPDIR)/xgethostname$U.Po \
$(DEPDIR)/xmalloc$U.Po $(DEPDIR)/xstrdup$U.Po $(DEPDIR)/xstrtod$U.Po \
$(DEPDIR)/xstrtol$U.Po $(DEPDIR)/xstrtoul$U.Po \
$(DEPDIR)/xstrtoumax$U.Po $(DEPDIR)/yesno$U.Po
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quote$U.Po \
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp.Po \
$(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po $(DEPDIR)/rmdir.Po \
$(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po $(DEPDIR)/same$U.Po \
$(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po $(DEPDIR)/stat.Po \
$(DEPDIR)/stime.Po $(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po \
$(DEPDIR)/strcspn.Po $(DEPDIR)/strdup.Po $(DEPDIR)/strftime.Po \
$(DEPDIR)/stripslash$U.Po $(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po \
$(DEPDIR)/strnlen.Po $(DEPDIR)/strpbrk.Po $(DEPDIR)/strstr.Po \
$(DEPDIR)/strtod.Po $(DEPDIR)/strtol.Po $(DEPDIR)/strtoul.Po \
$(DEPDIR)/strtoull.Po $(DEPDIR)/strtoumax.Po $(DEPDIR)/strverscmp.Po \
$(DEPDIR)/unicodeio$U.Po $(DEPDIR)/userspec$U.Po $(DEPDIR)/utime.Po \
$(DEPDIR)/version-etc$U.Po $(DEPDIR)/xgetcwd$U.Po \
$(DEPDIR)/xgethostname$U.Po $(DEPDIR)/xmalloc$U.Po \
$(DEPDIR)/xstrdup$U.Po $(DEPDIR)/xstrtod$U.Po $(DEPDIR)/xstrtol$U.Po \
$(DEPDIR)/xstrtoul$U.Po $(DEPDIR)/xstrtoumax$U.Po $(DEPDIR)/yesno$U.Po
DIST_COMMON = README $(noinst_HEADERS) ChangeLog Makefile.am \
Makefile.in TODO alloca.c atexit.c chown.c dup2.c error.c error.h \
euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c getdate.c \
getgroups.c gethostname.c getline.c getloadavg.c getpass.c \
Makefile.in TODO __fpending.c alloca.c atexit.c chown.c dup2.c error.c \
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getgroups.c gethostname.c getline.c getloadavg.c getpass.c \
getusershell.c group-member.c lchown.c malloc.c memchr.c memcmp.c \
memcpy.c memmove.c memset.c mktime.c mountlist.c nanosleep.c obstack.c \
obstack.h putenv.c readutmp.c realloc.c regex.c rmdir.c rpmatch.c \
@@ -295,6 +299,8 @@ libfetish.a: $(libfetish_a_OBJECTS) $(libfetish_a_DEPENDENCIES)
-rm -f libfetish.a
$(libfetish_a_AR) libfetish.a $(libfetish_a_OBJECTS) $(libfetish_a_LIBADD)
$(RANLIB) libfetish.a
__fpending_.c: __fpending.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/__fpending.c; then echo $(srcdir)/__fpending.c; else echo __fpending.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > __fpending_.c
addext_.c: addext.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > addext_.c
alloca_.c: alloca.c $(ANSI2KNR)
@@ -385,6 +391,8 @@ makepath_.c: makepath.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > makepath_.c
malloc_.c: malloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > malloc_.c
mbswidth_.c: mbswidth.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mbswidth.c; then echo $(srcdir)/mbswidth.c; else echo mbswidth.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > mbswidth_.c
md5_.c: md5.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/md5.c; then echo $(srcdir)/md5.c; else echo md5.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > md5_.c
memcasecmp_.c: memcasecmp.c $(ANSI2KNR)
@@ -417,6 +425,8 @@ posixtm_.c: posixtm.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > posixtm_.c
putenv_.c: putenv.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/putenv.c; then echo $(srcdir)/putenv.c; else echo putenv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > putenv_.c
quote_.c: quote.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quote.c; then echo $(srcdir)/quote.c; else echo quote.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quote_.c
quotearg_.c: quotearg.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quotearg_.c
readtokens_.c: readtokens.c $(ANSI2KNR)
@@ -503,19 +513,20 @@ xstrtoumax_.c: xstrtoumax.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtoumax.c; then echo $(srcdir)/xstrtoumax.c; else echo xstrtoumax.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrtoumax_.c
yesno_.c: yesno.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/yesno.c; then echo $(srcdir)/yesno.c; else echo yesno.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > yesno_.c
addext_.o alloca_.o argmatch_.o atexit_.o backupfile_.o basename_.o \
canon-host_.o chown_.o closeout_.o diacrit_.o dirname_.o dup2_.o \
error_.o euidaccess_.o exclude_.o fileblocks_.o filemode_.o fnmatch_.o \
fsusage_.o ftruncate_.o full-write_.o getdate_.o getgroups_.o \
gethostname_.o getline_.o getloadavg_.o getopt_.o getopt1_.o getpass_.o \
getstr_.o getugroups_.o getusershell_.o group-member_.o hard-locale_.o \
hash_.o human_.o idcache_.o isdir_.o lchown_.o linebuffer_.o \
localcharset_.o long-options_.o lstat_.o makepath_.o malloc_.o md5_.o \
memcasecmp_.o memchr_.o memcmp_.o memcoll_.o memcpy_.o memmove_.o \
memset_.o mktime_.o modechange_.o mountlist_.o nanosleep_.o obstack_.o \
path-concat_.o posixtm_.o putenv_.o quotearg_.o readtokens_.o \
readutmp_.o realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o \
same_.o save-cwd_.o savedir_.o stat_.o stime_.o stpcpy_.o strcasecmp_.o \
__fpending_.o addext_.o alloca_.o argmatch_.o atexit_.o backupfile_.o \
basename_.o canon-host_.o chown_.o closeout_.o diacrit_.o dirname_.o \
dup2_.o error_.o euidaccess_.o exclude_.o fileblocks_.o filemode_.o \
fnmatch_.o fsusage_.o ftruncate_.o full-write_.o getdate_.o \
getgroups_.o gethostname_.o getline_.o getloadavg_.o getopt_.o \
getopt1_.o getpass_.o getstr_.o getugroups_.o getusershell_.o \
group-member_.o hard-locale_.o hash_.o human_.o idcache_.o isdir_.o \
lchown_.o linebuffer_.o localcharset_.o long-options_.o lstat_.o \
makepath_.o malloc_.o mbswidth_.o md5_.o memcasecmp_.o memchr_.o \
memcmp_.o memcoll_.o memcpy_.o memmove_.o memset_.o mktime_.o \
modechange_.o mountlist_.o nanosleep_.o obstack_.o path-concat_.o \
posixtm_.o putenv_.o quote_.o quotearg_.o readtokens_.o readutmp_.o \
realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o same_.o \
save-cwd_.o savedir_.o stat_.o stime_.o stpcpy_.o strcasecmp_.o \
strcspn_.o strdup_.o strftime_.o stripslash_.o strncasecmp_.o \
strndup_.o strnlen_.o strpbrk_.o strstr_.o strtod_.o strtol_.o \
strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o unicodeio_.o \
@@ -562,6 +573,7 @@ distclean-tags:
maintainer-clean-tags:
@AMDEP@include $(DEPDIR)/__fpending.Po
@AMDEP@include $(DEPDIR)/addext$U.Po
@AMDEP@include $(DEPDIR)/alloca.Po
@AMDEP@include $(DEPDIR)/argmatch$U.Po
@@ -607,6 +619,7 @@ maintainer-clean-tags:
@AMDEP@include $(DEPDIR)/lstat.Po
@AMDEP@include $(DEPDIR)/makepath$U.Po
@AMDEP@include $(DEPDIR)/malloc.Po
@AMDEP@include $(DEPDIR)/mbswidth$U.Po
@AMDEP@include $(DEPDIR)/md5$U.Po
@AMDEP@include $(DEPDIR)/memcasecmp$U.Po
@AMDEP@include $(DEPDIR)/memchr.Po
@@ -623,6 +636,7 @@ maintainer-clean-tags:
@AMDEP@include $(DEPDIR)/path-concat$U.Po
@AMDEP@include $(DEPDIR)/posixtm$U.Po
@AMDEP@include $(DEPDIR)/putenv.Po
@AMDEP@include $(DEPDIR)/quote$U.Po
@AMDEP@include $(DEPDIR)/quotearg$U.Po
@AMDEP@include $(DEPDIR)/readtokens$U.Po
@AMDEP@include $(DEPDIR)/readutmp.Po

30
lib/__fpending.c Normal file
View File

@@ -0,0 +1,30 @@
/* __fpending.c -- return the number of pending output bytes on a stream
Copyright (C) 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
the Free Software Foundation; either version 2, 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, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Jim Meyering. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "__fpending.h"
size_t
__fpending (FILE *fp)
{
return PENDING_OUTPUT_N_BYTES;
}

18
lib/__fpending.h Normal file
View File

@@ -0,0 +1,18 @@
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#if HAVE_STDIO_EXT_H
# include <stdio_ext.h>
#endif
#include <sys/types.h>
#ifndef HAVE_DECL___FPENDING
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL___FPENDING
size_t __fpending (FILE *);
#endif

View File

@@ -1,5 +1,5 @@
/* basename.c -- return the last element in a path
Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1990, 1998, 1999, 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
@@ -19,6 +19,8 @@
# include <config.h>
#endif
#include <assert.h>
#ifndef FILESYSTEM_PREFIX_LEN
# define FILESYSTEM_PREFIX_LEN(Filename) 0
#endif
@@ -61,5 +63,8 @@ base_name (char const *name)
if (*base == '\0' && ISSLASH (*name) && all_slashes)
--base;
/* Make sure the last byte is not a slash. */
assert (all_slashes || !ISSLASH (*(p - 1)));
return (char *) base;
}

View File

@@ -1,5 +1,5 @@
/* BUMP_ALLOC macro - increase table allocation by one element.
Copyright (C) 1990, 1991, 1993, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1993, 1998, 2000 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1990.
This program is free software; you can redistribute it and/or modify
@@ -25,8 +25,8 @@
`-------------------------------------------------------------------------*/
/* Routines `xmalloc' and `xrealloc' are called to do the actual memory
management. This implies that the program will abort with an `Memory
exhausted!' error if any problem arise.
management. This implies that the program will abort with a "memory
exhausted" error if any problem arise.
To work correctly, at least EXPONENT and TYPE should always be the
same for all uses of this macro for any given TABLE. A secure way to

View File

@@ -43,6 +43,7 @@ extern int errno;
#include "closeout.h"
#include "error.h"
#include "quotearg.h"
#include "__fpending.h"
static int default_exit_status = EXIT_FAILURE;
static const char *file_name;
@@ -86,11 +87,15 @@ close_stdout_set_file_name (const char *file)
It's important to detect such failures and exit nonzero because many
tools (most notably `make' and other build-management systems) depend
on being able to detect failure in other tools via their exit status. */
void
close_stdout_status (int status)
{
int e = ferror (stdout) ? 0 : -1;
if (__fpending (stdout) == 0)
return;
if (fclose (stdout) != 0)
e = errno;

View File

@@ -31,32 +31,34 @@
# The current list of GNU canonical charset names is as follows.
#
# name used by which systems a MIME name?
# ASCII, ANSI_X3.4-1968 glibc solaris
# ISO-8859-1 glibc aix hpux irix osf solaris yes
# ISO-8859-2 glibc aix hpux irix solaris yes
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-2 glibc aix hpux irix solaris freebsd yes
# ISO-8859-4 solaris yes
# ISO-8859-5 glibc aix hpux irix solaris yes
# ISO-8859-6 aix hpux solaris yes
# ISO-8859-6 glibc aix hpux solaris yes
# ISO-8859-7 glibc aix hpux irix osf solaris yes
# ISO-8859-8 glibc aix hpux solaris yes
# ISO-8859-9 glibc aix hpux irix osf solaris yes
# ISO-8859-13 glibc
# ISO-8859-15 aix solaris
# KOI8-R glibc solaris yes
# ISO-8859-15 aix solaris freebsd
# KOI8-R glibc solaris freebsd yes
# KOI8-U glibc yes
# CP850 aix osf
# CP856 aix
# CP866 freebsd
# CP922 aix
# CP932 aix
# CP943 aix
# CP1046 aix
# CP1124 aix
# CP1129 aix
# CP1251 glibc
# CP1252 aix
# EUC-CN aix hpux solaris
# EUC-JP aix hpux solaris yes
# EUC-KR aix hpux solaris yes
# EUC-TW aix hpux solaris
# EUC-CN aix hpux irix solaris
# EUC-JP aix hpux irix solaris yes
# EUC-KR aix hpux irix solaris yes
# EUC-TW aix hpux irix solaris
# BIG5 aix hpux solaris yes
# GBK aix
# SJIS hpux solaris
@@ -132,6 +134,7 @@ case "$os" in
echo "iso88597 ISO-8859-7"
echo "iso88598 ISO-8859-8"
echo "iso88599 ISO-8859-9"
echo "iso885915 ISO-8859-15"
echo "roman8 HP-ROMAN8"
echo "arabic8 HP-ARABIC8"
echo "greek8 HP-GREEK8"
@@ -154,6 +157,10 @@ case "$os" in
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-9 ISO-8859-9"
echo "eucCN EUC-CN"
echo "eucJP EUC-JP"
echo "eucKR EUC-KR"
echo "eucTW EUC-TW"
;;
osf*)
echo "ISO8859-1 ISO-8859-1"
@@ -183,4 +190,27 @@ case "$os" in
#echo "sun_eu_greek ?" # what is this?
echo "UTF-8 UTF-8"
;;
freebsd*)
# FreeBSD 3.3 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "C ASCII"
echo "US-ASCII ASCII"
for l in lt_LN; do
echo "$l.ASCII ASCII"
done
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT lt_LN \
nl_BE nl_NL no_NO pt_PT sv_SE; do
echo "$l.ISO_8859-1 ISO-8859-1"
echo "$l.DIS_8859-15 ISO-8859-15"
done
for l in hr_HR hu_HU lt_LN pl_PL sl_SI; do
echo "$l.ISO_8859-2 ISO-8859-2"
done
for l in ru_RU ru_SU; do
echo "$l.KOI8-R KOI8-R"
echo "$l.CP866 CP866"
done
;;
esac

View File

@@ -1,5 +1,5 @@
/* Diacritics processing for a few character codes.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1992, 1993, 2000 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
All this file is a temporary hack, waiting for locales in GNU.
@@ -38,7 +38,7 @@ const char diacrit_base[256] =
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', 0, 0, 0, 0, 0,
#ifdef MSDOS
#ifdef __MSDOS__
'C', 'u', 'e', 'a', 'a', 'a', 'a', 'c',
'e', 'e', 'e', 'i', 'i', 'i', 'A', 'A',
@@ -57,7 +57,7 @@ const char diacrit_base[256] =
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
#else /* not MSDOS */
#else
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -76,7 +76,7 @@ const char diacrit_base[256] =
0, 'n', 'o', 'o', 'o', 'o', 'o', 0,
'o', 'u', 'u', 'u', 'u', 'y', 0, 'y',
#endif /* not MSDOS */
#endif
};
/*------------------------------------------------------------------------.
@@ -106,7 +106,7 @@ const char diacrit_diac[256] =
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 6, 0,
#ifdef MSDOS
#ifdef __MSDOS__
7, 5, 2, 4, 5, 3, 8, 7,
4, 5, 3, 5, 4, 3, 5, 8,
@@ -125,7 +125,7 @@ const char diacrit_diac[256] =
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
#else /* not MSDOS */
#else
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -144,5 +144,5 @@ const char diacrit_diac[256] =
0, 6, 3, 2, 4, 6, 5, 0,
9, 3, 2, 4, 5, 2, 0, 0,
#endif /* not MSDOS */
#endif
};

View File

@@ -13,4 +13,3 @@ extern const char diacrit_diac[]; /* diacritic code for each character */
/* Returns a diacritic code for CHAR. CHAR is known to be alphabetic. */
#define todiac(Char) (diacrit_diac[(unsigned char) (Char)])

View File

@@ -1,5 +1,5 @@
/* dirname.c -- return all but the last element in a path
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 1998, 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
@@ -32,9 +32,16 @@ char *malloc ();
# define strrchr rindex
# endif
#endif
#include <assert.h>
#include "dirname.h"
#ifndef ISSLASH
# define ISSLASH(C) ((C) == '/')
#endif
#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')
/* Return the leading directories part of PATH,
allocated with malloc. If out of memory, return 0.
Assumes that trailing slashes have already been
@@ -48,6 +55,19 @@ dir_name (const char *path)
int length; /* Length of result, not including NUL. */
slash = strrchr (path, '/');
if (BACKSLASH_IS_PATH_SEPARATOR)
{
char *b = strrchr (path, '\\');
if (b && slash < b)
slash = b;
}
/* Make sure there are no trailing slashes. */
assert (slash == NULL /* There are no slashes in PATH. */
|| slash[1] != 0 /* There is a non-NUL byte after the last slash. */
|| path == slash /* PATH is just `/'. */
);
if (slash == 0)
{
/* File is in the current directory. */
@@ -57,20 +77,25 @@ dir_name (const char *path)
else
{
/* Remove any trailing slashes from the result. */
#ifdef MSDOS
char *lim = (path[0] >= 'A' && path[0] <= 'z' && path[1] == ':')
? path + 2 : path;
if (BACKSLASH_IS_PATH_SEPARATOR)
{
const char *lim = ((path[0] >= 'A' && path[0] <= 'z'
&& path[1] == ':')
? path + 2 : path);
/* If canonicalized "d:/path", leave alone the root case "d:/". */
while (slash > lim && *slash == '/')
--slash;
#else
while (slash > path && *slash == '/')
--slash;
#endif
/* If canonicalized "d:/path", leave alone the root case "d:/". */
while (slash > lim && ISSLASH (*slash))
--slash;
}
else
{
while (slash > path && ISSLASH (*slash))
--slash;
}
length = slash - path + 1;
}
newpath = (char *) malloc (length + 1);
if (newpath == 0)
return 0;

View File

@@ -27,13 +27,13 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#else
# if !defined __STDC__ || !__STDC__
#endif
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
# ifndef const
# define const
# endif
# ifndef const
# define const
# endif
#endif
@@ -671,7 +671,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
pfound = p;
indfound = option_index;
}
else
else if (pfound->has_arg != p->has_arg
|| pfound->flag != p->flag
|| pfound->val != p->val)
/* Second or later nonexact match found. */
ambig = 1;
}

View File

@@ -1,5 +1,5 @@
/* getversion.c -- select backup filename type
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 1998, 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

View File

@@ -116,6 +116,7 @@ extern int errno;
#include "save-cwd.h"
#include "error.h"
#include "quote.h"
void strip_trailing_slashes ();
@@ -173,12 +174,13 @@ make_dir (const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
if (stat (dir, &stats))
{
error (0, saved_errno, _("cannot create directory `%s'"), dirpath);
error (0, saved_errno, _("cannot create directory %s"),
quote (dirpath));
fail = 1;
}
else if (!S_ISDIR (stats.st_mode))
{
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
error (0, 0, _("%s exists but is not a directory"), quote (dirpath));
fail = 1;
}
else
@@ -307,7 +309,7 @@ make_path (const char *argpath,
if (newly_created_dir)
{
if (verbose_fmt_string)
error (0, 0, verbose_fmt_string, dirpath);
error (0, 0, verbose_fmt_string, quote (dirpath));
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
@@ -316,7 +318,8 @@ make_path (const char *argpath,
#endif
)
{
error (0, errno, "%s", dirpath);
error (0, errno, _("cannot change owner and/or group of %s"),
quote (dirpath));
CLEANUP;
return 1;
}
@@ -337,7 +340,8 @@ make_path (const char *argpath,
stat and mkdir process O(n^2) file name components. */
if (do_chdir && chdir (basename_dir) < 0)
{
error (0, errno, _("cannot chdir to directory, %s"), dirpath);
error (0, errno, _("cannot chdir to directory, %s"),
quote (dirpath));
CLEANUP;
return 1;
}
@@ -366,7 +370,7 @@ make_path (const char *argpath,
umask (oldmask);
if (verbose_fmt_string != NULL)
error (0, 0, verbose_fmt_string, dirpath);
error (0, 0, verbose_fmt_string, quote (dirpath));
if (owner != (uid_t) -1 || group != (gid_t) -1)
{
@@ -376,7 +380,8 @@ make_path (const char *argpath,
#endif
)
{
error (0, errno, _("cannot chown %s"), dirpath);
error (0, errno, _("cannot change owner and/or group of %s"),
quote (dirpath));
retval = 1;
}
}
@@ -389,7 +394,7 @@ make_path (const char *argpath,
if ((mode & ~S_IRWXUGO)
&& chmod (basename_dir, mode))
{
error (0, errno, _("cannot chmod %s"), dirpath);
error (0, errno, _("cannot change permissions of %s"), quote (dirpath));
retval = 1;
}
@@ -403,7 +408,8 @@ make_path (const char *argpath,
*(p->dirname_end) = '\0';
if (chmod (dirpath, parent_mode))
{
error (0, errno, "%s", dirpath);
error (0, errno, "cannot change permissions of %s",
quote (dirpath));
retval = 1;
}
}
@@ -416,7 +422,7 @@ make_path (const char *argpath,
if (!S_ISDIR (stats.st_mode))
{
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
error (0, 0, _("%s exists but is not a directory"), quote (dirpath));
return 1;
}
@@ -435,12 +441,14 @@ make_path (const char *argpath,
#endif
)
{
error (0, errno, "%s", dirpath);
error (0, errno, _("cannot change owner and/or group of %s"),
quote (dirpath));
retval = 1;
}
if (chmod (dirpath, mode))
{
error (0, errno, "%s", dirpath);
error (0, errno, _("cannot change permissions of %s"),
quote (dirpath));
retval = 1;
}
}

207
lib/mbswidth.c Normal file
View File

@@ -0,0 +1,207 @@
/* Determine the number of screen columns needed for a string.
Copyright (C) 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
the Free Software Foundation; either version 2, 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, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Bruno Haible <haible@clisp.cons.org>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Get MB_LEN_MAX. */
#if HAVE_LIMITS_H
# include <limits.h>
#endif
/* Get MB_CUR_MAX. */
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#endif
/* Get isprint(). */
#include <ctype.h>
/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
#if HAVE_WCHAR_H
# include <wchar.h>
#endif
/* Get iswprint(). */
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
#if !defined iswprint && !HAVE_ISWPRINT
# define iswprint(wc) 1
#endif
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
#if HAVE_MBRTOWC && defined mbstate_t
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
# define mbsinit(ps) 1
#endif
#ifndef HAVE_DECL_WCWIDTH
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_WCWIDTH
int wcwidth ();
#endif
#ifndef wcwidth
# if !HAVE_WCWIDTH
/* wcwidth doesn't exist, so assume all printable characters have
width 1. */
# define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1)
# endif
#endif
/* Get ISPRINT. */
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
/* Undefine to protect against the definition in wctype.h of solaris2.6. */
# undef ISASCII
# define ISASCII(c) 1
#else
# define ISASCII(c) isascii (c)
#endif
/* Undefine to protect against the definition in wctype.h of solaris2.6. */
#undef ISPRINT
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#include "mbswidth.h"
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING. If a non-printable character
occurs, -1 is returned, unless MBSW_ACCEPT_UNPRINTABLE is specified.
With flags = 0, this is the multibyte analogon of the wcswidth function. */
int
mbswidth (const char *string, int flags)
{
return mbsnwidth (string, strlen (string), flags);
}
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING of length NBYTES. If a
non-printable character occurs, -1 is returned, unless
MBSW_ACCEPT_UNPRINTABLE is specified. */
int
mbsnwidth (const char *string, size_t nbytes, int flags)
{
const char *p = string;
const char *plimit = p + nbytes;
int width;
width = 0;
#if HAVE_MBRTOWC && (MB_LEN_MAX > 1)
if (MB_CUR_MAX > 1)
{
while (p < plimit)
switch (*p)
{
case ' ': case '!': case '"': case '#': case '%':
case '&': case '\'': case '(': case ')': case '*':
case '+': case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>':
case '?':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
case '[': case '\\': case ']': case '^': case '_':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z': case '{': case '|': case '}': case '~':
/* These characters are printable ASCII characters. */
p++;
width++;
break;
default:
/* If we have a multibyte sequence, scan it up to its end. */
{
mbstate_t mbstate;
memset (&mbstate, 0, sizeof mbstate);
do
{
wchar_t wc;
size_t bytes;
int w;
bytes = mbrtowc (&wc, p, plimit - p, &mbstate);
if (bytes == (size_t) -1)
/* An invalid multibyte sequence was encountered. */
{
if (flags & MBSW_ACCEPT_INVALID)
break;
else
return -1;
}
if (bytes == (size_t) -2)
/* An incomplete multibyte character at the end. */
{
if (flags & MBSW_ACCEPT_INVALID)
break;
else
return -1;
}
if (bytes == 0)
/* A null wide character was encountered. */
bytes = 1;
w = wcwidth (wc);
if (w >= 0)
/* A printable multibyte character. */
width += w;
else
/* An unprintable multibyte character. */
if (flags & MBSW_ACCEPT_UNPRINTABLE)
width += 1;
else
return -1;
p += bytes;
}
while (! mbsinit (&mbstate));
}
break;
}
return width;
}
#endif
while (p < plimit)
{
unsigned char c = (unsigned char) *p++;
if ((flags & MBSW_ACCEPT_UNPRINTABLE) || ISPRINT (c))
width++;
else
return -1;
}
return width;
}

41
lib/mbswidth.h Normal file
View File

@@ -0,0 +1,41 @@
/* Determine the number of screen columns needed for a string.
Copyright (C) 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
the Free Software Foundation; either version 2, 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, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef PARAMS
# if defined PROTOTYPES || defined __STDC__
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
/* Optional flags to influence mbswidth/mbsnwidth behavior. */
/* If this bit is set, assume invalid characters have width 0.
Otherwise, return -1 upon finding an invalid or incomplete character. */
#define MBSW_ACCEPT_INVALID 1
/* If this bit is set, assume unprintable characters have width 1.
Otherwise, return -1 upon finding a non-printable character. */
#define MBSW_ACCEPT_UNPRINTABLE 2
/* Returns the number of screen columns needed for STRING. */
extern int mbswidth PARAMS ((const char *string, int flags));
/* Returns the number of screen columns needed for the NBYTES bytes
starting at BUF. */
extern int mbsnwidth PARAMS ((const char *buf, size_t nbytes, int flags));

View File

@@ -36,6 +36,13 @@ extern int errno;
# include <unistd.h>
#endif
/* Some systems (MSDOS) don't have SIGCONT.
Using SIGTERM here turns the signal-handling code below
into a no-op on such systems. */
#ifndef SIGCONT
# define SIGCONT SIGTERM
#endif
#include "nanosleep.h"
static int suspended;

View File

@@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988-1994,96,97,98,99 Free Software Foundation, Inc.
Copyright (C) 1988-1994,96,97,98,1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.

25
lib/quote.c Normal file
View File

@@ -0,0 +1,25 @@
/* Written by Paul Eggert <eggert@twinsun.com> */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <quotearg.h>
#include <quote.h>
/* Return an unambiguous printable representated, allocated in slot N,
for NAME, suitable for diagnostics. */
char const *
quote_n (int n, char const *name)
{
return quotearg_n_style (n, locale_quoting_style, name);
}
/* Return an unambiguous printable representation of NAME, suitable
for diagnostics. */
char const *
quote (char const *name)
{
return quote_n (0, name);
}

4
lib/quote.h Normal file
View File

@@ -0,0 +1,4 @@
/* prototypes for quote.c */
char const *quote_n (int n, char const *name);
char const *quote (char const *name);

View File

@@ -33,6 +33,7 @@
#else
# define _(text) text
#endif
#define N_(text) text
#if HAVE_LIMITS_H
# include <limits.h>
@@ -58,23 +59,34 @@
# include <string.h>
#endif
#if HAVE_MBRTOWC && HAVE_WCHAR_H
#if HAVE_WCHAR_H
# include <wchar.h>
# if !HAVE_MBSTATE_T_OBJECT
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
# define mbstate_t int
# endif
#else
# define mbrtowc(pwc, s, n, ps) 1
# define mbsinit(ps) 1
# define mbstate_t int
#endif
#if HAVE_WCTYPE_H
# include <wctype.h>
#if HAVE_MBRTOWC
size_t mbrtowc ();
# ifdef mbstate_t
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
# define mbsinit(ps) 1
# endif
#else
/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the
other macros are defined only for documentation and to satisfy C
syntax. */
# undef MB_CUR_MAX
# define MB_CUR_MAX 1
# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
# define mbsinit(ps) 1
# define iswprint(wc) ISPRINT ((unsigned char) (wc))
#endif
#if !defined iswprint && !HAVE_ISWPRINT
# define iswprint(wc) 1
#ifndef iswprint
# if HAVE_WCTYPE_H
# include <wctype.h>
# endif
# if !defined iswprint && !HAVE_ISWPRINT
# define iswprint(wc) 1
# endif
#endif
#define INT_BITS (sizeof (int) * CHAR_BIT)
@@ -97,8 +109,7 @@ struct quoting_options
/* Quote the characters indicated by this bit vector even if the
quoting style would not normally require them to be quoted. */
int quote_these_too[((UCHAR_MAX + 1) / INT_BITS
+ ((UCHAR_MAX + 1) % INT_BITS != 0))];
int quote_these_too[(UCHAR_MAX / INT_BITS) + 1];
};
/* Names of quoting styles. */
@@ -110,6 +121,7 @@ char const *const quoting_style_args[] =
"c",
"escape",
"locale",
"clocale",
0
};
@@ -121,7 +133,8 @@ enum quoting_style const quoting_style_vals[] =
shell_always_quoting_style,
c_quoting_style,
escape_quoting_style,
locale_quoting_style
locale_quoting_style,
clocale_quoting_style
};
/* The default quoting options. */
@@ -170,6 +183,17 @@ set_char_quoting (struct quoting_options *o, char c, int i)
return r;
}
/* MSGID approximates a quotation mark. Return its translation if it
has one; otherwise, return either it or "\"", depending on S. */
static char const *
gettext_quote (char const *msgid, enum quoting_style s)
{
char const *translation = _(msgid);
if (translation == msgid && s == clocale_quoting_style)
translation = "\"";
return translation;
}
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
argument ARG (of size ARGSIZE), using QUOTING_STYLE and the
non-quoting-style part of O to control quoting.
@@ -194,6 +218,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
char const *quote_string = 0;
size_t quote_string_len = 0;
int backslash_escapes = 0;
int unibyte_locale = MB_CUR_MAX == 1;
#define STORE(c) \
do \
@@ -218,11 +243,31 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
break;
case locale_quoting_style:
for (quote_string = _("`"); *quote_string; quote_string++)
STORE (*quote_string);
backslash_escapes = 1;
quote_string = _("'");
quote_string_len = strlen (quote_string);
case clocale_quoting_style:
{
/* Get translations for open and closing quotation marks.
The message catalog should translate "`" to a left
quotation mark suitable for the locale, and similarly for
"'". If the catalog has no translation,
locale_quoting_style quotes `like this', and
clocale_quoting_style quotes "like this".
For example, an American English Unicode locale should
translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and
should translate "'" to U+201D (RIGHT DOUBLE QUOTATION
MARK). A British English Unicode locale should instead
translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and
U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. */
char const *left = gettext_quote (N_("`"), quoting_style);
char const *right = gettext_quote (N_("'"), quoting_style);
for (quote_string = left; *quote_string; quote_string++)
STORE (*quote_string);
backslash_escapes = 1;
quote_string = right;
quote_string_len = strlen (quote_string);
}
break;
case shell_always_quoting_style:
@@ -359,57 +404,59 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
we can't easily escape single characters within it. */
{
/* Length of multibyte sequence found so far. */
size_t m = 0;
size_t m;
int printable = 1;
mbstate_t mbstate;
memset (&mbstate, 0, sizeof mbstate);
int printable;
if (argsize == (size_t) -1)
argsize = strlen (arg);
do
if (unibyte_locale)
{
wchar_t w;
size_t bytes = mbrtowc (&w, &arg[i + m],
argsize - (i + m), &mbstate);
if (bytes == 0)
break;
else if (bytes == (size_t) -1)
{
printable = 0;
break;
}
else if (bytes == (size_t) -2)
{
printable = 0;
while (i + m < argsize && arg[i + m])
m++;
break;
}
else
{
if (! iswprint (w))
printable = 0;
m += bytes;
}
m = 1;
printable = ISPRINT (c);
}
while (! mbsinit (&mbstate));
if (m <= 1)
else
{
/* Escape a unibyte character like a multibyte
sequence if using backslash escapes, and if the
character is not printable. */
m = backslash_escapes && ! ISPRINT (c);
printable = 0;
mbstate_t mbstate;
memset (&mbstate, 0, sizeof mbstate);
m = 0;
printable = 1;
if (argsize == (size_t) -1)
argsize = strlen (arg);
do
{
wchar_t w;
size_t bytes = mbrtowc (&w, &arg[i + m],
argsize - (i + m), &mbstate);
if (bytes == 0)
break;
else if (bytes == (size_t) -1)
{
printable = 0;
break;
}
else if (bytes == (size_t) -2)
{
printable = 0;
while (i + m < argsize && arg[i + m])
m++;
break;
}
else
{
if (! iswprint (w))
printable = 0;
m += bytes;
}
}
while (! mbsinit (&mbstate));
}
if (m)
if (1 < m || (backslash_escapes && ! printable))
{
/* Output a multibyte sequence, or an escaped
unprintable unibyte character. */
size_t imax = i + m - 1;
size_t ilim = i + m;
for (;;)
{
@@ -420,7 +467,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
STORE ('0' + ((c >> 3) & 7));
c = '0' + (c & 7);
}
if (i == imax)
if (ilim <= i + 1)
break;
STORE (c);
c = arg[++i];
@@ -477,18 +524,23 @@ quotearg_buffer (char *buffer, size_t buffersize,
OPTIONS specifies the quoting options.
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
N must be nonnegative. N is deliberately declared with type `int'
N must be nonnegative. N is deliberately declared with type "int"
to allow for future extensions (using negative values). */
static char *
quotearg_n_options (int n, char const *arg,
struct quoting_options const *options)
{
static unsigned int nslots;
static struct slotvec
/* Preallocate a slot 0 buffer, so that the caller can always quote
one small component of a "memory exhausted" message in slot 0. */
static char slot0[256];
static unsigned int nslots = 1;
struct slotvec
{
size_t size;
char *val;
} *slotvec;
};
static struct slotvec slotvec0 = {sizeof slot0, slot0};
static struct slotvec *slotvec = &slotvec0;
if (nslots <= n)
{
@@ -496,6 +548,11 @@ quotearg_n_options (int n, char const *arg,
size_t s = n1 * sizeof (struct slotvec);
if (! (0 < n1 && n1 == s / sizeof (struct slotvec)))
abort ();
if (slotvec == &slotvec0)
{
slotvec = (struct slotvec *) xmalloc (sizeof (struct slotvec));
*slotvec = slotvec0;
}
slotvec = (struct slotvec *) xrealloc (slotvec, s);
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof (struct slotvec));
nslots = n;
@@ -509,7 +566,7 @@ quotearg_n_options (int n, char const *arg,
if (size <= qsize)
{
slotvec[n].size = size = qsize + 1;
slotvec[n].val = val = xrealloc (val, size);
slotvec[n].val = val = xrealloc (val == slot0 ? 0 : val, size);
quotearg_buffer (val, size, arg, (size_t) -1, options);
}

View File

@@ -1,5 +1,5 @@
/* quotearg.h - quote arguments for output
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 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
@@ -25,7 +25,8 @@ enum quoting_style
shell_always_quoting_style, /* --quoting-style=shell-always */
c_quoting_style, /* --quoting-style=c */
escape_quoting_style, /* --quoting-style=escape */
locale_quoting_style /* --quoting-style=locale */
locale_quoting_style, /* --quoting-style=locale */
clocale_quoting_style /* --quoting-style=clocale */
};
/* For now, --quoting-style=literal is the default, but this may change. */

View File

@@ -31,6 +31,10 @@
# include <sys/types.h>
# ifdef HAVE_UTMPX_H
# ifdef HAVE_UTMP_H
/* HPUX 10.20 needs utmp.h, for the definition of e.g., UTMP_FILE. */
# include <utmp.h>
# endif
# include <utmpx.h>
# define UTMP_STRUCT_NAME utmpx
# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec)

View File

@@ -1747,29 +1747,51 @@ static reg_errcode_t compile_range _RE_ARGS ((unsigned int range_start,
reset the pointers that pointed into the old block to point to the
correct places in the new one. If extending the buffer results in it
being larger than MAX_BUF_SIZE, then flag memory exhausted. */
#if __BOUNDED_POINTERS__
# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
# define MOVE_BUFFER_POINTER(P) \
(__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
else \
{ \
SET_HIGH_BOUND (b); \
SET_HIGH_BOUND (begalt); \
if (fixup_alt_jump) \
SET_HIGH_BOUND (fixup_alt_jump); \
if (laststart) \
SET_HIGH_BOUND (laststart); \
if (pending_exact) \
SET_HIGH_BOUND (pending_exact); \
}
#else
# define MOVE_BUFFER_POINTER(P) (P) += incr
# define ELSE_EXTEND_BUFFER_HIGH_BOUND
#endif
#define EXTEND_BUFFER() \
do { \
do { \
unsigned char *old_buffer = bufp->buffer; \
if (bufp->allocated == MAX_BUF_SIZE) \
if (bufp->allocated == MAX_BUF_SIZE) \
return REG_ESIZE; \
bufp->allocated <<= 1; \
if (bufp->allocated > MAX_BUF_SIZE) \
bufp->allocated = MAX_BUF_SIZE; \
bufp->allocated = MAX_BUF_SIZE; \
bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\
if (bufp->buffer == NULL) \
return REG_ESPACE; \
/* If the buffer moved, move all the pointers into it. */ \
if (old_buffer != bufp->buffer) \
{ \
b = (b - old_buffer) + bufp->buffer; \
begalt = (begalt - old_buffer) + bufp->buffer; \
if (fixup_alt_jump) \
fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
if (laststart) \
laststart = (laststart - old_buffer) + bufp->buffer; \
if (pending_exact) \
pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
int incr = bufp->buffer - old_buffer; \
MOVE_BUFFER_POINTER (b); \
MOVE_BUFFER_POINTER (begalt); \
if (fixup_alt_jump) \
MOVE_BUFFER_POINTER (fixup_alt_jump); \
if (laststart) \
MOVE_BUFFER_POINTER (laststart); \
if (pending_exact) \
MOVE_BUFFER_POINTER (pending_exact); \
} \
ELSE_EXTEND_BUFFER_HIGH_BOUND \
} while (0)

View File

@@ -45,6 +45,7 @@ extern int errno;
#include "same.h"
#include "dirname.h"
#include "error.h"
#include "xalloc.h"
#if ENABLE_NLS
# include <libintl.h>
@@ -81,7 +82,7 @@ same_name (const char *source, const char *dest)
source_dirname = dir_name (source);
dest_dirname = dir_name (dest);
if (source_dirname == NULL || dest_dirname == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
if (stat (source_dirname, &source_dir_stats))
{

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1992, 1995, 2000 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -35,7 +35,7 @@ USA. */
#endif
#ifndef HAVE_GNU_LD
# define __environ environ
# define __environ environ
#endif
int

View File

@@ -98,8 +98,8 @@ extern char *tzname[];
# define L_(Str) L##Str
# define NLW(Sym) _NL_W##Sym
# define MEMCPY(d, s, n) wmemcpy (d, s, n)
# define STRLEN(s) wcslen (s)
# define MEMCPY(d, s, n) __wmemcpy (d, s, n)
# define STRLEN(s) __wcslen (s)
#else
# define CHAR_T char
@@ -752,6 +752,11 @@ my_strftime (s, maxsize, format, tp ut_argument)
case L_('b'):
case L_('h'): /* POSIX.2 extension. */
if (change_case)
{
to_uppcase = 1;
to_lowcase = 0;
}
if (modifier != 0)
goto bad_format;
#if defined _NL_CURRENT || !HAVE_STRFTIME
@@ -848,7 +853,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
if (era)
{
# ifdef COMPILE_WIDE
size_t len = wcslen (era->era_wname);
size_t len = __wcslen (era->era_wname);
cpy (len, era->era_wname);
# else
size_t len = strlen (era->era_name);

View File

@@ -31,6 +31,13 @@
char *malloc ();
#endif
#ifndef HAVE_DECL_STRNLEN
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRNLEN
size_t strnlen ();
#endif
#undef __strndup
#undef strndup

View File

@@ -40,6 +40,14 @@ char *alloca ();
#include <pwd.h>
#include <grp.h>
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#else
@@ -57,6 +65,9 @@ char *alloca ();
# include <unistd.h>
#endif
#include "xalloc.h"
#include "xstrtol.h"
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
@@ -79,6 +90,34 @@ struct group *getgrgid ();
# define endpwent() ((void) 0)
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
It is necessary at least when t == time_t. */
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
#ifndef UID_T_MAX
# define UID_T_MAX TYPE_MAXIMUM (uid_t)
#endif
#ifndef GID_T_MAX
# define GID_T_MAX TYPE_MAXIMUM (gid_t)
#endif
/* MAXUID may come from limits.h or sys/params.h. */
#ifndef MAXUID
# define MAXUID UID_T_MAX
#endif
#ifndef MAXGID
# define MAXGID GID_T_MAX
#endif
/* Perform the equivalent of the statement `dest = strdup (src);',
but obtaining storage via alloca instead of from the heap. */
@@ -137,7 +176,6 @@ const char *
parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
char **username_arg, char **groupname_arg)
{
static const char *E_no_memory = N_("virtual memory exhausted");
static const char *E_invalid_user = N_("invalid user");
static const char *E_invalid_group = N_("invalid group");
static const char *E_bad_spec =
@@ -210,17 +248,21 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
{
if (!is_number (u))
error_msg = _(E_invalid_user);
error_msg = E_invalid_user;
else
{
int use_login_group;
use_login_group = (separator != NULL && g == NULL);
if (use_login_group)
error_msg = _(E_bad_spec);
error_msg = E_bad_spec;
else
{
/* FIXME: don't use atoi! */
*uid = atoi (u);
unsigned long int tmp_long;
if (xstrtoul (u, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long > MAXUID)
return _(E_invalid_user);
printf ("MAXUID: %u\n", (uid_t) MAXUID);
*uid = tmp_long;
}
}
}
@@ -259,11 +301,14 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
if (grp == NULL)
{
if (!is_number (g))
error_msg = _(E_invalid_group);
error_msg = E_invalid_group;
else
{
/* FIXME: don't use atoi! */
*gid = atoi (g);
unsigned long int tmp_long;
if (xstrtoul (u, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long > MAXGID)
return _(E_invalid_group);
*gid = tmp_long;
}
}
else
@@ -280,7 +325,7 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
{
*username_arg = strdup (u);
if (*username_arg == NULL)
error_msg = _(E_no_memory);
error_msg = xalloc_msg_memory_exhausted;
}
if (groupname != NULL && error_msg == NULL)
@@ -293,7 +338,7 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
free (*username_arg);
*username_arg = NULL;
}
error_msg = _(E_no_memory);
error_msg = xalloc_msg_memory_exhausted;
}
}
}
@@ -306,7 +351,7 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
goto retry;
}
return error_msg;
return _(error_msg);
}
#ifdef TEST

View File

@@ -46,9 +46,9 @@ extern int xalloc_exit_failure;
extern void (*xalloc_fail_func) PARAMS ((void));
/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this
message must be non-NULL. It is translated via gettext.
The default value is "Memory exhausted". */
extern char *const xalloc_msg_memory_exhausted;
message is output. It is translated via gettext.
Its value is "memory exhausted". */
extern char const xalloc_msg_memory_exhausted[];
/* This function is always triggered when memory is exhausted. It is
in charge of honoring the three previous items. This is the

View File

@@ -1,5 +1,5 @@
/* xgethostname.c -- return current hostname with unlimited length
Copyright (C) 1992, 1996 Free Software Foundation, Inc.
Copyright (C) 1992, 1996, 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
@@ -30,6 +30,10 @@ extern int errno;
#include "error.h"
#ifndef ENAMETOOLONG
# define ENAMETOOLONG 9999
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
@@ -47,28 +51,26 @@ xgethostname ()
{
char *hostname;
size_t size;
int err;
size = INITIAL_HOSTNAME_LENGTH;
hostname = xmalloc (size);
/* Use size + 1 here rather than size to work around the bug
in SunOS5.5's gethostname whereby it NUL-terminates HOSTNAME
even when the name is longer than the supplied buffer. */
hostname = xmalloc (size + 1);
while (1)
{
/* Use size - 2 here rather than size - 1 to work around the bug
in SunOS5.5's gethostname whereby it NUL-terminates HOSTNAME
even when the name is longer than the supplied buffer. */
int k = size - 2;
int k = size - 1;
int err;
errno = 0;
hostname[k] = '\0';
err = gethostname (hostname, size);
if (err == 0 && hostname[k] == '\0')
if (err >= 0 && hostname[k] == '\0')
break;
#ifdef ENAMETOOLONG
else if (err != 0 && errno != ENAMETOOLONG && errno != 0)
else if (err < 0 && errno != ENAMETOOLONG && errno != 0)
error (EXIT_FAILURE, errno, "gethostname");
#endif
size *= 2;
hostname = xrealloc (hostname, size);
hostname = xrealloc (hostname, size + 1);
}
return hostname;

View File

@@ -1,5 +1,5 @@
/* xmalloc.c -- malloc with out of memory checking
Copyright (C) 1990-1997, 98, 99 Free Software Foundation, Inc.
Copyright (C) 1990-1999, 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
@@ -63,7 +63,7 @@ void (*xalloc_fail_func) PARAMS ((void)) = 0;
/* If XALLOC_FAIL_FUNC is NULL, or does return, display this message
before exiting when memory is exhausted. Goes through gettext. */
char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
char const xalloc_msg_memory_exhausted[] = N_("memory exhausted");
void
xalloc_die (void)
@@ -91,8 +91,7 @@ xmalloc (size_t n)
}
/* Change the size of an allocated block of memory P to N bytes,
with error checking.
If P is NULL, run xmalloc. */
with error checking. */
void *
xrealloc (void *p, size_t n)

View File

@@ -1,3 +1,120 @@
2000-08-26 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: Use jm_FUNC_FPENDING.
* fpending.m4: New file.
2000-08-20 Jim Meyering <meyering@lucent.com>
* check-decl.m4: Include utmp.h `#if HAVE_UTMP_H', rather than
`#if !HAVE_UTMPX_H'. The latter would lose on systems with neither
utmp.h nor utmpx.h. Reported by Eli Zaretskii.
2000-08-11 J. David Anglin <dave@hiauly1.hia.nrc.ca>
Improve fileutils installation on systems where running
programs (like install) can't be unlinked.
* unlink-busy.m4 (jm_FUNC_UNLINK_BUSY_TEXT): New file/macro.
* jm-macros.m4: Use jm_FUNC_UNLINK_BUSY_TEXT.
2000-08-06 Paul Eggert <eggert@twinsun.com>
* m4/mbstate_t.m4 (AC_MBSTATE_T): Define mbstate_t to be int,
not char, for compatibility with glibc 2.1.3 strftime.c.
2000-07-23 Paul Eggert <eggert@twinsun.com>
* mbswidth.m4 (jm_PREREQ_MBSWIDTH): Check for wcwidth declaration.
2000-07-23 Jim Meyering <meyering@lucent.com>
* check-decl.m4 (jm_CHECK_DECLS): Check for declarations of these, too:
getgrgid, getpwuid, getuid.
2000-07-16 Bruno Haible <haible@clisp.cons.org>
* mbswidth.m4: New file.
* prereq.m4 (jm_PREREQ): Call jm_PREREQ_MBSWIDTH.
2000-07-14 Jim Meyering <meyering@lucent.com>
* xstrtoumax.m4 (jm_AC_PREREQ_XSTRTOUMAX): Require jm_AC_TYPE_UINTMAX_T.
2000-07-10 Paul Eggert <eggert@twinsun.com>
From a suggestion by Bruno Haible.
* mbstate_t.m4 (AC_MBSTATE_T):
Renamed from AC_MBSTATE_T_OBJECT. All uses changed.
Change from a two-part test, which defines both HAVE_MBSTATE_T_OBJECT
and mbstate_t, to a single-part test that simply defines mbstate_t.
* prereq.m4 (jm_PREREQ_QUOTEARG): s/AC_MBSTATE_T_OBJECT/AC_MBSTATE_T/.
2000-07-10 Jim Meyering <meyering@lucent.com>
* strerror_r.m4: Mirror the correction made in autoconf.
* gnu-source.m4: Output to confdefs.h directly.
Suggestion from Akim Demaille.
2000-07-09 Jim Meyering <meyering@lucent.com>
* jm-macros.m4 (jm_MACROS): Add a test to see if -lm is required
to link seq. If so, set SEQ_LIBM to -lm. From Bruno Haible.
* gnu-source.m4 (AC__GNU_SOURCE): New file/macro.
* jm-macros.m4 (jm_CHECK_ALL_TYPES): Require it.
2000-07-05 Bruno Haible <haible@clisp.cons.org>
* strerror_r.m4 (AC_FUNC_STRERROR_R): Pass a reasonably large buffer
to strerror_r.
Include <ctype.h> for use of isalpha.
2000-07-05 Paul Eggert <eggert@twinsun.com>
and Bruno Haible <haible@clisp.cons.org>
* mbstate_t.m4 (AC_MBSTATE_T_OBJECT): Test for mbstate_t
only if the test for an object-type mbstate_t fails. This
prevents us from mistakenly reporting that mbstate_t is a
system object type after we "#define mbstate_t int" to work
around its lack.
2000-07-04 Jim Meyering <meyering@lucent.com>
* fsusage.m4 (jm_FILE_SYSTEM_USAGE): Use plain old `echo' instead
of the deprecated AC_CHECKING.
2000-07-03 Jim Meyering <meyering@lucent.com>
* check-decl.m4 (AC_CHECK_DECLS): Add strnlen.
2000-07-03 Paul Eggert <eggert@twinsun.com>
* mbstate_t.m4 (AC_MBSTATE_T_OBJECT): Port to autoconf 2.13.
Add AC_CHECK_HEADERS(stdlib.h), since we use HAVE_STDLIB_H.
2000-07-02 Jim Meyering <meyering@lucent.com>
* mbstate_t.m4: Also define mbstate_t, if necessary.
* chown.m4: Replace each use of AC_SUBST(LIBOBJS)/LIBOBJS=... with
AC_LIBOBJ(function_name).
* chown.m4: Likewise.
* fnmatch.m4: Likewise.
* ftruncate.m4: Likewise.
* getgroups.m4: Likewise.
* getline.m4: Likewise.
* group-member.m4: Likewise.
* jm-macros.m4: Likewise.
* lstat.m4: Likewise.
* malloc.m4: Likewise.
* memcmp.m4: Likewise.
* nanosleep.m4: Likewise.
* putenv.m4: Likewise.
* realloc.m4: Likewise.
* regex.m4: Likewise.
* stat.m4: Likewise.
* strftime.m4: Likewise.
2000-07-01 Jim Meyering <meyering@lucent.com>
* ls-mntd-fs.m4: Remove a `FIXME' comment and fix the associated

View File

@@ -13,6 +13,7 @@ d-ino.m4 \
d-type.m4 \
error.m4 \
fnmatch.m4 \
fpending.m4 \
fstypename.m4 \
fsusage.m4 \
ftruncate.m4 \
@@ -21,6 +22,7 @@ getline.m4 \
getloadavg.m4 \
glibc.m4 \
glibc21.m4 \
gnu-source.m4 \
group-member.m4 \
iconv.m4 \
inttypes_h.m4 \
@@ -39,6 +41,7 @@ ls-mntd-fs.m4 \
lstat.m4 \
malloc.m4 \
mbstate_t.m4 \
mbswidth.m4 \
memcmp.m4 \
nanosleep.m4 \
perl.m4 \
@@ -58,6 +61,7 @@ strftime.m4 \
timespec.m4 \
uintmax_t.m4 \
ulonglong.m4 \
unlink-busy.m4 \
uptime.m4 \
utimbuf.m4 \
utime.m4 \

View File

@@ -104,6 +104,7 @@ POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
SEQ_LIBM = @SEQ_LIBM@
SQRT_LIBM = @SQRT_LIBM@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -126,6 +127,7 @@ d-ino.m4 \
d-type.m4 \
error.m4 \
fnmatch.m4 \
fpending.m4 \
fstypename.m4 \
fsusage.m4 \
ftruncate.m4 \
@@ -134,6 +136,7 @@ getline.m4 \
getloadavg.m4 \
glibc.m4 \
glibc21.m4 \
gnu-source.m4 \
group-member.m4 \
iconv.m4 \
inttypes_h.m4 \
@@ -152,6 +155,7 @@ ls-mntd-fs.m4 \
lstat.m4 \
malloc.m4 \
mbstate_t.m4 \
mbswidth.m4 \
memcmp.m4 \
nanosleep.m4 \
perl.m4 \
@@ -171,6 +175,7 @@ strftime.m4 \
timespec.m4 \
uintmax_t.m4 \
ulonglong.m4 \
unlink-busy.m4 \
uptime.m4 \
utimbuf.m4 \
utime.m4 \

View File

@@ -1,4 +1,4 @@
#serial 13
#serial 15
dnl This is just a wrapper function to encapsulate this kludge.
dnl Putting it in a separate file like this helps share it between
@@ -38,7 +38,7 @@ AC_DEFUN(jm_CHECK_DECLS,
# endif
#endif
#if !HAVE_UTMPX_H
#if HAVE_UTMP_H
# include <utmp.h>
#endif
'
@@ -47,7 +47,10 @@ AC_DEFUN(jm_CHECK_DECLS,
free,
getenv,
geteuid,
getgrgid,
getlogin,
getpwuid,
getuid,
getutent,
lseek,
malloc,
@@ -56,6 +59,7 @@ AC_DEFUN(jm_CHECK_DECLS,
realloc,
stpcpy,
strndup,
strnlen,
strstr,
strtoul,
strtoull,

View File

@@ -1,4 +1,4 @@
#serial 4
#serial 5
dnl From Jim Meyering.
dnl Determine whether chown accepts arguments of -1 for uid and gid.
@@ -42,8 +42,7 @@ AC_DEFUN(jm_FUNC_CHOWN,
jm_cv_func_working_chown=no)
])
if test $jm_cv_func_working_chown = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS chown.$ac_objext"
AC_LIBOBJ(chown)
AC_DEFINE_UNQUOTED(chown, rpl_chown,
[Define to rpl_chown if the replacement function should be used.])
fi

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
dnl Determine whether to add fnmatch.o to LIBOBJS and to
dnl define fnmatch to rpl_fnmatch.
@@ -10,8 +10,7 @@ AC_DEFUN(jm_FUNC_FNMATCH,
AC_FUNC_FNMATCH
if test $ac_cv_func_fnmatch_works = no \
&& test $ac_cv_gnu_library = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS fnmatch.$ac_objext"
AC_LIBOBJ(fnmatch)
AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch,
[Define to rpl_fnmatch if the replacement function should be used.])
fi

75
m4/fpending.m4 Normal file
View File

@@ -0,0 +1,75 @@
#serial 1
dnl From Jim Meyering
dnl Using code from emacs, based on suggestions from Paul Eggert
dnl and Ulrich Drepper.
dnl Find out how to determine the number of pending output bytes on a stream.
dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems,
dnl we have to grub around in the FILE struct.
AC_DEFUN(jm_FUNC_FPENDING,
[
AC_CHECK_HEADERS(stdio_ext.h)
AC_REPLACE_FUNCS([__fpending])
fp_headers='
# if HAVE_STDIO_EXT_H
# include <stdio_ext.h>
# endif
'
AC_CHECK_DECLS([__fpending], , , $fp_headers)
if test $ac_cv_func___fpending = no; then
AC_CACHE_CHECK(
[how to determine the number of pending output bytes on a stream],
ac_cv_sys_pending_output_n_bytes,
[
fp_save_DEFS=$DEFS
for ac_expr in \
\
'# glibc2' \
'fp->_IO_write_ptr - fp->_IO_write_base' \
\
'# traditional Unix' \
'fp->_ptr - fp->_base' \
\
'# BSD' \
'fp->_p - fp->_bf._base' \
\
'# SCO, Unixware' \
'fp->__ptr - fp->__base' \
\
'# old glibc?' \
'fp->__bufp - fp->__buffer' \
\
'# old glibc iostream?' \
'fp->_pptr - fp->_pbase' \
\
'# VMS' \
'(*fp)->_ptr - (*fp)->_base' \
\
'# e.g., DGUX R4.11; the info is not available' \
1 \
; do
# Skip each embedded comment.
case "$ac_expr" in '#'*) continue;; esac
DEFS="$DEFS -DPENDING_OUTPUT_N_BYTES=$ac_expr"
AC_TRY_COMPILE(
[#include <stdio.h>
],
[FILE *fp = stdin; (void) ($ac_expr);],
fp_done=yes
)
DEFS=$fp_save_DEFS
test "$fp_done" = yes && break
done
ac_cv_sys_pending_output_n_bytes=$ac_expr
]
)
AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES,
$ac_cv_sys_pending_output_n_bytes,
[the number of pending output bytes on stream `fp'])
fi
])

View File

@@ -11,7 +11,7 @@
AC_DEFUN(jm_FILE_SYSTEM_USAGE,
[
AC_CHECKING(how to get filesystem space usage)
echo "checking how to get filesystem space usage..."
ac_fsusage_space=no
# Perform only the link test since it seems there are no variants of the

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
# See if we need to emulate a missing ftruncate function using fcntl.
@@ -21,7 +21,7 @@ AC_DEFUN(jm_FUNC_FTRUNCATE,
fu_cv_sys_ftruncate_emulation=no)])
AC_MSG_RESULT($fu_cv_sys_ftruncate_emulation)
if test $fu_cv_sys_ftruncate_emulation = yes; then
LIBOBJS="$LIBOBJS ftruncate.$ac_objext"
AC_LIBOBJ(ftruncate)
fi
fi
])

View File

@@ -1,4 +1,4 @@
#serial 3
#serial 4
dnl From Jim Meyering.
dnl
@@ -38,8 +38,7 @@ AC_DEFUN(jm_FUNC_GETGROUPS,
jm_cv_func_working_getgroups=no)
])
if test $jm_cv_func_working_getgroups = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS getgroups.$ac_objext"
AC_LIBOBJ(getgroups)
AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups,
[Define as rpl_getgroups if getgroups doesn't work right.])
fi

View File

@@ -1,4 +1,4 @@
#serial 3
#serial 4
dnl See if there's a working, system-supplied version of the getline function.
dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
@@ -39,7 +39,6 @@ AC_DEFUN(AM_FUNC_GETLINE,
fi
if test $am_cv_func_working_getline = no; then
LIBOBJS="$LIBOBJS getline.$ac_objext"
AC_SUBST(LIBOBJS)dnl
AC_LIBOBJ(getline)
fi
])

25
m4/gnu-source.m4 Normal file
View File

@@ -0,0 +1,25 @@
#serial 2
# Make sure _GNU_SOURCE is defined where necessary: as early as possible
# for configure-time tests, as well as for every source file that includes
# config.h.
# From Jim Meyering.
AC_DEFUN(AC__GNU_SOURCE,
[
# Make sure that _GNU_SOURCE is defined for all subsequent
# configure-time compile tests.
# This definition must be emitted (into confdefs.h) before any
# test that involves compilation.
cat >>confdefs.h <<\EOF
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
EOF
# Emit this code into config.h.in.
# The ifndef is to avoid redefinition warnings.
AH_VERBATIM([_GNU_SOURCE], [#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif])
])

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
dnl Written by Jim Meyering
@@ -6,7 +6,6 @@ AC_DEFUN(jm_FUNC_GROUP_MEMBER,
[
dnl Do this replacement check manually because I want the hyphen
dnl (not the underscore) in the filename.
AC_CHECK_FUNC(group_member, , [LIBOBJS="$LIBOBJS group-member.$ac_objext"])
AC_SUBST(LIBOBJS)
AC_CHECK_FUNC(group_member, , [AC_LIBOBJ(group-member)])
]
)

View File

@@ -1,4 +1,4 @@
#serial 22
#serial 25
dnl Misc type-related macros for fileutils, sh-utils, textutils.
@@ -92,6 +92,7 @@ AC_DEFUN(jm_MACROS,
AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
AC_REQUIRE([jm_FUNC_MKTIME])
AC_REQUIRE([jm_FUNC_FPENDING])
AC_REQUIRE([jm_FUNC_GETGROUPS])
test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
@@ -188,9 +189,28 @@ AC_DEFUN(jm_MACROS,
AC_SUBST(POW_LIBM)
test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm
# See if linking `seq' requires -lm.
# It does on nearly every system. The single exception (so far) is
# BeOS which has all the math functions in the normal runtime library
# and doesn't have a separate math library.
AC_SUBST(SEQ_LIBM)
ac_seq_body='
static double x, y;
x = floor (x);
x = rint (x);
x = modf (x, &y);'
AC_TRY_LINK([#include <math.h>], $ac_seq_body, ,
[ac_seq_save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([#include <math.h>], $ac_seq_body, SEQ_LIBM=-lm)
LIBS="$ac_seq_save_LIBS"
])
jm_LANGINFO_CODESET
jm_GLIBC21
jm_ICONV
jm_FUNC_UNLINK_BUSY_TEXT
# These tests are for df.
jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
@@ -198,8 +218,8 @@ AC_DEFUN(jm_MACROS,
jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
if test $list_mounted_fs = yes && test $space = yes; then
DF_PROG="df"
LIBOBJS="$LIBOBJS fsusage.$ac_objext"
LIBOBJS="$LIBOBJS mountlist.$ac_objext"
AC_LIBOBJ(fsusage)
AC_LIBOBJ(mountlist)
fi
])
@@ -207,11 +227,10 @@ AC_DEFUN(jm_MACROS,
# This macro must be invoked before any tests that run the compiler.
AC_DEFUN(jm_CHECK_ALL_TYPES,
[
# Emit this code into config.h.in.
# The ifndef is to avoid redefinition warnings.
AH_VERBATIM([_GNU_SOURCE], [#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif])
# FIXME: I shouldn't have to require this macro here. Rather, it should
# be required by any autoconf macro that performs a compile-time test or
# otherwise uses confdefs.h.
AC_REQUIRE([AC__GNU_SOURCE])
dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect

View File

@@ -1,4 +1,4 @@
#serial 5
#serial 6
dnl From Jim Meyering.
dnl Determine whether lstat has the bug that it succeeds when given the
@@ -31,8 +31,7 @@ AC_DEFUN(jm_FUNC_LSTAT,
jm_cv_func_lstat_empty_string_bug=yes)
])
if test $jm_cv_func_lstat_empty_string_bug = yes; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS lstat.$ac_objext"
AC_LIBOBJ(lstat)
AC_DEFINE_UNQUOTED(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
[Define if lstat has the bug that it succeeds when given the zero-length
file name argument. The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)

View File

@@ -1,4 +1,4 @@
#serial 3
#serial 4
dnl From Jim Meyering.
dnl Determine whether malloc accepts 0 as its argument.
@@ -27,8 +27,7 @@ AC_DEFUN(jm_FUNC_MALLOC,
jm_cv_func_working_malloc=no)
])
if test $jm_cv_func_working_malloc = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS malloc.$ac_objext"
AC_LIBOBJ(malloc)
AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
[Define to rpl_malloc if the replacement function should be used.])
fi

View File

@@ -1,26 +1,29 @@
# serial 3
# serial 8
# From Paul Eggert.
# Some versions of BeOS define mbstate_t to be an incomplete type,
# BeOS 5 has <wchar.h> but does not define mbstate_t,
# so you can't declare an object of that type.
# Check for this incompatibility with Standard C.
# Include stdlib.h first, because otherwise this test would fail on Linux
# (at least glibc-2.1.3) because the `_XOPEN_SOURCE 500' definition elicits
# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits
# a syntax error in wchar.h due to the use of undefined __int32_t.
AC_DEFUN(AC_MBSTATE_T_OBJECT,
[AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
AC_DEFUN(AC_MBSTATE_T,
[
AC_CHECK_HEADERS(stdlib.h)
AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
[AC_TRY_COMPILE([
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <wchar.h>],
[mbstate_t x; return sizeof x;],
ac_cv_type_mbstate_t_object=yes,
ac_cv_type_mbstate_t_object=no)])
if test $ac_cv_type_mbstate_t_object = yes; then
AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
[Define if mbstate_t is an object type.])
ac_cv_type_mbstate_t=yes,
ac_cv_type_mbstate_t=no)])
if test $ac_cv_type_mbstate_t = no; then
AC_DEFINE(mbstate_t, int,
[Define to a type if <wchar.h> does not define.])
fi])

19
m4/mbswidth.m4 Normal file
View File

@@ -0,0 +1,19 @@
#serial 2
dnl autoconf tests required for use of mbswidth.c
dnl From Bruno Haible.
AC_DEFUN(jm_PREREQ_MBSWIDTH,
[
AC_REQUIRE([AC_HEADER_STDC])
AC_REQUIRE([AM_C_PROTOTYPES])
AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
AC_CHECK_FUNCS(isascii iswprint mbrtowc wcwidth)
headers='
# if HAVE_WCHAR_H
# include <wchar.h>
# endif
'
AC_CHECK_DECLS([wcwidth], , , $headers)
AC_MBSTATE_T
])

View File

@@ -1,4 +1,4 @@
#serial 4
#serial 5
dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
dnl the losing memcmp on some x86 Next systems.
@@ -36,8 +36,7 @@ main ()
jm_cv_func_memcmp_working=no,
jm_cv_func_memcmp_working=no)])
test $jm_cv_func_memcmp_working = no \
&& LIBOBJS="$LIBOBJS memcmp.$ac_objext"
AC_SUBST(LIBOBJS)dnl
&& AC_LIBOBJ(memcmp)
])
AC_DEFUN(jm_FUNC_MEMCMP,

View File

@@ -1,4 +1,4 @@
#serial 6
#serial 7
dnl From Jim Meyering.
dnl Check for the nanosleep function.
@@ -45,8 +45,7 @@ AC_DEFUN(jm_FUNC_NANOSLEEP,
jm_cv_func_nanosleep_works=no)
])
if test $jm_cv_func_nanosleep_works = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS nanosleep.$ac_objext"
AC_LIBOBJ(nanosleep)
AC_DEFINE_UNQUOTED(nanosleep, rpl_nanosleep,
[Define to rpl_nanosleep if the replacement function should be used.])
fi

View File

@@ -1,4 +1,4 @@
#serial 10
#serial 11
dnl These are the prerequisite macros for files in the lib/
dnl directories of the fileutils, sh-utils, and textutils packages.
@@ -10,6 +10,7 @@ AC_DEFUN(jm_PREREQ,
jm_PREREQ_ERROR
jm_PREREQ_GETPAGESIZE
jm_PREREQ_HUMAN
jm_PREREQ_MBSWIDTH
jm_PREREQ_QUOTEARG
jm_PREREQ_READUTMP
jm_PREREQ_REGEX
@@ -60,7 +61,7 @@ AC_DEFUN(jm_PREREQ_QUOTEARG,
AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
AC_HEADER_STDC
AC_C_BACKSLASH_A
AC_MBSTATE_T_OBJECT
AC_MBSTATE_T
AM_C_PROTOTYPES
])

View File

@@ -1,4 +1,4 @@
#serial 3
#serial 4
dnl From Jim Meyering.
dnl
@@ -33,8 +33,7 @@ AC_DEFUN(jm_FUNC_PUTENV,
jm_cv_func_svid_putenv=no)
])
if test $jm_cv_func_svid_putenv = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS putenv.$ac_objext"
AC_LIBOBJ(putenv)
AC_DEFINE_UNQUOTED(putenv, rpl_putenv,
[Define to rpl_putenv if the replacement function should be used.])
fi

View File

@@ -1,4 +1,4 @@
#serial 3
#serial 4
dnl From Jim Meyering.
dnl Determine whether realloc works when both arguments are 0.
@@ -27,8 +27,7 @@ AC_DEFUN(jm_FUNC_REALLOC,
jm_cv_func_working_realloc=no)
])
if test $jm_cv_func_working_realloc = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS realloc.$ac_objext"
AC_LIBOBJ(realloc)
AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
[Define to rpl_realloc if the replacement function should be used.])
fi

View File

@@ -1,4 +1,4 @@
#serial 7
#serial 8
dnl Initially derived from code in GNU grep.
dnl Mostly written by Jim Meyering.
@@ -62,8 +62,7 @@ AC_DEFUN(jm_INCLUDED_REGEX,
jm_with_regex=$withval,
jm_with_regex=$ac_use_included_regex)
if test "$jm_with_regex" = yes; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS regex.$ac_objext"
AC_LIBOBJ(regex)
fi
],
)

View File

@@ -1,4 +1,4 @@
#serial 5
#serial 6
dnl From Jim Meyering.
dnl Determine whether stat has the bug that it succeeds when given the
@@ -31,8 +31,7 @@ AC_DEFUN(jm_FUNC_STAT,
jm_cv_func_stat_empty_string_bug=yes)
])
if test $jm_cv_func_stat_empty_string_bug = yes; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS stat.$ac_objext"
AC_LIBOBJ(stat)
AC_DEFINE_UNQUOTED(HAVE_STAT_EMPTY_STRING_BUG, 1,
[Define if stat has the bug that it succeeds when given the zero-length
file name argument. The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)

View File

@@ -1,4 +1,4 @@
#serial 1000
#serial 1002
# Experimental replacement for the function in the latest CVS autoconf.
# If the compile-test says strerror_r doesn't work, then resort to a
# `run'-test that works on BeOS and segfaults on DEC Unix.
@@ -9,8 +9,7 @@ undefine([AC_FUNC_STRERROR_R])
# AC_FUNC_STRERROR_R
# ------------------
AC_DEFUN([AC_FUNC_STRERROR_R],
[# Check strerror_r
AC_CHECK_DECLS([strerror_r])
[AC_CHECK_DECLS([strerror_r])
AC_CHECK_FUNCS([strerror_r])
if test $ac_cv_func_strerror_r = yes; then
AC_CHECK_HEADERS(string.h)
@@ -25,8 +24,8 @@ if test $ac_cv_func_strerror_r = yes; then
# endif
],
[
char buf;
char x = *strerror_r (0, &buf, sizeof buf);
char buf[100];
char x = *strerror_r (0, buf, sizeof buf);
],
ac_cv_func_strerror_r_works=yes,
ac_cv_func_strerror_r_works=no
@@ -42,26 +41,26 @@ if test $ac_cv_func_strerror_r = yes; then
[
# include <stdio.h>
# include <string.h>
# include <ctype.h>
extern char *strerror_r ();
int
main ()
{
char buf[2];
char buf[100];
char x = *strerror_r (0, buf, sizeof buf);
exit (x && !isalpha (x));
exit (!isalpha (x));
}
],
ac_cv_func_strerror_r_works=yes,
ac_cv_func_strerror_r_works=no,
ac_cv_func_strerror_r_works=no)
fi
if test $ac_cv_func_strerror_r_works = yes; then
AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
[Define to 1 if `strerror_r' returns a string.])
fi
])
if test $ac_cv_func_strerror_r_works = yes; then
AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
[Define to 1 if `strerror_r' returns a string.])
fi
fi
])# AC_FUNC_STRERROR_R

View File

@@ -1,4 +1,4 @@
#serial 14
#serial 15
dnl This macro is intended to be used solely in this file.
dnl These are the prerequisite macros for GNU's strftime.c replacement.
@@ -146,8 +146,7 @@ main ()
jm_cv_func_working_gnu_strftime=no)
])
if test $jm_cv_func_working_gnu_strftime = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS strftime.$ac_objext"
AC_LIBOBJ(strftime)
AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
[Define to gnu_strftime if the replacement function should be used.])
fi

32
m4/unlink-busy.m4 Normal file
View File

@@ -0,0 +1,32 @@
#serial 5
dnl From J. David Anglin.
dnl HPUX and other systems can't unlink shared text that is being executed.
AC_DEFUN(jm_FUNC_UNLINK_BUSY_TEXT,
[dnl
AC_CACHE_CHECK([whether a running program can be unlinked],
jm_cv_func_unlink_busy_text,
[
AC_TRY_RUN([
main (argc, argv)
int argc;
char **argv;
{
if (!argc)
exit (-1);
exit (unlink (argv[0]));
}
],
jm_cv_func_unlink_busy_text=yes,
jm_cv_func_unlink_busy_text=no,
jm_cv_func_unlink_busy_text=no
)
]
)
if test $jm_cv_func_unlink_busy_text = no; then
INSTALL=$ac_install_sh
fi
])

View File

@@ -4,6 +4,7 @@
AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX,
[
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
AC_CHECK_HEADERS(stdlib.h)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# Generate a short man page from --help and --version output.
# Copyright © 1997, 98, 99 Free Software Foundation, Inc.
# Copyright © 1997, 1998, 1999, 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
@@ -27,11 +27,11 @@ use Text::Tabs qw(expand);
use POSIX qw(strftime setlocale LC_TIME);
my $this_program = 'help2man';
my $this_version = '1.020';
my $this_version = '1.022';
my $version_info = <<EOT;
$this_program $this_version
GNU $this_program $this_version
Copyright (C) 1997, 98, 99 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -53,6 +53,8 @@ Usage: $this_program [OPTION]... EXECUTABLE
--version print version number, then exit
EXECUTABLE should accept `--help' and `--version' options.
Report bugs to <bug-help2man\@gnu.org>.
EOT
my $section = 1;
@@ -480,7 +482,7 @@ for (@pre, (grep ! /^($filter)$/o, @include), @post)
{
my $quote = /\W/ ? '"' : '';
print ".SH $quote$_$quote\n";
for ($include{$_})
{
# Replace leading dot an backslash tokens.

View File

@@ -1,3 +1,478 @@
2000-09-09 Jim Meyering <meyering@lucent.com>
* Version 4.0z.
* tests/cp/special-bits: New file.
* tests/cp/Makefile.am (TESTS): Add special-bits.
(TESTS_ENVIRONMENT): Propagate $MAKE into environment, for special-bits.
* src/copy.c (SAME_OWNER, SAME_GROUP, SAME_OWNER_AND_GROUP): Define.
(copy_internal): Avoid calling chown if we know it's not necessary.
* src/copy.c (copy_internal): Call chmod also if we've made the
preceding chown call and we're supposed to preserve some special
permission bit(s) that would have been reset by chown.
Reported by Greg Louis.
2000-09-08 Jim Meyering <meyering@lucent.com>
* src/mkdir.c (S_IRWXUGO): Remove definition.
* src/sys2.h (S_IRWXUGO): Define here, instead.
2000-09-07 Jim Meyering <meyering@lucent.com>
* doc/texinfo.tex: Update from master repository.
* config.sub: Likewise.
* config.guess: Likewise.
2000-09-05 Jim Meyering <meyering@lucent.com>
* tests/mv/part-symlink: Redirect stdout to stderr before trying to
remove the temp directory. Otherwise, the `rm -rf' would get an
error because the output file wouldn't be closed and the directory
wouldn't be `empty'.
* tests/cp/same-file: Likewise.
* tests/cp/same-file: Remove the `cp -dl sl1 sl2' case,
since it's no longer portable (hard link to a symlink).
Likewise for the `cp -bdl symlink foo' case.
* config.guess: Update from master repository.
2000-09-04 Jim Meyering <meyering@lucent.com>
* src/cp.c: Move declaractions of lstat, stat, and rpl_lstat
as well as the definition of lstat from here...
* src/copy.h: ...to here.
* src/copy.c: Remove declaration of lstat, now that it's in copy.h.
* tests/mv/force: mv's --force (-f) option is no longer needed for
this test, now that all it does is cancel --interactive (-i).
* tests/cp/same-file: Add new tests using cp's --rem option.
Reflect the fact that cp's -f option no longer causes cp to remove the
destination file before trying to open it.
Reflect the fact that `cp -bdl' now makes a backup when copying a
symlink onto the file it points to (FIXME: look into this, and why
cp -bl does *not* do so).
* src/ln.c (do_link): Tweak diagnostics.
2000-09-03 Jim Meyering <meyering@lucent.com>
* src/install.c (cp_option_init): Initialize new members.
* src/cp.c (enum): Add UNLINK_DEST_BEFORE_OPENING.
[long_options]: Add an entry for --remove-destination.
(usage): Describe --remove-destination.
(do_copy): Use unlink_dest_after_failed_open member, not `force.'
(cp_option_init): Initialize new members.
(main): Handle UNLINK_DEST_BEFORE_OPENING (aka --remove-destination).
* src/mv.c: Remove obsolete comment block.
(cp_option_init): Initialize new members.
(usage): Reflect the fact that --force (-f) relates only to whether
mv prompts.
(main): Remove uses of old `force' option member.
* src/install.c (cp_option_init): Reflect
`force' no longer means unlink-dest-before-opening
* src/copy.h (struct cp_options) [force]: Remove member.
[unlink_dest_before_opening]: Add member. `cp -f' and `mv -f' used to
do this. Now, you must use `cp --remove-destination' to get this
behavior. Now, `cp -f' and `mv -f' work as required by POSIX.
[unlink_dest_after_failed_open]: Add member.
* src/copy.c (same_file_ok): New function, extracted from copy_internal,
and rewritten.
(copy_internal): Unlink destination file when unlink_dest_before_opening
option is set, and when the source is neither a regular file nor a
directory.
* tests/mv/Makefile.am (TESTS): Add part-symlink.
* src/ls.c: Use strcoll (not strcmp) when comparing file names.
Suggestion from Ulrich Drepper.
2000-08-27 Jim Meyering <meyering@lucent.com>
* src/copy.c (copy_reg): New parameters: X and NEW_DST.
Remove the SPARSE_MODE parameter. Update caller.
Perform POSIX-mandated (for cp) open-with-O_WRONLY|O_TRUNC when copying
a regular source file and the destination file exists; upon failure,
unlink that existing file, then open again, but with O_WRONLY|O_CREAT.
(copy_internal): `force' in not related to interactive; remove
the conjunct.
Remove the entire `else if (x->force)' block; justifying
removal of the non-directory part is easy: POSIX requires we try
to open an existing regular file, so we can't unlink it beforehand.
The part that changes the mode on a directory to allow overwriting
isn't necessary.
* src/copy.c (copy_reg): Rename two goto labels.
(copy_internal): Set `new_dst' when the move_mode rename fails,
since we then unlink the destination file.
* src/cp.c (usage): --force is independent of --interactive.
2000-08-24 Jim Meyering <meyering@lucent.com>
Put back the kluge. It's necessary after all.
* src/dd.c (buggy_lseek_support): New function.
(skip): Use it.
Frank Adler reported that although _llseek returns 0, lseek
erroneously returns an offset suggesting the operation succeeded
even though it fails.
* install-sh: Double quote as needed, to protect against arguments
containing spaces or shell metacharacters. Reported by Bruno Haible.
2000-08-23 Jim Meyering <meyering@lucent.com>
* tests/dd/not-rewound: New test, for the SEEK_CUR vs. SEEK_SET part
of the last change. Based on Paul's example.
* tests/dd/Makefile.am (TESTS): Add not-rewound.
2000-08-22 Paul Eggert <eggert@twinsun.com>
* src/dd.c (skip):
Assume lseek failed if it returned zero, since a zero return is
impossible and some buggy drivers return zero.
Use SEEK_CUR rather than SEEK_SET; this fixes a bug when the
file descriptor is not currently rewound.
2000-08-23 Jim Meyering <meyering@lucent.com>
* src/dd.c: Back out my last change. Paul's (above) is better.
2000-08-22 Jim Meyering <meyering@lucent.com>
Don't even try to use lseek on character devices.
* src/dd.c (buggy_lseek_support): New function.
(skip): Use it.
Reported by Martin Gallant via Michael Stone.
2000-08-21 Jim Meyering <meyering@lucent.com>
* tests/cp/same-file: Clean up traps. Create files in a subdir.
* install-sh (oIFS): Remove unmatched double quote, left over from
my 2000-08-12 change. From J. David Anglin.
* Makefile.maint (wget-update): Get the latest version of depcomp.
* depcomp: Update from automake.
2000-08-20 Jim Meyering <meyering@lucent.com>
* Version 4.0y.
Add support for cp's new POSIX-mandated -H and -L options.
* src/copy.h (enum Dereference_symlink): Define.
(struct cp_options) [dereference]: Change type to Dereference_symlink.
* src/copy.c: Declare lstat.
(copy_dir): Set `xstat' member to lstat so that with `-H' we don't
follow symlinks found via recursive traversal.
Update uses of `dereference' to compare against new enum member names.
* src/cp.c (long_opts): Add --dereference, -L.
(usage): Describe -L and -H.
(cp_option_init): Initialize to DEREF_UNDEFINED, not `1'.
(main): Add `H' and `-L' to getopt spec string.
[case 'a']: Initialize `dereference' to DEREF_NEVER, not 0.
[case 'd']: Likewise.
[case 'H']: New case.
[case 'L']: New case.
[case 'R']: Don't set dereference to `0' here.
If it's not yet defined, set x.dereference to DEREF_NEVER
if -R was specified, else set it to DEREF_ALWAYS.
Set x.xstat accordingly for -H.
* doc/fileutils.texi (cp invocation): Describe -H and -L.
* src/mv.c (cp_option_init): Initialize to DEREF_NEVER, not `0'.
* src/install.c (cp_option_init): Initialize to DEREF_ALWAYS, not `1'.
* tests/cp/Makefile.am (TESTS): Add cp-HL.
* tests/cp/cp-HL: New test.
* src/du.c (print_totals): Rename global from opt_combined_arguments.
2000-08-17 Paul Eggert <eggert@twinsun.com>
* src/copy.c (DO_CHOWN): Do not make a special case for non-root.
POSIX.2 requires that cp -p and mv attempt to set the uid of the
destination file, even if you're not root. This affects behavior
only on hosts that let you give files away via chmod.
* NEWS: Describe the above change.
2000-08-15 Jim Meyering <meyering@lucent.com>
* src/du.c (count_entry): Remember the current directory also for `.'
and `..'. Reported by Stephen Smoogen, based on a patch from H.J. Lu.
* tests/du/two-args: Add tests for this.
2000-08-14 Jim Meyering <meyering@lucent.com>
* src/copy.c (copy_reg): Move declaration of local, `n_read', into
the scope where it's used.
(copy_internal): In calling copy_reg, pass not the raw `src_mode',
but the possibly-umask-relative mode, `get_dest_mode (x, src_mode)'.
2000-08-13 Jim Meyering <meyering@lucent.com>
* src/copy.c (get_dest_mode): Rename from new_nondir_mode.
Honor the umask for `cp', but not for `mv' or `cp -p'.
(copy_reg): New 4th parameter, dst_mode. Pass it as 3rd arg. to open.
(copy_internal): Change type of locals `src_mode' and `src_type' from
int to mode_t.
Remove unnecessary local, `fix_mode'.
Combine two if-stmts into one.
Pass `src_mode' as 4th arg to copy_reg.
If we've just created a new regular file, return early, skipping the
chmod step. copy_reg now sets permissions of such files upon creation.
Use get_dest_mode, so there's just one chmod call here.
* tests/cp/Makefile.am (TESTS): Add perm.
* tests/cp/perm: New tests, to help ensure the above didn't
change anything.
2000-08-12 Jim Meyering <meyering@lucent.com>
* tests/mv/into-self-2: Remove test for the VERSION_CONTROL and/or
SIMPLE_BACKUP_SUFFIX envvars. Source ../envvar-check instead.
* tests/mv/i-2: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/cp/slink-2-slink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/cp/cp-mv-backup: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add envvar-check.
* tests/envvar-check: New file.
* install-sh: Remove trailing blanks.
Output diagnostics to stderr, not stdout.
Remove many useless curly braces and double quotes.
2000-08-11 J. David Anglin <dave@hiauly1.hia.nrc.ca>
* install-sh: Improve error handling.
Do the job even when the target file is `busy' on systems
that don't allow such files to be unlinked.
2000-08-12 Jim Meyering <meyering@lucent.com>
* README: Remove note about how installation can fail and the
work-around, now that it's all automated.
2000-08-07 Paul Eggert <eggert@twinsun.com>
* src/cp.c (usage, main): For cp -P messages, mention the new
behavior as well as the old.
2000-08-07 Paul Eggert <eggert@twinsun.com>
Standardize on "memory exhausted" instead of "Memory exhausted"
or "virtual memory exhausted".
Invoke xalloc_die instead of printing our own message.
* src/chmod.c (main): Likewise.
* src/copy.c (copy_dir, copy_internal): Likewise.
* src/cp.c (do_copy): Likewise.
* src/dircolors.c (xstrndup): Likewise.
* src/install.c (main): Likewise.
* src/ln.c (do_link): Likewise.
* src/mkdir.c (main): Likewise.
* src/mkfifo.c (main): Likewise.
* src/mknod.c (main): Likewise.
* src/mv.c (movefile): Likewise.
* src/remove.c (remove_cwd_entries, rm): Likewise.
* src/shred.c (quotearg_colon, xmalloc):
"virtual memory exhausted" -> "memory exhausted"
2000-08-07 Jim Meyering <meyering@lucent.com>
* src/cp.c (enum) [PARENTS_OPTION]: New member.
(long_opts): Update "parents" and deprecated "path" entries to use
`PARENTS_OPTION', not `P'.
(usage): Update --help output.
(main): Warn that the meaning of `-P' will soon change.
2000-08-06 Jim Meyering <meyering@lucent.com>
* doc/fileutils.texi (cp invocation) [-r]: Remove inaccurate mention of
`non-symbolic links'.
2000-08-05 Jim Meyering <meyering@lucent.com>
* config.guess: Update from master repository.
* config.sub: Likewise.
* Regenerate build/config framework to use the latest CVS versions
of automake and autoconf.
2000-07-31 Jim Meyering <meyering@lucent.com>
* src/shred.c [!HAVE_CONFIG_H]: Use `virtual memory exhausted', not
`Memory exhausted'.
2000-07-30 Jim Meyering <meyering@lucent.com>
* src/sys2.h (ISPRINT): Undef before defining to avoid warning.
* src/copy.c (copy_internal): Quote the file names that are displayed
with --verbose and --backup.
* src/remove.c (remove_file): Quote the file names that are displayed
with --verbose.
(remove_dir): Likewise.
* tests/mv/mv-special-1: Add quote marks to match new behavior.
* tests/rm/r-1: Likewise.
* tests/rm/r-2: Likewise.
* src/df.c: Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
* src/dircolors.c: Likewise.
* src/du.c: Likewise.
* src/mkdir.c: Likewise.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
* src/shred.c: Likewise.
* src/rmdir.c: Likewise.
* src/cp-hash.c: Likewise.
* src/chgrp.c: Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
* src/chmod.c: Likewise.
* src/chown.c: Likewise.
* src/remove.c (remove_cwd_entries): Quote one more file name.
* src/help-version: Remove file. Move it to ...
* tests/help-version: ...here
* tests/Makefile.am (TESTS): Set to help-version.
(TESTS_ENVIRONMENT): Define.
(EXTRA_DIST): Add $(TESTS).
* src/Makefile.am (EXTRA_DIST): Remove help-version.
(TESTS): Remove definition.
(TESTS_ENVIRONMENT): Remove definition.
2000-07-24 Bruno Haible <haible@clisp.cons.org>
* src/ls.c: Include <limits.h>, <stdlib.h>, <wchar.h>, <wctype.h>.
(quote_name): Use mbrtowc to step through the filename string while
replacing nonprintables with question marks. Return the screen width,
not the strlen length. Do no output if the out stream is NULL.
(length_of_file_name_and_frills): Use the quote_name return value.
2000-07-25 Jim Meyering <meyering@lucent.com>
* src/chgrp.c (change_file_group): Save errno from a possibly failed
chown, and use that later. Otherwise, errno itself could be clobbered
before used.
* src/chmod.c (change_file_mode): Likewise.
* src/chown.c (change_file_owner): Likewise.
* src/mv.c (main): Remove unnecessary "%s" argument.
* src/ln.c: Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
* src/mv.c: Likewise.
* src/cp.c: Likewise.
* src/touch.c: Likewise.
2000-07-23 Jim Meyering <meyering@lucent.com>
* Version 4.0x.
* src/dd.c (main): Give a better diagnostic for e.g.,
`dd if=/dev/fd0 seek=100000000000'.
Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call.
Add many, more precise diagnostics.
* src/remove.c (ASSIGN_STRDUPA): Remove macro definition.
* src/sys2.h (ASSIGN_STRDUPA): New macro (moved here from remove.c).
Fix cp so that `cp -r DIR1/ DIR2' works once again.
* src/cp.c (ASSIGN_BASENAME_STRDUPA): New macro.
(do_copy): Use it here (so we always strip trailing slashes before
calling base_name). Reported by Branden Robinson via Michael Stone.
Test for the above fix.
* tests/cp/Makefile.am (TESTS): Add dir-slash.
* tests/cp/dir-slash: New file.
2000-07-17 Jim Meyering <meyering@lucent.com>
* Makefile.maint (WGET): Define.
(ftp-gnu): Define.
(wget-update): New rule, based on the one in autoconf.
* src/shred.c (usage): Give a little more info.
Remove a FIXME comment.
Avoid warnings.
* src/ls.c (struct bin_str): Declare `string' member to be `const'.
(put_indicator): Declare local `p' to be `const'.
2000-07-15 Jim Meyering <meyering@lucent.com>
Begin converting "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call -- if there's only one.
If there are two or more, then use `quote_n (0, ...),
quote_n (1, ...), ...'.
Here's the justification, from Paul Eggert (thanks, Paul):
[Consider] the following, taken from fileutils/copy.c:
error (0, errno, _("cannot create directory `%s'"), dst_path);
Now, suppose dst_path is "/'\nrm: removing all files under `/"
(expressed in C string syntax). This will cause the user to see
the following delightfully ambiguous display:
cp: cannot create directory `/'
rm: removing all files under `/'
It would be better to rewrite the above line to be something
like this:
error (0, errno, _("cannot create directory %s"), quote (dst_path));
using the definition of "quote" [in lib/quote.c]. That way,
the user will see the following unambiguous display instead:
cp: cannot create directory `/\'\nrm: removing all files under `/'
One might object that any user who asks to copy a file with
a weird name like that deserves to get confused. But this
is not a good objection, as the source of the string may not
be under the user's control, or even visible to the user.
* src/copy.c: Adapt format strings and args as above. Include quote.h.
I have deliberately not changed the output of --verbose.
FIXME: maybe I should.
* src/cp.c: Likewise.
* src/remove.c: Likewise.
* src/install.c: Likewise. and improve a couple diagnostics.
2000-07-13 Paul Eggert <eggert@twinsun.com>
* NEWS: Describe --quoting-style=clocale.
* doc/fileutils.texi: New clocale quoting style.
Undo the previous change to the locale quoting style.
2000-07-09 Jim Meyering <meyering@lucent.com>
* config.guess: Update from FSF.
* config.sub: Likewise.
2000-07-05 Paul Eggert <eggert@twinsun.com>
* doc/fileutils.texi: Don't use ` and ' for quoting.
2000-07-01 Jim Meyering <meyering@lucent.com>
* Version 4.0w.

View File

@@ -1,4 +1,30 @@
Changes in release 4.1:
Changes in release 4.01:
[4.0z]
* `cp -p' once again preserves `special' permission bits (this bug was
introduced in 4.0y)
* mv's --force (-f) option now controls solely whether mv prompts (per POSIX)
* `cp -f' now first attempts to open an existing destination file, and only
if that fails does it resort to unlinking the file and retrying the open.
Before, it would unlink the file before trying to open it.
* cp accepts a new option, --remove-destination, that provides the old behavior
* cp's -f option no longer cancels the effect of --interactive (-i) (per POSIX)
* when ls sorts directory entries, it now honors the current locale settings
* dd's `skip=BLOCKS' operator once again works on systems with a buggy lseek
function (Linux, at least on SCSI tape devices)
* fix a typo in install-sh
[4.0y]
* cp now accepts the POSIX-mandated -H and -L options.
* cp -p and mv now try to preserve uid even if you're not root, as per POSIX.2.
This affects behavior only on hosts that let you give files away via chmod.
* du would fail when given `.' or `..' followed by other command line arguments
* Using cp's short-named `-P' option evokes the warning that that the
meaning of `-P' will soon change. Use `--parents' instead.
* chgrp, chmod, and chown: when used with the --verbose option, might give an
invalid diagnostic (due to clobbered errno) when failing.
[4.0x]
* Fix cp so that `cp -r DIR1/ DIR2' works properly once again.
* New ls option --quoting-style=clocale acts like --quoting-style=locale,
except that it quotes "like this" by default instead of `like this'.
[4.0w]
* When `cp -pR' fails to copy a file, it now preserves permissions, owner,
and group of the containing directory.

View File

@@ -1,3 +1,74 @@
2000-08-14 Jim Meyering <meyering@lucent.com>
* src/tee.c (main): Remove incorrect `FIXME' comment.
2000-08-07 Paul Eggert <eggert@twinsun.com>
* src/su.c (xputenv): Invoke xalloc_die instead of printing
our own message.
2000-07-30 Jim Meyering <meyering@lucent.com>
* src/tee.c (tee): Use SET_BINARY and SET_BINARY2.
From Prashant TR.
* src/help-version: Remove file. Move it to ...
* tests/help-version: ...here
* tests/Makefile.am (TESTS): Add help-version.
(TESTS_ENVIRONMENT): Define.
* src/Makefile.am (EXTRA_DIST): Remove help-version.
(TESTS): Remove definition.
(TESTS_ENVIRONMENT): Remove definition.
2000-07-23 Jim Meyering <meyering@lucent.com>
* src/help-version (su_args): Punt, so we don't try to start a shell.
* src/su.c: Include <sys/param.h> if HAVE_SYS_PARAM_H is defined,
rather than if _POSIX_VERSION is defined. Remove declarations of
getpwuid, getgrgid, and getuid, now that they're in sys2.h.
Prompted by a report from John David Anglin.
* src/sys2.h [!HAVE_DECL_GETPWUID]: Declare getpwuid.
[!HAVE_DECL_GETGRGID]: Declare getgrgid.
[!HAVE_DECL_GETUID]: Declare getuid.
2000-07-19 Jim Meyering <meyering@lucent.com>
* src/date.c (batch_convert): Free `initial_TZ' only if it was set.
Reported by Michael Hohn.
2000-07-17 Jim Meyering <meyering@lucent.com>
* src/stty.c (visible): Don't mark `<undef>' for translation.
The standard requires that exact string.
2000-07-09 Jim Meyering <meyering@lucent.com>
* config.guess: Update from FSF.
* config.sub: Likewise.
* src/Makefile.am (seq_LDADD): Don't hard-code `-lm' -- some systems
don't have/need it. From Bruno Haible.
2000-07-06 Jim Meyering <meyering@lucent.com>
* src/help-version: Punt on `groups' test, since all it does
is run `id -Gn', and groups fails if GNU id is not installed.
Reported by Christian Krackowizer.
2000-07-05 Bruno Haible <haible@clisp.cons.org>
* tests/nice: Avoid syntax error in "test" when `nice` generates
no output.
2000-07-04 Jim Meyering <meyering@lucent.com>
* Version 2.0j.
* tests/date/Test.pm (test_vector): Disable test #2 for all systems,
even though it fails only on SunOS4.
2000-07-01 Jim Meyering <meyering@lucent.com>
* configure.in (jm_DUMMY_1): Wrap a snippet in a macro definition

View File

@@ -1,4 +1,6 @@
Changes in release 2.1
[2.0k]
* `date -f - < /dev/null' no longer dumps core
[2.0j]
* `date -d DATE' now parses certain relative DATEs correctly
[2.0i]

View File

@@ -1,3 +1,192 @@
2000-09-07 Jim Meyering <meyering@lucent.com>
* src/cut.c: Remove obsolete comment block.
(usage): Note that when using -f, lines with no delimiters are
also printed.
* doc/textutils.texi (cut invocation): Likewise.
2000-08-23 Jim Meyering <meyering@lucent.com>
* src/md5sum.c: Include <config.h> unconditionally, to be consistent
with all the other programs in this directory.
* src/tsort.c: Likewise.
2000-08-19 Jim Meyering <meyering@lucent.com>
* src/comm.c (writeline): Correct comments. From Bruno Haible.
2000-08-11 Paul Eggert <eggert@twinsun.com>
* doc/textutils.texi:
Portable shell scripts should specify global options before
key fields.
Move global LC_CTYPE remark to each sort option that depends
on LC_CTYPE.
sort -g depends on LC_NUMERIC.
Add @vindex where it's missing.
"radix character" -> "decimal-point character", to match Standard C
terminology, which is easier for most people to follow.
"comm" does not consider trailing newlines to be significant.
2000-08-10 Paul Eggert <eggert@twinsun.com>
* doc/textutils.texi: Recommend against the System V syntax
for tr ranges, and don't use it in examples. Use POSIX
classes rather than ranges, for portability.
* src/tr.c (usage): Don't describe System V syntax, as it
doesn't always work.
* src/sort.c (usage): Describe -d and -i in a locale-independent way.
* doc/Makefile.am (constants.texi): Use the C locale so that
[A-Z] works as expected.
2000-08-07 Paul Eggert <eggert@twinsun.com>
* src/cut.c (cut_fields): Invoke xalloc_die instead of printing
our own message.
(cut_fields): Check for I/O error as well as end-of-file
2000-08-06 Bruno Haible <haible@clisp.cons.org>
* src/wc.c: Add support for multi-byte locales.
(iswprint, mbrtowc, wcwidth): Provide default definitions.
(total_bytes): New variable.
(print_bytes): New variable.
(longopts): Change abbreviation for --chars from 'c' to 'm'.
(usage): Update.
(write_counts): Add `bytes' argument.
(wc): New variables `bytes', `count_bytes', `count_chars',
`count_complicated'. The old code determines `bytes', not `chars'.
New case for MB_CUR_MAX > 1. A non-printable non-space character does
not increment the line position or start a word. Update `total_bytes'.
(main): Initialize `print_bytes' and `total_bytes' to 0. Accept 'm'
option. Pass `total_bytes' to write_counts.
* doc/textutils.texi (wc invocation): Update accordingly.
2000-08-06 Bruno Haible <haible@clisp.cons.org>
* src/head.c (head): Call write_header here.
(head_file): ... not here.
* src/cat.c (closeout_func): Remove variable.
(close_stdout_wrapper): Remove unused function.
(main): Remove assignment to closeout_func.
* src/fold.c (fold_file): Remove ferror(stdout) check, already done
in close_stdout.
2000-08-06 Paul Eggert <eggert@twinsun.com>
* src/sort.c (usage): Warn more succintly about the effects of
the locale on sort order.
2000-08-06 Jim Meyering <meyering@lucent.com>
* Version 2.0g.
* src/tail.c (pipe_lines): Declare local `cp' to be const.
2000-08-04 Greg McGary <greg@mcgary.org>
* src/tail.c (pipe_lines): Add variable `nbytes' so we can free
`tmp' immediately after read loop. Don't process an empty file.
[This fixes a buffer-underrun error -- detected thanks to
bounded pointers -jmm]
2000-08-05 Jim Meyering <meyering@lucent.com>
Fix buffer-overrun error.
* src/pr.c (init_header): Allocated buffer was sometimes too small.
Reported by Greg McGary (who found this bug using his
bounded-pointers-enabled gcc).
(init_header): Move declarations of several variables into the
inner scope where they are used.
* tests/pr/Test.pm (narrow-1): New test, for the above.
* src/csplit.c (MAX): Remove definition (It's in sys2.h).
2000-08-04 Jim Meyering <meyering@lucent.com>
* src/sort.c (main): Rename local `t' to `tmp_dir' to avoid shadowing
a previous local by that name.
(usage): Warn that GNU sort is now locale-aware, and suggest
people put LC_ALL=POSIX in their environment.
* src/pr.c (store_columns): Remove conjunct that would dereference
an out-of-bounds pointer. Reported by Greg McGary (who found this
bug using his bounded-pointers-enabled gcc).
2000-08-03 Jim Meyering <meyering@lucent.com>
* tests/Makefile.am.in ($(srcdir)/$x-tests): Use -I$(srcdir), not `-I.'.
(Makefile.am): Likewise. Reported by Greg McGary.
2000-08-01 Jim Meyering <meyering@lucent.com>
* doc/textutils.texi (tr invocation): Note that ranges are not portable.
Update examples not to use ranges.
2000-07-31 Jim Meyering <meyering@lucent.com>
* src/cut.c (cut_fields): Use `virtual memory exhausted',
not `Memory exhausted'.
2000-07-30 Jim Meyering <meyering@lucent.com>
* src/help-version: Remove file. Move it to ...
* tests/help-version: ...here
* tests/Makefile.am (TESTS): Set to help-version.
(TESTS_ENVIRONMENT): Define.
(EXTRA_DIST): Add $(TESTS).
* src/Makefile.am (EXTRA_DIST): Remove help-version.
(TESTS): Remove definition.
(TESTS_ENVIRONMENT): Remove definition.
2000-07-28 Paul Eggert <eggert@twinsun.com>
sort's -T option can now appear multiple times.
Thanks to Charles Randall for suggesting this idea.
* doc/textutils.texi, NEWS: Document this.
* src/sort.c (temp_dir): Remove.
(temp_dirs, temp_dir_count, temp_dir_alloc): New vars.
(process_id): New var.
(usage): Describe new use of -T.
(add_temp_dir): New function.
(tempname): Use new temp_dirs array.
Do not discard information from the process-id or sequence
number, unless we have short file names.
(sighandle): Use process_id instead of getpid.
(main): Initialize process_id.
Add support for the new use of -T.
2000-07-23 Jim Meyering <meyering@lucent.com>
* tests/head/Test.pm: Rename tests (and hence files) to have a short
enough prefix so that they're not truncated on 8+3 file systems.
Reported by Eli Zaretskii.
2000-07-09 Jim Meyering <meyering@lucent.com>
* config.guess: Update from FSF.
* config.sub: Likewise.
2000-07-02 Jim Meyering <meyering@lucent.com>
* Version 2.0f.
2000-07-01 Jim Meyering <meyering@lucent.com>
* src/cut.c: Change type of global, field_1_bufsize, from int to size_t.
2000-06-29 Jim Meyering <meyering@lucent.com>
* src/tr.c (find_bracketed_repeat): Add a cast to suppress a warning.

View File

@@ -1,5 +1,16 @@
Changes in release 2.1
[2.0h]
[2.0g]
* sort's --help output now warns that it is locale-aware
* tail: fix a buffer underrun error that occurred on an empty pipe,
also thanks to bounded pointers
* pr: fix a bounds violation found by Greg McGary's bounded-pointers-enabled gcc
It could have caused (with low probability) the columns on the last page of
output *not* to be `balanced' when they should have been.
* sort: if the -T tmpdir option is given multiple times, all the given
directories are used; this can improve performance for huge sort/merges.
[2.0f]
* all programs fail when printing --help or --version output to a full device
* cut no longer gets a segfault under some circumstances
* unexpand accepts new option: --first-only
[2.0e]

View File

@@ -462,17 +462,6 @@ cat (
}
}
/* This is gross, but necessary, because of the way close_stdout
works and because this program closes STDOUT_FILENO directly. */
static void (*closeout_func) (void) = close_stdout;
static void
close_stdout_wrapper (void)
{
if (closeout_func)
(*closeout_func) ();
}
int
main (int argc, char **argv)
{
@@ -632,8 +621,6 @@ main (int argc, char **argv)
}
}
closeout_func = NULL;
/* Get device, i-node number, and optimal blocksize of output. */
if (fstat (STDOUT_FILENO, &stat_buf) < 0)

View File

@@ -27,6 +27,7 @@
#include "error.h"
#include "lchown.h"
#include "group-member.h"
#include "quote.h"
#include "savedir.h"
#include "xstrtol.h"
@@ -137,7 +138,7 @@ describe_change (const char *file, enum Change_status changed)
if (changed == CH_NOT_APPLIED)
{
printf (_("neither symbolic link %s nor referent has been changed\n"),
file);
quote (file));
return;
}
@@ -155,7 +156,7 @@ describe_change (const char *file, enum Change_status changed)
default:
abort ();
}
printf (fmt, file, groupname);
printf (fmt, quote (file), groupname);
}
/* Set *G according to NAME. */
@@ -176,14 +177,14 @@ parse_group (const char *name, gid_t *g)
unsigned long int tmp_long;
if (!ISDIGIT (*name))
error (1, 0, _("invalid group name `%s'"), name);
error (1, 0, _("invalid group name %s"), quote (name));
s_err = xstrtoul (name, NULL, 0, &tmp_long, NULL);
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (name, _("group number"), s_err);
if (tmp_long > MAXGID)
error (1, 0, _("invalid group number `%s'"), name);
error (1, 0, _("invalid group number %s"), quote (name));
*g = tmp_long;
}
@@ -205,7 +206,7 @@ change_file_group (int cmdline_arg, const char *file, gid_t group)
if ((*xstat) (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, "%s", file);
error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
@@ -213,6 +214,7 @@ change_file_group (int cmdline_arg, const char *file, gid_t group)
{
int fail;
int symlink_changed = 1;
int saved_errno;
if (S_ISLNK (file_stats.st_mode) && change_symlinks)
{
@@ -231,6 +233,9 @@ change_file_group (int cmdline_arg, const char *file, gid_t group)
fail = chown (file, (uid_t) -1, group);
}
/* Save errno, since in verbose mode, describe_change might change it. */
saved_errno = errno;
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
{
enum Change_status ch_status = (! symlink_changed ? CH_NOT_APPLIED
@@ -246,18 +251,20 @@ change_file_group (int cmdline_arg, const char *file, gid_t group)
/* Give a more specific message. Some systems set errno
to EPERM for both `inaccessible file' and `user not a member
of the specified group' errors. */
if (errno == EPERM && !group_member (group))
if (saved_errno == EPERM && !group_member (group))
{
error (0, errno, _("you are not a member of group `%s'"),
groupname);
error (0, saved_errno, _("you are not a member of group %s"),
quote (groupname));
}
else if (errno == EINVAL && group > MAXUID)
else if (saved_errno == EINVAL && group > MAXUID)
{
error (0, 0, _("%s: invalid group number"), groupname);
error (0, 0, _("%s: invalid group number"),
quote (groupname));
}
else
{
error (0, errno, "%s", file);
error (0, saved_errno, _("changing group of %s"),
quote (file));
}
}
}
@@ -292,7 +299,7 @@ change_dir_group (const char *dir, gid_t group, const struct stat *statp)
if (name_space == NULL)
{
if (force_silent == 0)
error (0, errno, "%s", dir);
error (0, errno, "%s", quote (dir));
return 1;
}
@@ -419,7 +426,7 @@ main (int argc, char **argv)
{
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
error (1, errno, "%s", reference_file);
error (1, errno, _("getting attributes of %s"), quote (reference_file));
group = ref_stats.st_gid;
}

View File

@@ -26,6 +26,7 @@
#include "error.h"
#include "filemode.h"
#include "modechange.h"
#include "quote.h"
#include "savedir.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -120,7 +121,8 @@ describe_change (const char *file, mode_t mode,
default:
abort ();
}
printf (fmt, file, (unsigned long) (mode & CHMOD_MODE_BITS), &perms[1]);
printf (fmt, quote (file),
(unsigned long) (mode & CHMOD_MODE_BITS), &perms[1]);
}
/* Change the mode of FILE according to the list of operations CHANGES.
@@ -139,7 +141,7 @@ change_file_mode (const char *file, const struct mode_change *changes,
if (lstat (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, "%s", file);
error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
#ifdef S_ISLNK
@@ -151,7 +153,7 @@ change_file_mode (const char *file, const struct mode_change *changes,
if (stat (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, "%s", file);
error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
}
@@ -162,6 +164,7 @@ change_file_mode (const char *file, const struct mode_change *changes,
if (newmode != (file_stats.st_mode & CHMOD_MODE_BITS))
{
int fail = chmod (file, newmode);
int saved_errno = errno;
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
@@ -169,7 +172,8 @@ change_file_mode (const char *file, const struct mode_change *changes,
if (fail)
{
if (force_silent == 0)
error (0, errno, "%s", file);
error (0, saved_errno, _("changing permissions of %s"),
quote (file));
errors = 1;
}
}
@@ -201,7 +205,7 @@ change_dir_mode (const char *dir, const struct mode_change *changes,
if (name_space == NULL)
{
if (force_silent == 0)
error (0, errno, "%s", dir);
error (0, errno, "%s", quote (dir));
return 1;
}
@@ -349,9 +353,9 @@ main (int argc, char **argv)
if (changes == MODE_INVALID)
error (1, 0, _("invalid mode"));
else if (changes == MODE_MEMORY_EXHAUSTED)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
else if (changes == MODE_BAD_REFERENCE)
error (1, errno, "%s", reference_file);
error (1, errno, _("getting attributes of %s"), quote (reference_file));
for (; optind < argc; ++optind)
{

View File

@@ -38,6 +38,7 @@
#include "system.h"
#include "error.h"
#include "lchown.h"
#include "quote.h"
#include "savedir.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -144,7 +145,7 @@ describe_change (const char *file, enum Change_status changed)
if (changed == CH_NOT_APPLIED)
{
printf (_("neither symbolic link %s nor referent has been changed\n"),
file);
quote (file));
return;
}
@@ -186,7 +187,7 @@ change_file_owner (int cmdline_arg, const char *file, uid_t user, gid_t group,
if (lstat (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, "%s", file);
error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
@@ -199,6 +200,7 @@ change_file_owner (int cmdline_arg, const char *file, uid_t user, gid_t group,
{
int fail;
int symlink_changed = 1;
int saved_errno;
if (S_ISLNK (file_stats.st_mode) && change_symlinks)
{
@@ -216,6 +218,7 @@ change_file_owner (int cmdline_arg, const char *file, uid_t user, gid_t group,
{
fail = chown (file, newuser, newgroup);
}
saved_errno = errno;
if (verbosity == V_high || (verbosity == V_changes_only && !fail))
{
@@ -229,7 +232,8 @@ change_file_owner (int cmdline_arg, const char *file, uid_t user, gid_t group,
if (fail)
{
if (force_silent == 0)
error (0, errno, "%s", file);
error (0, saved_errno, _("changing ownership of %s"),
quote (file));
errors = 1;
}
}
@@ -266,7 +270,7 @@ change_dir_owner (const char *dir, uid_t user, gid_t group,
if (name_space == NULL)
{
if (force_silent == 0)
error (0, errno, "%s", dir);
error (0, errno, "%s", quote (dir));
return 1;
}
@@ -373,10 +377,11 @@ main (int argc, char **argv)
case FROM_OPTION:
{
char *u_dummy, *g_dummy;
const char *e = parse_user_spec (argv[optind], &old_user, &old_group,
const char *e = parse_user_spec (argv[optind],
&old_user, &old_group,
&u_dummy, &g_dummy);
if (e)
error (1, 0, "%s: %s", argv[optind], e);
error (1, 0, "%s: %s", quote (argv[optind]), e);
break;
}
case 'R':
@@ -412,7 +417,7 @@ main (int argc, char **argv)
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
error (1, errno, "%s", reference_file);
error (1, errno, _("getting attributes of %s"), quote (reference_file));
user = ref_stats.st_uid;
group = ref_stats.st_gid;

View File

@@ -108,7 +108,7 @@ writeline (const struct linebuffer *line, FILE *stream, int class)
case 2:
if (!only_file_2)
return;
/* Skip the tab stop for case 1, if we are printing case 1. */
/* Print a TAB if we are printing lines from file 1. */
if (only_file_1)
putc ('\t', stream);
break;
@@ -116,10 +116,10 @@ writeline (const struct linebuffer *line, FILE *stream, int class)
case 3:
if (!both)
return;
/* Skip the tab stop for case 1, if we are printing case 1. */
/* Print a TAB if we are printing lines from file 1. */
if (only_file_1)
putc ('\t', stream);
/* Skip the tab stop for case 2, if we are printing case 2. */
/* Print a TAB if we are printing lines from file 2. */
if (only_file_2)
putc ('\t', stream);
break;

View File

@@ -34,15 +34,20 @@
#include "cp-hash.h"
#include "dirname.h"
#include "path-concat.h"
#include "quote.h"
#include "same.h"
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
(Chown (File, New_uid, New_gid) \
/* If non-root uses -p, it's ok if we can't preserve ownership. \
But root probably wants to know, e.g. if NFS disallows it, \
or if the target system doesn't support file ownership. */ \
or if the target system doesn't support file ownership. */ \
&& ((errno != EPERM && errno != EINVAL) || x->myeuid == 0))
#define SAME_OWNER(A, B) ((A).st_uid == (B).st_uid)
#define SAME_GROUP(A, B) ((A).st_gid == (B).st_gid)
#define SAME_OWNER_AND_GROUP(A, B) (SAME_OWNER (A, B) && SAME_GROUP (A, B))
struct dir_list
{
struct dir_list *parent;
@@ -69,15 +74,18 @@ extern char *program_name;
new non-directories. */
static mode_t
new_nondir_mode (const struct cp_options *option, mode_t mode)
get_dest_mode (const struct cp_options *option, mode_t mode)
{
/* In some applications (e.g., install), use precisely the
specified mode. */
if (option->set_mode)
return option->mode;
/* In others (e.g., cp, mv), apply the user's umask. */
return mode & option->umask_kill;
/* Honor the umask for `cp', but not for `mv' or `cp -p'. */
if (!option->move_mode && !option->preserve_chmod_bits)
mode &= option->umask_kill;
return mode;
}
/* FIXME: describe */
@@ -112,15 +120,23 @@ copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
{
char *name_space;
char *namep;
struct cp_options non_command_line_options = *x;
int ret = 0;
name_space = savedir (src_path_in, src_sb->st_size);
if (name_space == NULL)
{
error (0, errno, "%s", src_path_in);
/* This diagnostic is a bit vague because savedir can fail in
several different ways. */
error (0, errno, _("cannot access %s"), quote (src_path_in));
return -1;
}
/* For cp's -H option, dereference command line arguments, but do not
dereference symlinks that are found via recursive traversal. */
if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS)
non_command_line_options.xstat = lstat;
namep = name_space;
while (*namep != '\0')
{
@@ -129,10 +145,11 @@ copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
char *dst_path = path_concat (dst_path_in, namep, NULL);
if (dst_path == NULL || src_path == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
ret |= copy_internal (src_path, dst_path, new_dst, src_sb->st_dev,
ancestors, x, 0, &local_copy_into_self, NULL);
ancestors, &non_command_line_options, 0,
&local_copy_into_self, NULL);
*copy_into_self |= local_copy_into_self;
/* Free the memory for `src_path'. The memory for `dst_path'
@@ -151,25 +168,26 @@ copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
If the source file contains holes, copies holes and blocks of zeros
in the source file as holes in the destination file.
(Holes are read as zeroes by the `read' system call.)
Use DST_MODE as the 3rd argument in the call to open.
X provides many option settings.
Return 0 if successful, -1 if an error occurred.
FIXME: describe sparse_mode. */
*NEW_DST is as in copy_internal. */
static int
copy_reg (const char *src_path, const char *dst_path,
enum Sparse_type sparse_mode)
const struct cp_options *x, mode_t dst_mode, int *new_dst)
{
char *buf;
int buf_size;
int dest_desc;
int source_desc;
int n_read;
struct stat sb;
char *cp;
int *ip;
int return_val = 0;
off_t n_read_total = 0;
int last_write_made_hole = 0;
int make_holes = (sparse_mode == SPARSE_ALWAYS);
int make_holes = (x->sparse_mode == SPARSE_ALWAYS);
source_desc = open (src_path, O_RDONLY);
if (source_desc < 0)
@@ -179,47 +197,70 @@ copy_reg (const char *src_path, const char *dst_path,
existed to start with, but copy_internal renamed DST_PATH
with the backup suffix, thus also renaming SRC_PATH. */
if (errno == ENOENT)
error (0, 0, _("`%s' and `%s' are the same file"),
src_path, dst_path);
error (0, 0, _("%s and %s are the same file"),
quote_n (0, src_path), quote_n (1, dst_path));
else
error (0, errno, _("cannot open `%s' for reading"), src_path);
error (0, errno, _("cannot open %s for reading"), quote (src_path));
return -1;
}
/* Create the new regular file with small permissions initially,
to not create a security hole. */
/* These semantics are required for cp.
The if-block will be taken in move_mode. */
if (*new_dst)
{
dest_desc = open (dst_path, O_WRONLY | O_CREAT, dst_mode);
}
else
{
dest_desc = open (dst_path, O_WRONLY | O_TRUNC, dst_mode);
if (dest_desc < 0 && x->unlink_dest_after_failed_open)
{
if (unlink (dst_path))
{
error (0, errno, _("cannot remove %s"), quote (dst_path));
return_val = -1;
goto close_src_desc;
}
/* Tell caller that the destination file was unlinked. */
*new_dst = 1;
/* Try the open again, but this time with different flags. */
dest_desc = open (dst_path, O_WRONLY | O_CREAT, dst_mode);
}
}
dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (dest_desc < 0)
{
error (0, errno, _("cannot create regular file `%s'"), dst_path);
error (0, errno, _("cannot create regular file %s"), quote (dst_path));
return_val = -1;
goto ret2;
goto close_src_desc;
}
/* Find out the optimal buffer size. */
if (fstat (dest_desc, &sb))
{
error (0, errno, "%s", dst_path);
error (0, errno, _("cannot fstat %s"), quote (dst_path));
return_val = -1;
goto ret;
goto close_src_and_dst_desc;
}
buf_size = ST_BLKSIZE (sb);
#if HAVE_STRUCT_STAT_ST_BLOCKS
if (sparse_mode == SPARSE_AUTO && S_ISREG (sb.st_mode))
if (x->sparse_mode == SPARSE_AUTO && S_ISREG (sb.st_mode))
{
/* Use a heuristic to determine whether SRC_PATH contains any
sparse blocks. */
if (fstat (source_desc, &sb))
{
error (0, errno, "%s", src_path);
error (0, errno, _("cannot fstat %s"), quote (src_path));
return_val = -1;
goto ret;
goto close_src_and_dst_desc;
}
/* If the file has fewer blocks than would normally
@@ -237,16 +278,16 @@ copy_reg (const char *src_path, const char *dst_path,
for (;;)
{
n_read = read (source_desc, buf, buf_size);
int n_read = read (source_desc, buf, buf_size);
if (n_read < 0)
{
#ifdef EINTR
if (errno == EINTR)
continue;
#endif
error (0, errno, "%s", src_path);
error (0, errno, _("reading %s"), quote (src_path));
return_val = -1;
goto ret;
goto close_src_and_dst_desc;
}
if (n_read == 0)
break;
@@ -278,9 +319,9 @@ copy_reg (const char *src_path, const char *dst_path,
/* Make a hole. */
if (lseek (dest_desc, (off_t) n_read, SEEK_CUR) < 0L)
{
error (0, errno, "%s", dst_path);
error (0, errno, _("cannot lseek %s"), quote (dst_path));
return_val = -1;
goto ret;
goto close_src_and_dst_desc;
}
last_write_made_hole = 1;
}
@@ -292,9 +333,9 @@ copy_reg (const char *src_path, const char *dst_path,
{
if (full_write (dest_desc, buf, n_read) < 0)
{
error (0, errno, "%s", dst_path);
error (0, errno, _("writing %s"), quote (dst_path));
return_val = -1;
goto ret;
goto close_src_and_dst_desc;
}
last_write_made_hole = 0;
}
@@ -316,27 +357,188 @@ copy_reg (const char *src_path, const char *dst_path,
|| full_write (dest_desc, "", 1) < 0)
#endif
{
error (0, errno, "%s", dst_path);
error (0, errno, _("writing %s"), quote (dst_path));
return_val = -1;
}
}
ret:
close_src_and_dst_desc:
if (close (dest_desc) < 0)
{
error (0, errno, "%s", dst_path);
error (0, errno, _("closing %s"), quote (dst_path));
return_val = -1;
}
ret2:
close_src_desc:
if (close (source_desc) < 0)
{
error (0, errno, "%s", src_path);
error (0, errno, _("closing %s"), quote (src_path));
return_val = -1;
}
return return_val;
}
/* Return nonzero if it's ok that the source and destination
files are the `same' by some measure. The goal is to avoid
making the `copy' operation remove both copies of the file
in that case, while still allowing the user to e.g., move or
copy a regular file onto a symlink that points to it.
Try to minimize the cost of this function in the common case. */
static int
same_file_ok (const char *src_path, const struct stat *src_sb,
const char *dst_path, const struct stat *dst_sb,
const struct cp_options *x, int *return_now)
{
const struct stat *src_sb_link;
const struct stat *dst_sb_link;
const struct stat *src_sb_no_link;
const struct stat *dst_sb_no_link;
int same_link;
int same = (SAME_INODE (*src_sb, *dst_sb));
*return_now = 0;
/* FIXME: this should (at the very least) be moved into the following
if-block. More likely, it should be removed, because it inhibits
making backups. But removing it will result in a change in behavior
that will probably have to be documented -- and tests will have to
be updated. */
if (same && x->hard_link)
{
*return_now = 1;
return 1;
}
if (x->xstat == lstat)
{
same_link = same;
/* If both the source and destination files are symlinks (and we'll
know this here IFF preserving symlinks (aka xstat == lstat),
then it's ok. */
if (S_ISLNK (src_sb->st_mode) && S_ISLNK (dst_sb->st_mode))
return 1;
src_sb_link = src_sb;
dst_sb_link = dst_sb;
}
else
{
static struct stat tmp_dst_sb;
static struct stat tmp_src_sb;
if (!same)
return 1;
if (lstat (dst_path, &tmp_dst_sb)
|| lstat (src_path, &tmp_src_sb))
return 1;
src_sb_link = &tmp_src_sb;
dst_sb_link = &tmp_dst_sb;
same_link = SAME_INODE (*src_sb_link, *dst_sb_link);
/* If both are symlinks, then it's ok, but only if the destination
will be unlinked before being opened. This is like the test
above, but with the addition of the unlink_dest_before_opening
conjunct because otherwise, with two symlinks to the same target,
we'd end up truncating the source file. */
if (S_ISLNK (src_sb_link->st_mode) && S_ISLNK (dst_sb_link->st_mode)
&& x->unlink_dest_before_opening)
return 1;
}
/* The backup code ensures there's a copy, so it's ok to remove
any destination file. But there's one exception: when both
source and destination are the same directory entry. In that
case, moving the destination file aside (in making the backup)
would also rename the source file and result in an error. */
if (x->backup_type != none)
{
if (!same_link)
return 1;
return ! same_name (src_path, dst_path);
}
#if 0
/* FIXME: use or remove */
/* If we're making a backup, we'll detect the problem case in
copy_reg because SRC_PATH will no longer exist. Allowing
the test to be deferred lets cp do some useful things.
But when creating hardlinks and SRC_PATH is a symlink
but DST_PATH is not we must test anyway. */
if (x->hard_link
|| !S_ISLNK (src_sb_link->st_mode)
|| S_ISLNK (dst_sb_link->st_mode))
return 1;
if (x->dereference != DEREF_NEVER)
return 1;
#endif
/* They may refer to the same file if we're in move mode and the
target is a symlink. That is ok, since we remove any existing
destination file before opening it -- via `rename' if they're on
the same file system, via `unlink (DST_PATH)' otherwise.
It's also ok if they're distinct hard links to the same file. */
if ((x->move_mode || x->unlink_dest_before_opening)
&& (S_ISLNK (dst_sb_link->st_mode)
|| (same_link && !same_name (src_path, dst_path))))
return 1;
/* If neither is a symlink, then it's ok as long as they aren't
links to the same file. */
if (!S_ISLNK (src_sb_link->st_mode) && !S_ISLNK (dst_sb_link->st_mode))
{
if (!SAME_INODE (*src_sb_link, *dst_sb_link))
return 1;
/* If they are the same file, it's ok if we're making hard links. */
if (x->hard_link)
{
*return_now = 1;
return 1;
}
}
/* It's ok to remove a destination symlink. But that works only when we
unlink before opening the destination and when they're on the same
partition. */
if (x->unlink_dest_before_opening
&& S_ISLNK (dst_sb_link->st_mode))
return src_sb_link->st_dev == src_sb_link->st_dev;
if (x->xstat == lstat)
{
static struct stat tmp_dst_sb;
static struct stat tmp_src_sb;
if (stat (dst_path, &tmp_dst_sb)
|| stat (src_path, &tmp_src_sb)
|| ! SAME_INODE (tmp_dst_sb, tmp_dst_sb))
return 1;
/* FIXME: shouldn't this be testing whether we're making symlinks? */
if (x->hard_link)
{
*return_now = 1;
return 1;
}
src_sb_no_link = &tmp_src_sb;
dst_sb_no_link = &tmp_dst_sb;
}
else
{
src_sb_no_link = src_sb;
dst_sb_no_link = dst_sb;
}
return 0;
}
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
any type. NEW_DST should be nonzero if the file DST_PATH cannot
exist because its parent directory was just created; NEW_DST should
@@ -360,14 +562,15 @@ copy_internal (const char *src_path, const char *dst_path,
{
struct stat src_sb;
struct stat dst_sb;
int src_mode;
int src_type;
mode_t src_mode;
mode_t src_type;
char *earlier_file;
char *dst_backup = NULL;
int backup_succeeded = 0;
int fix_mode = 0;
int rename_errno;
int delayed_fail;
int copied_as_regular = 0;
int ran_chown = 0;
if (move_mode && rename_succeeded)
*rename_succeeded = 0;
@@ -375,7 +578,7 @@ copy_internal (const char *src_path, const char *dst_path,
*copy_into_self = 0;
if ((*(x->xstat)) (src_path, &src_sb))
{
error (0, errno, "%s", src_path);
error (0, errno, _("cannot stat %s"), quote (src_path));
return 1;
}
@@ -390,7 +593,7 @@ copy_internal (const char *src_path, const char *dst_path,
if (S_ISDIR (src_type) && !x->recursive)
{
error (0, 0, _("%s: omitting directory"), src_path);
error (0, 0, _("omitting directory %s"), quote (src_path));
return 1;
}
@@ -400,7 +603,7 @@ copy_internal (const char *src_path, const char *dst_path,
{
if (errno != ENOENT)
{
error (0, errno, "%s", dst_path);
error (0, errno, _("cannot stat %s"), quote (dst_path));
return 1;
}
else
@@ -410,64 +613,17 @@ copy_internal (const char *src_path, const char *dst_path,
}
else
{
int same;
int return_now;
int ok = same_file_ok (src_path, &src_sb, dst_path, &dst_sb,
x, &return_now);
if (return_now)
return 0;
/* The destination file exists already. */
same = (SAME_INODE (src_sb, dst_sb));
#ifdef S_ISLNK
/* If we're preserving symlinks (--no-dereference) and either
file is a symlink, use stat (not xstat) to see if they refer
to the same file. */
if (!same
/* If we'll remove DST_PATH first, then this doesn't matter. */
&& ! x->force
/* Allow them to be the same (and don't set `same') if we're
in move mode and the target is a symlink. That is ok, since
we remove any existing destination file before opening it --
via `rename' if they're on the same file system,
via `unlink(DST_PATH)' otherwise. */
&& !(move_mode
&& S_ISLNK (dst_sb.st_mode))
/* If we're making a backup, we'll detect the problem case in
copy_reg because SRC_PATH will no longer exist. Allowing
the test to be deferred lets cp do some useful things.
But when creating hardlinks and SRC_PATH is a symlink
but DST_PATH is not we must test anyway. */
&& (x->backup_type == none
|| (x->hard_link
&& S_ISLNK (src_sb.st_mode)
&& !S_ISLNK (dst_sb.st_mode)))
&& !x->dereference
&& (S_ISLNK (dst_sb.st_mode) ^ S_ISLNK (src_sb.st_mode)))
if (! ok)
{
struct stat dst2_sb;
struct stat src2_sb;
if (stat (dst_path, &dst2_sb) == 0
&& stat (src_path, &src2_sb) == 0
&& SAME_INODE (src2_sb, dst2_sb))
{
same = 1;
}
}
#endif
if (same)
{
if (x->hard_link)
return 0;
if (x->backup_type == none
&& (!x->force || same_name (src_path, dst_path)))
{
error (0, 0, _("`%s' and `%s' are the same file"),
src_path, dst_path);
return 1;
}
error (0, 0, _("%s and %s are the same file"),
quote_n (0, src_path), quote_n (1, dst_path));
return 1;
}
if (!S_ISDIR (src_type))
@@ -475,8 +631,8 @@ copy_internal (const char *src_path, const char *dst_path,
if (S_ISDIR (dst_sb.st_mode))
{
error (0, 0,
_("%s: cannot overwrite directory with non-directory"),
dst_path);
_("cannot overwrite directory %s with non-directory"),
quote (dst_path));
return 1;
}
@@ -486,17 +642,17 @@ copy_internal (const char *src_path, const char *dst_path,
if (!S_ISDIR (src_type) && x->interactive)
{
if (euidaccess (dst_path, W_OK) != 0 && x->force)
if (euidaccess (dst_path, W_OK) != 0)
{
fprintf (stderr,
_("%s: overwrite `%s', overriding mode %04lo? "),
program_name, dst_path,
_("%s: overwrite %s, overriding mode %04lo? "),
program_name, quote (dst_path),
(unsigned long) (dst_sb.st_mode & CHMOD_MODE_BITS));
}
else
{
fprintf (stderr, _("%s: overwrite `%s'? "),
program_name, dst_path);
fprintf (stderr, _("%s: overwrite %s? "),
program_name, quote (dst_path));
}
if (!yesno ())
return (move_mode ? 1 : 0);
@@ -507,7 +663,8 @@ copy_internal (const char *src_path, const char *dst_path,
/* In move_mode, DEST may not be an existing directory. */
if (S_ISDIR (dst_sb.st_mode))
{
error (0, 0, _("%s: cannot overwrite directory"), dst_path);
error (0, 0, _("cannot overwrite directory %s"),
quote (dst_path));
return 1;
}
@@ -516,7 +673,7 @@ copy_internal (const char *src_path, const char *dst_path,
{
error (0, 0,
_("cannot move directory onto non-directory: %s -> %s"),
src_path, dst_path);
quote_n (0, src_path), quote_n (0, dst_path));
return 1;
}
}
@@ -526,7 +683,7 @@ copy_internal (const char *src_path, const char *dst_path,
char *tmp_backup = find_backup_file_name (dst_path,
x->backup_type);
if (tmp_backup == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
/* Detect (and fail) when creating the backup file would
destroy the source file. Before, running the commands
@@ -536,9 +693,11 @@ copy_internal (const char *src_path, const char *dst_path,
{
const char *fmt;
fmt = (move_mode
? _("backing up `%s' would destroy source; `%s' not moved")
: _("backing up `%s' would destroy source; `%s' not copied"));
error (0, 0, fmt, dst_path, src_path);
? _("backing up %s would destroy source; %s not moved")
: _("backing up %s would destroy source; %s not copied"));
error (0, 0, fmt,
quote_n (0, dst_path),
quote_n (1, src_path));
free (tmp_backup);
return 1;
}
@@ -550,7 +709,7 @@ copy_internal (const char *src_path, const char *dst_path,
{
if (errno != ENOENT)
{
error (0, errno, _("cannot backup `%s'"), dst_path);
error (0, errno, _("cannot backup %s"), quote (dst_path));
return 1;
}
else
@@ -564,36 +723,17 @@ copy_internal (const char *src_path, const char *dst_path,
}
new_dst = 1;
}
else if (x->force)
else if (x->unlink_dest_before_opening
|| (x->xstat == lstat
&& ! S_ISREG (src_sb.st_mode)
&& ! S_ISDIR (src_sb.st_mode)))
{
if (S_ISDIR (dst_sb.st_mode))
if (unlink (dst_path) && errno != ENOENT)
{
/* Temporarily change mode to allow overwriting. */
if (euidaccess (dst_path, W_OK | X_OK) != 0)
{
if (chmod (dst_path, S_IRWXU))
{
error (0, errno, "%s", dst_path);
return 1;
}
else
fix_mode = 1;
}
}
else
{
if (unlink (dst_path) && errno != ENOENT)
{
error (0, errno, _("cannot remove old link to `%s'"),
dst_path);
if (x->failed_unlink_is_fatal)
return 1;
}
else
{
new_dst = 1;
}
error (0, errno, _("cannot remove %s"), quote (dst_path));
return 1;
}
new_dst = 1;
}
}
}
@@ -603,30 +743,31 @@ copy_internal (const char *src_path, const char *dst_path,
sure we'll create a directory. */
if (x->verbose && !S_ISDIR (src_type))
{
printf ("%s -> %s", src_path, dst_path);
printf ("%s -> %s", quote_n (0, src_path), quote_n (1, dst_path));
if (backup_succeeded)
printf (_(" (backup: %s)"), dst_backup);
printf (_(" (backup: %s)"), quote (dst_backup));
putchar ('\n');
}
/* Did we copy this inode somewhere else (in this command line argument)
and therefore this is a second hard link to the inode? */
if (!x->dereference && src_sb.st_nlink > 1 && earlier_file)
if (x->dereference == DEREF_NEVER && src_sb.st_nlink > 1 && earlier_file)
{
/* Avoid damaging the destination filesystem by refusing to preserve
hard-linked directories (which are found at least in Netapp snapshot
directories). */
if (S_ISDIR (src_type))
{
error (0, 0, _("won't create hard link `%s' to directory `%s'"),
dst_path, earlier_file);
error (0, 0, _("won't create hard link %s to directory %s"),
quote_n (0, dst_path), quote_n (1, earlier_file));
goto un_backup;
}
if (link (earlier_file, dst_path))
{
error (0, errno, "%s", dst_path);
error (0, errno, _("cannot create hard link %s to %s"),
quote_n (0, dst_path), quote_n (1, earlier_file));
goto un_backup;
}
@@ -638,7 +779,7 @@ copy_internal (const char *src_path, const char *dst_path,
if (rename (src_path, dst_path) == 0)
{
if (x->verbose && S_ISDIR (src_type))
printf ("%s -> %s\n", src_path, dst_path);
printf ("%s -> %s\n", quote_n (0, src_path), quote_n (1, dst_path));
if (rename_succeeded)
*rename_succeeded = 1;
return 0;
@@ -681,10 +822,12 @@ copy_internal (const char *src_path, const char *dst_path,
if (unlink (dst_path) && errno != ENOENT)
{
/* Use the value of errno from the failed rename. */
error (0, rename_errno, _("cannot move `%s' to `%s'"),
src_path, dst_path);
error (0, rename_errno, _("cannot move %s to %s"),
quote_n (0, src_path), quote_n (1, dst_path));
return 1;
}
new_dst = 1;
}
delayed_fail = 0;
@@ -699,7 +842,8 @@ copy_internal (const char *src_path, const char *dst_path,
if (is_ancestor (&src_sb, ancestors))
{
error (0, 0, _("%s: cannot copy cyclic symbolic link"), src_path);
error (0, 0, _("cannot copy cyclic symbolic link %s"),
quote (src_path));
goto un_backup;
}
@@ -717,7 +861,8 @@ copy_internal (const char *src_path, const char *dst_path,
if (mkdir (dst_path, (src_mode & x->umask_kill) | S_IRWXU))
{
error (0, errno, _("cannot create directory `%s'"), dst_path);
error (0, errno, _("cannot create directory %s"),
quote (dst_path));
goto un_backup;
}
@@ -729,7 +874,7 @@ copy_internal (const char *src_path, const char *dst_path,
goto un_backup;
if (x->verbose)
printf ("%s -> %s\n", src_path, dst_path);
printf ("%s -> %s\n", quote_n (0, src_path), quote_n (1, dst_path));
}
/* Are we crossing a file system boundary? */
@@ -760,7 +905,7 @@ copy_internal (const char *src_path, const char *dst_path,
dst_parent = dir_name (dst_path);
if (dst_parent == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
in_current_dir = (STREQ (".", dst_parent)
/* If either stat call fails, it's ok not to report
@@ -775,13 +920,14 @@ copy_internal (const char *src_path, const char *dst_path,
{
error (0, 0,
_("%s: can make relative symbolic links only in current directory"),
dst_path);
quote (dst_path));
goto un_backup;
}
}
if (symlink (src_path, dst_path))
{
error (0, errno, "%s", dst_path);
error (0, errno, _("cannot create symbolic link %s to %s"),
quote_n (0, dst_path), quote_n (1, src_path));
goto un_backup;
}
@@ -792,7 +938,7 @@ copy_internal (const char *src_path, const char *dst_path,
{
if (link (src_path, dst_path))
{
error (0, errno, _("cannot create link `%s'"), dst_path);
error (0, errno, _("cannot create link %s"), quote (dst_path));
goto un_backup;
}
return 0;
@@ -804,16 +950,21 @@ copy_internal (const char *src_path, const char *dst_path,
#endif
))
{
if (copy_reg (src_path, dst_path, x->sparse_mode))
copied_as_regular = 1;
/* POSIX says the permission bits of the source file must be
used as the 3rd argument in the open call, but that's not consistent
with historical practice. */
if (copy_reg (src_path, dst_path, x,
get_dest_mode (x, src_mode), &new_dst))
goto un_backup;
}
else
#ifdef S_ISFIFO
if (S_ISFIFO (src_type))
{
if (mkfifo (dst_path, new_nondir_mode (x, src_mode)))
if (mkfifo (dst_path, get_dest_mode (x, src_mode)))
{
error (0, errno, _("cannot create fifo `%s'"), dst_path);
error (0, errno, _("cannot create fifo %s"), quote (dst_path));
goto un_backup;
}
}
@@ -825,9 +976,10 @@ copy_internal (const char *src_path, const char *dst_path,
#endif
)
{
if (mknod (dst_path, new_nondir_mode (x, src_mode), src_sb.st_rdev))
if (mknod (dst_path, get_dest_mode (x, src_mode), src_sb.st_rdev))
{
error (0, errno, _("cannot create special file `%s'"), dst_path);
error (0, errno, _("cannot create special file %s"),
quote (dst_path));
goto un_backup;
}
}
@@ -842,7 +994,7 @@ copy_internal (const char *src_path, const char *dst_path,
link_size = readlink (src_path, link_val, PATH_MAX + 1);
if (link_size < 0)
{
error (0, errno, _("cannot read symbolic link `%s'"), src_path);
error (0, errno, _("cannot read symbolic link %s"), quote (src_path));
goto un_backup;
}
link_val[link_size] = '\0';
@@ -867,8 +1019,8 @@ copy_internal (const char *src_path, const char *dst_path,
if (! same_link)
{
error (0, saved_errno, _("cannot create symbolic link `%s'"),
dst_path);
error (0, saved_errno, _("cannot create symbolic link %s"),
quote (dst_path));
goto un_backup;
}
}
@@ -896,7 +1048,7 @@ copy_internal (const char *src_path, const char *dst_path,
else
#endif
{
error (0, 0, _("%s: unknown file type"), src_path);
error (0, 0, _("%s has unknown file type"), quote (src_path));
goto un_backup;
}
@@ -925,56 +1077,42 @@ copy_internal (const char *src_path, const char *dst_path,
if (utime (dst_path, &utb))
{
error (0, errno, _("preserving times for %s"), dst_path);
error (0, errno, _("preserving times for %s"), quote (dst_path));
if (x->require_preserve)
return 1;
}
}
if (x->preserve_owner_and_group)
/* Avoid calling chown if we know it's not necessary. */
if (x->preserve_owner_and_group
&& (new_dst || !SAME_OWNER_AND_GROUP (src_sb, dst_sb)))
{
ran_chown = 1;
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
{
error (0, errno, _("preserving ownership for %s"), dst_path);
error (0, errno, _("preserving ownership for %s"), quote (dst_path));
if (x->require_preserve)
return 1;
}
}
if (x->set_mode)
{
/* This is so install's -m MODE option works. */
if (chmod (dst_path, x->mode))
{
error (0, errno, _("setting permissions for %s"), dst_path);
return 1;
}
}
else if ((x->preserve_chmod_bits || new_dst)
&& (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type)))
{
mode_t dst_mode = src_mode;
/* Permissions of newly-created regular files were set upon `open' in
copy_reg. But don't return early if there were any special bits and
we had to run chown, because the chown must have reset those bits. */
if ((new_dst && copied_as_regular)
&& !(ran_chown && (src_mode & ~S_IRWXUGO)))
return delayed_fail;
/* Honor the umask for `cp', but not for `mv'. */
if (!x->move_mode)
dst_mode &= x->umask_kill;
if (chmod (dst_path, dst_mode))
if ((x->preserve_chmod_bits || new_dst)
&& (x->copy_as_regular || S_ISREG (src_type) || S_ISDIR (src_type)))
{
if (chmod (dst_path, get_dest_mode (x, src_mode)))
{
error (0, errno, _("preserving permissions for %s"), dst_path);
if (x->require_preserve)
error (0, errno, _("setting permissions for %s"), quote (dst_path));
if (x->set_mode || x->require_preserve)
return 1;
}
}
else if (fix_mode)
{
/* Reset the temporarily changed mode. */
if (chmod (dst_path, dst_sb.st_mode))
{
error (0, errno, _("restoring permissions of %s"), dst_path);
return 1;
}
}
return delayed_fail;
@@ -982,11 +1120,12 @@ un_backup:
if (dst_backup)
{
if (rename (dst_backup, dst_path))
error (0, errno, _("cannot un-backup `%s'"), dst_path);
error (0, errno, _("cannot un-backup %s"), quote (dst_path));
else
{
if (x->verbose)
printf (_("%s -> %s (unbackup)\n"), dst_backup, dst_path);
printf (_("%s -> %s (unbackup)\n"),
quote_n (0, dst_backup), quote_n (1, dst_path));
}
}
return 1;

View File

@@ -22,6 +22,14 @@ enum Sparse_type
SPARSE_ALWAYS
};
enum Dereference_symlink
{
DEREF_UNDEFINED = 1,
DEREF_ALWAYS,
DEREF_NEVER,
DEREF_COMMAND_LINE_ARGUMENTS
};
# define VALID_SPARSE_MODE(Mode) \
((Mode) == SPARSE_NEVER \
|| (Mode) == SPARSE_AUTO \
@@ -36,16 +44,25 @@ struct cp_options
int copy_as_regular;
/* If nonzero, dereference symbolic links (copy the files they point to). */
int dereference;
enum Dereference_symlink dereference;
/* If nonzero, remove existing destination nondirectories. */
int force;
/* If nonzero, remove each existing destination nondirectory before
trying to open it. */
int unlink_dest_before_opening;
/* If nonzero, first try to open each existing destination nondirectory,
then, if the open fails, unlink and try again.
This option must be set for `cp -f', in case the destination file
exists when the open is attempted. It is irrelevant to `mv' since
any destination is sure to be removed before the open. */
int unlink_dest_after_failed_open;
/* Setting this member is meaningful only if FORCE is also set.
If nonzero, copy returns nonzero upon failed unlink.
Otherwise, the failure still elicits a diagnostic, but it doesn't
change copy's return value. This is nonzero for cp and mv, and zero
for install. */
/* FIXME: this is now unused. */
int failed_unlink_is_fatal;
/* If nonzero, create hard links instead of copying files.
@@ -113,6 +130,18 @@ struct cp_options
int (*xstat) ();
};
int stat ();
int lstat ();
/* Arrange to make lstat calls go through the wrapper function
on systems with an lstat function that does not dereference symlinks
that are specified with a trailing slash. */
# if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
int rpl_lstat PARAMS((const char *, struct stat *));
# undef lstat
# define lstat rpl_lstat
# endif
int
copy PARAMS ((const char *src_path, const char *dst_path,
int nonexistent_dst, const struct cp_options *options,

View File

@@ -1,5 +1,5 @@
/* cp-hash.c -- file copying (hash search routines)
Copyright (C) 89, 90, 91, 1995-1999 Free Software Foundation.
Copyright (C) 89, 90, 91, 1995-2000 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
@@ -27,6 +27,7 @@
#include "system.h"
#include "error.h"
#include "cp-hash.h"
#include "quote.h"
struct entry
{
@@ -60,7 +61,7 @@ remember_created (const char *path)
if (stat (path, &sb) < 0)
{
error (0, errno, "%s", path);
error (0, errno, "%s", quote (path));
return 1;
}

154
src/cp.c
View File

@@ -35,6 +35,17 @@
#include "error.h"
#include "dirname.h"
#include "path-concat.h"
#include "quote.h"
#define ASSIGN_BASENAME_STRDUPA(Dest, File_name) \
do \
{ \
char *tmp_abns_; \
ASSIGN_STRDUPA (tmp_abns_, (File_name)); \
strip_trailing_slashes (tmp_abns_); \
Dest = base_name (tmp_abns_); \
} \
while (0)
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "cp"
@@ -61,21 +72,11 @@ enum
{
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1,
SPARSE_OPTION,
STRIP_TRAILING_SLASHES_OPTION
STRIP_TRAILING_SLASHES_OPTION,
PARENTS_OPTION,
UNLINK_DEST_BEFORE_OPENING
};
int stat ();
int lstat ();
/* Arrange to make lstat calls go through the wrapper function
on systems with an lstat function that does not dereference symlinks
that are specified with a trailing slash. */
#if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
int rpl_lstat PARAMS((const char *, struct stat *));
# undef lstat
# define lstat rpl_lstat
#endif
void strip_trailing_slashes ();
/* Initial number of entries in each hash table entry's table of inodes. */
@@ -111,16 +112,18 @@ static struct option const long_opts[] =
{
{"archive", no_argument, NULL, 'a'},
{"backup", optional_argument, NULL, 'b'},
{"dereference", no_argument, NULL, 'L'},
{"force", no_argument, NULL, 'f'},
{"sparse", required_argument, NULL, SPARSE_OPTION},
{"interactive", no_argument, NULL, 'i'},
{"link", no_argument, NULL, 'l'},
{"no-dereference", no_argument, NULL, 'd'},
{"one-file-system", no_argument, NULL, 'x'},
{"parents", no_argument, NULL, 'P'},
{"path", no_argument, NULL, 'P'},
{"parents", no_argument, NULL, PARENTS_OPTION},
{"path", no_argument, NULL, PARENTS_OPTION}, /* Deprecated. */
{"preserve", no_argument, NULL, 'p'},
{"recursive", no_argument, NULL, 'R'},
{"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING},
{"strip-trailing-slash", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
{"suffix", required_argument, NULL, 'S'},
{"symbolic-link", no_argument, NULL, 's'},
@@ -154,14 +157,24 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
--backup[=CONTROL] make a backup of each existing destination file\n\
-b like --backup but does not accept an argument\n\
-d, --no-dereference preserve links\n\
-f, --force remove existing destinations, never prompt\n\
-f, --force if a preexisting destination file cannot be\n\
opened, then unlink it and try again\n\
-i, --interactive prompt before overwrite\n\
-H follow symbolic links that are explicitly\n\
specified in the command line, but do not\n\
follow symlinks that are found via recursive\n\
traversal\n\
-l, --link link files instead of copying\n\
-L, --dereference always follow symbolic links\n\
-p, --preserve preserve file attributes if possible\n\
-P, --parents append source path to DIRECTORY\n\
--parents append source path to DIRECTORY\n\
-P same as `--parents' for now; soon to change to\n\
`--no-dereference' to conform to POSIX\n\
-r copy recursively, non-directories as files\n\
WARNING: use -R instead when you might copy\n\
special files like FIFOs or /dev/zero\n\
--remove-destination unlink each preexisting destination file before\n\
attempting to open it (contrast with --force)\n\
--sparse=WHEN control creation of sparse files\n\
-R, --recursive copy directories recursively\n\
--strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
@@ -246,7 +259,8 @@ re_protect (const char *const_dst_path, int src_offset,
if ((*(x->xstat)) (src_path, &src_sb))
{
error (0, errno, "%s", src_path);
error (0, errno, _("getting attributes of %s"),
quote (src_path));
return 1;
}
@@ -267,7 +281,7 @@ re_protect (const char *const_dst_path, int src_offset,
if (utime (dst_path, &utb))
{
error (0, errno, _("preserving times for %s"), dst_path);
error (0, errno, _("preserving times for %s"), quote (dst_path));
return 1;
}
}
@@ -280,7 +294,8 @@ re_protect (const char *const_dst_path, int src_offset,
if (chown (dst_path, src_sb.st_uid, src_sb.st_gid)
&& ((errno != EPERM && errno != EINVAL) || myeuid == 0))
{
error (0, errno, _("preserving ownership for %s"), dst_path);
error (0, errno, _("preserving ownership for %s"),
quote (dst_path));
return 1;
}
}
@@ -289,7 +304,8 @@ re_protect (const char *const_dst_path, int src_offset,
{
if (chmod (dst_path, src_sb.st_mode & x->umask_kill))
{
error (0, errno, _("preserving permissions for %s"), dst_path);
error (0, errno, _("preserving permissions for %s"),
quote (dst_path));
return 1;
}
}
@@ -371,7 +387,8 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
new->is_new_dir = 1;
if (mkdir (dirpath, mode))
{
error (0, errno, _("cannot make directory `%s'"), dirpath);
error (0, errno, _("cannot make directory %s"),
quote (dirpath));
return 1;
}
else
@@ -382,7 +399,8 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
}
else if (!S_ISDIR (stats.st_mode))
{
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
error (0, 0, _("%s exists but is not a directory"),
quote (dirpath));
return 1;
}
else
@@ -403,7 +421,7 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
else if (!S_ISDIR (stats.st_mode))
{
error (0, 0, _("`%s' exists but is not a directory"), dst_dirname);
error (0, 0, _("%s exists but is not a directory"), quote (dst_dirname));
return 1;
}
else
@@ -449,7 +467,7 @@ do_copy (int n_files, char **file, const char *target_directory,
{
if (errno != ENOENT)
{
error (0, errno, "%s", dest);
error (0, errno, _("accessing %s"), quote (dest));
return 1;
}
@@ -472,15 +490,16 @@ do_copy (int n_files, char **file, const char *target_directory,
{
if (target_directory)
{
error (0, 0, _("specified target, `%s' is not a directory"), dest);
error (0, 0, _("specified target, %s is not a directory"),
quote (dest));
usage (1);
}
if (n_files > 1)
{
error (0, 0,
_("copying multiple files, but last argument (%s) is not a directory"),
dest);
_("copying multiple files, but last argument %s is not a directory"),
quote (dest));
usage (1);
}
}
@@ -494,7 +513,6 @@ do_copy (int n_files, char **file, const char *target_directory,
for (i = 0; i < n_files; i++)
{
char *ap;
char *dst_path;
int parent_exists = 1; /* True if dir_name (dst_path) exists. */
struct dir_attr *attr_list;
@@ -509,7 +527,7 @@ do_copy (int n_files, char **file, const char *target_directory,
/* Append all of `arg' to `dest'. */
dst_path = path_concat (dest, arg, &arg_in_concat);
if (dst_path == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
/* For --parents, we have to make sure that the directory
dir_name (dst_path) exists. We may have to create a few
@@ -524,13 +542,14 @@ do_copy (int n_files, char **file, const char *target_directory,
}
else
{
char *arg_base;
/* Append the last component of `arg' to `dest'. */
ap = base_name (arg);
ASSIGN_BASENAME_STRDUPA (arg_base, arg);
/* For `cp -R source/.. dest', don't copy into `dest/..'. */
dst_path = (STREQ (ap, "..")
dst_path = (STREQ (arg_base, "..")
? xstrdup (dest)
: path_concat (dest, ap, NULL));
: path_concat (dest, arg_base, NULL));
}
if (!parent_exists)
@@ -577,7 +596,7 @@ do_copy (int n_files, char **file, const char *target_directory,
`cp --force --backup foo foo' to `cp --force foo fooSUFFIX'
where SUFFIX is determined by any version control options used. */
if (x->force
if (x->unlink_dest_after_failed_open
&& x->backup_type != none
&& STREQ (source, dest)
&& !new_dst && S_ISREG (sb.st_mode))
@@ -595,7 +614,7 @@ do_copy (int n_files, char **file, const char *target_directory,
x = &x_tmp;
if (new_dest == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
}
/* When the destination is specified with a trailing slash and the
@@ -610,14 +629,8 @@ do_copy (int n_files, char **file, const char *target_directory,
&& !S_ISDIR (source_stats.st_mode))
{
char *source_base;
char *tmp_source;
tmp_source = (char *) alloca (strlen (source) + 1);
strcpy (tmp_source, source);
if (remove_trailing_slashes)
strip_trailing_slashes (tmp_source);
source_base = base_name (tmp_source);
ASSIGN_BASENAME_STRDUPA (source_base, source);
new_dest = (char *) alloca (strlen (dest)
+ strlen (source_base) + 1);
stpcpy (stpcpy (new_dest, dest), source_base);
@@ -637,8 +650,9 @@ static void
cp_option_init (struct cp_options *x)
{
x->copy_as_regular = 1;
x->dereference = 1;
x->force = 0;
x->dereference = DEREF_UNDEFINED;
x->unlink_dest_before_opening = 0;
x->unlink_dest_after_failed_open = 0;
x->failed_unlink_is_fatal = 1;
x->hard_link = 0;
x->interactive = 0;
@@ -676,6 +690,7 @@ main (int argc, char **argv)
char *version_control_string = NULL;
struct cp_options x;
char *target_directory = NULL;
int used_P_option = 0;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -690,7 +705,7 @@ main (int argc, char **argv)
we'll actually use backup_suffix_string. */
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
while ((c = getopt_long (argc, argv, "abdfilprsuvxPRS:V:", long_opts, NULL))
while ((c = getopt_long (argc, argv, "abdfHilLprsuvxPRS:V:", long_opts, NULL))
!= -1)
{
switch (c)
@@ -704,7 +719,7 @@ main (int argc, char **argv)
break;
case 'a': /* Like -dpR. */
x.dereference = 0;
x.dereference = DEREF_NEVER;
x.preserve_owner_and_group = 1;
x.preserve_chmod_bits = 1;
x.preserve_timestamps = 1;
@@ -727,11 +742,15 @@ main (int argc, char **argv)
break;
case 'd':
x.dereference = 0;
x.dereference = DEREF_NEVER;
break;
case 'f':
x.force = 1;
x.unlink_dest_after_failed_open = 1;
break;
case 'H':
x.dereference = DEREF_COMMAND_LINE_ARGUMENTS;
break;
case 'i':
@@ -742,6 +761,10 @@ main (int argc, char **argv)
x.hard_link = 1;
break;
case 'L':
x.dereference = DEREF_ALWAYS;
break;
case 'p':
x.preserve_owner_and_group = 1;
x.preserve_chmod_bits = 1;
@@ -750,6 +773,9 @@ main (int argc, char **argv)
break;
case 'P':
used_P_option = 1;
/* fall through */
case PARENTS_OPTION:
flag_path = 1;
break;
@@ -763,6 +789,10 @@ main (int argc, char **argv)
x.copy_as_regular = 0;
break;
case UNLINK_DEST_BEFORE_OPENING:
x.unlink_dest_before_opening = 1;
break;
case STRIP_TRAILING_SLASHES_OPTION:
remove_trailing_slashes = 1;
break;
@@ -811,6 +841,14 @@ main (int argc, char **argv)
usage (1);
}
if (used_P_option)
{
error (0, 0,
_("\
Warning: the meaning of `-P' will change in the future to conform to POSIX.\n\
Use `--parents' for the old meaning, and `--no-dereference' for the new."));
}
if (backup_suffix_string)
simple_backup_suffix = xstrdup (backup_suffix_string);
@@ -822,13 +860,27 @@ main (int argc, char **argv)
if (x.preserve_chmod_bits == 1)
x.umask_kill = ~ (mode_t) 0;
if (x.dereference == DEREF_UNDEFINED)
{
if (x.recursive)
/* This is compatible with FreeBSD. */
x.dereference = DEREF_NEVER;
else
x.dereference = DEREF_ALWAYS;
}
/* The key difference between -d (--no-dereference) and not is the version
of `stat' to call. */
if (x.dereference)
x.xstat = stat;
else
if (x.dereference == DEREF_NEVER)
x.xstat = lstat;
else
{
/* For DEREF_COMMAND_LINE_ARGUMENTS, x.xstat must be stat for
each command line argument, but must later be `lstat' for
any symlinks that are found via recursive traversal. */
x.xstat = stat;
}
/* Allocate space for remembering copied and created files. */

View File

@@ -46,10 +46,6 @@
# include <stdlib.h>
#endif
#ifndef MAX
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef TRUE
# define FALSE 0
# define TRUE 1

View File

@@ -20,42 +20,7 @@
/* POSIX changes, bug fixes, long-named options, and cleanup
by David MacKenzie <djm@gnu.ai.mit.edu>.
Rewrite cut_fields and cut_bytes -- Jim Meyering.
Options:
--bytes=byte-list
-b byte-list Print only the bytes in positions listed
in BYTE-LIST.
Tabs and backspaces are treated like any
other character; they take up 1 byte.
--characters=character-list
-c character-list Print only characters in positions listed
in CHARACTER-LIST.
The same as -b for now, but
internationalization will change that.
Tabs and backspaces are treated like any
other character; they take up 1 character.
--fields=field-list
-f field-list Print only the fields listed in FIELD-LIST.
Fields are separated by a TAB by default.
--delimiter=delim
-d delim For -f, fields are separated by the first
character in DELIM instead of TAB.
-n Do not split multibyte chars (no-op for now).
--only-delimited
-s For -f, do not print lines that do not contain
the field separator character.
The BYTE-LIST, CHARACTER-LIST, and FIELD-LIST are one or more numbers
or ranges separated by commas. The first byte, character, and field
are numbered 1.
A FILE of `-' means standard input. */
Rewrite cut_fields and cut_bytes -- Jim Meyering. */
#include <config.h>
@@ -116,7 +81,7 @@ struct range_pair
static char *field_1_buffer;
/* The number of bytes allocated for FIELD_1_BUFFER. */
static int field_1_bufsize;
static size_t field_1_bufsize;
/* The largest field or byte index used as an endpoint of a closed
or degenerate range specification; this doesn't include the starting
@@ -209,7 +174,9 @@ Print selected parts of lines from each FILE to standard output.\n\
-b, --bytes=LIST output only these bytes\n\
-c, --characters=LIST output only these characters\n\
-d, --delimiter=DELIM use DELIM instead of TAB for field delimiter\n\
-f, --fields=LIST output only these fields\n\
-f, --fields=LIST output only these fields; also print any line\n\
that contains no delimiter character, unless\n\
the -s option is specified\n\
-n (ignored)\n\
-s, --only-delimited do not print lines not containing delimiters\n\
--output-delimiter=STRING use STRING as the output delimiter\n\
@@ -478,9 +445,9 @@ cut_fields (FILE *stream)
delim, '\n', 0);
if (len < 0)
{
if (feof (stream))
if (ferror (stream) || feof (stream))
break;
FATAL_ERROR (_("Memory exhausted"));
xalloc_die ();
}
assert (len != 0);

View File

@@ -287,7 +287,8 @@ batch_convert (const char *input_filename, const char *format)
}
}
free (initial_TZ);
if (universal_time)
free (initial_TZ);
if (fclose (in_stream) == EOF)
error (2, errno, "`%s'", input_filename);

View File

@@ -35,6 +35,7 @@
#include "getpagesize.h"
#include "human.h"
#include "long-options.h"
#include "quote.h"
#include "safe-read.h"
#include "xstrtol.h"
@@ -366,9 +367,9 @@ cleanup (void)
{
print_stats ();
if (close (STDIN_FILENO) < 0)
error (1, errno, "%s", input_file);
error (1, errno, _("closing input file %s"), quote (input_file));
if (close (STDOUT_FILENO) < 0)
error (1, errno, "%s", output_file);
error (1, errno, _("closing output file %s"), quote (output_file));
}
static inline void
@@ -452,7 +453,7 @@ write_output (void)
int nwritten = full_write (STDOUT_FILENO, obuf, output_blocksize);
if (nwritten != output_blocksize)
{
error (0, errno, "%s", output_file);
error (0, errno, _("writing to %s"), quote (output_file));
if (nwritten > 0)
w_partial++;
quit (1);
@@ -484,7 +485,7 @@ parse_conversion (char *str)
}
if (conversions[i].convname == NULL)
{
error (0, 0, _("%s: invalid conversion"), str);
error (0, 0, _("invalid conversion: %s"), quote (str));
usage (1);
}
str = new;
@@ -540,7 +541,7 @@ scanargs (int argc, char **argv)
val = strchr (name, '=');
if (val == NULL)
{
error (0, 0, _("unrecognized option `%s'"), name);
error (0, 0, _("unrecognized option %s"), quote (name));
usage (1);
}
*val++ = '\0';
@@ -587,12 +588,13 @@ scanargs (int argc, char **argv)
max_records = n;
else
{
error (0, 0, _("unrecognized option `%s=%s'"), name, val);
error (0, 0, _("unrecognized option %s=%s"),
quote_n (0, name), quote_n (1, val));
usage (1);
}
if (invalid)
error (1, 0, _("invalid number `%s'"), val);
error (1, 0, _("invalid number %s"), quote (val));
}
}
@@ -716,9 +718,41 @@ swab_buffer (unsigned char *buf, size_t *nread)
return ++bufstart;
}
/* Return nonzero iff the file referenced by FDESC is of a type for
which lseek's return value is known to be invalid on some systems.
Otherwise, return zero.
For example, return nonzero if FDESC references a character device
(on any system) because the lseek on many Linux systems incorrectly
returns an offset implying it succeeds for tape devices, even though
the function fails to perform the requested operation. In that case,
lseek should return nonzero and set errno. */
static int
buggy_lseek_support (int fdesc)
{
/* We have to resort to this because on some systems, lseek doesn't work
on some special files but doesn't return an error, either.
In particular, the Linux tape drivers are a problem.
For example, when I did the following using dd-4.0y or earlier on a
Linux-2.2.17 system with a Exabyte SCSI tape drive:
dev=/dev/nst0
reset='mt -f $dev rewind; mt -f $dev fsf 1'
eval $reset; dd if=$dev bs=32k of=out1
eval $reset; dd if=$dev bs=32k of=out2 skip=1
the resulting files, out1 and out2, would compare equal. */
struct stat stats;
return (fstat (fdesc, &stats) == 0
&& (S_ISCHR (stats.st_mode)));
}
/* Throw away RECORDS blocks of BLOCKSIZE bytes on file descriptor FDESC,
which is open with read permission for FILE. Store up to BLOCKSIZE
bytes of the data at a time in BUF, if necessary. */
bytes of the data at a time in BUF, if necessary. RECORDS must be
nonzero. */
static void
skip (int fdesc, char *file, uintmax_t records, size_t blocksize,
@@ -727,10 +761,13 @@ skip (int fdesc, char *file, uintmax_t records, size_t blocksize,
off_t o;
/* Try lseek and if an error indicates it was an inappropriate
operation, fall back on using read. */
operation, fall back on using read. Some broken versions of
lseek may return zero, so count that as an error too as a valid
zero return is not possible here. */
o = records * blocksize;
if (o / blocksize != records
|| lseek (fdesc, o, SEEK_SET) == -1)
|| buggy_lseek_support (fdesc)
|| lseek (fdesc, o, SEEK_CUR) <= 0)
{
while (records-- > 0)
{
@@ -739,7 +776,7 @@ skip (int fdesc, char *file, uintmax_t records, size_t blocksize,
nread = safe_read (fdesc, buf, blocksize);
if (nread < 0)
{
error (0, errno, "%s", file);
error (0, errno, _("reading %s"), quote (file));
quit (1);
}
/* POSIX doesn't say what to do when dd detects it has been
@@ -932,7 +969,7 @@ dd_copy (void)
if (nread < 0)
{
error (0, errno, "%s", input_file);
error (0, errno, _("reading %s"), quote (input_file));
if (conversions_mask & C_NOERROR)
{
print_stats ();
@@ -975,7 +1012,7 @@ dd_copy (void)
int nwritten = full_write (STDOUT_FILENO, obuf, n_bytes_read);
if (nwritten < 0)
{
error (0, errno, "%s", output_file);
error (0, errno, _("writing %s"), quote (output_file));
quit (1);
}
else if (n_bytes_read == input_blocksize)
@@ -1036,7 +1073,7 @@ dd_copy (void)
w_partial++;
if (nwritten < 0)
{
error (0, errno, "%s", output_file);
error (0, errno, _("writing %s"), quote (output_file));
quit (1);
}
}
@@ -1091,7 +1128,7 @@ main (int argc, char **argv)
if (input_file != NULL)
{
if (open_fd (STDIN_FILENO, input_file, O_RDONLY, 0) < 0)
error (1, errno, "%s", input_file);
error (1, errno, _("opening %s"), quote (input_file));
}
else
input_file = _("standard input");
@@ -1109,7 +1146,7 @@ main (int argc, char **argv)
if ((! seek_record
|| open_fd (STDOUT_FILENO, output_file, O_RDWR | opts, perms) < 0)
&& open_fd (STDOUT_FILENO, output_file, O_WRONLY | opts, perms) < 0)
error (1, errno, "%s", output_file);
error (1, errno, _("opening %s"), quote (output_file));
#if HAVE_FTRUNCATE
if (seek_record != 0 && !(conversions_mask & C_NOTRUNC))
{
@@ -1117,7 +1154,12 @@ main (int argc, char **argv)
if (o / output_blocksize != seek_record)
error (1, 0, _("file offset out of range"));
if (ftruncate (STDOUT_FILENO, o) < 0)
error (1, errno, "%s", output_file);
{
char buf[LONGEST_HUMAN_READABLE + 1];
error (1, errno, _("advancing past %s blocks in output file %s"),
human_readable (seek_record, buf, 1, 1),
quote (output_file));
}
}
#endif
}

View File

@@ -39,6 +39,7 @@
#include "human.h"
#include "mountlist.h"
#include "path-concat.h"
#include "quote.h"
#include "save-cwd.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -275,7 +276,7 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
if (get_fs_usage (stat_file, disk, &fsu))
{
error (0, errno, "%s", stat_file);
error (0, errno, "%s", quote (stat_file));
exit_status = 1;
return;
}
@@ -627,7 +628,7 @@ show_point (const char *point, const struct stat *statp)
me->me_dev = disk_stats.st_dev;
else
{
error (0, errno, "%s", me->me_mountdir);
error (0, errno, "%s", quote (me->me_mountdir));
exit_status = 1;
/* So we won't try and fail repeatedly. */
me->me_dev = (dev_t) -2;
@@ -666,7 +667,7 @@ show_point (const char *point, const struct stat *statp)
free (mp);
}
else
error (0, errno, "%s", point);
error (0, errno, "%s", quote (point));
}
goto free_then_return;
@@ -872,8 +873,8 @@ main (int argc, char **argv)
if (STREQ (fs_incl->fs_name, fs_excl->fs_name))
{
error (0, 0,
_("file system type `%s' both selected and excluded"),
fs_incl->fs_name);
_("file system type %s both selected and excluded"),
quote (fs_incl->fs_name));
match = 1;
break;
}
@@ -894,7 +895,7 @@ main (int argc, char **argv)
{
if (stat (argv[i], &stats[i - optind]))
{
error (0, errno, "%s", argv[i]);
error (0, errno, "%s", quote (argv[i]));
exit_status = 1;
argv[i] = NULL;
}

View File

@@ -1,6 +1,6 @@
/* dircolors - output commands to set the LS_COLOR environment variable
Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000 H. Peter Anvin
Copyright (C) 1996-1999 Free Software Foundation, Inc.
Copyright (C) 1996-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
@@ -30,6 +30,7 @@
#include "error.h"
#include "getline.h"
#include "obstack.h"
#include "quote.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "dircolors"
@@ -125,7 +126,7 @@ xstrndup (const char *s, size_t n)
{
char *new = strndup (s, n);
if (new == NULL)
error (EXIT_FAILURE, 0, _("virtual memory exhausted"));
xalloc_die ();
return new;
}
@@ -365,8 +366,8 @@ dc_parse_stream (FILE *fp, const char *filename)
if (unrecognized && (state == ST_TERMSURE || state == ST_TERMYES))
{
error (0, 0, _("%s:%lu: unrecognized keyword `%s'"),
(filename ? filename : _("<internal>")),
error (0, 0, _("%s:%lu: unrecognized keyword %s"),
(filename ? quote (filename) : _("<internal>")),
(long unsigned) line_number, keywd);
err = 1;
}
@@ -399,7 +400,7 @@ dc_parse_file (const char *filename)
fp = fopen (filename, "r");
if (fp == NULL)
{
error (0, errno, "%s", filename);
error (0, errno, "%s", quote (filename));
return 1;
}
}
@@ -408,7 +409,7 @@ dc_parse_file (const char *filename)
if (fp != stdin && fclose (fp) == EOF)
{
error (0, errno, "%s", filename);
error (0, errno, "%s", quote (filename));
return 1;
}

View File

@@ -55,6 +55,7 @@
#include "error.h"
#include "exclude.h"
#include "human.h"
#include "quote.h"
#include "save-cwd.h"
#include "savedir.h"
#include "xstrtol.h"
@@ -122,7 +123,7 @@ static int opt_count_all = 0;
static int opt_one_file_system = 0;
/* If nonzero, print a grand total at the end. */
static int opt_combined_arguments = 0;
static int print_totals = 0;
/* If nonzero, do not add sizes of subdirectories. */
static int opt_separate_dirs = 0;
@@ -471,7 +472,7 @@ pop_dir (struct saved_cwd *cwd, const char *curr_dir_name)
else if (chdir ("..") < 0)
{
error (1, errno, _("cannot change to `..' from directory %s"),
curr_dir_name);
quote (curr_dir_name));
}
}
@@ -494,7 +495,7 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
? stat (ent, &stat_buf)
: (*xstat) (ent, &stat_buf)) < 0)
{
error (0, errno, "%s", path->text);
error (0, errno, "%s", quote (path->text));
exit_status = 1;
return 0;
}
@@ -528,8 +529,12 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
/* If we're traversing more than one level, or if we're
dereferencing symlinks and we're about to chdir through a
symlink, remember the current directory so we can return to
it later. In other cases, chdir ("..") works fine. */
it later. In other cases, chdir ("..") works fine.
Treat `.' and `..' like multi-level paths, since `chdir ("..")'
wont't restore the current working directory after a `chdir'
to one of those. */
if (strchr (ent, '/')
|| DOT_OR_DOTDOT (ent)
|| (xstat == stat
&& lstat (ent, &e_buf) == 0
&& S_ISLNK (e_buf.st_mode)))
@@ -543,7 +548,8 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
if (chdir (ent) < 0)
{
error (0, errno, _("cannot change to directory %s"), path->text);
error (0, errno, _("cannot change to directory %s"),
quote (path->text));
if (cwd)
free_cwd (cwd);
exit_status = 1;
@@ -553,7 +559,7 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
name_space = savedir (".", stat_buf.st_size);
if (name_space == NULL)
{
error (0, errno, "%s", path->text);
error (0, errno, "%s", quote (path->text));
pop_dir (cwd, path->text);
exit_status = 1;
return 0;
@@ -622,13 +628,13 @@ du_files (char **files)
else
str_copyc (path, arg);
if (!opt_combined_arguments)
if (!print_totals)
hash_reset ();
count_entry (arg, 1, 0, 0);
}
if (opt_combined_arguments)
if (print_totals)
print_size (tot_size, _("total"));
}
@@ -675,7 +681,7 @@ main (int argc, char **argv)
break;
case 'c':
opt_combined_arguments = 1;
print_totals = 1;
break;
case 'h':
@@ -693,7 +699,7 @@ main (int argc, char **argv)
case MAX_DEPTH_OPTION: /* --max-depth=N */
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
error (1, 0, _("invalid maximum depth `%s'"), optarg);
error (1, 0, _("invalid maximum depth %s"), quote (optarg));
max_depth_specified = 1;
max_depth = (int) tmp_long;
@@ -729,7 +735,7 @@ main (int argc, char **argv)
case 'X':
if (add_exclude_file (add_exclude, exclude, optarg, '\n') != 0)
error (1, errno, "%s", optarg);
error (1, errno, "%s", quote (optarg));
break;
case EXCLUDE_OPTION:

View File

@@ -1,5 +1,5 @@
/* factor -- print factors of n.
Copyright (C) 86, 95, 96, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 86, 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

View File

@@ -221,12 +221,6 @@ fold_file (char *filename, int width)
return 1;
}
if (ferror (stdout))
{
error (0, errno, _("write error"));
return 1;
}
return 0;
}

View File

@@ -175,6 +175,9 @@ head_lines (const char *filename, int fd, uintmax_t lines_to_write)
static int
head (const char *filename, int fd, uintmax_t n_units, int count_lines)
{
if (print_headers)
write_header (filename);
if (count_lines)
return head_lines (filename, fd, n_units);
else
@@ -189,10 +192,7 @@ head_file (const char *filename, uintmax_t n_units, int count_lines)
if (STREQ (filename, "-"))
{
have_read_stdin = 1;
filename = _("standard input");
if (print_headers)
write_header (filename);
return head (filename, STDIN_FILENO, n_units, count_lines);
return head (_("standard input"), STDIN_FILENO, n_units, count_lines);
}
else
{
@@ -201,8 +201,6 @@ head_file (const char *filename, uintmax_t n_units, int count_lines)
{
int errors;
if (print_headers)
write_header (filename);
errors = head (filename, fd, n_units, count_lines);
if (close (fd) == 0)
return errors;

View File

@@ -80,6 +80,7 @@
#include "makepath.h"
#include "modechange.h"
#include "path-concat.h"
#include "quote.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -187,8 +188,9 @@ static void
cp_option_init (struct cp_options *x)
{
x->copy_as_regular = 1;
x->dereference = 1;
x->force = 1;
x->dereference = DEREF_ALWAYS;
x->unlink_dest_before_opening = 0;
x->unlink_dest_after_failed_open = 1;
/* If unlink fails, try to proceed anyway. */
x->failed_unlink_is_fatal = 0;
@@ -330,9 +332,9 @@ main (int argc, char **argv)
{
struct mode_change *change = mode_compile (symbolic_mode, 0);
if (change == MODE_INVALID)
error (1, 0, _("invalid mode `%s'"), symbolic_mode);
error (1, 0, _("invalid mode %s"), quote (symbolic_mode));
else if (change == MODE_MEMORY_EXHAUSTED)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
mode = mode_adjust (0, change);
}
@@ -345,7 +347,7 @@ main (int argc, char **argv)
{
errors |=
make_path (file[i], mode, mode, owner_id, group_id, 0,
(x.verbose ? "creating directory `%s'" : NULL));
(x.verbose ? _("creating directory %s") : NULL));
}
}
else
@@ -370,9 +372,9 @@ main (int argc, char **argv)
if (!isdir (dest))
{
error (0, 0,
_("installing multiple files, but last argument (%s) \
_("installing multiple files, but last argument, %s \
is not a directory"),
dest);
quote (dest));
usage (1);
}
for (i = 0; i < n_files - 1; i++)
@@ -407,7 +409,7 @@ install_file_to_path (const char *from, const char *to,
distribution doesn't provide proper install rules. */
#define DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
fail = make_path (dest_dir, DIR_MODE, DIR_MODE, owner_id, group_id, 0,
(x->verbose ? _("creating directory `%s'") : NULL));
(x->verbose ? _("creating directory %s") : NULL));
}
if (fail == 0)
@@ -471,7 +473,7 @@ copy_file (const char *from, const char *to, const struct cp_options *x)
and that sendmail's installation process relies on the behavior. */
if (isdir (from))
{
error (0, 0, _("`%s' is a directory"), from);
error (0, 0, _("%s is a directory"), quote (from));
return 1;
}
@@ -507,13 +509,13 @@ change_attributes (const char *path)
#endif
)
{
error (0, errno, "cannot change ownership of `%s'", path);
error (0, errno, "cannot change ownership of %s", quote (path));
err = 1;
}
if (!err && chmod (path, mode))
{
error (0, errno, "cannot change permissions of `%s'", path);
error (0, errno, "cannot change permissions of %s", quote (path));
err = 1;
}
@@ -531,7 +533,7 @@ change_timestamps (const char *from, const char *to)
if (stat (from, &stb))
{
error (0, errno, "%s", from);
error (0, errno, _("cannot obtain time stamps for %s"), quote (from));
return 1;
}
@@ -543,7 +545,7 @@ change_timestamps (const char *from, const char *to)
utb.modtime = stb.st_mtime;
if (utime (to, &utb))
{
error (0, errno, "%s", to);
error (0, errno, _("cannot set time stamps for %s"), quote (to));
return 1;
}
return 0;
@@ -596,7 +598,7 @@ get_ids (void)
long int tmp_long;
if (xstrtol (owner_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > UID_T_MAX)
error (1, 0, _("invalid user `%s'"), owner_name);
error (1, 0, _("invalid user %s"), quote (owner_name));
owner_id = (uid_t) tmp_long;
}
else
@@ -614,7 +616,7 @@ get_ids (void)
long int tmp_long;
if (xstrtol (group_name, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > GID_T_MAX)
error (1, 0, _("invalid group `%s'"), group_name);
error (1, 0, _("invalid group %s"), quote (group_name));
group_id = (gid_t) tmp_long;
}
else

View File

@@ -30,6 +30,7 @@
#include "same.h"
#include "backupfile.h"
#include "error.h"
#include "quote.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "ln"
@@ -157,7 +158,7 @@ do_link (const char *source, const char *dest)
{
if (STAT_LIKE_LINK (source, &source_stats) != 0)
{
error (0, errno, "%s", source);
error (0, errno, _("accessing %s"), quote (source));
return 1;
}
@@ -165,12 +166,13 @@ do_link (const char *source, const char *dest)
{
error (0, 0, _("%s: warning: making a hard link to a symbolic link\
is not portable"),
source);
quote (source));
}
if (!hard_dir_link && S_ISDIR (source_stats.st_mode))
{
error (0, 0, _("%s: hard link not allowed for directory"), source);
error (0, 0, _("%s: hard link not allowed for directory"),
quote (source));
return 1;
}
}
@@ -178,7 +180,7 @@ do_link (const char *source, const char *dest)
lstat_status = lstat (dest, &dest_stats);
if (lstat_status != 0 && errno != ENOENT)
{
error (0, errno, "%s", dest);
error (0, errno, _("accessing %s"), quote (dest));
return 1;
}
@@ -205,7 +207,7 @@ do_link (const char *source, const char *dest)
lstat_status = lstat (dest, &dest_stats);
if (lstat_status != 0 && errno != ENOENT)
{
error (0, errno, "%s", dest);
error (0, errno, _("accessing %s"), quote (dest));
return 1;
}
}
@@ -232,7 +234,8 @@ do_link (const char *source, const char *dest)
name in the same directory. */
&& (source_stats.st_nlink == 1 || same_name (source, dest)))
{
error (0, 0, _("`%s' and `%s' are the same file"), source, dest);
error (0, 0, _("%s and %s are the same file"),
quote_n (0, source), quote_n (1, dest));
return 1;
}
@@ -240,18 +243,18 @@ do_link (const char *source, const char *dest)
{
if (S_ISDIR (dest_stats.st_mode))
{
error (0, 0, _("%s: cannot overwrite directory"), dest);
error (0, 0, _("%s: cannot overwrite directory"), quote (dest));
return 1;
}
if (interactive)
{
fprintf (stderr, _("%s: replace `%s'? "), program_name, dest);
fprintf (stderr, _("%s: replace %s? "), program_name, quote (dest));
if (!yesno ())
return 0;
}
else if (!remove_existing_files && backup_type == none)
{
error (0, 0, _("%s: File exists"), dest);
error (0, 0, _("%s: File exists"), quote (dest));
return 1;
}
@@ -259,7 +262,7 @@ do_link (const char *source, const char *dest)
{
char *tmp_backup = find_backup_file_name (dest, backup_type);
if (tmp_backup == NULL)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
dest_backup = (char *) alloca (strlen (tmp_backup) + 1);
strcpy (dest_backup, tmp_backup);
free (tmp_backup);
@@ -267,7 +270,7 @@ do_link (const char *source, const char *dest)
{
if (errno != ENOENT)
{
error (0, errno, _("cannot backup `%s'"), dest);
error (0, errno, _("cannot backup %s"), quote (dest));
return 1;
}
else
@@ -285,24 +288,24 @@ do_link (const char *source, const char *dest)
DEST in that case, the subsequent LINKFUNC call would fail. */
if (unlink (dest) && errno != ENOENT)
{
error (0, errno, _("cannot remove `%s'"), dest);
error (0, errno, _("cannot remove %s"), quote (dest));
return 1;
}
}
else if (errno != ENOENT)
{
error (0, errno, "%s", dest);
error (0, errno, _("accessing %s"), quote (dest));
return 1;
}
if (verbose)
{
printf ((symbolic_link
? _("create symbolic link `%s' to `%s'")
: _("create hard link `%s' to `%s'")),
dest, source);
? _("create symbolic link %s to %s")
: _("create hard link %s to %s")),
quote_n (0, dest), quote_n (1, source));
if (backup_succeeded)
printf (_(" (backup: %s)"), dest_backup);
printf (_(" (backup: %s)"), quote (dest_backup));
putchar ('\n');
}
@@ -313,14 +316,14 @@ do_link (const char *source, const char *dest)
error (0, errno,
(symbolic_link
? _("create symbolic link `%s' to `%s'")
: _("create hard link `%s' to `%s'")),
dest, source);
? _("creating symbolic link %s to %s")
: _("creating hard link %s to %s")),
quote_n (0, dest), quote_n (1, source));
if (dest_backup)
{
if (rename (dest_backup, dest))
error (0, errno, _("cannot un-backup `%s'"), dest);
error (0, errno, _("cannot un-backup %s"), quote (dest));
}
return 1;
}
@@ -503,8 +506,8 @@ main (int argc, char **argv)
if (target_directory_specified && !dest_is_dir)
{
error (0, 0, _("specified target directory, `%s' is not a directory"),
target_directory);
error (0, 0, _("specified target directory, %s is not a directory"),
quote (target_directory));
usage (1);
}

235
src/ls.c
View File

@@ -70,6 +70,50 @@
#include <pwd.h>
#include <getopt.h>
/* Get MB_LEN_MAX. */
#if HAVE_LIMITS_H
# include <limits.h>
#endif
/* Get MB_CUR_MAX. */
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
#if HAVE_WCHAR_H
# include <wchar.h>
#endif
/* Get iswprint(). */
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
#if !defined iswprint && !HAVE_ISWPRINT
# define iswprint(wc) 1
#endif
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
#if HAVE_MBRTOWC && defined mbstate_t
# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
# define mbsinit(ps) 1
#endif
#ifndef HAVE_DECL_WCWIDTH
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_WCWIDTH
int wcwidth ();
#endif
/* If wcwidth() doesn't exist, assume all printable characters have
width 1. */
#ifndef wcwidth
# if !HAVE_WCWIDTH
# define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1)
# endif
#endif
#include "system.h"
#include <fnmatch.h>
@@ -78,6 +122,7 @@
#include "human.h"
#include "filemode.h"
#include "ls.h"
#include "mbswidth.h"
#include "obstack.h"
#include "path-concat.h"
#include "quotearg.h"
@@ -202,7 +247,7 @@ struct fileinfo
struct bin_str
{
int len; /* Number of bytes */
char *string; /* Pointer to the same */
const char *string; /* Pointer to the same */
};
#ifndef STDC_HEADERS
@@ -2064,7 +2109,7 @@ compare_ctime (const struct fileinfo *file1, const struct fileinfo *file2)
{
int diff = CTIME_CMP (file2->stat, file1->stat);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2073,7 +2118,7 @@ rev_cmp_ctime (const struct fileinfo *file2, const struct fileinfo *file1)
{
int diff = CTIME_CMP (file2->stat, file1->stat);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2082,7 +2127,7 @@ compare_mtime (const struct fileinfo *file1, const struct fileinfo *file2)
{
int diff = MTIME_CMP (file2->stat, file1->stat);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2091,7 +2136,7 @@ rev_cmp_mtime (const struct fileinfo *file2, const struct fileinfo *file1)
{
int diff = MTIME_CMP (file2->stat, file1->stat);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2100,7 +2145,7 @@ compare_atime (const struct fileinfo *file1, const struct fileinfo *file2)
{
int diff = ATIME_CMP (file2->stat, file1->stat);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2109,7 +2154,7 @@ rev_cmp_atime (const struct fileinfo *file2, const struct fileinfo *file1)
{
int diff = ATIME_CMP (file2->stat, file1->stat);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2118,7 +2163,7 @@ compare_size (const struct fileinfo *file1, const struct fileinfo *file2)
{
int diff = longdiff (file2->stat.st_size, file1->stat.st_size);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2127,7 +2172,7 @@ rev_cmp_size (const struct fileinfo *file2, const struct fileinfo *file1)
{
int diff = longdiff (file2->stat.st_size, file1->stat.st_size);
if (diff == 0)
diff = strcmp (file1->name, file2->name);
diff = strcoll (file1->name, file2->name);
return diff;
}
@@ -2146,13 +2191,13 @@ rev_cmp_version (const struct fileinfo *file2, const struct fileinfo *file1)
static int
compare_name (const struct fileinfo *file1, const struct fileinfo *file2)
{
return strcmp (file1->name, file2->name);
return strcoll (file1->name, file2->name);
}
static int
rev_cmp_name (const struct fileinfo *file2, const struct fileinfo *file1)
{
return strcmp (file1->name, file2->name);
return strcoll (file1->name, file2->name);
}
/* Compare file extensions. Files with no extension are `smallest'.
@@ -2167,14 +2212,14 @@ compare_extension (const struct fileinfo *file1, const struct fileinfo *file2)
base1 = strrchr (file1->name, '.');
base2 = strrchr (file2->name, '.');
if (base1 == 0 && base2 == 0)
return strcmp (file1->name, file2->name);
return strcoll (file1->name, file2->name);
if (base1 == 0)
return -1;
if (base2 == 0)
return 1;
cmp = strcmp (base1, base2);
cmp = strcoll (base1, base2);
if (cmp == 0)
return strcmp (file1->name, file2->name);
return strcoll (file1->name, file2->name);
return cmp;
}
@@ -2187,14 +2232,14 @@ rev_cmp_extension (const struct fileinfo *file2, const struct fileinfo *file1)
base1 = strrchr (file1->name, '.');
base2 = strrchr (file2->name, '.');
if (base1 == 0 && base2 == 0)
return strcmp (file1->name, file2->name);
return strcoll (file1->name, file2->name);
if (base1 == 0)
return -1;
if (base2 == 0)
return 1;
cmp = strcmp (base1, base2);
cmp = strcoll (base1, base2);
if (cmp == 0)
return strcmp (file1->name, file2->name);
return strcoll (file1->name, file2->name);
return cmp;
}
@@ -2422,35 +2467,163 @@ print_long_format (const struct fileinfo *f)
print_type_indicator (f->stat.st_mode);
}
/* Output to OUT a quoted representation of the file name P,
using OPTIONS to control quoting.
Return the number of characters in P's quoted representation. */
/* Output to OUT a quoted representation of the file name NAME,
using OPTIONS to control quoting. Produce no output if OUT is NULL.
Return the number of screen columns occupied by NAME's quoted
representation. */
static size_t
quote_name (FILE *out, const char *p, struct quoting_options const *options)
quote_name (FILE *out, const char *name, struct quoting_options const *options)
{
char smallbuf[BUFSIZ];
size_t len = quotearg_buffer (smallbuf, sizeof smallbuf, p, -1, options);
size_t len = quotearg_buffer (smallbuf, sizeof smallbuf, name, -1, options);
char *buf;
int displayed_width;
if (len < sizeof smallbuf)
buf = smallbuf;
else
{
buf = (char *) alloca (len + 1);
quotearg_buffer (buf, len + 1, p, -1, options);
quotearg_buffer (buf, len + 1, name, -1, options);
}
if (qmark_funny_chars)
{
size_t i;
for (i = 0; i < len; i++)
if (! ISPRINT ((unsigned char) buf[i]))
buf[i] = '?';
#if HAVE_MBRTOWC && (MB_LEN_MAX > 1)
if (MB_CUR_MAX > 1)
{
const char *p = buf;
char *plimit = buf + len;
char *q = buf;
displayed_width = 0;
while (p < plimit)
switch (*p)
{
case ' ': case '!': case '"': case '#': case '%':
case '&': case '\'': case '(': case ')': case '*':
case '+': case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case ':': case ';': case '<': case '=': case '>':
case '?':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
case '[': case '\\': case ']': case '^': case '_':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z': case '{': case '|': case '}': case '~':
/* These characters are printable ASCII characters. */
*q++ = *p++;
displayed_width += 1;
break;
default:
/* If we have a multibyte sequence, copy it until we
reach its end, replacing each non-printable multibyte
character with a single question mark. */
{
mbstate_t mbstate;
memset (&mbstate, 0, sizeof mbstate);
do
{
wchar_t wc;
size_t bytes;
int w;
bytes = mbrtowc (&wc, p, plimit - p, &mbstate);
if (bytes == (size_t) -1)
{
/* An invalid multibyte sequence was
encountered. Skip one input byte, and
put a question mark. */
p++;
*q++ = '?';
displayed_width += 1;
break;
}
if (bytes == (size_t) -2)
{
/* An incomplete multibyte character
at the end. Replace it entirely with
a question mark. */
p = plimit;
*q++ = '?';
displayed_width += 1;
break;
}
if (bytes == 0)
/* A null wide character was encountered. */
bytes = 1;
w = wcwidth (wc);
if (w >= 0)
{
/* A printable multibyte character.
Keep it. */
for (; bytes > 0; --bytes)
*q++ = *p++;
displayed_width += w;
}
else
{
/* An unprintable multibyte character.
Replace it entirely with a question
mark. */
p += bytes;
*q++ = '?';
displayed_width += 1;
}
}
while (! mbsinit (&mbstate));
}
break;
}
/* The buffer may have shrunk. */
len = q - buf;
}
else
#endif
{
char *p = buf;
char *plimit = buf + len;
while (p < plimit)
{
if (! ISPRINT ((unsigned char) *p))
*p = '?';
p++;
}
displayed_width = len;
}
}
else
{
/* Assume unprintable characters have a displayed_width of 1. */
#if HAVE_MBRTOWC && (MB_LEN_MAX > 1)
if (MB_CUR_MAX > 1)
displayed_width = mbsnwidth (buf, len,
(MBSW_ACCEPT_INVALID
| MBSW_ACCEPT_UNPRINTABLE));
else
#endif
displayed_width = len;
}
fwrite (buf, 1, len, out);
return len;
if (out != NULL)
fwrite (buf, 1, len, out);
return displayed_width;
}
static void
@@ -2605,7 +2778,7 @@ static void
put_indicator (const struct bin_str *ind)
{
register int i;
register char *p;
register const char *p;
p = ind->string;
@@ -2624,7 +2797,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
if (print_block_size)
len += 1 + block_size_size;
len += quotearg_buffer (0, 0, f->name, -1, filename_quoting_options);
len += quote_name (NULL, f->name, filename_quoting_options);
if (indicator_style != none)
{

View File

@@ -18,9 +18,7 @@
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <config.h>
#include <getopt.h>
#include <stdio.h>

View File

@@ -26,10 +26,7 @@
#include "error.h"
#include "makepath.h"
#include "modechange.h"
#ifndef S_IRWXUGO
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
#endif
#include "quote.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "mkdir"
@@ -107,7 +104,7 @@ main (int argc, char **argv)
symbolic_mode = optarg;
break;
case 'v': /* --verbose */
verbose_fmt_string = _("created directory `%s'");
verbose_fmt_string = _("created directory %s");
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -128,9 +125,9 @@ main (int argc, char **argv)
{
struct mode_change *change = mode_compile (symbolic_mode, 0);
if (change == MODE_INVALID)
error (1, 0, _("invalid mode `%s'"), symbolic_mode);
error (1, 0, _("invalid mode %s"), quote (symbolic_mode));
else if (change == MODE_MEMORY_EXHAUSTED)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
newmode = mode_adjust (newmode, change);
}
@@ -146,9 +143,10 @@ main (int argc, char **argv)
{
fail = mkdir (argv[optind], newmode);
if (fail)
error (0, errno, _("cannot create directory `%s'"), argv[optind]);
error (0, errno, _("cannot create directory %s"),
quote (argv[optind]));
else if (verbose_fmt_string)
error (0, 0, verbose_fmt_string, argv[optind]);
error (0, 0, verbose_fmt_string, quote (argv[optind]));
/* mkdir(2) is required to honor only the file permission bits.
In particular, it needn't do anything about `special' bits,
@@ -157,8 +155,8 @@ main (int argc, char **argv)
{
fail = chmod (argv[optind], newmode);
if (fail)
error (0, errno, _("cannot set permissions of directory `%s'"),
argv[optind]);
error (0, errno, _("cannot set permissions of directory %s"),
quote (argv[optind]));
}
}

View File

@@ -1,5 +1,5 @@
/* mkfifo -- make fifo's (named pipes)
Copyright (C) 90, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 90, 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
@@ -30,6 +30,7 @@
#include "system.h"
#include "error.h"
#include "modechange.h"
#include "quote.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "mkfifo"
@@ -121,7 +122,7 @@ main (int argc, char **argv)
if (change == MODE_INVALID)
error (1, 0, _("invalid mode"));
else if (change == MODE_MEMORY_EXHAUSTED)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
newmode = mode_adjust (newmode, change);
}
@@ -129,7 +130,7 @@ main (int argc, char **argv)
{
if (mkfifo (argv[optind], newmode))
{
error (0, errno, _("cannot make fifo `%s'"), argv[optind]);
error (0, errno, _("cannot make fifo %s"), quote (argv[optind]));
errors = 1;
}
}

View File

@@ -1,5 +1,5 @@
/* mknod -- make special files
Copyright (C) 90, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 90, 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
@@ -35,6 +35,7 @@
#include "system.h"
#include "error.h"
#include "modechange.h"
#include "quote.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -124,7 +125,7 @@ main (int argc, char **argv)
if (change == MODE_INVALID)
error (1, 0, _("invalid mode"));
else if (change == MODE_MEMORY_EXHAUSTED)
error (1, 0, _("virtual memory exhausted"));
xalloc_die ();
newmode = mode_adjust (newmode, change);
}
@@ -160,17 +161,17 @@ numbers must be specified"));
s = argv[optind + 2];
if (xstrtol (s, NULL, 0, &tmp_major, NULL) != LONGINT_OK)
error (1, 0, _("invalid major device number `%s'"), s);
error (1, 0, _("invalid major device number %s"), quote (s));
s = argv[optind + 3];
if (xstrtol (s, NULL, 0, &tmp_minor, NULL) != LONGINT_OK)
error (1, 0, _("invalid minor device number `%s'"), s);
error (1, 0, _("invalid minor device number %s"), quote (s));
i_major = (int) tmp_major;
i_minor = (int) tmp_minor;
if (mknod (argv[optind], newmode | S_IFBLK, makedev (i_major, i_minor)))
error (1, errno, "%s", argv[optind]);
error (1, errno, "%s", quote (argv[optind]));
#endif
break;
@@ -189,17 +190,17 @@ numbers must be specified"));
s = argv[optind + 2];
if (xstrtol (s, NULL, 0, &tmp_major, NULL) != LONGINT_OK)
error (1, 0, _("invalid major device number `%s'"), s);
error (1, 0, _("invalid major device number %s"), quote (s));
s = argv[optind + 3];
if (xstrtol (s, NULL, 0, &tmp_minor, NULL) != LONGINT_OK)
error (1, 0, _("invalid minor device number `%s'"), s);
error (1, 0, _("invalid minor device number %s"), quote (s));
i_major = (int) tmp_major;
i_minor = (int) tmp_minor;
if (mknod (argv[optind], newmode | S_IFCHR, makedev (i_major, i_minor)))
error (1, errno, "%s", argv[optind]);
error (1, errno, "%s", quote (argv[optind]));
#endif
break;
@@ -214,7 +215,7 @@ major and minor device numbers may not be specified for fifo files"));
usage (1);
}
if (mkfifo (argv[optind], newmode))
error (1, errno, "%s", argv[optind]);
error (1, errno, "%s", quote (argv[optind]));
#endif
break;

Some files were not shown because too many files have changed in this diff Show More