Compare commits

...

218 Commits

Author SHA1 Message Date
Jim Meyering
c96ef37ba9 *** empty log message *** 1998-02-22 09:20:33 +00:00
Jim Meyering
ccc65c4a81 *** empty log message *** 1998-02-22 09:20:17 +00:00
Jim Meyering
be5250f0ec *** empty log message *** 1998-02-22 09:19:36 +00:00
Jim Meyering
d1c1677873 . 1998-02-22 09:18:33 +00:00
Jim Meyering
6eae430477 Truncate to 1998 entries only. 1998-02-22 09:17:58 +00:00
Jim Meyering
82d361dc53 *** empty log message *** 1998-02-22 09:10:57 +00:00
Jim Meyering
6e05a13259 revert most of last delta, but leave cppi/copyright changes 1998-02-22 08:21:07 +00:00
Jim Meyering
a1413ad1cd *** empty log message *** 1998-02-22 08:19:19 +00:00
Jim Meyering
c9dd33ec3f *** empty log message *** 1998-02-22 08:18:51 +00:00
Jim Meyering
b9a394eec5 *** empty log message *** 1998-02-21 16:15:23 +00:00
Jim Meyering
f315b52ca9 . 1998-02-21 16:14:42 +00:00
Jim Meyering
26c02dd946 . 1998-02-21 16:14:15 +00:00
Jim Meyering
a03a97d7d8 *** empty log message *** 1998-02-21 16:14:05 +00:00
Jim Meyering
ead1152ef8 *** empty log message *** 1998-02-21 11:55:30 +00:00
Jim Meyering
2326be84d5 *** empty log message *** 1998-02-21 11:54:09 +00:00
Jim Meyering
7980fa3b78 *** empty log message *** 1998-02-21 11:53:27 +00:00
Jim Meyering
70a8ff09ed *** empty log message *** 1998-02-21 11:52:45 +00:00
Jim Meyering
38a63c863e . 1998-02-21 11:44:39 +00:00
Jim Meyering
a4fb33a110 . 1998-02-21 11:44:13 +00:00
Jim Meyering
bd9a38183c *** empty log message *** 1998-02-21 11:39:06 +00:00
Jim Meyering
45d85e3ba2 . 1998-02-21 11:38:47 +00:00
Jim Meyering
afa328c54e . 1998-02-21 11:33:09 +00:00
Jim Meyering
c66e967d70 . 1998-02-21 11:29:12 +00:00
Jim Meyering
ccaf565665 *** empty log message *** 1998-02-21 11:28:46 +00:00
Jim Meyering
b1a82ad6f2 . 1998-02-21 11:17:06 +00:00
Jim Meyering
c9a2ec01e5 *** empty log message *** 1998-02-21 11:15:43 +00:00
Jim Meyering
f7acc2f589 *** empty log message *** 1998-02-21 11:09:33 +00:00
Jim Meyering
5bf77e1015 . 1998-02-21 11:04:07 +00:00
Jim Meyering
3aa15eac61 *** empty log message *** 1998-02-20 21:51:48 +00:00
Jim Meyering
5799c6474d . 1998-02-20 21:50:49 +00:00
Jim Meyering
f8998dae41 Include get-date.h.
Remove get_date decl.
1998-02-20 21:50:30 +00:00
Jim Meyering
a7ba2688ca s/getdate.h/get-date.h/ 1998-02-20 21:47:10 +00:00
Jim Meyering
6810b30f39 (noinst_HEADERS): s/getdate.h/get-date.h/ 1998-02-20 21:42:29 +00:00
Jim Meyering
f8d66bde6a s/getdate.h/get-date.h/ 1998-02-20 21:42:11 +00:00
Jim Meyering
4675b67c10 . 1998-02-20 12:22:50 +00:00
Jim Meyering
ae3c7c2fb1 *** empty log message *** 1998-02-19 21:38:16 +00:00
Jim Meyering
a3ff199f12 *** empty log message *** 1998-02-19 21:37:45 +00:00
Jim Meyering
61ef81a837 (dirname): Include ctype.h.
[IN_CTYPE_DOMAIN]: Define.
[ISALPHA]: Define.
[MSDOS]: Add support for DOS-style file names with drive letters.
Based on a patch from Eli Zaretskii.
1998-02-19 21:31:06 +00:00
Jim Meyering
dcb8db3c82 [__DJGPP__]: Add missing typedef for daddr_t. 1998-02-19 21:28:38 +00:00
Jim Meyering
92b49f0da1 *** empty log message *** 1998-02-16 23:28:09 +00:00
Jim Meyering
f322649c58 (cp_option_init): Set copy_as_regular to 0, not 1.
Otherwise, mv tries to open special files.
Reported by Kjetil Torgrim Homme.
1998-02-16 23:27:50 +00:00
Jim Meyering
f49fee3e5f *** empty log message *** 1998-02-13 08:49:34 +00:00
Jim Meyering
6dbc8ff80b *** empty log message *** 1998-02-13 08:48:54 +00:00
Jim Meyering
65978b6328 Add my comment from ChangeLog entry for gkm's change. 1998-02-11 22:17:38 +00:00
Jim Meyering
5f8949c46c *** empty log message *** 1998-02-09 07:02:15 +00:00
Jim Meyering
b302e2becc *** empty log message *** 1998-02-09 07:01:02 +00:00
Jim Meyering
5921d6bc50 (cvs-dist): Update po/. 1998-02-09 07:00:34 +00:00
Jim Meyering
ec76108bb7 . 1998-02-08 22:17:10 +00:00
Jim Meyering
519365bb08 (usage): Reword to use TARGET' and LINK_NAME' in description. 1998-02-08 21:27:18 +00:00
Jim Meyering
c1fc9dbe64 . 1998-02-07 15:17:56 +00:00
Jim Meyering
06b4686f8a . 1998-02-07 15:17:31 +00:00
Jim Meyering
5a244d2598 *** empty log message *** 1998-02-07 10:19:22 +00:00
Jim Meyering
497a1e0c04 *** empty log message *** 1998-02-07 10:17:43 +00:00
Jim Meyering
32ee7fb170 *** empty log message *** 1998-02-07 10:14:29 +00:00
Jim Meyering
db7449461c . 1998-02-07 09:59:05 +00:00
Jim Meyering
9ed89c9d9c *** empty log message *** 1998-02-07 09:58:59 +00:00
Jim Meyering
6110857115 *** empty log message *** 1998-02-07 09:57:39 +00:00
Jim Meyering
36afcc383a *** empty log message *** 1998-02-07 09:54:05 +00:00
Jim Meyering
9e7ca26738 Don't set am_cv_func_working_getline before the
cache-check for the same variable -- that defeated the purpose of
the test; the test program was never run.  This was a problem only
on systems with losing getline functions -- HP-UX 10.20 is one.
Reported by Bjorn Helgaas.
1998-02-07 09:50:58 +00:00
Jim Meyering
de38f9c61f . 1998-02-07 08:13:44 +00:00
Jim Meyering
aa14b2d994 . 1998-02-07 08:13:08 +00:00
Jim Meyering
a6a3dee962 *** empty log message *** 1998-02-06 20:48:10 +00:00
Jim Meyering
0324f8d422 . 1998-02-06 20:47:23 +00:00
Jim Meyering
5a9c4223f6 . 1998-02-06 20:45:51 +00:00
Jim Meyering
eeeb6c7b23 . 1998-02-06 12:37:16 +00:00
Jim Meyering
206e3f08de *** empty log message *** 1998-02-06 12:37:07 +00:00
Jim Meyering
61a80b3a12 (EXTRA_DIST): Add perl.m4. 1998-02-06 12:36:59 +00:00
Jim Meyering
4da3feb0e9 . 1998-02-06 12:36:04 +00:00
Jim Meyering
a3d39ceb13 *** empty log message *** 1998-02-06 10:42:55 +00:00
Jim Meyering
b252cc8d6d . 1998-02-06 10:32:31 +00:00
Jim Meyering
afac7f3a78 . 1998-02-04 20:28:08 +00:00
Jim Meyering
fae6846955 *** empty log message *** 1998-02-04 20:19:14 +00:00
Jim Meyering
f79e8bdcaf . 1998-02-04 20:18:09 +00:00
Jim Meyering
ebfdc834f2 . 1998-02-04 18:15:05 +00:00
Jim Meyering
6e5ac55673 . 1998-02-04 18:06:31 +00:00
Jim Meyering
43d2406f55 . 1998-02-04 18:04:39 +00:00
Jim Meyering
29772527c8 . 1998-02-04 18:01:23 +00:00
Jim Meyering
4e72061130 . 1998-02-04 18:00:57 +00:00
Jim Meyering
470cfd9491 . 1998-02-04 12:41:35 +00:00
Jim Meyering
ff9a9a2bdf . 1998-02-03 08:56:02 +00:00
Jim Meyering
a3db75c4b3 add comments on #endif's 1998-02-03 08:28:43 +00:00
Jim Meyering
46fb234f5f (xgetgroups): Guard function defn with #if HAVE_GETGROUPS. 1998-02-03 08:27:48 +00:00
Jim Meyering
1e985af9d7 . 1998-02-03 07:38:23 +00:00
Jim Meyering
8ef38f80ec (sys/types.h): Include to get size_t on some systems.
(NULL): Define if needed.
1998-02-03 07:23:13 +00:00
Jim Meyering
047f0c2125 *** empty log message *** 1998-02-01 09:58:33 +00:00
Jim Meyering
a10c7fcd7c *** empty log message *** 1998-02-01 09:56:46 +00:00
Jim Meyering
54a0879129 *** empty log message *** 1998-01-31 07:28:56 +00:00
Jim Meyering
494d8173bd *** empty log message *** 1998-01-28 08:14:56 +00:00
Jim Meyering
e8b739e317 (print_header): Change format to align heading over
last column of `df -i' output.  From Andreas Schwab.
1998-01-28 08:09:56 +00:00
Jim Meyering
ef4765e11b . 1998-01-25 21:21:47 +00:00
Jim Meyering
ca9451a39d . 1998-01-25 21:20:53 +00:00
Jim Meyering
1349c30df2 Use $(VERSION) etc. Not @VERSION@. 1998-01-25 21:07:30 +00:00
Jim Meyering
8659ec88d4 . 1998-01-25 20:50:57 +00:00
Jim Meyering
e27d21668c (parse_obsolescent_option): -l is an obsolescent option. 1998-01-25 14:07:46 +00:00
Jim Meyering
902598d05d . 1998-01-25 12:20:58 +00:00
Jim Meyering
fc026cd548 . 1998-01-25 12:19:05 +00:00
Jim Meyering
7d4a70eaff *** empty log message *** 1998-01-25 10:51:55 +00:00
Jim Meyering
186958482f *** empty log message *** 1998-01-25 10:51:21 +00:00
Jim Meyering
da80ee04d2 . 1998-01-25 09:49:00 +00:00
Jim Meyering
dd3a865a8e . 1998-01-25 09:47:51 +00:00
Jim Meyering
aaf66a2413 *** empty log message *** 1998-01-25 09:29:46 +00:00
Jim Meyering
0eba2a8dd7 (DO_CHOWN): Don't fail for non-root when chown fails due
not only to lack of permission (EPERM), but also to lack of support
(EINVAL).  Reported by Bengt Martensson.
1998-01-25 09:28:48 +00:00
Jim Meyering
7c04ce1f09 (re_protect): Don't fail for non-root when chown fails due
not only to lack of permission (EPERM), but also to lack of support
(EINVAL).  Reported by Bengt Martensson.
1998-01-25 09:27:57 +00:00
Jim Meyering
7b4833b03c *** empty log message *** 1998-01-25 09:23:26 +00:00
Jim Meyering
3a62f8785f (cat): Convert comma-expressions to pairs of
semicolon-terminated stmts.
Add braces around compound if/else stmts.
1998-01-25 08:25:05 +00:00
Jim Meyering
85923cb2bc add missing `)' 1998-01-24 23:34:46 +00:00
Jim Meyering
bc05ba3d5a *** empty log message *** 1998-01-24 23:33:18 +00:00
Jim Meyering
ea2969da49 (parse_obsolescent_option): Do not interpret `-f -n 1 ...'
as obsolescent options.
Accept new option: --sleep-interval=SECONDS (-s).
(parse_options): Recognize it.
(usage): Describe it.
(tail_forever): Use it.
(dump_remainder): Use it.
1998-01-24 23:33:02 +00:00
Jim Meyering
0966b97bd1 (f-1): Add test for option-processing of `-f -n 1'. 1998-01-24 23:32:43 +00:00
Jim Meyering
8c3fb79a89 . 1998-01-24 16:48:52 +00:00
Jim Meyering
fc68d2786b *** empty log message *** 1998-01-24 16:27:26 +00:00
Jim Meyering
0d26afa6e0 *** empty log message *** 1998-01-24 16:22:11 +00:00
Jim Meyering
bb964b3eec (test_failure): Note that the SunOS4.1.4 failure
of the ctime test is expected.
Rename does not update ctime; link does -- so use ln, not mv.
1998-01-24 16:21:48 +00:00
Jim Meyering
638776e577 *** empty log message *** 1998-01-24 15:13:58 +00:00
Jim Meyering
0881032a16 *** empty log message *** 1998-01-24 14:50:28 +00:00
Jim Meyering
c58c644f8f *** empty log message *** 1998-01-24 14:50:16 +00:00
Jim Meyering
6e602a0232 *** empty log message *** 1998-01-24 14:49:30 +00:00
Jim Meyering
097d40b3d3 *** empty log message *** 1998-01-24 09:55:10 +00:00
Jim Meyering
57258b3446 . 1998-01-24 08:46:29 +00:00
Jim Meyering
39508b8db3 *** empty log message *** 1998-01-24 08:46:21 +00:00
Jim Meyering
cd4c2d0fdc (TYPE_MINIMUM): Add extra outer cast to work around
bug in Cray C 5.0.3.0 when T == time_t.
1998-01-24 08:45:55 +00:00
Jim Meyering
8a0550a816 Adjust expected output for changed format of `rm --verbose'. 1998-01-24 08:43:46 +00:00
Jim Meyering
663d8b143c *** empty log message *** 1998-01-23 22:09:18 +00:00
Jim Meyering
2a1a1843b7 (__mktime_internal): Work around bug in Irix4.0.5's
C compiler.  From Kaveh Ghazi.
(TYPE_MINIMUM): Define.
(TYPE_MAXIMUM): Define.
(TIME_T_MIN): Use TYPE_MINIMUM.
(TIME_T_MAX): Use TYPE_MAXIMUM.
1998-01-23 22:02:54 +00:00
Jim Meyering
9c70563ee7 add curlies 1998-01-23 18:34:12 +00:00
Jim Meyering
37ce5a5497 . 1998-01-22 23:29:35 +00:00
Jim Meyering
37a3052a36 *** empty log message *** 1998-01-22 09:03:08 +00:00
Jim Meyering
2a4842f7f3 (quit): Declare to be inline to stifle compile warning. 1998-01-22 08:58:12 +00:00
Jim Meyering
d82fadf365 Reorder functions to obviate forward dcls. 1998-01-22 08:55:13 +00:00
Jim Meyering
ef63ce007d (do_copy): Add unreachable `return 0' to stifle warning. 1998-01-22 08:36:27 +00:00
Jim Meyering
6a8e657775 . 1998-01-22 08:33:34 +00:00
Jim Meyering
309819620b (TESTS_ENVIRONMENT): Add TOUCH. 1998-01-22 08:33:26 +00:00
Jim Meyering
f7bb262cc8 minor tweaks 1998-01-22 08:33:02 +00:00
Jim Meyering
d5494d57f5 Don't use -f. Do adjust $RM if it's a relative path. 1998-01-22 08:32:22 +00:00
Jim Meyering
14a2593daf Use GNU touch to work around problems with NFS caching and/or clock skew. 1998-01-22 08:27:16 +00:00
Jim Meyering
9cdd2e05e6 (copy_internal): Use x->backup_type, not the global.
(valid_options): Use VALID_BACKUP_TYPE and VALID_SPARSE_MODE.
1998-01-22 08:22:00 +00:00
Jim Meyering
6cce6a1b7f [NDEBUG]: Comment out definition.
(do_copy): Use x->backup_type, not the global.
1998-01-22 08:19:17 +00:00
Jim Meyering
d9f0ca41bd (rm_option_init): New function.
(cp_option_init): New function.
(copy_reg): Remove now-unused function.
(do_move): Set up for and use `copy.c (copy)' in place of copy_reg.
Set up for and use `remove.c (rm)' in place of unlink.
1998-01-22 08:16:09 +00:00
Jim Meyering
df7cef21c7 Remove and minimally librarify guts for use in mv.c.
(main): Pass options (`&x') to rm.
Call remove_init and remove_fini instead of open-coding them.
1998-01-22 08:14:52 +00:00
Jim Meyering
9f2d1beded *** empty log message *** 1998-01-22 08:14:17 +00:00
Jim Meyering
ff59218d54 New file. Contains guts of old rm.c.
(remove_init): New function.
(remove_fini): New function.
1998-01-22 08:13:57 +00:00
Jim Meyering
1a18272561 Declare new global, backup_type.
(main): Initialize backup_type unconditionally.
(do_link): Call find_backup_file_name with new argument, backup_type.
1998-01-22 08:13:12 +00:00
Jim Meyering
2bdf8621d6 Declare new global, backup_type.
(main): Initialize backup_type unconditionally.
(copy_file): Call find_backup_file_name with new backup_type, argument.
1998-01-22 08:12:24 +00:00
Jim Meyering
758ab7a013 *** empty log message *** 1998-01-21 16:37:09 +00:00
Jim Meyering
734d1cccc3 (VALID_SPARSE_MODE): Define.
[struct cp_options] (backup_type): New member.
1998-01-21 16:16:00 +00:00
Jim Meyering
13de1036ac . 1998-01-21 15:59:28 +00:00
Jim Meyering
2167febcb1 Fix copyright 1998-01-21 15:57:48 +00:00
Jim Meyering
2c11b736aa Use ANSI function definitions.
Remove global declaration of backup_type.
(simple_backup_suffix): Default to `~', not `.orig'.
Use PARAMS, not __BACKUPFILE_P.
(find_backup_file_name): Add parameter, backup_type.
1998-01-21 15:57:18 +00:00
Jim Meyering
a52e0efbe2 Remove extern declaration of backup_type.
Use PARAMS, not __BACKUPFILE_P.
(VALID_BACKUP_TYPE): Define.
(find_backup_file_name): Adjust prototype.
1998-01-21 15:55:12 +00:00
Jim Meyering
4935348b67 Use ANSI function definitions. 1998-01-20 11:34:38 +00:00
Jim Meyering
e6a0306b1b [enum backup_type]: Set `none' to 1. 1998-01-20 11:34:04 +00:00
Jim Meyering
2bec121abb add `,' in comment 1998-01-19 09:29:27 +00:00
Jim Meyering
412043f1d8 . 1998-01-18 11:52:44 +00:00
Jim Meyering
4ffa362cc4 *** empty log message *** 1998-01-18 11:52:38 +00:00
Jim Meyering
35592ba64c (strncoll, strncoll_s2_readonly, look_for_fraction, numcompare):
Remove the `unsigned' from some `unsigned char*' parameter types.
Add casts via UCHAR where necessary to avoid problems with unwanted
sign extension.  Based on a patch from Kaveh Ghazi to appease Irix4's
cc compiler.
e.g.,
 > cc -DLOCALEDIR=\"/caip/u3/ghazi/foobar/share/locale\" -DHAVE_CONFIG_H
 >      -I.. -I../../src -I../../lib -I../intl -c ../../src/sort.c
 > accom: Error: ../../src/sort.c, line 500: prototype parameter 1 type
 >      must have all of the actual arguments qualifiers (except the
 >      outermost) and pointed-to types must be compatible (ANSI
 >      3.3.2.2,3.3.16.1)
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
 > accom: Error: ../../src/sort.c, line 500: Argument 1 Type Doesn't
 >      Match prototype description; prototype: pointer to const char is
 >      different from actual: pointer to unsigned char
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
 > accom: Error: ../../src/sort.c, line 500: prototype parameter 2 type
 >      must have all of the actual arguments qualifiers (except the
 >      outermost) and pointed-to types must be compatible (ANSI
 >      3.3.2.2,3.3.16.1)
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
 > accom: Error: ../../src/sort.c, line 500: Argument 2 Type Doesn't
 >      Match prototype description; prototype: pointer to const char is
 >      different from actual: pointer to unsigned char
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
1998-01-18 11:51:08 +00:00
Jim Meyering
c1618a8c4c (next_file_name): Rewrite. This removes an artificial limit (albeit
already high, at INT_MAX :-) on the number of files split could create.
Reported by Ralf W. Stephan.
1998-01-18 11:18:08 +00:00
Jim Meyering
96be8bca99 Guard inclusion of langinfo.h also with HAVE_LANGINFO_H,
for Irix-4.0.5.  From Kaveh Ghazi.
1998-01-16 23:29:24 +00:00
Jim Meyering
b8a16a3f2a (mergefps): Add braces to avoid ambiguous `else' statement.
(nls_set_fraction): Likewise.
1998-01-16 23:23:04 +00:00
Jim Meyering
f1217e4976 . 1998-01-16 11:18:05 +00:00
Jim Meyering
62279c6e2d . 1998-01-16 11:17:02 +00:00
Jim Meyering
71545a6276 Make PARAMS-defining conditionals consistent. 1998-01-16 08:52:30 +00:00
Jim Meyering
53cfcbd19c Make PARAMS-defining conditionals consistent. 1998-01-16 08:51:39 +00:00
Jim Meyering
5618133eed (fail-0): Disable test. It depends on
sizeof(long) being 32 bits.  Reported by Kaveh Ghazi.
1998-01-16 08:04:19 +00:00
Jim Meyering
ade1f58e11 (print_header): Fix inode format header to line it up
with the rest of the output.
1998-01-14 08:52:56 +00:00
Jim Meyering
74cf3e8bab Set errno to ENOENT, not EINVAL. This is consistent
with most other implementations.
1998-01-13 10:08:11 +00:00
Jim Meyering
ca50e875af *** empty log message *** 1998-01-13 09:53:15 +00:00
Jim Meyering
a75ea1014e *** empty log message *** 1998-01-12 09:00:10 +00:00
Jim Meyering
98af2e9636 *** empty log message *** 1998-01-12 08:55:42 +00:00
Jim Meyering
68e5877403 *** empty log message *** 1998-01-12 08:55:01 +00:00
Jim Meyering
2b906615c2 *** empty log message *** 1998-01-12 08:53:18 +00:00
Jim Meyering
443f852f61 Include sys/param.h only #if HAVE_SYS_PARAM_H.
Move function-spanning `#if ...BSIZE' stmt to follow inclusion of
sys/param.h since BSIZE is sometimes defined in sys/param.h.
Based on a patch from Philippe De Muyter.
1998-01-12 08:13:39 +00:00
Jim Meyering
d1f4e617b5 *** empty log message *** 1998-01-11 09:24:17 +00:00
Jim Meyering
1aa070dd2e . 1998-01-11 09:14:29 +00:00
Jim Meyering
007e81132a . 1998-01-11 09:14:02 +00:00
Jim Meyering
6bcfff640e *** empty log message *** 1998-01-11 09:12:30 +00:00
Jim Meyering
aa2880362c . 1998-01-11 08:02:39 +00:00
Jim Meyering
88bd90109b *** empty log message *** 1998-01-10 22:13:49 +00:00
Jim Meyering
dba300a0d0 CHAR_BIT SCHAR_MAX UCHAR_MAX SHRT_MAX INT_MAX UINT_MAX LONG_MAX ULONG_MAX
Remove definitions of those symbols.
* src/csplit.c: Move inclusion of regex.h/rx.h to follow system.h
since it now includes limit.h which defines RE_DUP_MAX.
* src/nl.c: Likewise.
* src/tac.c: Likewise.
1998-01-10 22:12:03 +00:00
Jim Meyering
b9ed71e46e . 1998-01-10 20:53:56 +00:00
Jim Meyering
7bba3e945f initialize fail to 0 1998-01-10 16:25:46 +00:00
Jim Meyering
1bdfcabd2c . 1998-01-10 16:24:46 +00:00
Jim Meyering
c88a4c91da (EXTRA_DIST): Add const.m4. 1998-01-10 16:24:26 +00:00
Jim Meyering
136f2fd28c . 1998-01-10 15:57:57 +00:00
Jim Meyering
82739833a1 *** empty log message *** 1998-01-10 15:09:46 +00:00
Jim Meyering
1c5c2597b5 *** empty log message *** 1998-01-10 15:08:00 +00:00
Jim Meyering
eacbf12ea4 *** empty log message *** 1998-01-10 15:04:32 +00:00
Jim Meyering
0ccdf3419d (usage): Describe -D. 1998-01-10 15:03:58 +00:00
Jim Meyering
cec85a4b3a . 1998-01-10 14:25:27 +00:00
Jim Meyering
a077a7833c *** empty log message *** 1998-01-10 14:23:08 +00:00
Jim Meyering
a3094b0529 (batch_convert): Use memcpy when we don't need return value. 1998-01-10 14:21:35 +00:00
Jim Meyering
d73dd15544 . 1998-01-10 13:36:47 +00:00
Jim Meyering
27c1ad9576 *** empty log message *** 1998-01-10 13:36:09 +00:00
Jim Meyering
2eefbf7647 (usage): Correct descriptions of --sort, --time, and -t.
Suggestions from Andreas Schwab.
1998-01-10 12:53:09 +00:00
Jim Meyering
79d39ab7bf (decode_switches) [-u]: Fix bug whereby -u had no effect
without -l or -t.  Now, -u (like -c) implies --sort=time.
Suggestion from Andreas Schwab.
1998-01-10 12:07:50 +00:00
Jim Meyering
12782f54b0 *** empty log message *** 1998-01-10 11:56:26 +00:00
Jim Meyering
fff6de7b04 *** empty log message *** 1998-01-10 11:54:39 +00:00
Jim Meyering
cc76db2016 use sh-script test, not Test.pm framework 1998-01-10 11:27:24 +00:00
Jim Meyering
77c94909cf *** empty log message *** 1998-01-10 11:24:51 +00:00
Jim Meyering
3b8d19272d . 1998-01-10 11:00:46 +00:00
Jim Meyering
6099914170 *** empty log message *** 1998-01-10 10:36:41 +00:00
Jim Meyering
09d96ac539 (make_path): Reformat 3 if-stmts to test `if (newly_created_dir)' only once.
Suggestion from Andreas Schwab.
1998-01-10 10:28:37 +00:00
Jim Meyering
3edbca0e04 (make_path): Put only newly created directories on the LEADING_DIRS list. 1998-01-10 10:22:30 +00:00
Jim Meyering
c062a35803 *** empty log message *** 1998-01-08 23:17:20 +00:00
Jim Meyering
3da029a5d9 *** empty log message *** 1998-01-08 23:16:14 +00:00
Jim Meyering
de1dabf7d7 *** empty log message *** 1998-01-08 22:58:18 +00:00
Jim Meyering
03283b5000 (tac_stream): Don't perform arithmetic on now-void pointer
result of xrealloc (until recently it was char*).
1998-01-08 22:58:03 +00:00
Jim Meyering
9f5dc7e7d0 (inittables): Add && HAVE_NL_LANGINFO to the #if-test
guarding the nls month-checking code.
(nls_numeric_format): Remove unnecessary (and error-evoking w/SunOS' cc)
`unsigned' from dcls of text and lim.
(main): Cast lconvp->grouping to `unsigned char*' to appease SunOS's cc.
1998-01-08 22:56:45 +00:00
Jim Meyering
ab9cd27938 *** empty log message *** 1998-01-07 07:45:46 +00:00
Jim Meyering
c767a49741 *** empty log message *** 1998-01-06 23:53:50 +00:00
Jim Meyering
0fdd1b9130 Add %expect directive.
Move inclusion of getdate.h and dependent extern declarations down
so getdate.h's prototype follows the sometimes-enabled definition
of `const' to nothing.  Otherwise, the prototype wouldn't match
the definition because of the defined-away `const'.
(get_date): ANSI-fy definition.
From Kaveh Ghazi.
1998-01-06 23:53:33 +00:00
Jim Meyering
f19ca6fe29 *** empty log message *** 1998-01-05 17:43:31 +00:00
Jim Meyering
6cc3cf776c (df_readable): New function.
(show_dev): If a value consists entirely of 1 bits, or is derived
from some other value that consists entirely of 1 bits, report "-".
Check inode and block counts more carefully for plausibility,
to avoid arithmetic overflow when computing percentages.
1998-01-05 17:43:00 +00:00
Jim Meyering
e162abfc5b (get_fs_usage): Add parens. 1998-01-05 17:38:38 +00:00
Jim Meyering
866773c72a (PROPAGATE_ALL_ONES): New macro.
(get_fs_usage): If a value consists entirely of 1 bits,
propagate this info to the output by setting it to (uintmax_t) -1.
1998-01-05 17:33:54 +00:00
Jim Meyering
06bab849fc reindent a little 1998-01-05 10:11:08 +00:00
Jim Meyering
ed0becde29 reformat comment, dcl fail, dirname 1998-01-05 10:09:24 +00:00
Jim Meyering
8d64a37a77 remove SPECIAL_BITS #ifdefs 1998-01-05 10:06:41 +00:00
Jim Meyering
0520188821 Add support for marty's -D option 1998-01-05 10:06:07 +00:00
113 changed files with 9936 additions and 9820 deletions

7
GNUmakefile Normal file
View File

@@ -0,0 +1,7 @@
# Having a separate GNUmakefile lets me `include' the dynamically
# generated rules created via Makefile.maint as well as Makefile.maint itself.
# This makefile is used only if you run GNU Make.
# It is necessary if you modify files in the m4/ directory or
# want to build targets usually of interest only to the maintainer.
include Makefile
include $(srcdir)/Makefile.maint

62
Makefile.maint Normal file
View File

@@ -0,0 +1,62 @@
# -*-Makefile-*-
# This Makefile fragment is shared between fileutils, sh-utils, textutils.
maintainer-check:
if head ChangeLog| grep 'Version $(VERSION)' > /dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog; not tagging" 1>&2; \
exit 1; \
fi
$(MAKE) distcheck
$(MAKE) my-distcheck
# Tag before making distribution. Also, don't make a distribution if
# checks fail. Also, make sure the NEWS file is up-to-date.
cvs-dist: maintainer-check
pkg=`echo "$(PACKAGE)" | tr a-z A-Z`; \
ver=`echo "$(VERSION)" | sed 's/\./_/g'`; \
tag="$$pkg-$$ver"; \
echo tag=$$tag; \
if cvs -n log -h README| grep -e $$tag > /dev/null; then \
echo "VERSION not new; not tagging" 1>&2; \
exit 1; \
fi; \
cvs update po; \
cvs tag -c $$tag
$(MAKE) dist
t=./=test
my-distcheck: dist
-rm -rf $(t)
mkdir $(t)
GZIP=$(GZIP) $(TAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-gettext \
&& $(MAKE) \
&& $(MAKE) dvi \
&& $(MAKE) check \
&& $(MAKE) distclean
cd $(t) && $(TAR) --diff -z -f ../$(distdir).tar.gz
-rm -rf $(t)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
acdir = m4
aclocal-files: configure.in m4/Makefile.am
echo "acfiles = \\" > $@-tmp
(cd $(srcdir) && find $(acdir) -type f -name '*.m4' -print) \
| sed 's!^!$(top_srcdir)/!' \
| tr '\012' ' ' \
| fmt \
| sed -e 's/$$/ \\/' -e '$$s/..$$//' \
>> $@-tmp
echo >> $@-tmp
mv $@-tmp $@
include aclocal-files
# Override default rule to use --acdir option
$(srcdir)/aclocal.m4: configure.in $(acfiles)
cd $(srcdir) && aclocal -I $(acdir)

5
THANKS
View File

@@ -6,8 +6,10 @@ Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
Arne Henrik Juul: arnej@imf.unit.no
Bauke Jan Douma: bjdouma@xs4all.nl
Bengt Martensson: bengt@mathematik.uni-Bremen.de
Bjorn Helgaas: helgaas@rsn.hp.com
Charles Karney: karney@pppl.gov
Eirik Fuller: eirik@netcom.com
Eli Zaretskii: eliz@is.elta.co.il
Emile LeBlanc: leblanc@math.toronto.edu
Galen Hazelwood: galenh@micron.net
Greg McGary: gkm@eng.ascend.com
@@ -17,6 +19,7 @@ James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
Jesse Thilo: jgt2@eecs.lehigh.edu
Joakim Rosqvist: dvljrt@cs.umu.se
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
Marcus Daniels: marcus@sysc.pdx.edu
Mark A. Thomas: thommark@access.digex.net
Mark Harris: mark@monitor.designacc.com
@@ -27,6 +30,7 @@ Miles Bader: miles@gnu.ai.mit.edu
Noel Cragg: noel@red-bean.com
Peter Eriksson: peter@ifm.liu.se
Paul Eggert: eggert@twinsun.com
Philippe De Muyter: phdm@macqel.be
Ross Ridge: rridge@calum.csclub.uwaterloo.ca
Santiago Vila Doncel: sanvila@unex.es
Stuart Kemp: skemp@peter.bmc.com
@@ -35,4 +39,3 @@ Torbjorn Lindgren: tl@funcom.no
Tony Leneis: tony@plaza.ds.adp.com
Michael Veksler: mveksler@techunix.technion.ac.il
Wayne Stewart: wstewa@atl.com

View File

@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
@@ -116,7 +115,7 @@ default: all
.SUFFIXES:
.SUFFIXES: .dvi .info .ps .texi .texinfo
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -124,7 +123,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
version.texi: @MAINT@stamp-vti
version.texi: stamp-vti
cp $(srcdir)/stamp-vti $(srcdir)/version.texi
stamp-vti: fileutils.texi $(top_srcdir)/configure.in
@@ -145,7 +144,7 @@ clean-vti:
distclean-vti:
maintainer-clean-vti:
-@MAINT@rm -f stamp-vti version.texi
-rm -f stamp-vti version.texi
fileutils.info: fileutils.texi version.texi
fileutils.dvi: fileutils.texi version.texi

View File

@@ -166,7 +166,7 @@ The GNU shell utilities are mostly compatible with the POSIX.2 standard.
@c This paragraph appears in all of fileutils.texi, textutils.texi, and
@c sh-utils.texi too -- so be sure to keep them consistent.
@cindex bugs, reporting
Please report bugs to @samp{sh-utils-bugs@@gnu.ai.mit.edu}. Remember
Please report bugs to @samp{sh-utils-bugs@@gnu.org}. Remember
to include the version number, machine architecture, input files, and
any other information needed to reproduce the bug: your input, what you
expected, what you got, and why it is wrong. Diffs are welcome, but

View File

@@ -142,7 +142,7 @@ The GNU text utilities are mostly compatible with the @sc{POSIX.2} standard.
@c This paragraph appears in all of fileutils.texi, textutils.texi, and
@c sh-utils.texi too -- so be sure to keep them consistent.
@cindex bugs, reporting
Please report bugs to @samp{textutils-bugs@@gnu.ai.mit.edu}. Remember
Please report bugs to @samp{textutils-bugs@@gnu.org}. Remember
to include the version number, machine architecture, input files, and
any other information needed to reproduce the bug: your input, what you
expected, what you got, and why it is wrong. Diffs are welcome, but

View File

@@ -22,7 +22,7 @@ libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
get-date.h getline.h getopt.h group-member.h human.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h

View File

@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -110,7 +109,7 @@ libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
get-date.h getline.h getopt.h group-member.h human.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
@@ -178,7 +177,7 @@ default: all
.SUFFIXES:
.SUFFIXES: .S .c .h .o .s .y
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -424,12 +423,12 @@ distdir: $(DISTFILES)
MKDEP = $(CC) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
-include .deps/.P
.deps/.P: $(BUILT_SOURCES)
echo > $@
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:

View File

@@ -1,5 +1,5 @@
/* backupfile.c -- make Emacs style backup file names
Copyright (C) 1990,1991,1992,1993,1995,1997 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -74,7 +74,7 @@ char *malloc ();
# include <limits.h>
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
# define CHAR_BIT 8
#endif
/* Upper bound on the string length of an integer converted to string.
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
@@ -97,15 +97,12 @@ char *malloc ();
# define REAL_DIR_ENTRY(dp) 1
#endif
/* Which type of backup file names are generated. */
enum backup_type backup_type = none;
/* The extension added to file names to produce a simple (as opposed
to numbered) backup file name. */
const char *simple_backup_suffix = ".orig";
const char *simple_backup_suffix = "~";
static int max_backup_version __BACKUPFILE_P ((const char *, const char *));
static int version_number __BACKUPFILE_P ((const char *, const char *, size_t));
static int max_backup_version PARAMS ((const char *, const char *));
static int version_number PARAMS ((const char *, const char *, size_t));
/* Return the name of the new backup file for file FILE,
allocated with malloc. Return 0 if out of memory.
@@ -113,8 +110,7 @@ static int version_number __BACKUPFILE_P ((const char *, const char *, size_t));
Do not call this function if backup_type == none. */
char *
find_backup_file_name (file)
const char *file;
find_backup_file_name (const char *file, enum backup_type backup_type)
{
size_t backup_suffix_size_max;
size_t file_len = strlen (file);
@@ -163,9 +159,7 @@ find_backup_file_name (file)
*/
static int
max_backup_version (file, dir)
const char *file;
const char *dir;
max_backup_version (const char *file, const char *dir)
{
DIR *dirp;
struct dirent *dp;
@@ -199,10 +193,7 @@ max_backup_version (file, dir)
*/
static int
version_number (base, backup, base_length)
const char *base;
const char *backup;
size_t base_length;
version_number (const char *base, const char *backup, size_t base_length)
{
int version;
const char *p;
@@ -235,8 +226,7 @@ static const enum backup_type backup_types[] =
Unique abbreviations are accepted. */
enum backup_type
get_version (version)
const char *version;
get_version (const char *version)
{
int i;

View File

@@ -1,5 +1,5 @@
/* backupfile.h -- declarations for making Emacs style backup file names
Copyright (C) 1990, 1991, 1992, 1997 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,18 +33,23 @@ enum backup_type
numbered
};
extern enum backup_type backup_type;
#define VALID_BACKUP_TYPE(Type) \
((Type) == none \
|| (Type) == simple \
|| (Type) == numbered_existing \
|| (Type) == numbered)
extern char const *simple_backup_suffix;
#ifndef __BACKUPFILE_P
# if defined __STDC__ || __GNUC__
# define __BACKUPFILE_P(args) args
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define __BACKUPFILE_P(args) ()
# define PARAMS(Args) ()
# endif
#endif
char *base_name __BACKUPFILE_P ((char const *));
char *find_backup_file_name __BACKUPFILE_P ((char const *));
enum backup_type get_version __BACKUPFILE_P ((char const *));
void addext __BACKUPFILE_P ((char *, char const *, int));
char *base_name PARAMS ((char const *));
char *find_backup_file_name PARAMS ((char const *, enum backup_type));
enum backup_type get_version PARAMS ((char const *));
void addext PARAMS ((char *, char const *, int));

View File

@@ -1,5 +1,5 @@
/* dirname.c -- return all but the last element in a path
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,21 +16,21 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
# include <stdlib.h>
#else
char *malloc ();
#endif
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
#include <string.h>
#if defined STDC_HEADERS || defined HAVE_STRING_H
# include <string.h>
#else
#include <strings.h>
#ifndef strrchr
#define strrchr rindex
#endif
# include <strings.h>
# ifndef strrchr
# define strrchr rindex
# endif
#endif
/* Return the leading directories part of PATH,

View File

@@ -1,5 +1,5 @@
/* Convert file size to number of blocks on System V-like machines.
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,18 +21,27 @@
# include <config.h>
#endif
#if !HAVE_ST_BLOCKS && !defined _POSIX_SOURCE && defined BSIZE
# include <sys/types.h>
#include <sys/types.h>
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if !HAVE_ST_BLOCKS && !defined _POSIX_SOURCE && defined BSIZE
# if HAVE_UNISTD_H
# include <unistd.h>
# endif
# ifndef NINDIR
# if defined (__DJGPP__)
typedef long daddr_t; /* for disk address */
# endif
/* Some SysV's, like Irix, seem to lack this. Hope it's correct. */
/* Number of inode pointers per indirect block. */
# define NINDIR (BSIZE/sizeof(daddr_t))
# define NINDIR (BSIZE / sizeof (daddr_t))
# endif /* !NINDIR */
/* Number of direct block addresses in an inode. */

View File

@@ -1,5 +1,5 @@
/* fsusage.c -- return space usage of mounted filesystems
Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -65,6 +65,12 @@ int statfs ();
int statvfs ();
#endif
/* Many space usage primitives use all 1 bits to denote a value that is
not applicable or unknown. Propagate this information by returning
a uintmax_t value that is all 1 bits if the argument is all 1 bits,
even if the argument is unsigned and smaller than unitmax_t. */
#define PROPAGATE_ALL_ONES(x) ((x) == -1 ? (uintmax_t) -1 : (uintmax_t) (x))
int safe_read ();
/* Fill in the fields of FSP with information about space usage for
@@ -87,7 +93,7 @@ get_fs_usage (path, disk, fsp)
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
return -1;
fsp->fsu_blocksize = fsd.f_fsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#endif /* STAT_STATFS3_OSF1 */
@@ -99,11 +105,11 @@ get_fs_usage (path, disk, fsp)
return -1;
fsp->fsu_blocksize = 1024;
fsp->fsu_blocks = fsd.fd_req.btot;
fsp->fsu_bfree = fsd.fd_req.bfree;
fsp->fsu_bavail = fsd.fd_req.bfreen;
fsp->fsu_files = fsd.fd_req.gtot;
fsp->fsu_ffree = fsd.fd_req.gfree;
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.fd_req.bfreen);
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
#endif /* STAT_STATFS2_FS_DATA */
@@ -132,12 +138,14 @@ get_fs_usage (path, disk, fsp)
}
close (fd);
fsp->fsu_blocksize = fsd.s_type == Fs2b ? 1024 : 512;
fsp->fsu_blocks = fsd.s_fsize;
fsp->fsu_bfree = fsd.s_tfree;
fsp->fsu_bavail = fsd.s_tfree;
fsp->fsu_files = (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1);
fsp->fsu_ffree = fsd.s_tinode;
fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.s_tfree);
fsp->fsu_files = (fsd.s_isize == -1
? (uintmax_t) -1
: (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1));
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.s_tinode);
#endif /* STAT_READ_FILSYS */
@@ -148,7 +156,7 @@ get_fs_usage (path, disk, fsp)
if (statfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocksize = fsd.f_bsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
@@ -174,7 +182,7 @@ get_fs_usage (path, disk, fsp)
if (statfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocksize = fsd.f_fsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#endif /* STAT_STATFS2_FSIZE */
@@ -193,7 +201,7 @@ get_fs_usage (path, disk, fsp)
systems seem to always be in terms of 512-byte blocks,
no matter what value f_bsize has. */
# if _AIX || defined(_CRAY)
fsp->fsu_blocksize = fsd.f_bsize;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
# else
fsp->fsu_blocksize = 512;
# endif
@@ -208,18 +216,19 @@ get_fs_usage (path, disk, fsp)
return -1;
/* f_frsize isn't guaranteed to be supported. */
fsp->fsu_blocksize = fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize;
fsp->fsu_blocksize =
PROPAGATE_ALL_ONES (fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize);
#endif /* STAT_STATVFS */
#if !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ_FILSYS)
/* !Ultrix && !SVR2 */
fsp->fsu_blocks = fsd.f_blocks;
fsp->fsu_bfree = fsd.f_bfree;
fsp->fsu_bavail = fsd.f_bavail;
fsp->fsu_files = fsd.f_files;
fsp->fsu_ffree = fsd.f_ffree;
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.f_bavail);
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
#endif /* not STAT_STATFS2_FS_DATA && not STAT_READ_FILSYS */

View File

@@ -1,46 +0,0 @@
/* Copyright (C) 1995, 1997 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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#if defined (vms)
# include <types.h>
# include <time.h>
#else
# include <sys/types.h>
# ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
# endif
#endif /* defined (vms) */
time_t get_date PARAMS ((const char *p, const time_t *now));

View File

@@ -5,8 +5,6 @@
** a couple of people on Usenet. Completely overhauled by Rich $alz
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
**
** This grammar has 13 shift/reduce conflicts.
**
** This code is in the public domain and has no copyright.
*/
@@ -51,8 +49,6 @@
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#include "getdate.h"
#if defined (STDC_HEADERS) || defined (USG)
# include <string.h>
#endif
@@ -64,10 +60,6 @@
# define bcopy(from, to, len) memcpy ((to), (from), (len))
#endif
extern struct tm *gmtime ();
extern struct tm *localtime ();
extern time_t mktime ();
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
yacc generated parsers in the same program. Note that these are only
@@ -172,6 +164,9 @@ static int yyRelYear;
%}
/* This grammar has 13 shift/reduce conflicts. */
%expect 13
%union {
int Number;
enum _MERIDIAN Meridian;
@@ -441,6 +436,15 @@ o_merid : /* NULL */
%%
/* Include this file down here because bison inserts code above which
may define-away `const'. We want the prototype for get_date to have
the same signature as the function definition does. */
#include "get-date.h"
extern struct tm *gmtime ();
extern struct tm *localtime ();
extern time_t mktime ();
/* Month and day table. */
static TABLE const MonthDayTable[] = {
{ "january", tMONTH, 1 },
@@ -886,9 +890,7 @@ difftm (a, b)
}
time_t
get_date (p, now)
const char *p;
const time_t *now;
get_date (const char *p, const time_t *now)
{
struct tm tm, tm0, *tmp;
time_t Start;

View File

@@ -1,5 +1,5 @@
/* linebuffer.h -- declarations for reading arbitrarily long lines
Copyright (C) 1986, 1991 Free Software Foundation, Inc.
Copyright (C) 1986, 1991, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,7 +14,10 @@
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. */
#if !defined LINEBUFFER_H
# define LINEBUFFER_H
/* A `struct linebuffer' holds a line of text. */
struct linebuffer
@@ -24,12 +27,13 @@ struct linebuffer
char *buffer;
};
#undef PARAMS
#if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
#else
# define PARAMS(Args) ()
#endif
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
/* Initialize linebuffer LINEBUFFER for use. */
void initbuffer PARAMS ((struct linebuffer *linebuffer));
@@ -42,3 +46,5 @@ struct linebuffer *readline PARAMS ((struct linebuffer *linebuffer,
/* Free linebuffer LINEBUFFER and its data, all allocated with malloc. */
void freebuffer PARAMS ((struct linebuffer *));
#endif /* LINEBUFFER_H */

View File

@@ -1,5 +1,5 @@
/* makepath.c -- Ensure that a directory path exists.
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -217,6 +217,14 @@ make_path (const char *argpath,
if (!do_chdir)
basename_dir = dirpath;
/* The mkdir and stat calls below appear to be reversed.
They are not. It is important to call mkdir first and then to
call stat (to distinguish the three cases) only if mkdir fails.
The alternative to this approach is to `stat' each directory,
then to call mkdir if it doesn't exist. But if some other process
were to create the directory between the stat & mkdir, the mkdir
would fail with EEXIST. */
*slash = '\0';
if (mkdir (basename_dir, tmp_mode))
{
@@ -239,29 +247,31 @@ make_path (const char *argpath,
}
}
if (newly_created_dir && verbose_fmt_string != NULL)
fprintf (stderr, verbose_fmt_string, dirpath);
if (newly_created_dir)
{
if (verbose_fmt_string)
fprintf (stderr, verbose_fmt_string, dirpath);
if (newly_created_dir
&& (owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
#if defined(AFS) && defined (EPERM)
&& errno != EPERM
&& errno != EPERM
#endif
)
{
error (0, errno, "%s", dirpath);
CLEANUP;
return 1;
}
)
{
error (0, errno, "%s", dirpath);
CLEANUP;
return 1;
}
if (re_protect)
{
struct ptr_list *new = (struct ptr_list *)
alloca (sizeof (struct ptr_list));
new->dirname_end = slash;
new->next = leading_dirs;
leading_dirs = new;
if (re_protect)
{
struct ptr_list *new = (struct ptr_list *)
alloca (sizeof (struct ptr_list));
new->dirname_end = slash;
new->next = leading_dirs;
leading_dirs = new;
}
}
/* If we were able to save the initial working directory,

View File

@@ -1,8 +1,9 @@
#undef PARAMS
#if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
#else
# define PARAMS(Args) ()
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
int

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Paul Eggert (eggert@twinsun.com).
NOTE: The canonical source of this file is maintained with the GNU C Library.
@@ -73,21 +73,26 @@
# 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) 0 - TYPE_MINIMUM (t))
#ifndef INT_MIN
# define INT_MIN (~0 << (sizeof (int) * CHAR_BIT - 1))
# define INT_MIN TYPE_MINIMUM (int)
#endif
#ifndef INT_MAX
# define INT_MAX (~0 - INT_MIN)
# define INT_MAX TYPE_MAXIMUM (int)
#endif
#ifndef TIME_T_MIN
/* The outer cast to time_t works around a bug in Cray C 5.0.3.0. */
# define TIME_T_MIN ((time_t) \
(0 < (time_t) -1 ? (time_t) 0 \
: ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)))
# define TIME_T_MIN TYPE_MINIMUM (time_t)
#endif
#ifndef TIME_T_MAX
# define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
# define TIME_T_MAX TYPE_MAXIMUM (time_t)
#endif
#define TM_YEAR_BASE 1900
@@ -365,7 +370,15 @@ __mktime_internal (tp, convert, offset)
double dday = 366 * dyear + mday;
double dsec = 60 * (60 * (24 * dday + hour) + min) + sec_requested;
if (TIME_T_MAX / 3 - TIME_T_MIN / 3 < (dsec < 0 ? - dsec : dsec))
/* On Irix4.0.5 cc, dividing TIME_T_MIN by 3 does not produce
correct results, ie., it erroneously gives a positive value
of 715827882. Setting a variable first then doing math on it
seems to work. (ghazi@caip.rutgers.edu) */
const time_t time_t_max = TIME_T_MAX;
const time_t time_t_min = TIME_T_MIN;
if (time_t_max / 3 - time_t_min / 3 < (dsec < 0 ? - dsec : dsec))
return -1;
}

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 1997, 1998 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.
@@ -28,6 +28,8 @@
systems like Irix 5.3. */
#undef putenv
#include <sys/types.h>
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
# include <stdlib.h>
#endif
@@ -51,6 +53,10 @@
extern char **environ;
#endif
#ifndef NULL
# define NULL 0
#endif
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int

View File

@@ -1,7 +1,7 @@
/* Work around the bug in some systems whereby stat succeeds when
given the zero-length file name argument. The stat from SunOS4.1.4
has this bug.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,7 +33,13 @@
extern int errno;
#endif
/* FIXME: describe. */
/* This is a wrapper for stat(2).
If FILE is the empty string, fail with errno == ENOENT.
Otherwise, return the result of calling the real stat.
This works around the bug in some systems whereby stat succeeds when
given the zero-length file name argument. The stat from SunOS4.1.4
has this bug. */
int
rpl_stat (file, sbuf)
@@ -42,7 +48,7 @@ rpl_stat (file, sbuf)
{
if (file && *file == 0)
{
errno = EINVAL;
errno = ENOENT;
return -1;
}

View File

@@ -1,12 +1,13 @@
#ifndef XSTRTOD_H
# define XSTRTOD_H 1
#undef PARAMS
#if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
#else
# define PARAMS(Args) ()
#endif
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int
xstrtod PARAMS ((const char *str, const char **ptr, double *result));

View File

@@ -1,3 +1,23 @@
1998-02-07 Jim Meyering <meyering@eng.ascend.com>
* getline.m4: Don't set am_cv_func_working_getline before the
cache-check for the same variable -- that defeated the purpose of
the test; the test program was never run. This was a problem only
on systems with losing getline functions -- HP-UX 10.20 is one.
Reported by Bjorn Helgaas.
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
* Makefile.am (EXTRA_DIST): Add perl.m4.
1998-01-10 Jim Meyering <meyering@na-net.ornl.gov>
* Makefile.am (EXTRA_DIST): Add const.m4.
* const.m4: New file. Use an initializer in this declaration
typedef int charset[2]; const charset x;
Reported by Bob Glickstein.
1997-12-21 Jim Meyering <meyering@na-net.ornl.gov>
* chown.m4: Fix reversed types on -1 args to chown.

View File

@@ -4,8 +4,8 @@
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
check-decl.m4 chown.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 getline.m4 \
getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 lfs.m4 \
lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 realloc.m4 \
stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 \
getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 putenv.m4 \
readdir.m4 realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
mktime.m4

View File

@@ -64,6 +64,7 @@ CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -74,27 +75,27 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
EXTRA_DIST = README \
check-decl.m4 chown.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 getline.m4 \
getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 lfs.m4 \
lstat.m4 malloc.m4 memcmp.m4 putenv.m4 readdir.m4 realloc.m4 \
stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 getgroups.m4 \
getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 putenv.m4 \
readdir.m4 realloc.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
mktime.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
@@ -109,7 +110,7 @@ GZIP = --best
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)

66
m4/const.m4 Normal file
View File

@@ -0,0 +1,66 @@
#serial 1
dnl Just like AC_C_CONST from autoconf-2.12, but with an initializer
dnl for `charset x' and with
dnl AC_DEFINE(const, )
dnl changed to
dnl AC_DEFINE_UNQUOTED(const, [/* empty */])
dnl to avoid this warning:
dnl [...]/m4: Warning: Excess arguments to built-in `define' ignored
undefine([AC_C_CONST])
AC_DEFUN(AC_C_CONST,
[dnl This message is consistent in form with the other checking messages,
dnl and with the result message.
AC_CACHE_CHECK([for working const], ac_cv_c_const,
[AC_TRY_COMPILE(,
changequote(<<, >>)dnl
<<
/* Ultrix mips cc rejects this. */
typedef int charset[2]; const charset x = {0, 0};
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this. */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
It does not let you subtract one const X* pointer from another in an arm
of an if-expression whose if-part is not a constant expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
int x[] = {25, 17};
const int *foo = &x[0];
++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
typedef const int *iptr;
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
}
>>,
changequote([, ])dnl
ac_cv_c_const=yes, ac_cv_c_const=no)])
if test $ac_cv_c_const = no; then
AC_DEFINE_UNQUOTED(const, [/* empty */])
fi
])

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
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
@@ -7,7 +7,6 @@ dnl to do with the function we need.
AC_DEFUN(AM_FUNC_GETLINE,
[dnl
am_getline_needs_run_time_check=no
am_cv_func_working_getline=yes
AC_CHECK_FUNC(getline,
dnl Found it in some library. Verify that it works.
am_getline_needs_run_time_check=yes,

39
m4/perl.m4 Normal file
View File

@@ -0,0 +1,39 @@
#serial 1
dnl From Jim Meyering.
dnl Find a new-enough version of Perl.
dnl
AC_DEFUN(jm_PERL,
[
dnl FIXME: don't hard-code 5.003
dnl FIXME: should we cache the result?
AC_MSG_CHECKING([for perl5.003 or newer])
if test "${PERL+set}" = set; then
# `PERL' is set in the user's environment.
candidate_perl_names="$PERL"
perl_specified=yes
else
candidate_perl_names='perl perl5'
perl_specified=no
fi
found=no
AC_SUBST(PERL)
PERL="$missing_dir/missing perl"
for perl in $candidate_perl_names; do
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
if ( $perl -e 'require 5.003' ) > /dev/null 2>&1; then
PERL=$perl
found=yes
break
fi
done
AC_MSG_RESULT($found)
test $found = no && AC_MSG_WARN([
*** You don't seem to have perl5.003 or newer installed.
*** Because of that, you may be unable to regenerate certain files
*** if you modify the sources from which they are derived.] )
])

File diff suppressed because it is too large Load Diff

6160
old/fileutils/ChangeLog-1997 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,11 @@
Changes in release 3.17:
[3.16m]
* mv can move (and doesn't read) special files
* remove maintainer mode
[3.16l]
* mv can finally move non-regular files between partitions
[3.16k]
* install accepts new option, -D
[3.16j]
* du accepts new options, --exclude=PAT and --exclude-from=FILE (-X FILE)
* ls now quotes file names for the shell by default, if they contain

View File

@@ -1,3 +1,27 @@
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
* tests/nice: Fail immediately if this test is run with `nice'
level different from zero. Reported by Philippe De Muyter.
1998-02-03 Philippe De Muyter <phdm@macqel.be>
* src/id.c (xgetgroups): Guard function defn with #if HAVE_GETGROUPS.
* lib/putenv.c (sys/types.h): Include to get size_t on some systems.
(NULL): Define if needed.
1998-01-31 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (AC_LFS): Use it.
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
* Makefile.maint: New file.
* Makefile.am: Move rules common to textutils, fileutils, sh-utils
into Makefile.maint.
Include Makefile.maint.
(EXTRA_DIST): Add Makefile.maint.
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
* lib/Makefile.am (AUTOMAKE_OPTIONS): Define to ../src/ansi2knr.

View File

@@ -1,3 +1,147 @@
1998-02-06 Jim Meyering <meyering@eng.ascend.com>
* Version 1.22e.
* configure.in: Don't use AM_MAINTAINER_MODE or
AC_PATH_PROG(PERL, perl).
(jm_PERL): Use this.
1998-02-04 Jim Meyering <meyering@eng.ascend.com>
* tests/Makefile.am.in (EXTRA_DIST): Remove mk-script.pl.
(mk_script): Set to ../mk-script.
(x-tests): Use `$(PERL) -w -- $(mk_script)', not ./mk-script.
Remove @MAINT@ cruft.
(Makefile.am): Likewise.
Remove @MAINT@ cruft. Now `missing' will explain the failure
when people don't have Perl yet modify a file whose rebuilding
would lead to the use of Perl.
* tests/Makefile.am (EXTRA_DIST): Add mk-script.
* tests/*/mk-script.pl: Remove files.
* GNUmakefile: New file.
* Makefile.am (EXTRA_DIST): Add GNUmakefile.
Don't include Makefile.maint from here. It's included from GNUmakefile.
1998-01-30 Paul Eggert <eggert@twinsun.com>
* configure.in (AC_LFS): Put before anything that can affect or use
CPPFLAGS, LDFLAGS, or LIBS.
1998-01-25 Jim Meyering <meyering@na-net.ornl.gov>
* Makefile.maint: New file.
* Makefile.am: Move rules common to textutils, fileutils, sh-utils
into Makefile.maint.
Include Makefile.maint.
(EXTRA_DIST): Add Makefile.maint.
* src/cat.c (cat): Convert comma-expressions to pairs of
semicolon-terminated stmts.
Add braces around compound if/else stmts.
1998-01-24 Jim Meyering <meyering@na-net.ornl.gov>
* src/tail.c (parse_obsolescent_option): Do not interpret `-f -n 1 ...'
as obsolescent options.
Accept new option: --sleep-interval=SECONDS (-s).
FIXME: document new option in textutils.texi.
(parse_options): Recognize it.
(usage): Describe it.
(tail_forever): Use it.
(dump_remainder): Use it.
* tests/tail/Test.pm (f-1): Add test for option-processing of `-f -n 1'.
* tests/cut/: Rename directory to remove `-test' suffix.
* tests/join/: Likewise.
* tests/md5sum/: Likewise.
* tests/pr/: Likewise.
* tests/sort/: Likewise.
* tests/tr/: Likewise.
* configure.in (AC_OUTPUT): Reflect renamings in tests/.
* tests/Makefile.am (SUBDIRS): Reflect renamings in tests/.
* src/system.h (TYPE_MINIMUM): Add extra outer cast to work around
bug in Cray C 5.0.3.0 when T == time_t.
1998-01-18 Jim Meyering <meyering@na-net.ornl.gov>
* src/sort.c (strncoll, strncoll_s2_readonly, look_for_fraction,
numcompare): Remove the `unsigned' from some `unsigned char*'
parameter types. Add casts via UCHAR where necessary to avoid
problems with unwanted sign extension. Based on a patch from
Kaveh Ghazi to appease Irix4's cc compiler.
1998-01-17 Jim Meyering <meyering@na-net.ornl.gov>
* src/split.c (next_file_name): Rewrite. This removes an artificial
limit (albeit already high, at INT_MAX :-) on the number of files
split could create. Reported by Ralf W. Stephan.
1998-01-16 Jim Meyering <meyering@na-net.ornl.gov>
* src/sort.c: (mergefps): Add braces to avoid ambiguous `else' stmt.
(nls_set_fraction): Likewise.
* src/sort.c: Guard inclusion of langinfo.h also with HAVE_LANGINFO_H,
for Irix-4.0.5. From Kaveh Ghazi.
* configure.in: Check for langinfo.h.
* lib/getline.c: Make PARAMS-defining conditionals consistent.
* lib/linebuffer.h: Likewise.
* lib/long-options.h: Likewise.
* lib/memcasecmp.h: Likewise.
* lib/xstrtod.h: Likewise.
* lib/xstrtol.h: Likewise.
Suggestion from Kaveh Ghazi.
* tests/head/Test.pm (fail-0): Disable test. It depends on
sizeof(long) being 32 bits. Reported by Kaveh Ghazi.
1998-01-10 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.22d.
* src/system.h [HAVE_LIMITS_H]: Include limits.h
(TYPE_SIGNED): Define.
(TYPE_MINIMUM): Define.
(TYPE_MAXIMUM): Define.
(CHAR_BIT): Define.
(SCHAR_MAX): Define.
(UCHAR_MAX): Define.
(SHRT_MAX): Define.
(INT_MAX): Define.
(UINT_MAX): Define.
(LONG_MAX): Define.
(ULONG_MAX): Define.
* src/*.c: Remove definitions of those symbols.
* src/csplit.c: Move inclusion of regex.h/rx.h to follow system.h
since it now includes limit.h which defines RE_DUP_MAX.
* src/nl.c: Likewise.
* src/tac.c: Likewise.
* lib/xstrtol.c (bkm_scale): Renamed from BKM_SCALE.
Rewrite macro as function. Return a value. Update caller.
Cast __ZLONG_MAX `__unsigned long int' before casting to double to
avoid SunOS /bin/cc compiler bug.
1998-01-08 Jim Meyering <meyering@na-net.ornl.gov>
* src/tac-pipe.c: New file. But not yet used.
* src/Makefile.am (EXTRA_DIST): Add tac-pipe.c.
* src/tac.c (tac_stream): Don't perform arithmetic on now-void* pointer
result of xrealloc (until recently it was char*).
* configure.in (AC_CHECK_FUNCS): Add nl_langinfo.
* src/sort.c (inittables): Add && HAVE_NL_LANGINFO to the #if-test
guarding the nls month-checking code.
(nls_numeric_format): Remove unnecessary (and error-evoking w/SunOS' cc)
`unsigned' from dcls of text and lim.
(main): Cast lconvp->grouping to `unsigned char*' to appease SunOS's cc.
1998-01-03 Jim Meyering <meyering@na-net.ornl.gov>
* lib/Makefile.am (AUTOMAKE_OPTIONS): Define to ../src/ansi2knr.

View File

@@ -1,4 +1,6 @@
Changes in release 1.23
[1.22e]
* remove maintainer mode
[1.22d]
* wc accepts new option: --max-line-length (-L)
* sort can sort according to your locale if your C library supports that

116
src/cat.c
View File

@@ -1,5 +1,5 @@
/* cat -- concatenate files and print on the standard output.
Copyright (C) 88, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -381,60 +381,76 @@ cat (
/* If quoting, i.e. at least one of -v, -e, or -t specified,
scan for chars that need conversion. */
if (quote)
for (;;)
{
if (ch >= 32)
{
if (ch < 127)
*bpout++ = ch;
else if (ch == 127)
*bpout++ = '^',
*bpout++ = '?';
else
{
*bpout++ = 'M',
{
for (;;)
{
if (ch >= 32)
{
if (ch < 127)
*bpout++ = ch;
else if (ch == 127)
{
*bpout++ = '^';
*bpout++ = '?';
}
else
{
*bpout++ = 'M';
*bpout++ = '-';
if (ch >= 128 + 32)
if (ch < 128 + 127)
*bpout++ = ch - 128;
if (ch >= 128 + 32)
{
if (ch < 128 + 127)
*bpout++ = ch - 128;
else
{
*bpout++ = '^';
*bpout++ = '?';
}
}
else
*bpout++ = '^',
*bpout++ = '?';
else
*bpout++ = '^',
*bpout++ = ch - 128 + 64;
}
}
else if (ch == '\t' && output_tabs)
*bpout++ = '\t';
else if (ch == '\n')
{
newlines = -1;
break;
}
else
*bpout++ = '^',
*bpout++ = ch + 64;
{
*bpout++ = '^';
*bpout++ = ch - 128 + 64;
}
}
}
else if (ch == '\t' && output_tabs)
*bpout++ = '\t';
else if (ch == '\n')
{
newlines = -1;
break;
}
else
{
*bpout++ = '^';
*bpout++ = ch + 64;
}
ch = *bpin++;
}
ch = *bpin++;
}
}
else
/* Not quoting, neither of -v, -e, or -t specified. */
for (;;)
{
if (ch == '\t' && !output_tabs)
*bpout++ = '^',
*bpout++ = ch + 64;
else if (ch != '\n')
*bpout++ = ch;
else
{
newlines = -1;
break;
}
{
/* Not quoting, neither of -v, -e, or -t specified. */
for (;;)
{
if (ch == '\t' && !output_tabs)
{
*bpout++ = '^';
*bpout++ = ch + 64;
}
else if (ch != '\n')
*bpout++ = ch;
else
{
newlines = -1;
break;
}
ch = *bpin++;
}
ch = *bpin++;
}
}
}
}

View File

@@ -25,8 +25,9 @@
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (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. */ \
&& (errno != EPERM || x->myeuid == 0))
But root probably wants to know, e.g. if NFS disallows it, \
or if the target system doesn't support file ownership. */ \
&& ((errno != EPERM && errno != EINVAL) || x->myeuid == 0))
struct dir_list
{
@@ -422,9 +423,10 @@ copy_internal (const char *src_path, const char *dst_path,
return 0;
}
if (backup_type != none && !S_ISDIR (dst_sb.st_mode))
if (x->backup_type != none && !S_ISDIR (dst_sb.st_mode))
{
char *tmp_backup = find_backup_file_name (dst_path);
char *tmp_backup = find_backup_file_name (dst_path,
x->backup_type);
if (tmp_backup == NULL)
error (1, 0, _("virtual memory exhausted"));
@@ -755,10 +757,12 @@ valid_options (const struct cp_options *co)
{
assert (co != NULL);
assert (VALID_BACKUP_TYPE (co->backup_type));
/* FIXME: make sure xstat and dereference are consistent. */
assert (co->xstat);
assert (co->sparse_mode != SPARSE_UNUSED);
assert (VALID_SPARSE_MODE (co->sparse_mode));
return 1;
}
@@ -766,9 +770,7 @@ valid_options (const struct cp_options *co)
any type. NONEXISTENT_DST should be nonzero if the file DST_PATH
is known not to exist (e.g., because its parent directory was just
created); NONEXISTENT_DST should be zero if DST_PATH might already
exist. DEVICE is the device number of the parent directory of
DST_PATH, or 0 if the parent of this file is not known.
OPTIONS is ... FIXME-describe
exist. OPTIONS is ... FIXME-describe
Return 0 if successful, 1 if an error occurs. */
int

View File

@@ -22,8 +22,15 @@ enum Sparse_type
SPARSE_ALWAYS
};
# define VALID_SPARSE_MODE(Mode) \
((Mode) == SPARSE_NEVER \
|| (Mode) == SPARSE_AUTO \
|| (Mode) == SPARSE_ALWAYS)
struct cp_options
{
enum backup_type backup_type;
/* If nonzero, copy all files except (directories and, if not dereferencing
them, symbolic links,) as if they were regular files. */
int copy_as_regular;

View File

@@ -25,7 +25,9 @@
#include <stdio.h>
#include <sys/types.h>
/* FIXME: uncomment for release
#define NDEBUG
*/
#include <assert.h>
#include <getopt.h>
@@ -245,9 +247,10 @@ re_protect (const char *const_dst_path, int src_offset,
}
/* 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. */
But root probably wants to know, e.g. if NFS disallows it,
or if the target system doesn't support file ownership. */
if (chown (dst_path, src_sb.st_uid, src_sb.st_gid)
&& (errno != EPERM || myeuid == 0))
&& ((errno != EPERM && errno != EINVAL) || myeuid == 0))
{
error (0, errno, _("preserving ownership for %s"), dst_path);
return 1;
@@ -521,17 +524,22 @@ do_copy (int argc, char **argv, const struct cp_options *x)
where SUFFIX is determined by any version control options used. */
if (x->force
&& backup_type != none
&& x->backup_type != none
&& STREQ (source, dest)
&& !new_dst && S_ISREG (sb.st_mode))
{
new_dest = find_backup_file_name (dest);
/* Set backup_type to `none' so that the normal backup
static struct cp_options x_tmp;
new_dest = find_backup_file_name (dest, x->backup_type);
/* Set x->backup_type to `none' so that the normal backup
mechanism is not used when performing the actual copy.
backup_type must be set to `none' only *after* the above
call to find_backup_file_name -- that function uses
backup_type to determine the suffix it applies. */
backup_type = none;
x_tmp = *x;
x_tmp.backup_type = none;
x = &x_tmp;
if (new_dest == NULL)
error (1, 0, _("virtual memory exhausted"));
}
@@ -574,6 +582,9 @@ is not a directory"),
dest);
usage (1);
}
/* unreachable */
return 0;
}
static void
@@ -743,8 +754,7 @@ main (int argc, char **argv)
usage (1);
}
if (make_backups)
backup_type = get_version (version);
x.backup_type = (make_backups ? get_version (version) : none);
if (x.preserve == 1)
x.umask_kill = 0777777;

View File

@@ -1,5 +1,5 @@
/* csplit - split a file into sections determined by context lines
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,24 +29,15 @@
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif /* HAVE_LIMITS_H */
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#if WITH_REGEX
# include <regex.h>
#else
# include <rx.h>
#endif
#include "system.h"
#include "error.h"
#include "xstrtoul.h"
#include "xalloc.h"

View File

@@ -26,7 +26,7 @@
#include "system.h"
#include "getline.h"
#include "error.h"
#include "getdate.h"
#include "get-date.h"
#ifndef STDC_HEADERS
size_t strftime ();
@@ -142,7 +142,7 @@ batch_convert (const char *input_filename, const char *format)
{
size_t tz_len = strlen (initial_TZ);
char *buf = xmalloc (3 + tz_len + 1);
mempcpy (mempcpy (buf, "TZ=", 3), initial_TZ, tz_len + 1);
memcpy (mempcpy (buf, "TZ=", 3), initial_TZ, tz_len + 1);
initial_TZ = buf;
}
}

70
src/dcgen Executable file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/perl -w
# -*- perl -*-
eval 'exec /p/bin/perl -S $0 ${1+"$@"}'
if 0;
# dcgen -- generate C declarations of arrays of lines and line lengths
# Copyright (C) 1996, 1998 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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 you uncomment the following lines, you should also do
# s/chop/chomp and s/local/my/.
#require 5.002;
#use strict;
# Convert an arbitrary file to dcl of two arrays.
# One of lines, the other of lengths.
local $prefix = 'G_';
local @line;
while (<>)
{
chop;
push (@line, $_);
}
local $n = @line;
print "#define ${prefix}N_LINES $n\n\n";
local $indent = ' ';
print "const size_t ${prefix}line_length[${prefix}N_LINES] =\n{\n$indent";
local $ind = $indent;
local $i;
for ($i = 0; $i < @line; $i++)
{
local $comma = ($i < @line - 1 ? ',' : '');
$ind = '' if $i == @line - 1;
local $sep = ($i && $i % 18 == 0 || $i == @line - 1 ? "\n$ind" : ' ');
print length ($line[$i]), $comma, $sep;
}
print "};\n\n";
print "const char *const ${prefix}line[${prefix}N_LINES] =\n{\n";
while (1)
{
$_ = shift (@line);
local $comma = (@line ? ',' : '');
print "$indent\"$_\"$comma\n";
last if !@line;
}
print "};\n";
exit (0);

1172
src/dd.c

File diff suppressed because it is too large Load Diff

View File

@@ -141,7 +141,7 @@ print_header (void)
printf (" ");
if (inode_format)
printf (" Inodes IUsed IFree %%IUsed");
printf (" Inodes IUsed IFree %%IUsed ");
else
if (output_units == 1024 * 1024)
printf (" MB-blocks Used Available Capacity");
@@ -185,6 +185,13 @@ excluded_fstype (const char *fstype)
return 0;
}
/* Like human_readable, except return "-" if the argument is -1. */
static char *
df_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
{
return n == -1 ? "-" : human_readable (n, buf, from_units, to_units, base);
}
/* Display a space listing for the disk device with absolute path DISK.
If MOUNT_POINT is non-NULL, it is the path of the root of the
filesystem on DISK.
@@ -235,23 +242,28 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
double inodes_percent_used;
uintmax_t inodes_used;
if (fsu.fsu_files == 0)
if (fsu.fsu_files == -1 || fsu.fsu_files < fsu.fsu_ffree)
{
inodes_used = 0;
fsu.fsu_ffree = 0;
inodes_percent_used = 0;
inodes_used = -1;
inodes_percent_used = -1;
}
else
{
inodes_used = fsu.fsu_files - fsu.fsu_ffree;
inodes_percent_used = inodes_used * 100.0 / fsu.fsu_files;
inodes_percent_used =
(fsu.fsu_files == 0 ? 0
: inodes_used * 100.0 / fsu.fsu_files);
}
printf (" %7s %7s %7s %5.0f%%",
human_readable (fsu.fsu_files, buf[0], 1, 1, human_readable_base),
human_readable (inodes_used, buf[1], 1, 1, human_readable_base),
human_readable (fsu.fsu_ffree, buf[2], 1, 1, human_readable_base),
inodes_percent_used);
printf (" %7s %7s %7s ",
df_readable (fsu.fsu_files, buf[0], 1, 1, human_readable_base),
df_readable (inodes_used, buf[1], 1, 1, human_readable_base),
df_readable (fsu.fsu_ffree, buf[2], 1, 1, human_readable_base));
if (inodes_percent_used < 0)
printf (" - ");
else
printf (" %5.0f%%", inodes_percent_used);
}
else
{
@@ -260,27 +272,31 @@ show_dev (const char *disk, const char *mount_point, const char *fstype)
double blocks_percent_used;
uintmax_t blocks_used;
if (fsu.fsu_blocks == 0 || fsu.fsu_bavail == (unsigned long) -1)
if (fsu.fsu_blocks == -1 || fsu.fsu_blocks < fsu.fsu_bfree)
{
blocks_used = 0;
fsu.fsu_bavail = 0;
blocks_percent_used = 0;
blocks_used = -1;
blocks_percent_used = -1;
}
else
{
blocks_used = fsu.fsu_blocks - fsu.fsu_bfree;
blocks_percent_used =
blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail);
(fsu.fsu_bfree < fsu.fsu_bavail ? -1
: (blocks_used + fsu.fsu_bavail) == 0 ? 0
: blocks_used * 100.0 / (blocks_used + fsu.fsu_bavail));
}
printf (" %*s %*s %*s %5.0f%% ",
w, human_readable (fsu.fsu_blocks, buf[0], fsu.fsu_blocksize,
output_units, human_readable_base),
w, human_readable (blocks_used, buf[1], fsu.fsu_blocksize,
output_units, human_readable_base),
w, human_readable (fsu.fsu_bavail, buf[2], fsu.fsu_blocksize,
output_units, human_readable_base),
blocks_percent_used);
printf (" %*s %*s %*s ",
w, df_readable (fsu.fsu_blocks, buf[0], fsu.fsu_blocksize,
output_units, human_readable_base),
w, df_readable (blocks_used, buf[1], fsu.fsu_blocksize,
output_units, human_readable_base),
w, df_readable (fsu.fsu_bavail, buf[2], fsu.fsu_blocksize,
output_units, human_readable_base));
if (blocks_percent_used < 0)
printf (" - ");
else
printf (" %5.0f%% ", blocks_percent_used);
}
if (mount_point)

View File

@@ -1,5 +1,5 @@
/* GNU fmt -- simple text formatter.
Copyright (C) 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,18 +22,6 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
/* Redefine. Otherwise, systems (Unicos for one) with headers that define
it to be a type get syntax errors for the variable declaration below. */
#define word unused_word_type

View File

@@ -1,5 +1,5 @@
/* fold -- wrap each input line to fit in specified width.
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,18 +26,6 @@
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "xstrtol.h"
#include "error.h"

View File

@@ -1,5 +1,5 @@
/* id -- print real and effective UIDs and GIDs
Copyright (C) 1989-1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1989-1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -215,6 +215,8 @@ print_group (int gid)
printf ("%s", grp->gr_name);
}
#if HAVE_GETGROUPS
static int
xgetgroups (const char *username, int *n_groups, GETGROUPS_T **groups)
{
@@ -249,6 +251,8 @@ xgetgroups (const char *username, int *n_groups, GETGROUPS_T **groups)
return fail;
}
#endif /* HAVE_GETGROUPS */
/* Print all of the distinct groups the user is in. */
static void
@@ -281,7 +285,7 @@ print_group_list (const char *username)
}
free (groups);
}
#endif
#endif /* HAVE_GETGROUPS */
}
/* Print all of the info about the user's user and group IDs. */
@@ -353,7 +357,7 @@ print_full_info (const char *username)
}
free (groups);
}
#endif
#endif /* HAVE_GETGROUPS */
}
static void

View File

@@ -53,6 +53,11 @@
This is different from the SunOS 4.0 install, which gives
directories that it creates the default attributes.
-D
Like the -d option, but a file is installed, along with the directory.
Useful when installing into a new directory, and the install
process doesn't properly comprehend making directories.
David MacKenzie <djm@gnu.ai.mit.edu> */
#ifdef _AIX
@@ -113,6 +118,7 @@ gid_t getgid ();
#endif
char *base_name ();
char *dirname ();
int safe_read ();
int full_write ();
int isdir ();
@@ -122,6 +128,7 @@ static int change_timestamps PARAMS ((const char *from, const char *to));
static int change_attributes PARAMS ((const char *path, int no_need_to_chown));
static int copy_file PARAMS ((const char *from, const char *to,
int *to_created));
static int install_file_to_path PARAMS ((const char *from, const char *to));
static int install_file_in_dir PARAMS ((const char *from, const char *to_dir));
static int install_file_in_file PARAMS ((const char *from, const char *to));
static void get_ids PARAMS ((void));
@@ -131,6 +138,9 @@ static void usage PARAMS ((int status));
/* The name this program was run with, for error messages. */
char *program_name;
/* FIXME: document */
enum backup_type backup_type;
/* The user name that will own the files, or NULL to make the owner
the current user ID. */
static char *owner_name;
@@ -191,6 +201,7 @@ main (int argc, char **argv)
char *symbolic_mode = NULL;
int make_backups = 0;
char *version;
int mkdir_and_install = 0;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -206,12 +217,12 @@ main (int argc, char **argv)
verbose = 0;
umask (0);
version = getenv ("SIMPLE_BACKUP_SUFFIX");
if (version)
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
version = getenv ("SIMPLE_BACKUP_SUFFIX");
if (version)
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
while ((optc = getopt_long (argc, argv, "bcsdg:m:o:pvV:S:", long_options,
while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pvV:S:", long_options,
NULL)) != -1)
{
switch (optc)
@@ -229,6 +240,9 @@ main (int argc, char **argv)
case 'd':
dir_arg = 1;
break;
case 'D':
mkdir_and_install = 1;
break;
case 'v':
verbose = 1;
break;
@@ -270,8 +284,7 @@ main (int argc, char **argv)
error (1, 0,
_("the strip option may not be used when installing a directory"));
if (make_backups)
backup_type = get_version (version);
backup_type = (make_backups ? get_version (version) : none);
if (optind == argc || (optind == argc - 1 && !dir_arg))
{
@@ -303,8 +316,10 @@ main (int argc, char **argv)
else
{
if (optind == argc - 2)
{
if (!isdir (argv[argc - 1]))
{
if (mkdir_and_install)
errors = install_file_to_path (argv[argc - 2], argv[argc - 1]);
else if (!isdir (argv[argc - 1]))
errors = install_file_in_file (argv[argc - 2], argv[argc - 1]);
else
errors = install_file_in_dir (argv[argc - 2], argv[argc - 1]);
@@ -325,6 +340,41 @@ main (int argc, char **argv)
exit (errors);
}
/* Copy file FROM onto file TO, creating any missing parent directories of TO.
Return 0 if successful, 1 if an error occurs */
static int
install_file_to_path (const char *from, const char *to)
{
char *dest_dir;
int fail;
dest_dir = dirname (to);
/* check to make sure this is a path (not install a b ) */
if (!STREQ (dest_dir, ".")
&& !isdir (dest_dir))
{
/* FIXME: Note that it's a little kludgey (even dangerous) that we
derive the permissions for parent directories from the permissions
specfied for the file, but since this option is intended mainly to
help installers when the distribution doesn't provide proper install
rules, it's not so bad. Maybe use something like this instead:
int parent_dir_mode = (mode | (S_IRUGO | S_IXUGO)) & (~SPECIAL_BITS);
*/
fail = make_path (dest_dir, mode, mode, owner_id, group_id, 0,
(verbose ? _("creating directory `%s'") : NULL));
}
else
{
fail = install_file_in_file (from, to);
}
free (dest_dir);
return fail;
}
/* Copy file FROM onto file TO and give TO the appropriate
attributes.
Return 0 if successful, 1 if an error occurs. */
@@ -417,7 +467,7 @@ copy_file (const char *from, const char *to, int *to_created)
/* The destination file exists. Try to back it up if required. */
if (backup_type != none)
{
char *tmp_backup = find_backup_file_name (to);
char *tmp_backup = find_backup_file_name (to, backup_type);
char *dst_backup;
if (tmp_backup == NULL)
@@ -647,13 +697,16 @@ Usage: %s [OPTION]... SOURCE DEST (1st format)\n\
"),
program_name, program_name, program_name);
printf (_("\
In first two formats, copy SOURCE to DEST or multiple SOURCE(s) to\n\
DIRECTORY, while setting permission modes and owner/group. In third\n\
format, make all components of the given DIRECTORY(ies).\n\
In the first two formats, copy SOURCE to DEST or multiple SOURCE(s) to\n\
the existing DIRECTORY, while setting permission modes and owner/group.\n\
In the third format, create all components of the given DIRECTORY(ies).\n\
\n\
-b, --backup make backup before removal\n\
-c (ignored)\n\
-d, --directory create [leading] directories, mandatory for 3rd format\n\
-d, --directory treat all arguments as directory names; create all\n\
components of the specified directories\n\
-D create all leading components of DEST except the last,\n\
then copy SOURCE to DEST; useful in the 1st format\n\
-g, --group=GROUP set group ownership, instead of process' current group\n\
-m, --mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x\n\
-o, --owner=OWNER set ownership (super-user only)\n\

View File

@@ -1,5 +1,5 @@
/* join - join lines of two files on a common field
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,18 +28,6 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#if _LIBC || STDC_HEADERS
# define TOLOWER(c) tolower (c)
#else

View File

@@ -67,6 +67,9 @@ void strip_trailing_slashes ();
/* The name by which the program was run, for error messages. */
char *program_name;
/* FIXME: document */
enum backup_type backup_type;
/* A pointer to the function used to make links. This will point to either
`link' or `symlink'. */
static int (*linkfunc) ();
@@ -266,7 +269,7 @@ do_link (const char *source, const char *dest)
if (backup_type != none)
{
char *tmp_backup = find_backup_file_name (dest);
char *tmp_backup = find_backup_file_name (dest, backup_type);
if (tmp_backup == NULL)
error (1, 0, _("virtual memory exhausted"));
dest_backup = (char *) alloca (strlen (tmp_backup) + 1);
@@ -323,26 +326,28 @@ usage (int status)
else
{
printf (_("\
Usage: %s [OPTION]... SOURCE [DEST]\n\
or: %s [OPTION]... SOURCE... DIRECTORY\n\
Usage: %s [OPTION]... TARGET [LINK_NAME]\n\
or: %s [OPTION]... TARGET... DIRECTORY\n\
"),
program_name, program_name);
printf (_("\
Link SOURCE to DEST (. by default), or multiple SOURCE(s) to DIRECTORY.\n\
Makes hard links by default, symbolic links with -s.\n\
Create a link to the specified TARGET with optional LINK_NAME. If there is\n\
more than one TARGET, the last argument must be a directory; create links\n\
in DIRECTORY to each TARGET. Create hard links by default, symbolic links\n\
with --symbolic. When creating hard links, each TARGET must exist.\n\
\n\
-b, --backup make backups for removed files\n\
-d, -F, --directory hard link directories (super-user only)\n\
-f, --force remove existing destinations\n\
-n, --no-dereference treat destination that is a symlink to a\n\
directory as if it were a normal file\n\
-i, --interactive prompt whether to remove destinations\n\
-s, --symbolic make symbolic links instead of hard links\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
-v, --verbose print name of each file before linking\n\
-V, --version-control=WORD override the usual version control\n\
--help display this help and exit\n\
--version output version information and exit\n\
-b, --backup make a backup of each existing destination file\n\
-d, -F, --directory hard link directories (super-user only)\n\
-f, --force remove existing destination files\n\
-n, --no-dereference treat destination that is a symlink to a\n\
directory as if it were a normal file\n\
-i, --interactive prompt whether to remove destinations\n\
-s, --symbolic make symbolic links instead of hard links\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
-v, --verbose print name of each file before linking\n\
-V, --version-control=WORD override the usual version control\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
"));
printf (_("\
@@ -444,8 +449,7 @@ main (int argc, char **argv)
usage (1);
}
if (make_backups)
backup_type = get_version (version);
backup_type = (make_backups ? get_version (version) : none);
#ifdef S_ISLNK
if (symbolic_link)

View File

@@ -1020,6 +1020,7 @@ decode_switches (int argc, char **argv)
break;
case 'u':
sort_type = sort_time;
time_type = time_atime;
break;
@@ -1709,7 +1710,10 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
val = lstat (path, &files[files_index].stat);
}
else
val = lstat (path, &files[files_index].stat);
{
val = lstat (path, &files[files_index].stat);
}
if (val < 0)
{
error (0, errno, "%s", path);
@@ -2966,12 +2970,13 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
printf (_("\
-S sort by file size\n\
--sort=WORD ctime -c, extension -X, none -U, size -S,\n\
--sort=WORD extension -X, none -U, size -S, time -t,\n\
version -v\n\
status -c, time -t, atime -u, access -u, use -u\n\
--time=WORD show time as WORD instead of modification time:\n\
atime, access, use, ctime or status\n\
-t sort by modification time; with -l: show mtime\n\
atime, access, use, ctime or status; use\n\
specified time as sort key if --sort=time\n\
-t sort by modification time\n\
-T, --tabsize=COLS assume tab stops at each COLS instead of 8\n\
-u sort by last access time; with -l: show atime\n\
-U do not sort; list entries in directory order\n\

286
src/mv.c
View File

@@ -46,41 +46,42 @@
#include <getopt.h>
#include <sys/types.h>
/* FIXME: uncomment for release
#define NDEBUG
*/
#include <assert.h>
#include "system.h"
#include "path-concat.h"
#include "backupfile.h"
#include "closeout.h"
#include "cp-hash.h"
#include "copy.h"
#include "remove.h"
#include "error.h"
#ifdef HAVE_LCHOWN
# define chown(PATH, OWNER, GROUP) lchown(PATH, OWNER, GROUP)
#endif
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
/* Initial number of entries in the inode hash table. */
#define INITIAL_ENTRY_TAB_SIZE 70
char *base_name ();
int euidaccess ();
int full_write ();
enum backup_type get_version ();
int isdir ();
int yesno ();
int lstat ();
int safe_read ();
int full_write ();
int euidaccess ();
int yesno ();
/* The name this program was run with. */
char *program_name;
/* If nonzero, query the user before overwriting files. */
static int interactive;
/* If nonzero, do not query the user before overwriting unwritable
files. */
static int override_mode;
/* If nonzero, do not move a nondirectory that has an existing destination
with the same or newer modification time. */
static int update = 0;
/* If nonzero, list each file as it is moved. */
static int verbose;
/* If nonzero, stdin is a tty. */
static int stdin_tty;
@@ -96,14 +97,59 @@ static struct option const long_options[] =
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
{"suffix", required_argument, NULL, 'S'},
{"update", no_argument, &update, 1},
{"verbose", no_argument, &verbose, 1},
{"update", no_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'},
{"version-control", required_argument, NULL, 'V'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
static void
rm_option_init (struct rm_options *x)
{
x->unlink_dirs = 0;
/* FIXME: maybe this should be 1. The POSIX spec doesn't specify. */
x->ignore_missing_files = 0;
x->recursive = 1;
/* Should we prompt for removal, too? No. Prompting for the `move'
part is enough. It implies removal. */
x->interactive = 0;
x->stdin_tty = 0;
x->verbose = 0;
}
static void
cp_option_init (struct cp_options *x)
{
x->copy_as_regular = 0; /* FIXME: maybe make this an option */
x->dereference = 0;
x->force = 0;
x->hard_link = 0;
x->interactive = 0;
x->myeuid = geteuid ();
x->one_file_system = 0;
x->preserve = 1;
x->require_preserve = 0; /* FIXME: maybe make this an option */
x->recursive = 1;
x->sparse_mode = SPARSE_AUTO; /* FIXME: maybe make this an option */
x->symbolic_link = 0;
/* Find out the current file creation mask, to knock the right bits
when using chmod. The creation mask is set to be liberal, so
that created directories can be written, even if it would not
have been allowed with the mask this process was started with. */
x->umask_kill = 0777777 ^ umask (0);
x->update = 0;
x->verbose = 0;
x->xstat = lstat;
}
/* If PATH is an existing directory, return nonzero, else 0. */
static int
@@ -114,140 +160,17 @@ is_real_dir (const char *path)
return lstat (path, &stats) == 0 && S_ISDIR (stats.st_mode);
}
/* Apply as many of the file attributes (the struct stat fields: st_atime,
st_mtime, st_uid, st_gid, st_mode) of ATTR to FILE as possible.
Return non-zero if any operation failed; return zero otherwise. */
static int
apply_attributes (const char *file, const struct stat *attr)
{
struct utimbuf tv;
mode_t mode = attr->st_mode;
int fail = 0;
/* Try to apply the modtime and access time. */
tv.actime = attr->st_atime;
tv.modtime = attr->st_mtime;
if (utime (file, &tv))
{
error (0, errno, "%s: unable to restore file times", file);
fail = 1;
}
/* chown would turn off set[ug]id bits for non-root, so do the
chown before the chmod. */
/* Try to apply group ID and owner ID. */
if (chown (file, attr->st_uid, attr->st_gid))
{
error (0, errno, "%s: unable to restore owner and group IDs", file);
/* If the owner and group cannot be preserved, then mask off
any setgid and setuid bits. */
mode &= (~(S_ISUID | S_ISGID));
fail = 1;
}
/* Try to apply file mode. */
if (chmod (file, mode & 07777))
{
error (0, errno, "%s: unable to restore file mode", file);
fail = 1;
}
return fail;
}
/* Copy regular file SOURCE onto file DEST. SOURCE_STATS must be
the result of calling lstat on SOURCE.
Return 1 if an error occurred, 0 if successful. */
static int
copy_reg (const char *source, const char *dest, const struct stat *source_stats)
{
int ifd;
int ofd;
char buf[1024 * 8];
int len; /* Number of bytes read into `buf'. */
if (!S_ISREG (source_stats->st_mode))
{
error (0, 0,
_("cannot move `%s' across filesystems: Not a regular file"),
source);
return 1;
}
if (unlink (dest) && errno != ENOENT)
{
error (0, errno, _("cannot remove `%s'"), dest);
return 1;
}
ifd = open (source, O_RDONLY, 0);
if (ifd < 0)
{
error (0, errno, "%s", source);
return 1;
}
ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (ofd < 0)
{
error (0, errno, "%s", dest);
close (ifd);
return 1;
}
while ((len = safe_read (ifd, buf, sizeof (buf))) > 0)
{
if (full_write (ofd, buf, len) < 0)
{
error (0, errno, "%s", dest);
close (ifd);
close (ofd);
unlink (dest);
return 1;
}
}
if (len < 0)
{
error (0, errno, "%s", source);
close (ifd);
close (ofd);
unlink (dest);
return 1;
}
if (close (ifd) < 0)
{
error (0, errno, "%s", source);
close (ofd);
return 1;
}
if (close (ofd) < 0)
{
error (0, errno, "%s", dest);
return 1;
}
/* Try to apply the attributes of SOURCE to DEST.
Each failure gets a diagnostic, but POSIX requires that failure
to preserve attributes not change mv's exit status. */
apply_attributes (dest, source_stats);
return 0;
}
/* Move SOURCE onto DEST. Handles cross-filesystem moves.
If SOURCE is a directory, DEST must not exist.
Return 0 if successful, non-zero if an error occurred. */
static int
do_move (const char *source, const char *dest)
do_move (const char *source, const char *dest, const struct cp_options *x)
{
char *dest_backup = NULL;
struct stat source_stats;
struct stat dest_stats;
int nonexistent_dst;
int fail;
if (lstat (source, &source_stats) != 0)
@@ -256,8 +179,10 @@ do_move (const char *source, const char *dest)
return 1;
}
nonexistent_dst = 1;
if (lstat (dest, &dest_stats) == 0)
{
nonexistent_dst = 0;
if (source_stats.st_dev == dest_stats.st_dev
&& source_stats.st_ino == dest_stats.st_ino)
@@ -272,11 +197,11 @@ do_move (const char *source, const char *dest)
return 1;
}
if (!S_ISDIR (source_stats.st_mode) && update
if (!S_ISDIR (source_stats.st_mode) && x->update
&& source_stats.st_mtime <= dest_stats.st_mtime)
return 0;
if (!override_mode && (interactive || stdin_tty)
if (!x->force && (x->interactive || stdin_tty)
&& euidaccess (dest, W_OK))
{
fprintf (stderr, _("%s: replace `%s', overriding mode %04o? "),
@@ -285,16 +210,16 @@ do_move (const char *source, const char *dest)
if (!yesno ())
return 0;
}
else if (interactive)
else if (x->interactive)
{
fprintf (stderr, _("%s: replace `%s'? "), program_name, dest);
if (!yesno ())
return 0;
}
if (backup_type != none)
if (x->backup_type != none)
{
char *tmp_backup = find_backup_file_name (dest);
char *tmp_backup = find_backup_file_name (dest, x->backup_type);
if (tmp_backup == NULL)
error (1, 0, _("virtual memory exhausted"));
dest_backup = (char *) alloca (strlen (tmp_backup) + 1);
@@ -318,7 +243,7 @@ do_move (const char *source, const char *dest)
return 1;
}
if (verbose)
if (x->verbose)
printf ("%s -> %s\n", source, dest);
/* Always try rename first. */
@@ -346,7 +271,17 @@ do_move (const char *source, const char *dest)
This function used to resort to copying only when rename failed
and set errno to EXDEV. */
fail = copy_reg (source, dest, &source_stats);
static int first = 1;
if (first)
{
first = 0;
/* Allocate space for remembering copied and created files. */
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
}
fail = copy (source, dest, nonexistent_dst, x);
if (fail)
{
/* Restore original destination file DEST if made a backup. */
@@ -355,7 +290,23 @@ do_move (const char *source, const char *dest)
}
else
{
fail = unlink (source);
struct rm_options rm_options;
struct File_spec fs;
enum RM_status status;
rm_option_init (&rm_options);
rm_options.verbose = x->verbose;
remove_init ();
fspec_init_file (&fs, source);
status = rm (&fs, 1, &rm_options);
assert (VALID_STATUS (status));
if (status == RM_ERROR)
fail = 1;
remove_fini ();
if (fail)
error (0, errno, _("cannot remove `%s'"), source);
}
@@ -382,7 +333,7 @@ strip_trailing_slashes_2 (char *path)
Return 0 if successful, non-zero if an error occurred. */
static int
movefile (char *source, char *dest, int dest_is_dir)
movefile (char *source, char *dest, int dest_is_dir, const struct cp_options *x)
{
int dest_had_trailing_slash = strip_trailing_slashes_2 (dest);
int fail;
@@ -408,12 +359,12 @@ movefile (char *source, char *dest, int dest_is_dir)
new_dest = path_concat (dest, src_basename, NULL);
if (new_dest == NULL)
error (1, 0, _("virtual memory exhausted"));
fail = do_move (source, new_dest);
fail = do_move (source, new_dest, x);
free (new_dest);
}
else
{
fail = do_move (source, dest);
fail = do_move (source, dest, x);
}
return fail;
@@ -439,7 +390,7 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\
-f, --force remove existing destinations, never prompt\n\
-i, --interactive prompt before overwrite\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
-u, --update move only older or brand new files\n\
-u, --update move only older or brand new non-directories\n\
-v, --verbose explain what is being done\n\
-V, --version-control=WORD override the usual version control\n\
--help display this help and exit\n\
@@ -468,18 +419,20 @@ main (int argc, char **argv)
int make_backups = 0;
int dest_is_dir;
char *version;
struct cp_options x;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
cp_option_init (&x);
version = getenv ("SIMPLE_BACKUP_SUFFIX");
if (version)
simple_backup_suffix = version;
version = getenv ("VERSION_CONTROL");
interactive = override_mode = verbose = update = 0;
errors = 0;
while ((c = getopt_long (argc, argv, "bfiuvS:V:", long_options, NULL)) != -1)
@@ -492,18 +445,18 @@ main (int argc, char **argv)
make_backups = 1;
break;
case 'f':
interactive = 0;
override_mode = 1;
x.interactive = 0;
x.force = 1;
break;
case 'i':
interactive = 1;
override_mode = 0;
x.interactive = 1;
x.force = 0;
break;
case 'u':
update = 1;
x.update = 1;
break;
case 'v':
verbose = 1;
x.verbose = 1;
break;
case 'S':
simple_backup_suffix = optarg;
@@ -534,8 +487,7 @@ main (int argc, char **argv)
usage (1);
}
if (make_backups)
backup_type = get_version (version);
x.backup_type = (make_backups ? get_version (version) : none);
stdin_tty = isatty (STDIN_FILENO);
dest_is_dir = isdir (argv[argc - 1]);
@@ -546,9 +498,9 @@ main (int argc, char **argv)
/* Move each arg but the last onto the last. */
for (; optind < argc - 1; ++optind)
errors |= movefile (argv[optind], argv[argc - 1], dest_is_dir);
errors |= movefile (argv[optind], argv[argc - 1], dest_is_dir, &x);
if (verbose)
if (x.verbose)
close_stdout ();
exit (errors);
}

View File

@@ -1,5 +1,5 @@
/* nl -- number lines of files
Copyright (C) 89, 92, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 92, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,9 +24,8 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#include "linebuffer.h"
#include "system.h"
#if WITH_REGEX
# include <regex.h>
@@ -34,16 +33,6 @@
# include <rx.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "linebuffer.h"
#include "system.h"
#include "error.h"
#include "xstrtol.h"

View File

@@ -1,5 +1,5 @@
/* od -- dump files in octal and other formats
Copyright (C) 92, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 92, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,36 +37,11 @@ typedef long double LONG_DOUBLE;
typedef double LONG_DOUBLE;
#endif
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef SCHAR_MAX
# define SCHAR_MAX 127
#endif
#ifndef SCHAR_MIN
# define SCHAR_MIN (-128)
#endif
#ifndef SHRT_MAX
# define SHRT_MAX 32767
#endif
#ifndef SHRT_MIN
# define SHRT_MIN (-32768)
#endif
#ifndef ULONG_MAX
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
#endif
#ifndef LONG_MAX
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
#endif
#if HAVE_VALUES_H
# include <values.h>
#endif
#ifndef BITSPERBYTE
# define BITSPERBYTE 8
#endif
#ifndef MAX
# define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif

View File

@@ -1,5 +1,5 @@
/* pr -- convert text files for printing.
Copyright (C) 88, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -178,18 +178,6 @@
#include "error.h"
#include "xstrtol.h"
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#ifndef TRUE
# define TRUE 1
# define FALSE 0

848
src/remove.c Normal file
View File

@@ -0,0 +1,848 @@
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <assert.h>
#include "save-cwd.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "obstack.h"
#include "hash.h"
#include "remove.h"
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
#ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#ifdef D_INO_IN_DIRENT
# define D_INO(dp) ((dp)->d_ino)
# define ENABLE_CYCLE_CHECK
#else
/* Some systems don't have inodes, so fake them to avoid lots of ifdefs. */
# define D_INO(dp) 1
#endif
#if !defined (S_ISLNK)
# define S_ISLNK(Mode) 0
#endif
#define DOT_OR_DOTDOT(Basename) \
(Basename[0] == '.' && (Basename[1] == '\0' \
|| (Basename[1] == '.' && Basename[2] == '\0')))
#if defined strdupa
# define ASSIGN_STRDUPA(DEST, S) \
do { DEST = strdupa(S); } while (0)
#else
# define ASSIGN_STRDUPA(DEST, S) \
do \
{ \
const char *s_ = (S); \
size_t len_ = strlen (s_) + 1; \
char *tmp_dest_ = (char *) alloca (len_); \
DEST = memcpy (tmp_dest_, (s_), len_); \
} \
while (0)
#endif
/* Initial capacity of per-directory hash table of entries that have
been processed but not been deleted. */
#define HT_INITIAL_CAPACITY 13
/* Initial capacity of the active directory hash table. This table will
be resized only for hierarchies more than about 45 levels deep. */
#define ACTIVE_DIR_INITIAL_CAPACITY 53
char *base_name ();
int euidaccess ();
int yesno ();
extern char *program_name;
/* state initialized by remove_init, freed by remove_fini */
/* An entry in the active_dir_map. */
struct active_dir_ent
{
ino_t inum;
unsigned int depth;
};
/* The name of the directory (starting with and relative to a command
line argument) being processed. When a subdirectory is entered, a new
component is appended (pushed). When RM chdir's out of a directory,
the top component is removed (popped). This is used to form a full
file name when necessary. */
static struct obstack dir_stack;
/* Stack of lengths of directory names (including trailing slash)
appended to dir_stack. We have to have a separate stack of lengths
(rather than just popping back to previous slash) because the first
element pushed onto the dir stack may contain slashes. */
static struct obstack len_stack;
/* Set of `active' directories from the current command-line argument
to the level in the hierarchy at which files are being removed.
A directory is added to the active set when RM begins removing it
(or its entries), and it is removed from the set just after RM has
finished processing it.
This is actually a map (not a set), implemented with a hash table.
For each active directory, it maps the directory's inode number to the
depth of that directory relative to the root of the tree being deleted.
A directory specified on the command line has depth zero.
This construct is used to detect directory cycles so that RM can warn
about them rather than iterating endlessly. */
#ifdef ENABLE_CYCLE_CHECK
static struct HT *active_dir_map;
#endif
static inline unsigned int
current_depth (void)
{
return obstack_object_size (&len_stack) / sizeof (size_t);
}
static void
print_nth_dir (FILE *stream, unsigned int depth)
{
size_t *length = (size_t *) obstack_base (&len_stack);
char *dir_name = (char *) obstack_base (&dir_stack);
unsigned int sum = 0;
unsigned int i;
assert (0 <= depth && depth < current_depth ());
for (i = 0; i <= depth; i++)
{
sum += length[i];
}
fwrite (dir_name, 1, sum, stream);
}
static inline struct active_dir_ent *
make_active_dir_ent (ino_t inum, unsigned int depth)
{
struct active_dir_ent *ent;
ent = (struct active_dir_ent *) xmalloc (sizeof *ent);
ent->inum = inum;
ent->depth = depth;
return ent;
}
static unsigned int
hash_active_dir_ent (void const *x, unsigned int table_size)
{
struct active_dir_ent const *ade = x;
return ade->inum % table_size;
}
static int
hash_compare_active_dir_ents (void const *x, void const *y)
{
struct active_dir_ent const *a = x;
struct active_dir_ent const *b = y;
return (a->inum == b->inum ? 0 : 1);
}
/* A hash function for null-terminated char* strings using
the method described in Aho, Sethi, & Ullman, p 436. */
static unsigned int
hash_pjw (const void *x, unsigned int tablesize)
{
const char *s = x;
unsigned int h = 0;
unsigned int g;
while (*s != 0)
{
h = (h << 4) + *s++;
if ((g = h & (unsigned int) 0xf0000000) != 0)
h = (h ^ (g >> 24)) ^ g;
}
return (h % tablesize);
}
static int
hash_compare_strings (void const *x, void const *y)
{
return strcmp (x, y);
}
static inline void
push_dir (const char *dir_name)
{
size_t len;
len = strlen (dir_name);
/* Append the string onto the stack. */
obstack_grow (&dir_stack, dir_name, len);
/* Append a trailing slash. */
obstack_1grow (&dir_stack, '/');
/* Add one for the slash. */
++len;
/* Push the length (including slash) onto its stack. */
obstack_grow (&len_stack, &len, sizeof (len));
}
static inline void
pop_dir (void)
{
int n_lengths = obstack_object_size (&len_stack) / sizeof (size_t);
size_t *length = (size_t *) obstack_base (&len_stack);
size_t top_len;
assert (n_lengths > 0);
top_len = length[n_lengths - 1];
assert (top_len >= 2);
/* Pop off the specified length of pathname. */
assert (obstack_object_size (&dir_stack) >= top_len);
obstack_blank (&dir_stack, -top_len);
/* Pop the length stack, too. */
assert (obstack_object_size (&len_stack) >= sizeof (size_t));
obstack_blank (&len_stack, -(sizeof (size_t)));
}
/* Copy the SRC_LEN bytes of data beginning at SRC into the DST_LEN-byte
buffer, DST, so that the last source byte is at the end of the destination
buffer. If SRC_LEN is longer than DST_LEN, then set *TRUNCATED to non-zero.
Set *RESULT to point to the beginning of (the portion of) the source data
in DST. Return the number of bytes remaining in the destination buffer. */
static size_t
right_justify (char *dst, size_t dst_len, const char *src, size_t src_len,
char **result, int *truncated)
{
const char *sp;
char *dp;
if (src_len <= dst_len)
{
sp = src;
dp = dst + (dst_len - src_len);
*truncated = 0;
}
else
{
sp = src + (src_len - dst_len);
dp = dst;
src_len = dst_len;
*truncated = 1;
}
*result = memcpy (dp, sp, src_len);
return dst_len - src_len;
}
/* Using the global directory name obstack, create the full path to FILENAME.
Return it in sometimes-realloc'd space that should not be freed by the
caller. Realloc as necessary. If realloc fails, use a static buffer
and put as long a suffix in that buffer as possible. */
static char *
full_filename (const char *filename)
{
static char *buf = NULL;
static size_t n_allocated = 0;
int dir_len = obstack_object_size (&dir_stack);
char *dir_name = (char *) obstack_base (&dir_stack);
size_t n_bytes_needed;
size_t filename_len;
filename_len = strlen (filename);
n_bytes_needed = dir_len + filename_len + 1;
if (n_bytes_needed > n_allocated)
{
/* This code requires that realloc accept NULL as the first arg.
This function must not use xrealloc. Otherwise, an out-of-memory
error involving a file name to be expanded here wouldn't ever
be issued. Use realloc and fall back on using a static buffer
if memory allocation fails. */
buf = realloc (buf, n_bytes_needed);
n_allocated = n_bytes_needed;
if (buf == NULL)
{
#define SBUF_SIZE 512
#define ELLIPSES_PREFIX "[...]"
static char static_buf[SBUF_SIZE];
int truncated;
size_t len;
char *p;
len = right_justify (static_buf, SBUF_SIZE, filename,
filename_len + 1, &p, &truncated);
right_justify (static_buf, len, dir_name, dir_len, &p, &truncated);
if (truncated)
{
memcpy (static_buf, ELLIPSES_PREFIX,
sizeof (ELLIPSES_PREFIX) - 1);
}
return p;
}
}
/* Copy directory part, including trailing slash, and then
append the filename part, including a trailing zero byte. */
memcpy (mempcpy (buf, dir_name, dir_len), filename, filename_len + 1);
assert (strlen (buf) + 1 == n_bytes_needed);
return buf;
}
void
fspec_init_file (struct File_spec *fs, const char *filename)
{
fs->filename = (char *) filename;
fs->have_full_mode = 0;
fs->have_filetype_mode = 0;
}
static inline void
fspec_init_dp (struct File_spec *fs, struct dirent *dp)
{
fs->filename = dp->d_name;
fs->have_full_mode = 0;
fs->have_filetype_mode = 0;
fs->inum = D_INO (dp);
#if D_TYPE_IN_DIRENT && defined (DT_UNKNOWN) && defined (DTTOIF)
if (dp->d_type != DT_UNKNOWN)
{
fs->have_filetype_mode = 1;
fs->mode = DTTOIF (dp->d_type);
}
#endif
}
static inline int
fspec_get_full_mode (struct File_spec *fs, mode_t *full_mode)
{
struct stat stat_buf;
if (fs->have_full_mode)
{
*full_mode = fs->mode;
return 0;
}
if (lstat (fs->filename, &stat_buf))
return 1;
fs->have_full_mode = 1;
fs->have_filetype_mode = 1;
fs->mode = stat_buf.st_mode;
fs->inum = stat_buf.st_ino;
*full_mode = stat_buf.st_mode;
return 0;
}
static inline int
fspec_get_filetype_mode (struct File_spec *fs, mode_t *filetype_mode)
{
int fail;
if (fs->have_filetype_mode)
{
*filetype_mode = fs->mode;
fail = 0;
}
else
{
fail = fspec_get_full_mode (fs, filetype_mode);
}
return fail;
}
static inline mode_t
fspec_filetype_mode (const struct File_spec *fs)
{
assert (fs->have_filetype_mode);
return fs->mode;
}
/* Recursively remove all of the entries in the current directory.
Return an indication of the success of the operation. */
enum RM_status
remove_cwd_entries (const struct rm_options *x)
{
/* NOTE: this is static. */
static DIR *dirp = NULL;
/* NULL or a malloc'd and initialized hash table of entries in the
current directory that have been processed but not removed --
due either to an error or to an interactive `no' response. */
struct HT *ht = NULL;
/* FIXME: describe */
static struct obstack entry_name_pool;
static int first_call = 1;
enum RM_status status = RM_OK;
if (first_call)
{
first_call = 0;
obstack_init (&entry_name_pool);
}
if (dirp)
{
if (CLOSEDIR (dirp))
{
/* FIXME-someday: but this is actually the previously opened dir. */
error (0, errno, "%s", full_filename ("."));
status = RM_ERROR;
}
dirp = NULL;
}
do
{
/* FIXME: why do this? */
errno = 0;
dirp = opendir (".");
if (dirp == NULL)
{
if (errno != ENOENT || !x->ignore_missing_files)
{
error (0, errno, "%s", full_filename ("."));
status = RM_ERROR;
}
break;
}
while (1)
{
char *entry_name;
struct File_spec fs;
enum RM_status tmp_status;
struct dirent *dp;
/* FILE should be skipped if it is `.' or `..', or if it is in
the table, HT, of entries we've already processed. */
#define SKIPPABLE(Ht, File) (DOT_OR_DOTDOT(File) \
|| (Ht && hash_query_in_table (Ht, File)))
/* FIXME: use readdir_r directly into an obstack to avoid
the obstack_copy0 below --
Suggestion from Uli. Be careful -- there are different
prototypes on e.g. Solaris.
Do something like this:
#define NAME_MAX_FOR(Parent_dir) pathconf ((Parent_dir),
_PC_NAME_MAX);
dp = obstack_alloc (sizeof (struct dirent)
+ NAME_MAX_FOR (".") + 1);
fail = xreaddir (dirp, dp);
where xreaddir is ...
But what about systems like the hurd where NAME_MAX is supposed
to be effectively unlimited. We don't want to have to allocate
a huge buffer to accommodate maximum possible entry name. */
dp = readdir (dirp);
#if ! HAVE_WORKING_READDIR
if (dp == NULL)
{
/* Since we have probably modified the directory since it
was opened, readdir returning NULL does not necessarily
mean we have read the last entry. Rewind it and check
again. This happens on SunOS4.1.4 with 254 or more files
in a directory. */
rewinddir (dirp);
while ((dp = readdir (dirp)) && SKIPPABLE (ht, dp->d_name))
{
/* empty */
}
}
#endif
if (dp == NULL)
break;
if (SKIPPABLE (ht, dp->d_name))
continue;
fspec_init_dp (&fs, dp);
/* Save a copy of the name of this entry, in case we have
to add it to the set of unremoved entries below. */
entry_name = obstack_copy0 (&entry_name_pool,
dp->d_name, NLENGTH (dp));
/* CAUTION: after this call to rm, DP may not be valid --
it may have been freed due to a close in a recursive call
(through rm and remove_dir) to this function. */
tmp_status = rm (&fs, 0, x);
/* Update status. */
if (tmp_status > status)
status = tmp_status;
assert (VALID_STATUS (status));
/* If this entry was not removed (due either to an error or to
an interactive `no' response), record it in the hash table so
we don't consider it again if we reopen this directory later. */
if (status != RM_OK)
{
int fail;
if (ht == NULL)
{
ht = hash_initialize (HT_INITIAL_CAPACITY, NULL,
hash_pjw, hash_compare_strings);
if (ht == NULL)
error (1, 0, _("Memory exhausted"));
}
HASH_INSERT_NEW_ITEM (ht, entry_name, &fail);
if (fail)
error (1, 0, _("Memory exhausted"));
}
else
{
/* This entry was not saved in the hash table. Free it. */
obstack_free (&entry_name_pool, entry_name);
}
if (dirp == NULL)
break;
}
}
while (dirp == NULL);
if (CLOSEDIR (dirp))
{
error (0, errno, "%s", full_filename ("."));
status = 1;
}
dirp = NULL;
if (ht)
{
hash_free (ht);
}
if (obstack_object_size (&entry_name_pool) > 0)
obstack_free (&entry_name_pool, obstack_base (&entry_name_pool));
return status;
}
/* Query the user if appropriate, and if ok try to remove the
file or directory specified by FS. Return RM_OK if it is removed,
and RM_ERROR or RM_USER_DECLINED if not. */
static enum RM_status
remove_file (struct File_spec *fs, const struct rm_options *x)
{
int asked = 0;
char *pathname = fs->filename;
if (!x->ignore_missing_files && (x->interactive || x->stdin_tty)
&& euidaccess (pathname, W_OK))
{
if (!S_ISLNK (fspec_filetype_mode (fs)))
{
fprintf (stderr,
(S_ISDIR (fspec_filetype_mode (fs))
? _("%s: remove write-protected directory `%s'? ")
: _("%s: remove write-protected file `%s'? ")),
program_name, full_filename (pathname));
if (!yesno ())
return RM_USER_DECLINED;
asked = 1;
}
}
if (!asked && x->interactive)
{
/* FIXME: use a variant of error (instead of fprintf) that doesn't
append a newline. Then we won't have to declare program_name in
this file. */
fprintf (stderr,
(S_ISDIR (fspec_filetype_mode (fs))
? _("%s: remove directory `%s'? ")
: _("%s: remove `%s'? ")),
program_name, full_filename (pathname));
if (!yesno ())
return RM_USER_DECLINED;
}
if (x->verbose)
printf (_("removing non-directory %s\n"), full_filename (pathname));
if (unlink (pathname) && (errno != ENOENT || !x->ignore_missing_files))
{
error (0, errno, _("cannot unlink `%s'"), full_filename (pathname));
return RM_ERROR;
}
return RM_OK;
}
/* If not in recursive mode, print an error message and return RM_ERROR.
Otherwise, query the user if appropriate, then try to recursively
remove the directory specified by FS. Return RM_OK if it is removed,
and RM_ERROR or RM_USER_DECLINED if not.
FIXME: describe need_save_cwd parameter. */
static enum RM_status
remove_dir (struct File_spec *fs, int need_save_cwd, const struct rm_options *x)
{
enum RM_status status;
struct saved_cwd cwd;
char *dir_name = fs->filename;
const char *fmt = NULL;
if (!x->recursive)
{
error (0, 0, _("%s: is a directory"), full_filename (dir_name));
return RM_ERROR;
}
if (!x->ignore_missing_files && (x->interactive || x->stdin_tty)
&& euidaccess (dir_name, W_OK))
{
fmt = _("%s: directory `%s' is write protected; descend into it anyway? ");
}
else if (x->interactive)
{
fmt = _("%s: descend into directory `%s'? ");
}
if (fmt)
{
fprintf (stderr, fmt, program_name, full_filename (dir_name));
if (!yesno ())
return RM_USER_DECLINED;
}
if (x->verbose)
printf (_("removing any entries of directory %s\n"),
full_filename (dir_name));
/* Save cwd if needed. */
if (need_save_cwd && save_cwd (&cwd))
return RM_ERROR;
/* Make target directory the current one. */
if (chdir (dir_name) < 0)
{
error (0, errno, _("cannot change to directory %s"),
full_filename (dir_name));
if (need_save_cwd)
free_cwd (&cwd);
return RM_ERROR;
}
push_dir (dir_name);
/* Save a copy of dir_name. Otherwise, remove_cwd_entries may clobber
it because it is just a pointer to the dir entry's d_name field, and
remove_cwd_entries may close the directory. */
ASSIGN_STRDUPA (dir_name, dir_name);
status = remove_cwd_entries (x);
pop_dir ();
/* Restore cwd. */
if (need_save_cwd)
{
if (restore_cwd (&cwd, NULL, NULL))
{
free_cwd (&cwd);
return RM_ERROR;
}
free_cwd (&cwd);
}
else if (chdir ("..") < 0)
{
error (0, errno, _("cannot change back to directory %s via `..'"),
full_filename (dir_name));
return RM_ERROR;
}
if (x->interactive)
{
error (0, 0, _("remove directory `%s'%s? "), full_filename (dir_name),
(status != RM_OK ? _(" (might be nonempty)") : ""));
if (!yesno ())
{
return RM_USER_DECLINED;
}
}
if (x->verbose)
printf (_("removing the directory itself: %s\n"), full_filename (dir_name));
if (rmdir (dir_name) && (errno != ENOENT || !x->ignore_missing_files))
{
error (0, errno, _("cannot remove directory `%s'"),
full_filename (dir_name));
return RM_ERROR;
}
return RM_OK;
}
/* Remove the file or directory specified by FS after checking appropriate
things. Return RM_OK if it is removed, and RM_ERROR or RM_USER_DECLINED
if not. If USER_SPECIFIED_NAME is non-zero, then the name part of FS may
be `.', `..', or may contain slashes. Otherwise, it must be a simple file
name (and hence must specify a file in the current directory). */
enum RM_status
rm (struct File_spec *fs, int user_specified_name, const struct rm_options *x)
{
mode_t filetype_mode;
if (user_specified_name)
{
char *base = base_name (fs->filename);
if (DOT_OR_DOTDOT (base))
{
error (0, 0, _("cannot remove `.' or `..'"));
return RM_ERROR;
}
}
if (fspec_get_filetype_mode (fs, &filetype_mode))
{
if (x->ignore_missing_files && errno == ENOENT)
return RM_OK;
error (0, errno, _("cannot remove `%s'"), full_filename (fs->filename));
return RM_ERROR;
}
#ifdef ENABLE_CYCLE_CHECK
if (S_ISDIR (filetype_mode))
{
int fail;
struct active_dir_ent *old_ent;
/* Insert this directory in the active_dir_map.
If there is already a directory in the map with the same inum,
then there's *probably* a directory cycle. This test can get
a false positive if two directories have the same inode number
but different device numbers and one directory contains the
other. But since people don't often try to delete hierarchies
containing mount points, and when they do, duplicate inode
numbers are not that likely, this isn't worth detecting. */
old_ent = hash_insert_if_absent (active_dir_map,
make_active_dir_ent (fs->inum,
current_depth ()),
&fail);
if (fail)
error (1, 0, _("Memory exhausted"));
if (old_ent)
{
error (0, 0, _("\
WARNING: Circular directory structure.\n\
This almost certainly means that you have a corrupted file system.\n\
NOTIFY YOUR SYSTEM MANAGER.\n\
The following two directories have the same inode number:\n"));
/* FIXME: test this!! */
print_nth_dir (stderr, current_depth ());
fputc ('\n', stderr);
print_nth_dir (stderr, old_ent->depth);
fputc ('\n', stderr);
fflush (stderr);
free (old_ent);
if (x->interactive)
{
error (0, 0, _("continue? "));
if (yesno ())
return RM_ERROR;
}
exit (1);
}
}
#endif
if (!S_ISDIR (filetype_mode) || x->unlink_dirs)
{
return remove_file (fs, x);
}
else
{
int need_save_cwd = user_specified_name;
enum RM_status status;
if (need_save_cwd)
need_save_cwd = (strchr (fs->filename, '/') != NULL);
status = remove_dir (fs, need_save_cwd, x);
#ifdef ENABLE_CYCLE_CHECK
{
struct active_dir_ent tmp;
struct active_dir_ent *old_ent;
/* Remove this directory from the active_dir_map. */
tmp.inum = fs->inum;
old_ent = hash_delete_if_present (active_dir_map, &tmp);
assert (old_ent != NULL);
free (old_ent);
}
#endif
return status;
}
}
void
remove_init (void)
{
/* Initialize dir-stack obstacks. */
obstack_init (&dir_stack);
obstack_init (&len_stack);
#ifdef ENABLE_CYCLE_CHECK
active_dir_map = hash_initialize (ACTIVE_DIR_INITIAL_CAPACITY, free,
hash_active_dir_ent,
hash_compare_active_dir_ents);
#endif
}
void
remove_fini (void)
{
#ifdef ENABLE_CYCLE_CHECK
hash_free (active_dir_map);
#endif
obstack_free (&dir_stack, NULL);
obstack_free (&len_stack, NULL);
}

49
src/remove.h Normal file
View File

@@ -0,0 +1,49 @@
struct rm_options
{
/* If nonzero, ignore nonexistant files. */
int ignore_missing_files;
/* If nonzero, query the user about whether to remove each file. */
int interactive;
/* If nonzero, recursively remove directories. */
int recursive;
/* If nonzero, stdin is a tty. */
int stdin_tty;
/* If nonzero, remove directories with unlink instead of rmdir, and don't
require a directory to be empty before trying to unlink it.
Only works for the super-user. */
int unlink_dirs;
/* If nonzero, display the name of each file removed. */
int verbose;
};
enum RM_status
{
/* These must be listed in order of increasing seriousness. */
RM_OK = 1,
RM_USER_DECLINED,
RM_ERROR
};
#define VALID_STATUS(S) \
((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
struct File_spec
{
char *filename;
unsigned int have_filetype_mode:1;
unsigned int have_full_mode:1;
mode_t mode;
ino_t inum;
};
enum RM_status rm PARAMS ((struct File_spec *fs, int user_specified_name,
const struct rm_options *x));
void fspec_init_file PARAMS ((struct File_spec *fs, const char *filename));
void remove_init PARAMS ((void));
void remove_fini PARAMS ((void));

899
src/rm.c
View File

@@ -20,7 +20,7 @@
/* Implementation overview:
In the `usual' case RM saves no state for directories it is processing.
In the `usual' case, RM saves no state for directories it is processing.
When a removal fails (either due to an error or to an interactive `no'
reply), the failure is noted (see description of `ht' in remove_cwd_entries)
so that when/if the containing directory is reopened, RM doesn't try to
@@ -53,240 +53,31 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "obstack.h"
#include "hash.h"
#include "remove.h"
#ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#endif
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
#ifdef D_INO_IN_DIRENT
# define D_INO(dp) ((dp)->d_ino)
# define ENABLE_CYCLE_CHECK
#else
/* Some systems don't have inodes, so fake them to avoid lots of ifdefs. */
# define D_INO(dp) 1
#endif
#if !defined (S_ISLNK)
# define S_ISLNK(Mode) 0
#endif
#define DOT_OR_DOTDOT(Basename) \
(Basename[0] == '.' && (Basename[1] == '\0' \
|| (Basename[1] == '.' && Basename[2] == '\0')))
#if defined strdupa
# define ASSIGN_STRDUPA(DEST, S) \
do { DEST = strdupa(S); } while (0)
#else
# define ASSIGN_STRDUPA(DEST, S) \
do \
{ \
const char *s_ = (S); \
size_t len_ = strlen (s_) + 1; \
char *tmp_dest_ = (char *) alloca (len_); \
DEST = memcpy (tmp_dest_, (s_), len_); \
} \
while (0)
#endif
enum RM_status
{
/* These must be listed in order of increasing seriousness. */
RM_OK,
RM_USER_DECLINED,
RM_ERROR
};
#define VALID_STATUS(S) \
((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
/* Initial capacity of per-directory hash table of entries that have
been processed but not been deleted. */
#define HT_INITIAL_CAPACITY 13
/* Initial capacity of the active directory hash table. This table will
be resized only for hierarchies more than about 45 levels deep. */
#define ACTIVE_DIR_INITIAL_CAPACITY 53
struct File_spec
{
char *filename;
unsigned int have_filetype_mode:1;
unsigned int have_full_mode:1;
mode_t mode;
ino_t inum;
};
char *base_name ();
int euidaccess ();
void strip_trailing_slashes ();
int yesno ();
/* Forward dcl for recursively called function. */
static enum RM_status rm PARAMS ((struct File_spec *fs,
int user_specified_name));
/* Name this program was run with. */
char *program_name;
/* If nonzero, display the name of each file removed. */
static int verbose;
/* If nonzero, ignore nonexistant files. */
static int ignore_missing_files;
/* If nonzero, recursively remove directories. */
static int recursive;
/* If nonzero, query the user about whether to remove each file. */
static int interactive;
/* If nonzero, remove directories with unlink instead of rmdir, and don't
require a directory to be empty before trying to unlink it.
Only works for the super-user. */
static int unlink_dirs;
/* If nonzero, stdin is a tty. */
static int stdin_tty;
/* If nonzero, display usage information and exit. */
static int show_help;
/* If nonzero, print the version on standard output and exit. */
static int show_version;
/* The name of the directory (starting with and relative to a command
line argument) being processed. When a subdirectory is entered, a new
component is appended (pushed). When RM chdir's out of a directory,
the top component is removed (popped). This is used to form a full
file name when necessary. */
static struct obstack dir_stack;
/* Stack of lengths of directory names (including trailing slash)
appended to dir_stack. We have to have a separate stack of lengths
(rather than just popping back to previous slash) because the first
element pushed onto the dir stack may contain slashes. */
static struct obstack len_stack;
/* Set of `active' directories from the current command-line argument
to the level in the hierarchy at which files are being removed.
A directory is added to the active set when RM begins removing it
(or its entries), and it is removed from the set just after RM has
finished processing it.
This is actually a map (not a set), implemented with a hash table.
For each active directory, it maps the directory's inode number to the
depth of that directory relative to the root of the tree being deleted.
A directory specified on the command line has depth zero.
This construct is used to detect directory cycles so that RM can warn
about them rather than iterating endlessly. */
#ifdef ENABLE_CYCLE_CHECK
static struct HT *active_dir_map;
#endif
/* An entry in the active_dir_map. */
struct active_dir_ent
{
ino_t inum;
unsigned int depth;
};
static struct option const long_opts[] =
{
{"directory", no_argument, &unlink_dirs, 1},
{"directory", no_argument, NULL, 'd'},
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
{"recursive", no_argument, &recursive, 1},
{"verbose", no_argument, &verbose, 1},
{"recursive", no_argument, NULL, 'r'},
{"verbose", no_argument, NULL, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
static inline unsigned int
current_depth (void)
{
return obstack_object_size (&len_stack) / sizeof (size_t);
}
static void
print_nth_dir (FILE *stream, unsigned int depth)
{
size_t *length = (size_t *) obstack_base (&len_stack);
char *dir_name = (char *) obstack_base (&dir_stack);
unsigned int sum = 0;
unsigned int i;
assert (0 <= depth && depth < current_depth ());
for (i = 0; i <= depth; i++)
{
sum += length[i];
}
fwrite (dir_name, 1, sum, stream);
}
static inline struct active_dir_ent *
make_active_dir_ent (ino_t inum, unsigned int depth)
{
struct active_dir_ent *ent;
ent = (struct active_dir_ent *) xmalloc (sizeof *ent);
ent->inum = inum;
ent->depth = depth;
return ent;
}
static unsigned int
hash_active_dir_ent (void const *x, unsigned int table_size)
{
struct active_dir_ent const *ade = x;
return ade->inum % table_size;
}
static int
hash_compare_active_dir_ents (void const *x, void const *y)
{
struct active_dir_ent const *a = x;
struct active_dir_ent const *b = y;
return (a->inum == b->inum ? 0 : 1);
}
/* A hash function for null-terminated char* strings using
the method described in Aho, Sethi, & Ullman, p 436. */
static unsigned int
hash_pjw (const void *x, unsigned int tablesize)
{
const char *s = x;
unsigned int h = 0;
unsigned int g;
while (*s != 0)
{
h = (h << 4) + *s++;
if ((g = h & (unsigned int) 0xf0000000) != 0)
h = (h ^ (g >> 24)) ^ g;
}
return (h % tablesize);
}
static int
hash_compare_strings (void const *x, void const *y)
{
return strcmp (x, y);
}
static void
usage (int status)
{
@@ -313,644 +104,21 @@ Remove (unlink) the FILE(s).\n\
exit (status);
}
static inline void
push_dir (const char *dir_name)
static void
rm_option_init (struct rm_options *x)
{
size_t len;
len = strlen (dir_name);
/* Append the string onto the stack. */
obstack_grow (&dir_stack, dir_name, len);
/* Append a trailing slash. */
obstack_1grow (&dir_stack, '/');
/* Add one for the slash. */
++len;
/* Push the length (including slash) onto its stack. */
obstack_grow (&len_stack, &len, sizeof (len));
}
static inline void
pop_dir (void)
{
int n_lengths = obstack_object_size (&len_stack) / sizeof (size_t);
size_t *length = (size_t *) obstack_base (&len_stack);
size_t top_len;
assert (n_lengths > 0);
top_len = length[n_lengths - 1];
assert (top_len >= 2);
/* Pop off the specified length of pathname. */
assert (obstack_object_size (&dir_stack) >= top_len);
obstack_blank (&dir_stack, -top_len);
/* Pop the length stack, too. */
assert (obstack_object_size (&len_stack) >= sizeof (size_t));
obstack_blank (&len_stack, -(sizeof (size_t)));
}
/* Copy the SRC_LEN bytes of data beginning at SRC into the DST_LEN-byte
buffer, DST, so that the last source byte is at the end of the destination
buffer. If SRC_LEN is longer than DST_LEN, then set *TRUNCATED to non-zero.
Set *RESULT to point to the beginning of (the portion of) the source data
in DST. Return the number of bytes remaining in the destination buffer. */
static size_t
right_justify (char *dst, size_t dst_len, const char *src, size_t src_len,
char **result, int *truncated)
{
const char *sp;
char *dp;
if (src_len <= dst_len)
{
sp = src;
dp = dst + (dst_len - src_len);
*truncated = 0;
}
else
{
sp = src + (src_len - dst_len);
dp = dst;
src_len = dst_len;
*truncated = 1;
}
*result = memcpy (dp, sp, src_len);
return dst_len - src_len;
}
/* Using the global directory name obstack, create the full path to FILENAME.
Return it in sometimes-realloc'd space that should not be freed by the
caller. Realloc as necessary. If realloc fails, use a static buffer
and put as long a suffix in that buffer as possible. */
static char *
full_filename (const char *filename)
{
static char *buf = NULL;
static size_t n_allocated = 0;
int dir_len = obstack_object_size (&dir_stack);
char *dir_name = (char *) obstack_base (&dir_stack);
size_t n_bytes_needed;
size_t filename_len;
filename_len = strlen (filename);
n_bytes_needed = dir_len + filename_len + 1;
if (n_bytes_needed > n_allocated)
{
/* This code requires that realloc accept NULL as the first arg.
This function must not use xrealloc. Otherwise, an out-of-memory
error involving a file name to be expanded here wouldn't ever
be issued. Use realloc and fall back on using a static buffer
if memory allocation fails. */
buf = realloc (buf, n_bytes_needed);
n_allocated = n_bytes_needed;
if (buf == NULL)
{
#define SBUF_SIZE 512
#define ELLIPSES_PREFIX "[...]"
static char static_buf[SBUF_SIZE];
int truncated;
size_t len;
char *p;
len = right_justify (static_buf, SBUF_SIZE, filename,
filename_len + 1, &p, &truncated);
right_justify (static_buf, len, dir_name, dir_len, &p, &truncated);
if (truncated)
{
memcpy (static_buf, ELLIPSES_PREFIX,
sizeof (ELLIPSES_PREFIX) - 1);
}
return p;
}
}
/* Copy directory part, including trailing slash, and then
append the filename part, including a trailing zero byte. */
memcpy (mempcpy (buf, dir_name, dir_len), filename, filename_len + 1);
assert (strlen (buf) + 1 == n_bytes_needed);
return buf;
}
static inline void
fspec_init_file (struct File_spec *fs, const char *filename)
{
fs->filename = (char *) filename;
fs->have_full_mode = 0;
fs->have_filetype_mode = 0;
}
static inline void
fspec_init_dp (struct File_spec *fs, struct dirent *dp)
{
fs->filename = dp->d_name;
fs->have_full_mode = 0;
fs->have_filetype_mode = 0;
fs->inum = D_INO (dp);
#if D_TYPE_IN_DIRENT && defined (DT_UNKNOWN) && defined (DTTOIF)
if (dp->d_type != DT_UNKNOWN)
{
fs->have_filetype_mode = 1;
fs->mode = DTTOIF (dp->d_type);
}
#endif
}
static inline int
fspec_get_full_mode (struct File_spec *fs, mode_t *full_mode)
{
struct stat stat_buf;
if (fs->have_full_mode)
{
*full_mode = fs->mode;
return 0;
}
if (lstat (fs->filename, &stat_buf))
return 1;
fs->have_full_mode = 1;
fs->have_filetype_mode = 1;
fs->mode = stat_buf.st_mode;
fs->inum = stat_buf.st_ino;
*full_mode = stat_buf.st_mode;
return 0;
}
static inline int
fspec_get_filetype_mode (struct File_spec *fs, mode_t *filetype_mode)
{
int fail;
if (fs->have_filetype_mode)
{
*filetype_mode = fs->mode;
fail = 0;
}
else
{
fail = fspec_get_full_mode (fs, filetype_mode);
}
return fail;
}
static inline mode_t
fspec_filetype_mode (const struct File_spec *fs)
{
assert (fs->have_filetype_mode);
return fs->mode;
}
/* Recursively remove all of the entries in the current directory.
Return an indication of the success of the operation. */
enum RM_status
remove_cwd_entries (void)
{
/* NOTE: this is static. */
static DIR *dirp = NULL;
/* NULL or a malloc'd and initialized hash table of entries in the
current directory that have been processed but not removed --
due either to an error or to an interactive `no' response. */
struct HT *ht = NULL;
/* FIXME: describe */
static struct obstack entry_name_pool;
static int first_call = 1;
enum RM_status status = RM_OK;
if (first_call)
{
first_call = 0;
obstack_init (&entry_name_pool);
}
if (dirp)
{
if (CLOSEDIR (dirp))
{
/* FIXME-someday: but this is actually the previously opened dir. */
error (0, errno, "%s", full_filename ("."));
status = RM_ERROR;
}
dirp = NULL;
}
do
{
/* FIXME: why do this? */
errno = 0;
dirp = opendir (".");
if (dirp == NULL)
{
if (errno != ENOENT || !ignore_missing_files)
{
error (0, errno, "%s", full_filename ("."));
status = RM_ERROR;
}
break;
}
while (1)
{
char *entry_name;
struct File_spec fs;
enum RM_status tmp_status;
struct dirent *dp;
/* FILE should be skipped if it is `.' or `..', or if it is in
the table, HT, of entries we've already processed. */
#define SKIPPABLE(Ht, File) (DOT_OR_DOTDOT(File) \
|| (Ht && hash_query_in_table (Ht, File)))
/* FIXME: use readdir_r directly into an obstack to avoid
the obstack_copy0 below --
Suggestion from Uli. Be careful -- there are different
prototypes on e.g. Solaris.
Do something like this:
#define NAME_MAX_FOR(Parent_dir) pathconf ((Parent_dir),
_PC_NAME_MAX);
dp = obstack_alloc (sizeof (struct dirent)
+ NAME_MAX_FOR (".") + 1);
fail = xreaddir (dirp, dp);
where xreaddir is ...
But what about systems like the hurd where NAME_MAX is supposed
to be effectively unlimited. We don't want to have to allocate
a huge buffer to accommodate maximum possible entry name. */
dp = readdir (dirp);
#if ! HAVE_WORKING_READDIR
if (dp == NULL)
{
/* Since we have probably modified the directory since it
was opened, readdir returning NULL does not necessarily
mean we have read the last entry. Rewind it and check
again. This happens on SunOS4.1.4 with 254 or more files
in a directory. */
rewinddir (dirp);
while ((dp = readdir (dirp)) && SKIPPABLE (ht, dp->d_name))
{
/* empty */
}
}
#endif
if (dp == NULL)
break;
if (SKIPPABLE (ht, dp->d_name))
continue;
fspec_init_dp (&fs, dp);
/* Save a copy of the name of this entry, in case we have
to add it to the set of unremoved entries below. */
entry_name = obstack_copy0 (&entry_name_pool,
dp->d_name, NLENGTH (dp));
/* CAUTION: after this call to rm, DP may not be valid --
it may have been freed due to a close in a recursive call
(through rm and remove_dir) to this function. */
tmp_status = rm (&fs, 0);
/* Update status. */
if (tmp_status > status)
status = tmp_status;
assert (VALID_STATUS (status));
/* If this entry was not removed (due either to an error or to
an interactive `no' response), record it in the hash table so
we don't consider it again if we reopen this directory later. */
if (status != RM_OK)
{
int fail;
if (ht == NULL)
{
ht = hash_initialize (HT_INITIAL_CAPACITY, NULL,
hash_pjw, hash_compare_strings);
if (ht == NULL)
error (1, 0, _("Memory exhausted"));
}
HASH_INSERT_NEW_ITEM (ht, entry_name, &fail);
if (fail)
error (1, 0, _("Memory exhausted"));
}
else
{
/* This entry was not saved in the hash table. Free it. */
obstack_free (&entry_name_pool, entry_name);
}
if (dirp == NULL)
break;
}
}
while (dirp == NULL);
if (CLOSEDIR (dirp))
{
error (0, errno, "%s", full_filename ("."));
status = 1;
}
dirp = NULL;
if (ht)
{
hash_free (ht);
}
if (obstack_object_size (&entry_name_pool) > 0)
obstack_free (&entry_name_pool, obstack_base (&entry_name_pool));
return status;
}
/* Query the user if appropriate, and if ok try to remove the
file or directory specified by FS. Return RM_OK if it is removed,
and RM_ERROR or RM_USER_DECLINED if not. */
static enum RM_status
remove_file (struct File_spec *fs)
{
int asked = 0;
char *pathname = fs->filename;
if (!ignore_missing_files && (interactive || stdin_tty)
&& euidaccess (pathname, W_OK) )
{
if (!S_ISLNK (fspec_filetype_mode (fs)))
{
fprintf (stderr,
(S_ISDIR (fspec_filetype_mode (fs))
? _("%s: remove write-protected directory `%s'? ")
: _("%s: remove write-protected file `%s'? ")),
program_name, full_filename (pathname));
if (!yesno ())
return RM_USER_DECLINED;
asked = 1;
}
}
if (!asked && interactive)
{
fprintf (stderr,
(S_ISDIR (fspec_filetype_mode (fs))
? _("%s: remove directory `%s'? ")
: _("%s: remove `%s'? ")),
program_name, full_filename (pathname));
if (!yesno ())
return RM_USER_DECLINED;
}
if (verbose)
printf ("%s\n", full_filename (pathname));
if (unlink (pathname) && (errno != ENOENT || !ignore_missing_files))
{
error (0, errno, _("cannot unlink `%s'"), full_filename (pathname));
return RM_ERROR;
}
return RM_OK;
}
/* If not in recursive mode, print an error message and return RM_ERROR.
Otherwise, query the user if appropriate, then try to recursively
remove the directory specified by FS. Return RM_OK if it is removed,
and RM_ERROR or RM_USER_DECLINED if not.
FIXME: describe need_save_cwd parameter. */
static enum RM_status
remove_dir (struct File_spec *fs, int need_save_cwd)
{
enum RM_status status;
struct saved_cwd cwd;
char *dir_name = fs->filename;
const char *fmt = NULL;
if (!recursive)
{
error (0, 0, _("%s: is a directory"), full_filename (dir_name));
return RM_ERROR;
}
if (!ignore_missing_files && (interactive || stdin_tty)
&& euidaccess (dir_name, W_OK))
{
fmt = _("%s: directory `%s' is write protected; descend into it anyway? ");
}
else if (interactive)
{
fmt = _("%s: descend into directory `%s'? ");
}
if (fmt)
{
fprintf (stderr, fmt, program_name, full_filename (dir_name));
if (!yesno ())
return RM_USER_DECLINED;
}
if (verbose)
printf ("%s\n", full_filename (dir_name));
/* Save cwd if needed. */
if (need_save_cwd && save_cwd (&cwd))
return RM_ERROR;
/* Make target directory the current one. */
if (chdir (dir_name) < 0)
{
error (0, errno, _("cannot change to directory %s"),
full_filename (dir_name));
if (need_save_cwd)
free_cwd (&cwd);
return RM_ERROR;
}
push_dir (dir_name);
/* Save a copy of dir_name. Otherwise, remove_cwd_entries may clobber
it because it is just a pointer to the dir entry's d_name field, and
remove_cwd_entries may close the directory. */
ASSIGN_STRDUPA (dir_name, dir_name);
status = remove_cwd_entries ();
pop_dir ();
/* Restore cwd. */
if (need_save_cwd)
{
if (restore_cwd (&cwd, NULL, NULL))
{
free_cwd (&cwd);
return RM_ERROR;
}
free_cwd (&cwd);
}
else if (chdir ("..") < 0)
{
error (0, errno, _("cannot change back to directory %s via `..'"),
full_filename (dir_name));
return RM_ERROR;
}
if (interactive)
{
error (0, 0, _("remove directory `%s'%s? "), full_filename (dir_name),
(status != RM_OK ? _(" (might be nonempty)") : ""));
if (!yesno ())
{
return RM_USER_DECLINED;
}
}
if (rmdir (dir_name) && (errno != ENOENT || !ignore_missing_files))
{
error (0, errno, _("cannot remove directory `%s'"),
full_filename (dir_name));
return RM_ERROR;
}
return RM_OK;
}
/* Remove the file or directory specified by FS after checking appropriate
things. Return RM_OK if it is removed, and RM_ERROR or RM_USER_DECLINED
if not. If USER_SPECIFIED_NAME is non-zero, then the name part of FS may
be `.', `..', or may contain slashes. Otherwise, it must be a simple file
name (and hence must specify a file in the current directory). */
static enum RM_status
rm (struct File_spec *fs, int user_specified_name)
{
mode_t filetype_mode;
if (user_specified_name)
{
char *base = base_name (fs->filename);
if (DOT_OR_DOTDOT (base))
{
error (0, 0, _("cannot remove `.' or `..'"));
return RM_ERROR;
}
}
if (fspec_get_filetype_mode (fs, &filetype_mode))
{
if (ignore_missing_files && errno == ENOENT)
return RM_OK;
error (0, errno, _("cannot remove `%s'"), full_filename (fs->filename));
return RM_ERROR;
}
#ifdef ENABLE_CYCLE_CHECK
if (S_ISDIR (filetype_mode))
{
int fail;
struct active_dir_ent *old_ent;
/* Insert this directory in the active_dir_map.
If there is already a directory in the map with the same inum,
then there's *probably* a directory cycle. This test can get
a false positive if two directories have the same inode number
but different device numbers and one directory contains the
other. But since people don't often try to delete hierarchies
containing mount points, and when they do, duplicate inode
numbers are not that likely, this isn't worth detecting. */
old_ent = hash_insert_if_absent (active_dir_map,
make_active_dir_ent (fs->inum,
current_depth ()),
&fail);
if (fail)
error (1, 0, _("Memory exhausted"));
if (old_ent)
{
error (0, 0, _("\
WARNING: Circular directory structure.\n\
This almost certainly means that you have a corrupted file system.\n\
NOTIFY YOUR SYSTEM MANAGER.\n\
The following two directories have the same inode number:\n"));
/* FIXME: test this!! */
print_nth_dir (stderr, current_depth ());
fputc ('\n', stderr);
print_nth_dir (stderr, old_ent->depth);
fputc ('\n', stderr);
fflush (stderr);
free (old_ent);
if (interactive)
{
error (0, 0, _("continue? "));
if (yesno ())
return RM_ERROR;
}
exit (1);
}
}
#endif
if (!S_ISDIR (filetype_mode) || unlink_dirs)
{
return remove_file (fs);
}
else
{
int need_save_cwd = user_specified_name;
enum RM_status status;
if (need_save_cwd)
need_save_cwd = (strchr (fs->filename, '/') != NULL);
status = remove_dir (fs, need_save_cwd);
#ifdef ENABLE_CYCLE_CHECK
{
struct active_dir_ent tmp;
struct active_dir_ent *old_ent;
/* Remove this directory from the active_dir_map. */
tmp.inum = fs->inum;
old_ent = hash_delete_if_present (active_dir_map, &tmp);
assert (old_ent != NULL);
free (old_ent);
}
#endif
return status;
}
x->unlink_dirs = 0;
x->ignore_missing_files = 0;
x->interactive = 0;
x->recursive = 0;
x->stdin_tty = isatty (STDIN_FILENO);
x->verbose = 0;
}
int
main (int argc, char **argv)
{
struct rm_options x;
int fail = 0;
int c;
@@ -959,8 +127,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
verbose = ignore_missing_files = recursive = interactive
= unlink_dirs = 0;
rm_option_init (&x);
while ((c = getopt_long (argc, argv, "dfirvR", long_opts, NULL)) != -1)
{
@@ -969,22 +136,22 @@ main (int argc, char **argv)
case 0: /* Long option. */
break;
case 'd':
unlink_dirs = 1;
x.unlink_dirs = 1;
break;
case 'f':
interactive = 0;
ignore_missing_files = 1;
x.interactive = 0;
x.ignore_missing_files = 1;
break;
case 'i':
interactive = 1;
ignore_missing_files = 0;
x.interactive = 1;
x.ignore_missing_files = 0;
break;
case 'r':
case 'R':
recursive = 1;
x.recursive = 1;
break;
case 'v':
verbose = 1;
x.verbose = 1;
break;
default:
usage (1);
@@ -1003,7 +170,7 @@ main (int argc, char **argv)
if (optind == argc)
{
if (ignore_missing_files)
if (x.ignore_missing_files)
exit (0);
else
{
@@ -1012,17 +179,7 @@ main (int argc, char **argv)
}
}
stdin_tty = isatty (STDIN_FILENO);
/* Initialize dir-stack obstacks. */
obstack_init (&dir_stack);
obstack_init (&len_stack);
#ifdef ENABLE_CYCLE_CHECK
active_dir_map = hash_initialize (ACTIVE_DIR_INITIAL_CAPACITY, free,
hash_active_dir_ent,
hash_compare_active_dir_ents);
#endif
remove_init ();
for (; optind < argc; optind++)
{
@@ -1033,17 +190,15 @@ main (int argc, char **argv)
if the arg is not a directory, it will fail with ENOTDIR. */
strip_trailing_slashes (argv[optind]);
fspec_init_file (&fs, argv[optind]);
status = rm (&fs, 1);
status = rm (&fs, 1, &x);
assert (VALID_STATUS (status));
if (status == RM_ERROR)
fail = 1;
}
#ifdef ENABLE_CYCLE_CHECK
hash_free (active_dir_map);
#endif
remove_fini ();
if (verbose)
if (x.verbose)
close_stdout ();
exit (fail);
}

View File

@@ -1,5 +1,5 @@
/* sort - sort lines of text (with all kinds of options).
Copyright (C) 88, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
Copyright (C) 88, 91-97, 98 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -39,18 +39,10 @@
#include "xstrtod.h"
#include "xalloc.h"
#ifdef ENABLE_NLS
#if defined ENABLE_NLS && HAVE_LANGINFO_H
# include <langinfo.h>
#endif
#ifdef HAVE_LIMITS_H
# include <limits.h>
#else
# ifndef UCHAR_MAX
# define UCHAR_MAX 255
# endif
#endif
char *xstrdup ();
/* Undefine, to avoid warning about redefinition on some systems. */
@@ -90,7 +82,7 @@ char *xstrdup ();
static unsigned char decimal_point;
static unsigned char th_sep;
static unsigned char *nls_grouping;
static char *nls_grouping;
/* This is "C" locale, need another? */
static int need_locale = 0;
@@ -491,7 +483,7 @@ nls_sort_month_comp (const void *m1, const void *m2)
/* Do collation on strings S1 and S2, but for at most L characters.
we use the fact, that we KNOW that LEN is the min of the two lengths */
static int
strncoll (unsigned char *s1, unsigned char *s2, int len)
strncoll (char *s1, char *s2, int len)
{
register int diff;
@@ -521,7 +513,7 @@ strncoll (unsigned char *s1, unsigned char *s2, int len)
Use the fact, that we KNOW that S2 is the shorter string and has
length LEN. */
static int
strncoll_s2_readonly (unsigned char *s1, const unsigned char *s2, int len)
strncoll_s2_readonly (char *s1, const char *s2, int len)
{
register int diff;
@@ -567,26 +559,26 @@ inittables (void)
fold_toupper[i] = i;
}
#ifdef ENABLE_NLS
#if defined ENABLE_NLS && HAVE_NL_LANGINFO
/* If We're not in the "C" locale, read in different names for months. */
if (need_locale)
{
nls_months_collide[0] = 1; /* if an error, look again */
for (i = 0; i < NLS_NUM_MONTHS; i++)
{
unsigned char *s;
char *s;
size_t s_len;
int j;
s = nl_langinfo (ABMON_1 + us_monthtab[i].val - 1);
s = (char *) nl_langinfo (ABMON_1 + us_monthtab[i].val - 1);
s_len = strlen (s);
nls_monthtab[i].name = (char *) xmalloc (s_len + 1);
nls_monthtab[i].val = us_monthtab[i].val;
/* It has been pointed out, that abreviated month names
/* Be careful: abreviated month names
may be longer than the usual 3 characters. */
for (j = 0; j < s_len; j++)
nls_monthtab[i].name[j] = fold_toupper[s[j]];
nls_monthtab[i].name[j] = fold_toupper[UCHAR (s[j])];
nls_monthtab[i].name[j] = '\0';
nls_months_collide[nls_monthtab[i].val] = 0;
@@ -1067,26 +1059,28 @@ static void
nls_set_fraction (register unsigned char ch)
{
if (!nls_fraction_found && ch != decimal_point)
if (ch == FLOATING_POINT)
{ /* US style */
decimal_point = FLOATING_POINT;
th_sep = FLOATING_COMMA;
}
else if (ch == FLOATING_COMMA)
{ /* EU style */
decimal_point = FLOATING_COMMA;
th_sep = FLOATING_POINT;
}
else if (ch != decimal_point)
{ /* Alien */
decimal_point = ch;
th_sep = '\0';
}
{
if (ch == FLOATING_POINT)
{ /* US style */
decimal_point = FLOATING_POINT;
th_sep = FLOATING_COMMA;
}
else if (ch == FLOATING_COMMA)
{ /* EU style */
decimal_point = FLOATING_COMMA;
th_sep = FLOATING_POINT;
}
else if (ch != decimal_point)
{ /* Alien */
decimal_point = ch;
th_sep = '\0';
}
}
nls_fraction_found = 1;
}
/* Look for a fraction
It ain't as simple as it looks... however, consider a number:
It isn't as simple as it looks... however, consider a number:
1.234,00
1,234.00
It's easy to tell which is a decimal point, and which isn't. We use
@@ -1132,9 +1126,9 @@ nls_set_fraction (register unsigned char ch)
*/
static void
look_for_fraction (unsigned const char *s, unsigned const char *e)
look_for_fraction (const char *s, const char *e)
{
register unsigned const char *p;
register const char *p;
register unsigned short n = 0;
static unsigned short max_groups = 0;
static unsigned short *groups = NULL;
@@ -1146,7 +1140,7 @@ look_for_fraction (unsigned const char *s, unsigned const char *e)
}
/* skip blanks and signs */
while (blanks[*s] || *s == NEGATIVE_SIGN)
while (blanks[UCHAR (*s)] || *s == NEGATIVE_SIGN)
s++;
/* groups = {}, n = 0 */
for (p = s; p < e; p++)
@@ -1208,14 +1202,14 @@ look_for_fraction (unsigned const char *s, unsigned const char *e)
}
static int
numcompare (register const unsigned char *a, register const unsigned char *b)
numcompare (register const char *a, register const char *b)
{
int ret_code = 1; /* normal return status, see later in code */
int diff = 0; /* difference between two digits */
while (blanks[*a])
while (blanks[UCHAR (*a)])
++a;
while (blanks[*b])
while (blanks[UCHAR (*b)])
++b;
/* next character in a,b is non-blank */
@@ -1653,8 +1647,8 @@ keycompare (const struct line *a, const struct line *b)
of the time) we could temporarily NUL-terminate them in
place and avoid the copy. */
unsigned char *copy_a = (unsigned char *) alloca (lena + 1);
unsigned char *copy_b = (unsigned char *) alloca (lenb + 1);
char *copy_a = (char *) alloca (lena + 1);
char *copy_b = (char *) alloca (lenb + 1);
int new_len_a, new_len_b, i;
/* We can't use strcoll directly on the two strings,
@@ -2032,32 +2026,34 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
/* Check if we need to read more lines into core. */
if (++cur[ord[0]] == lines[ord[0]].used)
if (fillbuf (&buffer[ord[0]], fps[ord[0]]))
{
findlines (&buffer[ord[0]], &lines[ord[0]]);
cur[ord[0]] = 0;
}
else
{
/* We reached EOF on fps[ord[0]]. */
for (i = 1; i < nfps; ++i)
if (ord[i] > ord[0])
--ord[i];
--nfps;
xfclose (fps[ord[0]]);
free (buffer[ord[0]].buf);
free ((char *) lines[ord[0]].lines);
for (i = ord[0]; i < nfps; ++i)
{
fps[i] = fps[i + 1];
buffer[i] = buffer[i + 1];
lines[i] = lines[i + 1];
cur[i] = cur[i + 1];
}
for (i = 0; i < nfps; ++i)
ord[i] = ord[i + 1];
continue;
}
{
if (fillbuf (&buffer[ord[0]], fps[ord[0]]))
{
findlines (&buffer[ord[0]], &lines[ord[0]]);
cur[ord[0]] = 0;
}
else
{
/* We reached EOF on fps[ord[0]]. */
for (i = 1; i < nfps; ++i)
if (ord[i] > ord[0])
--ord[i];
--nfps;
xfclose (fps[ord[0]]);
free (buffer[ord[0]].buf);
free ((char *) lines[ord[0]].lines);
for (i = ord[0]; i < nfps; ++i)
{
fps[i] = fps[i + 1];
buffer[i] = buffer[i + 1];
lines[i] = lines[i + 1];
cur[i] = cur[i + 1];
}
for (i = 0; i < nfps; ++i)
ord[i] = ord[i + 1];
continue;
}
}
/* The new line just read in may be larger than other lines
already in core; push it back in the queue until we encounter
@@ -2100,8 +2096,8 @@ nls_numeric_format (const struct line *line, int nlines)
int iter;
for (iter = 0; !nls_fraction_found; iter++)
{
unsigned char *text;
unsigned char *lim;
char *text;
char *lim;
struct keyfield *key = n_key->key;
/* text = {}, lim = {}, key = first key */
@@ -2492,7 +2488,7 @@ main (int argc, char **argv)
decimal_point = *lconvp->decimal_point;
th_sep = *lconvp->thousands_sep;
nls_grouping = lconvp->grouping;
nls_grouping = (char *) (lconvp->grouping);
}
/* if locale doesn't define a decimal point, we'll use the

View File

@@ -1,5 +1,5 @@
/* split.c -- split a file into pieces.
Copyright (C) 88, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,18 +27,6 @@
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "error.h"
#include "xstrtol.h"
@@ -127,40 +115,30 @@ SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\
static void
next_file_name (void)
{
int x;
char *ne;
unsigned int i;
static unsigned n_digits = 2;
char *p;
static int first_call = 1;
/* Status for outfile name generation. */
static unsigned outfile_count = 0;
static unsigned outfile_name_limit = 25 * 26;
static unsigned outfile_name_generation = 1;
if (!first_call)
outfile_count++;
first_call = 0;
if (outfile_count < outfile_name_limit)
/* Change any suffix of `z's to `a's. */
for (p = outfile_end - 1; *p == 'z'; p--)
{
for (ne = outfile_end - 1; ; ne--)
{
x = *ne;
if (x != 'z')
break;
*ne = 'a';
}
*ne = x + 1;
return;
*p = 'a';
}
outfile_count = 0;
outfile_name_limit *= 26;
outfile_name_generation++;
*outfile_mid++ = 'z';
for (i = 0; i <= outfile_name_generation; i++)
outfile_mid[i] = 'a';
outfile_end += 2;
/* Increment the rightmost non-`z' character that was present before the
above z/a substitutions. There is guaranteed to be such a character. */
++(*p);
/* If the result of that increment operation yielded a `z' and there
are only `z's to the left of it, then append two more `a' characters
to the end and add 1 (-1 + 2) to the number of digits (we're taking
out this `z' and adding two `a's). */
if (*p == 'z' && p == outfile_mid)
{
++n_digits;
++outfile_mid;
*outfile_end++ = 'a';
*outfile_end++ = 'a';
}
}
/* Write BYTES bytes at BP to an output file.

View File

@@ -120,7 +120,10 @@
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
#define TYPE_MINIMUM(t) (TYPE_SIGNED (t) ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)
/* 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) 0 - TYPE_MINIMUM (t))
#ifndef INT_MAX

View File

@@ -1,5 +1,5 @@
/* tac - concatenate and print files in reverse
Copyright (C) 88, 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 88, 89, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,12 +40,14 @@ tac -r -s '.\|
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
#if WITH_REGEX
# include <regex.h>
#else
# include <rx.h>
#endif
#include "system.h"
#include "error.h"
#ifndef DEFAULT_TMPDIR
@@ -312,7 +314,8 @@ tac_stream (FILE *in, const char *file)
read_size *= 2;
G_buffer_size = read_size * 2 + sentinel_length + 2;
newbuffer = xrealloc (G_buffer - offset, G_buffer_size) + offset;
newbuffer = xrealloc (G_buffer - offset, G_buffer_size);
newbuffer += offset;
/* Adjust the pointers for the new buffer location. */
match_start += newbuffer - G_buffer;
past_end += newbuffer - G_buffer;

View File

@@ -1,5 +1,5 @@
/* tail -- output the last part of file(s)
Copyright (C) 89, 90, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -49,25 +49,17 @@
#include <assert.h>
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#include "system.h"
#include "xstrtoul.h"
#include "error.h"
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
#ifndef OFF_T_MIN
# define OFF_T_MIN (0 < (off_t) -1 ? (off_t) 0 \
: ~ (off_t) 0 << (sizeof (off_t) * CHAR_BIT - 1))
# define OFF_T_MIN TYPE_MINIMUM (off_t)
#endif
#ifndef OFF_T_MAX
# define OFF_T_MAX (~ (off_t) 0 - OFF_T_MIN)
# define OFF_T_MAX TYPE_MAXIMUM (off_t)
#endif
/* Disable assertions. Some systems have broken assert macros. */
@@ -124,6 +116,9 @@ int safe_read ();
/* The name this program was run with. */
char *program_name;
/* The number of seconds to sleep between accesses. */
static unsigned int sleep_interval = 1;
/* Nonzero if we have ever read standard input. */
static int have_read_stdin;
@@ -140,6 +135,7 @@ static struct option const long_options[] =
{"lines", required_argument, NULL, 'n'},
{"quiet", no_argument, NULL, 'q'},
{"silent", no_argument, NULL, 'q'},
{"sleep-interval", required_argument, NULL, 's'},
{"verbose", no_argument, NULL, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
@@ -167,6 +163,7 @@ With no FILE, or when FILE is -, read standard input.\n\
-f, --follow output appended data as the file grows\n\
-n, --lines=N output the last N lines, instead of last 10\n\
-q, --quiet, --silent never output headers giving file names\n\
-s, --sleep-interval=S with -f, sleep S seconds between iterations\n\
-v, --verbose always output headers giving file names\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -557,7 +554,7 @@ output:
if (forever)
{
fflush (stdout);
sleep (1);
sleep (sleep_interval);
goto output;
}
else
@@ -629,7 +626,7 @@ tail_forever (char **names, int nfiles)
/* If none of the files changed size, sleep. */
if (! changed)
sleep (1);
sleep (sleep_interval);
}
}
@@ -879,14 +876,9 @@ parse_obsolescent_option (int argc, const char *const *argv,
if (argc < 2)
return 0;
/* If I were implementing this in Perl, the rest of this function
would be essentially this single statement:
return $p ne '-' && $p ne '-c' && $p =~ /^[+-]\d*[cl]?f?$/; */
/* Test this:
if (STREQ (p, "-") || STREQ (p, "-c"))
but without using strcmp. */
if (p[0] == '-' && (p[1] == 0 || (p[1] == 'c' && p[2] == 0)))
/* If P starts with `+', `-N' (where N is a digit), or `-l',
then it is obsolescent. Return zero otherwise. */
if ( ! (p[0] == '+' || (p[0] == '-' && (p[1] == 'l' || ISDIGIT (p[1])))) )
return 0;
if (*p == '+')
@@ -1018,7 +1010,7 @@ parse_options (int argc, char **argv,
count_lines = 1;
forever = forever_multiple = from_start = print_headers = 0;
while ((c = getopt_long (argc, argv, "c:n:fqv", long_options, NULL)) != -1)
while ((c = getopt_long (argc, argv, "c:n:fqs:v", long_options, NULL)) != -1)
{
switch (c)
{
@@ -1063,6 +1055,20 @@ parse_options (int argc, char **argv,
*header_mode = never;
break;
case 's':
{
strtol_error s_err;
unsigned long int tmp_ulong;
s_err = xstrtoul (optarg, NULL, 0, &tmp_ulong, "");
if (s_err != LONGINT_OK || tmp_ulong > UINT_MAX)
{
error (EXIT_FAILURE, 0,
_("%s: invalid number of seconds"), optarg);
}
sleep_interval = tmp_ulong;
}
break;
case 'v':
*header_mode = always;
break;

View File

@@ -41,12 +41,12 @@
#include "closeout.h"
#include "error.h"
#include "argmatch.h"
#include "get-date.h"
#ifndef STDC_HEADERS
time_t time ();
#endif
time_t get_date ();
time_t posixtime ();
int safe_read ();
int full_write ();

View File

@@ -1,5 +1,5 @@
/* tr -- a filter to translate characters
Copyright (C) 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,33 +29,9 @@
#include <sys/types.h>
#include <getopt.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#include "system.h"
#include "error.h"
#ifndef ULONG_MAX
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
#endif
#ifndef LONG_MAX
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#ifndef UCHAR_MAX
# define UCHAR_MAX 0xFF
#endif
#define N_CHARS (UCHAR_MAX + 1)
/* A pointer to a function that returns an int. */

View File

@@ -1,5 +1,5 @@
/* unexpand - convert spaces to tabs
Copyright (C) 89, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 89, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,18 +45,6 @@
#include <sys/types.h>
#include "system.h"
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "error.h"
/* The number of bytes added at a time to the amount of memory

View File

@@ -1,5 +1,5 @@
/* uniq -- remove duplicate lines from a sorted file
Copyright (C) 86, 91, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 86, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,18 +26,6 @@
#include <getopt.h>
#include <sys/types.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
#ifndef INT_MAX
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#include "system.h"
#include "linebuffer.h"
#include "error.h"

View File

@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -106,7 +105,7 @@ GZIP = --best
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/cp/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = cut
@@ -17,7 +17,7 @@ empty-fl.E missing-fl.O missing-fl.E empty-bl.O empty-bl.E missing-bl.O \
missing-bl.E empty-f1.O empty-f1.E empty-f2.O empty-f2.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -25,29 +25,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -100,7 +99,7 @@ s.E t.O t.E u.O u.E v.O v.E w.O w.E x.O x.E y.O y.E z.O z.E empty-fl.O \
empty-fl.E missing-fl.O missing-fl.E empty-bl.O empty-bl.E missing-bl.O \
missing-bl.E empty-f1.O empty-f1.E empty-f2.O empty-f2.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -108,7 +107,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -127,9 +126,8 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/cut-test/Makefile
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/cut/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
@@ -141,14 +139,14 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/cut-test
subdir = tests/cut
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/cut-test/Makefile
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/cut/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
@@ -233,28 +231,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = date
@@ -23,7 +23,7 @@ date2sec-0a.O date2sec-0a.E date2sec-1.O date2sec-1.E sec2date-0.O \
sec2date-0.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -31,29 +31,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -61,6 +61,7 @@ CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
GENCAT = @GENCAT@
GETHOSTBYNAME_LIB = @GETHOSTBYNAME_LIB@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -117,7 +118,7 @@ utc-0a.E utc-1.O utc-1.E utc-1a.O utc-1a.E date2sec-0.O date2sec-0.E \
date2sec-0a.O date2sec-0a.E date2sec-1.O date2sec-1.E sec2date-0.O \
sec2date-0.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -125,7 +126,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -144,7 +145,6 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/date/Makefile
@@ -250,28 +250,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = factor
@@ -11,7 +11,7 @@ m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
x.O x.E y.O y.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -19,29 +19,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -61,6 +61,7 @@ CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
GENCAT = @GENCAT@
GETHOSTBYNAME_LIB = @GETHOSTBYNAME_LIB@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -105,7 +106,7 @@ d.O d.E e.O e.E f.O f.E g.O g.E h.O h.E i.O i.E j.O j.E k.O k.E l.O l.E m.O \
m.E n.O n.E o.O o.E p.O p.E q.O q.E s.O s.E t.O t.E u.O u.E v.O v.E w.O w.E \
x.O x.E y.O y.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -113,7 +114,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -132,7 +133,6 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/factor/Makefile
@@ -238,28 +238,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = head
@@ -6,17 +6,17 @@ explicit = in in-1024
maint_gen = idem-0.I idem-0.X idem-1.I idem-1.X idem-2.I idem-2.X idem-3.I \
idem-3.X basic-0-10.I basic-0-10.X basic-0-09.I basic-0-09.X basic-0-11.I \
basic-0-11.X obs-0.I obs-0.X obs-1.I obs-1.X obs-2.I obs-2.X obs-3.I obs-3.X \
fail-0.I fail-0.X fail-1.I fail-1.X posix-0.I posix-0.X posix-1.I posix-1.X \
posix-2.I posix-2.X posix-3.I posix-3.X
fail-1.I fail-1.X posix-0.I posix-0.X posix-1.I posix-1.X posix-2.I posix-2.X \
posix-3.I posix-3.X
run_gen = idem-0.O idem-0.E idem-1.O idem-1.E idem-2.O idem-2.E idem-3.O \
idem-3.E basic-0-10.O basic-0-10.E basic-0-09.O basic-0-09.E basic-0-11.O \
basic-0-11.E obs-0.O obs-0.E obs-1.O obs-1.E obs-2.O obs-2.E obs-3.O obs-3.E \
obs-4.O obs-4.E obs-5.O obs-5.E fail-0.O fail-0.E fail-1.O fail-1.E posix-0.O \
posix-0.E posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E \
posix-4.O posix-4.E posix-5.O posix-5.E
obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E posix-0.O posix-0.E \
posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E posix-4.O \
posix-4.E posix-5.O posix-5.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -24,29 +24,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -90,16 +89,16 @@ explicit = in in-1024
maint_gen = idem-0.I idem-0.X idem-1.I idem-1.X idem-2.I idem-2.X idem-3.I \
idem-3.X basic-0-10.I basic-0-10.X basic-0-09.I basic-0-09.X basic-0-11.I \
basic-0-11.X obs-0.I obs-0.X obs-1.I obs-1.X obs-2.I obs-2.X obs-3.I obs-3.X \
fail-0.I fail-0.X fail-1.I fail-1.X posix-0.I posix-0.X posix-1.I posix-1.X \
posix-2.I posix-2.X posix-3.I posix-3.X
fail-1.I fail-1.X posix-0.I posix-0.X posix-1.I posix-1.X posix-2.I posix-2.X \
posix-3.I posix-3.X
run_gen = idem-0.O idem-0.E idem-1.O idem-1.E idem-2.O idem-2.E idem-3.O \
idem-3.E basic-0-10.O basic-0-10.E basic-0-09.O basic-0-09.E basic-0-11.O \
basic-0-11.E obs-0.O obs-0.E obs-1.O obs-1.E obs-2.O obs-2.E obs-3.O obs-3.E \
obs-4.O obs-4.E obs-5.O obs-5.E fail-0.O fail-0.E fail-1.O fail-1.E posix-0.O \
posix-0.E posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E \
posix-4.O posix-4.E posix-5.O posix-5.E
obs-4.O obs-4.E obs-5.O obs-5.E fail-1.O fail-1.E posix-0.O posix-0.E \
posix-1.O posix-1.E posix-2.O posix-2.E posix-3.O posix-3.E posix-4.O \
posix-4.E posix-5.O posix-5.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -107,7 +106,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -126,8 +125,7 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/head/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -232,28 +230,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -31,7 +31,9 @@ my @tv = (
# This test fails for textutils-1.22, because head let 4096m overflow to 0
# and did not fail. Now head fails with a diagnostic.
['fail-0', '-n 4096m', "a\n", "", 1],
# Disable this test because it fails on systems with 64-bit longs.
# ['fail-0', '-n 4096m', "a\n", "", 1],
# In spite of its name, this test passes -- just to contrast with the above.
['fail-1', '-n 2048m', "a\n", "a\n", 0],

View File

@@ -1,339 +0,0 @@
#! @PERL@ -w
# -*- perl -*-
# @configure_input@
my $In = '.I';
my $Out = '.O';
my $Exp = '.X';
my $Err = '.E';
require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use Test;
my $srcdir = '@srcdir@';
sub validate
{
my %seen;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
@$test_vector;
die "$0: wrong number of elements in test $test_name\n"
if (!defined $e_ret_code || defined $rest);
assert (!ref $test_name);
assert (!ref $flags);
assert (!ref $e_ret_code);
die "$0: duplicate test name \`$test_name'\n"
if (defined $seen{$test_name});
$seen{$test_name} = 1;
}
}
# Given a spec for the input file(s) or expected output file of a single
# test, create a file for any string. A file is created for each literal
# string -- not for named files. Whether a perl `string' is treated as
# a string to be put in a file for a test or the name of an existing file
# depends on how many references have to be traversed to get from
# the top level variable to the actual string literal.
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
# as the contents of a file.
# If $SPEC is a hash reference, then there are no inputs.
# If $SPEC is an array reference, consider each element of the array.
# If the element is a string reference, treat the string as the name of
# an existing file. Otherwise, the element must be a string and is treated
# just like a scalar $SPEC. When a file is created, its name is derived
# from the name TEST_NAME of the corresponding test and the TYPE of file.
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
# the expected output for test `7c' would be named t7c.exp.
#
# Also, return two lists of file names:
# - maintainer-generated files -- names of files created by this function
# - files named explicitly in Test.pm
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
assert ($type eq $In || $type eq $Exp);
my @explicit_file;
my @maint_gen_file;
my @content_string;
# If SPEC is a hash reference, return empty lists.
if (ref $spec eq 'HASH')
{
assert ($type eq $In);
return {
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
};
}
if (ref $spec)
{
assert (ref $spec eq 'ARRAY' || ref $spec eq 'HASH');
my $file_spec;
foreach $file_spec (@$spec)
{
# A file spec may be a string or a reference.
# If it's a string, that string is to be the contents of a
# generated (by this script) file with name derived from the
# name of this test.
# If it's a reference, then it must be the name of an existing
# file.
if (ref $file_spec)
{
my $r = ref $file_spec;
die "bad test: $test_name is $r\n"
if ref $file_spec ne 'SCALAR';
my $existing_file = $$file_spec;
# FIXME: make sure $existing_file exists somewhere.
push (@explicit_file, $existing_file);
}
else
{
push (@content_string, $file_spec);
}
}
}
else
{
push (@content_string, $spec);
}
my $i = 1;
my $file_contents;
foreach $file_contents (@content_string)
{
my $suffix = (@content_string > 1 ? $i : '');
my $maint_gen_file = "$test_name$type$suffix";
push (@maint_gen_file, $maint_gen_file);
open (F, ">$srcdir/$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
print F $file_contents;
close (F) || die "$0: $maint_gen_file: $!\n";
++$i;
}
my $n_fail = 0;
foreach $i (@explicit_file, @maint_gen_file)
{
my $max_len = 14;
if (length ($i) > $max_len)
{
warn "$0: $i: generated test file name would be longer than"
. " $max_len characters\n";
++$n_fail;
}
}
exit (1) if $n_fail;
my %h = (
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
);
return \%h;
}
sub wrap
{
my ($preferred_line_len, @tok) = @_;
assert ($preferred_line_len > 0);
my @lines;
my $line = '';
my $word;
foreach $word (@tok)
{
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
{
push (@lines, $line);
$line = $word;
next;
}
my $sp = ($line ? ' ' : '');
$line .= "$sp$word";
}
push (@lines, $line);
return @lines;
}
# ~~~~~~~ main ~~~~~~~~
{
$| = 1;
die "Usage: $0: program-name\n" if @ARGV != 1;
my $xx = $ARGV[0];
if ($xx eq '--list')
{
validate ();
# Output three lists of files:
# EXPLICIT -- file names specified in Test.pm
# MAINT_GEN -- maintainer-generated files
# RUN_GEN -- files created when running the tests
my $test_vector;
my @exp;
my @maint;
my @run;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
push (@run, ("$test_name$Out", "$test_name$Err"));
my $in = spec_to_list ($in_spec, $test_name, $In);
push (@exp, @{$in->{EXPLICIT}});
push (@maint, @{$in->{MAINT_GEN}});
my $e = spec_to_list ($exp_spec, $test_name, $Exp);
push (@exp, @{$e->{EXPLICIT}});
push (@maint, @{$e->{MAINT_GEN}});
}
# The list of explicitly mentioned files may contain duplicates.
# Eliminated any duplicates.
my %e = map {$_ => 1} @exp;
@exp = sort keys %e;
my $len = 77;
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
exit 0;
}
print <<EOF1;
#! /bin/sh
# This script was generated automatically by build-script.
case \$# in
0\) xx='$xx';;
*\) xx="\$1";;
esac
test "\$VERBOSE" && echo=echo || echo=:
\$echo testing program: \$xx
errors=0
test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
# Make sure we get English translations.
LANGUAGE=C
export LANGUAGE
LC_ALL=C
export LC_ALL
LANG=C
export LANG
EOF1
validate ();
my $n_tests = 0;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
my $in = spec_to_list ($in_spec, $test_name, $In);
my @srcdir_rel_in_file;
my $f;
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
{
push (@srcdir_rel_in_file, "\$srcdir/$f");
}
my $exp = spec_to_list ($exp_spec, $test_name, $Exp);
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
assert (@all == 1);
my $exp_name = "\$srcdir/$all[0]";
my $out = "$test_name$Out";
my $err_output = "$test_name$Err";
my %valid_via = map {$_ => 1} qw (REDIR FILE PIPE);
my %via_msg_string = (REDIR => '<', FILE => 'F', PIPE => '|');
# Inhibit warnings about `used only once'.
die if 0 && $Test::input_via{$test_name} && $Test::input_via_default;
die if 0 && $Test::env{$test_name} && $Test::env_default;
my $vias = $Test::input_via{$test_name} || $Test::input_via_default
|| {FILE => 0};
my $n_vias = keys %$vias;
my ($via, $val);
while (($via, $val) = each %$vias)
{
my $cmd;
my $via_msg = ($n_vias == 1 ? '' : $via_msg_string{$via});
my $file_args = join (' ', @srcdir_rel_in_file);
if ($via eq 'FILE')
{
$cmd = "\$xx $flags $file_args > $out 2> $err_output";
}
elsif ($via eq 'PIPE')
{
$via_msg = "|$val" if $val;
$val ||= 'cat';
$cmd = "$val $file_args | \$xx $flags > $out 2> $err_output";
}
else
{
assert (@srcdir_rel_in_file == 1);
$cmd = "\$xx $flags < $file_args > $out 2> $err_output";
}
my $env = $Test::env{$test_name} || $Test::env_default || [''];
my $e;
foreach $e (@$env)
{
my $sep = ($via_msg && $e ? ':' : '');
my $msg = "$e$sep$via_msg";
$msg = "($msg)" if $msg;
my $t_name = "$test_name$msg";
my $e_cmd = ($e ? "$e " : '');
++$n_tests;
print <<EOF;
$e_cmd$cmd
code=\$?
if test \$code != $e_ret_code ; then
\$echo "Test $t_name failed: $xx return code \$code differs from expected value $e_ret_code" 1>&2
errors=`expr \$errors + 1`
else
cmp $out $exp_name > /dev/null 2>&1
case \$? in
0) if test "\$VERBOSE" ; then \$echo "passed $t_name"; fi ;;
1) \$echo "Test $t_name failed: files $out and $exp_name differ" 1>&2;
errors=`expr \$errors + 1` ;;
2) \$echo "Test $t_name may have failed." 1>&2;
\$echo The command \"cmp $out $exp_name\" failed. 1>&2 ;
errors=`expr \$errors + 1` ;;
esac
fi
test -s $err_output || rm -f $err_output
EOF
}
}
}
print <<EOF3 ;
if test \$errors = 0 ; then
\$echo Passed all $n_tests tests. 1>&2
else
\$echo Failed \$errors tests. 1>&2
fi
test \$errors = 0 || errors=1
exit \$errors
EOF3
}

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = join
@@ -19,7 +19,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -27,29 +27,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -102,7 +101,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
5g.E 5h.O 5h.E 5i.O 5i.E 5j.O 5j.E 5k.O 5k.E 5l.O 5l.E 5m.O 5m.E 6a.O 6a.E \
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -110,7 +109,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -129,9 +128,8 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/join-test/Makefile
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/join/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
@@ -143,14 +141,14 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/join-test
subdir = tests/join
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/join-test/Makefile
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/join/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
@@ -235,28 +233,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -1,339 +0,0 @@
#! @PERL@ -w
# -*- perl -*-
# @configure_input@
my $In = '.I';
my $Out = '.O';
my $Exp = '.X';
my $Err = '.E';
require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use Test;
my $srcdir = '@srcdir@';
sub validate
{
my %seen;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
@$test_vector;
die "$0: wrong number of elements in test $test_name\n"
if (!defined $e_ret_code || defined $rest);
assert (!ref $test_name);
assert (!ref $flags);
assert (!ref $e_ret_code);
die "$0: duplicate test name \`$test_name'\n"
if (defined $seen{$test_name});
$seen{$test_name} = 1;
}
}
# Given a spec for the input file(s) or expected output file of a single
# test, create a file for any string. A file is created for each literal
# string -- not for named files. Whether a perl `string' is treated as
# a string to be put in a file for a test or the name of an existing file
# depends on how many references have to be traversed to get from
# the top level variable to the actual string literal.
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
# as the contents of a file.
# If $SPEC is a hash reference, then there are no inputs.
# If $SPEC is an array reference, consider each element of the array.
# If the element is a string reference, treat the string as the name of
# an existing file. Otherwise, the element must be a string and is treated
# just like a scalar $SPEC. When a file is created, its name is derived
# from the name TEST_NAME of the corresponding test and the TYPE of file.
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
# the expected output for test `7c' would be named t7c.exp.
#
# Also, return two lists of file names:
# - maintainer-generated files -- names of files created by this function
# - files named explicitly in Test.pm
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
assert ($type eq $In || $type eq $Exp);
my @explicit_file;
my @maint_gen_file;
my @content_string;
# If SPEC is a hash reference, return empty lists.
if (ref $spec eq 'HASH')
{
assert ($type eq $In);
return {
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
};
}
if (ref $spec)
{
assert (ref $spec eq 'ARRAY' || ref $spec eq 'HASH');
my $file_spec;
foreach $file_spec (@$spec)
{
# A file spec may be a string or a reference.
# If it's a string, that string is to be the contents of a
# generated (by this script) file with name derived from the
# name of this test.
# If it's a reference, then it must be the name of an existing
# file.
if (ref $file_spec)
{
my $r = ref $file_spec;
die "bad test: $test_name is $r\n"
if ref $file_spec ne 'SCALAR';
my $existing_file = $$file_spec;
# FIXME: make sure $existing_file exists somewhere.
push (@explicit_file, $existing_file);
}
else
{
push (@content_string, $file_spec);
}
}
}
else
{
push (@content_string, $spec);
}
my $i = 1;
my $file_contents;
foreach $file_contents (@content_string)
{
my $suffix = (@content_string > 1 ? $i : '');
my $maint_gen_file = "$test_name$type$suffix";
push (@maint_gen_file, $maint_gen_file);
open (F, ">$srcdir/$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
print F $file_contents;
close (F) || die "$0: $maint_gen_file: $!\n";
++$i;
}
my $n_fail = 0;
foreach $i (@explicit_file, @maint_gen_file)
{
my $max_len = 14;
if (length ($i) > $max_len)
{
warn "$0: $i: generated test file name would be longer than"
. " $max_len characters\n";
++$n_fail;
}
}
exit (1) if $n_fail;
my %h = (
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
);
return \%h;
}
sub wrap
{
my ($preferred_line_len, @tok) = @_;
assert ($preferred_line_len > 0);
my @lines;
my $line = '';
my $word;
foreach $word (@tok)
{
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
{
push (@lines, $line);
$line = $word;
next;
}
my $sp = ($line ? ' ' : '');
$line .= "$sp$word";
}
push (@lines, $line);
return @lines;
}
# ~~~~~~~ main ~~~~~~~~
{
$| = 1;
die "Usage: $0: program-name\n" if @ARGV != 1;
my $xx = $ARGV[0];
if ($xx eq '--list')
{
validate ();
# Output three lists of files:
# EXPLICIT -- file names specified in Test.pm
# MAINT_GEN -- maintainer-generated files
# RUN_GEN -- files created when running the tests
my $test_vector;
my @exp;
my @maint;
my @run;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
push (@run, ("$test_name$Out", "$test_name$Err"));
my $in = spec_to_list ($in_spec, $test_name, $In);
push (@exp, @{$in->{EXPLICIT}});
push (@maint, @{$in->{MAINT_GEN}});
my $e = spec_to_list ($exp_spec, $test_name, $Exp);
push (@exp, @{$e->{EXPLICIT}});
push (@maint, @{$e->{MAINT_GEN}});
}
# The list of explicitly mentioned files may contain duplicates.
# Eliminated any duplicates.
my %e = map {$_ => 1} @exp;
@exp = sort keys %e;
my $len = 77;
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
exit 0;
}
print <<EOF1;
#! /bin/sh
# This script was generated automatically by build-script.
case \$# in
0\) xx='$xx';;
*\) xx="\$1";;
esac
test "\$VERBOSE" && echo=echo || echo=:
\$echo testing program: \$xx
errors=0
test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
# Make sure we get English translations.
LANGUAGE=C
export LANGUAGE
LC_ALL=C
export LC_ALL
LANG=C
export LANG
EOF1
validate ();
my $n_tests = 0;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
my $in = spec_to_list ($in_spec, $test_name, $In);
my @srcdir_rel_in_file;
my $f;
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
{
push (@srcdir_rel_in_file, "\$srcdir/$f");
}
my $exp = spec_to_list ($exp_spec, $test_name, $Exp);
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
assert (@all == 1);
my $exp_name = "\$srcdir/$all[0]";
my $out = "$test_name$Out";
my $err_output = "$test_name$Err";
my %valid_via = map {$_ => 1} qw (REDIR FILE PIPE);
my %via_msg_string = (REDIR => '<', FILE => 'F', PIPE => '|');
# Inhibit warnings about `used only once'.
die if 0 && $Test::input_via{$test_name} && $Test::input_via_default;
die if 0 && $Test::env{$test_name} && $Test::env_default;
my $vias = $Test::input_via{$test_name} || $Test::input_via_default
|| {FILE => 0};
my $n_vias = keys %$vias;
my ($via, $val);
while (($via, $val) = each %$vias)
{
my $cmd;
my $via_msg = ($n_vias == 1 ? '' : $via_msg_string{$via});
my $file_args = join (' ', @srcdir_rel_in_file);
if ($via eq 'FILE')
{
$cmd = "\$xx $flags $file_args > $out 2> $err_output";
}
elsif ($via eq 'PIPE')
{
$via_msg = "|$val" if $val;
$val ||= 'cat';
$cmd = "$val $file_args | \$xx $flags > $out 2> $err_output";
}
else
{
assert (@srcdir_rel_in_file == 1);
$cmd = "\$xx $flags < $file_args > $out 2> $err_output";
}
my $env = $Test::env{$test_name} || $Test::env_default || [''];
my $e;
foreach $e (@$env)
{
my $sep = ($via_msg && $e ? ':' : '');
my $msg = "$e$sep$via_msg";
$msg = "($msg)" if $msg;
my $t_name = "$test_name$msg";
my $e_cmd = ($e ? "$e " : '');
++$n_tests;
print <<EOF;
$e_cmd$cmd
code=\$?
if test \$code != $e_ret_code ; then
\$echo "Test $t_name failed: $xx return code \$code differs from expected value $e_ret_code" 1>&2
errors=`expr \$errors + 1`
else
cmp $out $exp_name > /dev/null 2>&1
case \$? in
0) if test "\$VERBOSE" ; then \$echo "passed $t_name"; fi ;;
1) \$echo "Test $t_name failed: files $out and $exp_name differ" 1>&2;
errors=`expr \$errors + 1` ;;
2) \$echo "Test $t_name may have failed." 1>&2;
\$echo The command \"cmp $out $exp_name\" failed. 1>&2 ;
errors=`expr \$errors + 1` ;;
esac
fi
test -s $err_output || rm -f $err_output
EOF
}
}
}
print <<EOF3 ;
if test \$errors = 0 ; then
\$echo Passed all $n_tests tests. 1>&2
else
\$echo Failed \$errors tests. 1>&2
fi
test \$errors = 0 || errors=1
exit \$errors
EOF3
}

View File

@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -106,7 +105,7 @@ GZIP = --best
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/ln/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)

View File

@@ -36,6 +36,7 @@ export LC_ALL
LANG=C
export LANG
fail=0
$LN -sf a b > err 2>&1 && fail=1
case `cat err` in
*'are the same file') ;;

View File

@@ -1,42 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = ls
explicit = '""""" "' b
maint_gen = q1.X q2.X
run_gen = q1.O q1.E q2.O q2.E
##test-files-end
AUTOMAKE_OPTIONS = 1.2 gnits
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
TESTS = time-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = LS=../../src/ls TOUCH=../../src/touch

View File

@@ -1,8 +1,14 @@
# Makefile.in generated automatically by automake 1.2 from Makefile.am
# Makefile.in generated automatically by automake 1.2d from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
@@ -43,12 +49,12 @@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = true
PRE_INSTALL = true
POST_INSTALL = true
NORMAL_UNINSTALL = true
PRE_UNINSTALL = true
POST_UNINSTALL = true
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
@@ -65,12 +71,12 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
@@ -81,42 +87,14 @@ VERSION = @VERSION@
YACC = @YACC@
l = @l@
x = ls
explicit =
maint_gen = obs-c1.I obs-c1.X obs-c2.I obs-c2.X obs-c3.I obs-c3.X obs-c4.I \
obs-c4.X obs-c5.I obs-c5.X obs-l1.I obs-l1.X obs-l2.I obs-l2.X obs-l3.I \
obs-l3.X obs-l4.I obs-l4.X obs-l5.I obs-l5.X obs-1.I obs-1.X obs-2.I obs-2.X \
obs-3.I obs-3.X obs-4.I obs-4.X obs-5.I obs-5.X obsx-1.I obsx-1.X obsx-2.I \
obsx-2.X obs-l.I obs-l.X err-1.I err-1.X err-2.I err-2.X err-3.I err-3.X \
err-4.I err-4.X err-5.I err-5.X err-6.I err-6.X minus-1.I minus-1.X minus-2.I \
minus-2.X n-1.I n-1.X n-2.I n-2.X n-3.I n-3.X n-4.I n-4.X n-4a.I n-4a.X n-5.I \
n-5.X n-5a.I n-5a.X n-5b.I n-5b.X
run_gen = obs-c1.O obs-c1.E obs-c2.O obs-c2.E obs-c3.O obs-c3.E obs-c4.O \
obs-c4.E obs-c5.O obs-c5.E obs-l1.O obs-l1.E obs-l2.O obs-l2.E obs-l3.O \
obs-l3.E obs-l4.O obs-l4.E obs-l5.O obs-l5.E obs-1.O obs-1.E obs-2.O obs-2.E \
obs-3.O obs-3.E obs-4.O obs-4.E obs-5.O obs-5.E obsx-1.O obsx-1.E obsx-2.O \
obsx-2.E obs-l.O obs-l.E err-1.O err-1.E err-2.O err-2.E err-3.O err-3.E \
err-4.O err-4.E err-5.O err-5.E err-6.O err-6.E minus-1.O minus-1.E minus-2.O \
minus-2.E n-1.O n-1.E n-2.O n-2.E n-3.O n-3.E n-4.O n-4.E n-4a.O n-4a.E n-5.O \
n-5.E n-5a.O n-5a.E n-5b.O n-5b.E
AUTOMAKE_OPTIONS = 1.2 gnits
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
TESTS = time-1
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = LS=../../src/ls TOUCH=../../src/touch
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
SCRIPTS = $(noinst_SCRIPTS)
DIST_COMMON = Makefile.am Makefile.in
@@ -127,8 +105,7 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/ls/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
@@ -146,6 +123,7 @@ subdir = tests/ls
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/ls/Makefile
@for file in $(DISTFILES); do \
@@ -195,7 +173,7 @@ install: install-exec install-data all
uninstall:
all: Makefile $(SCRIPTS)
all: Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
@@ -203,25 +181,25 @@ installdirs:
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
rm -f Makefile $(DISTCLEANFILES)
rm -f config.cache config.log stamp-h stamp-h[0-9]*
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean
distclean: distclean-generic clean
rm -f config.status
-rm -f config.status
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@@ -233,27 +211,6 @@ mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

81
tests/ls/time-1 Executable file
View File

@@ -0,0 +1,81 @@
#!/bin/sh
# Test some of ls's sorting options.
: ${LS=ls}
: ${TOUCH=touch}
test=time-1
if test "$VERBOSE" = yes; then
set -x
$LS --version
fi
tmp=t-ls.$$
# We're going to run LS from a subdir.
# Prepend ../ if $LS is a relative file name.
case $LS in
/*) ;;
*/*) LS=../$LS
esac
case $TOUCH in
/*) ;;
*/*) TOUCH=../$TOUCH
esac
test_failure=0
mkdir $tmp || test_failure=1
cd $tmp || test_failure=1
t1='1998-01-15 21:00'
t2='1998-01-15 22:00'
t3='1998-01-15 23:00'
u1='1998-01-14 11:00'
u2='1998-01-14 12:00'
u3='1998-01-14 13:00'
$TOUCH -m -d "$t3" a || test_failure=1
$TOUCH -m -d "$t2" b || test_failure=1
$TOUCH -m -d "$t1" c || test_failure=1
$TOUCH -a -d "$u1" a || test_failure=1
$TOUCH -a -d "$u2" b || test_failure=1
$TOUCH -a -d "$u3" c || test_failure=1
# Sleep so long in an attempt to avoid spurious failures
# due to NFS caching and/or clock skew.
sleep 5
# Create a link, updating c's ctime.
ln c d || test_failure=1
if test $test_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
fail=0
set `$LS -u a b c`
test "$*" = 'c b a' && : || fail=1
set `$LS -t a b c`
test "$*" = 'a b c' && : || fail=1
# C has newer ctime.
set `$LS -c a c`
if test "$*" = 'c a'; then
: ok
else
# In spite of documentation, (e.g., stat(2)), neither link nor chmod
# update a file's st_ctime on SunOS4.1.4.
echo "failed ls ctime test -- this is expected at least for SunOS4.1.4" >&2
fail=1
fi
cd ..
rm -rf $tmp
exit $fail

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = md5sum
@@ -7,7 +7,7 @@ maint_gen = 1.I 1.X 2.I 2.X 3.I 3.X 4.I 4.X 5.I 5.X 6.I 6.X 7.I 7.X
run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -15,29 +15,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -90,7 +89,7 @@ explicit =
maint_gen = 1.I 1.X 2.I 2.X 3.I 3.X 4.I 4.X 5.I 5.X 6.I 6.X 7.I 7.X
run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -98,7 +97,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -117,9 +116,8 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/md5sum-test/Makefile
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/md5sum/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
@@ -131,14 +129,14 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/md5sum-test
subdir = tests/md5sum
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/md5sum-test/Makefile
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/md5sum/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
@@ -223,28 +221,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

7
tests/cut/mk-script.pl → tests/mk-script Normal file → Executable file
View File

@@ -1,6 +1,5 @@
#! @PERL@ -w
#! /usr/bin/perl -w
# -*- perl -*-
# @configure_input@
my $In = '.I';
my $Out = '.O';
@@ -11,10 +10,10 @@ require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
BEGIN { push @INC, '.' if '.' ne '.'; }
use Test;
my $srcdir = '@srcdir@';
my $srcdir = '.';
sub validate
{

View File

@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -106,7 +105,7 @@ GZIP = --best
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/mkdir/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)

1
tests/mv/.cvsignore Normal file
View File

@@ -0,0 +1 @@
Makefile

12
tests/mv/Makefile.am Normal file
View File

@@ -0,0 +1,12 @@
AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = mv-special-1
EXTRA_DIST = $(TESTS) setup
TESTS_ENVIRONMENT = \
DF=../../src/df \
LS=../../src/ls \
MKDIR=../../src/mkdir \
MKNOD=../../src/mknod \
MV=../../src/mv \
RM=../../src/rm \
TOUCH=../../src/touch

223
tests/mv/Makefile.in Normal file
View File

@@ -0,0 +1,223 @@
# Makefile.in generated automatically by automake 1.2d from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
AUTOMAKE_OPTIONS = 1.1 gnits
TESTS = mv-special-1
EXTRA_DIST = $(TESTS) setup
TESTS_ENVIRONMENT = \
DF=../../src/df \
LS=../../src/ls \
MKDIR=../../src/mkdir \
MKNOD=../../src/mknod \
MV=../../src/mv \
RM=../../src/rm \
TOUCH=../../src/touch
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = README Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/mv/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/mv
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/mv/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; \
srcdir=$(srcdir); export srcdir; \
for tst in $(TESTS); do \
if test -f $$tst; then dir=.; \
else dir="$(srcdir)"; fi; \
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
all=`expr $$all + 1`; \
echo "PASS: $$tst"; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="$$failed of $$all tests failed"; \
fi; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
test "$$failed" -eq 0
info:
dvi:
check: all
$(MAKE) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
install-data:
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
all: Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean
distclean: distclean-generic clean
-rm -f config.status
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: default tags distdir check-TESTS info dvi installcheck \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

42
tests/mv/mv-special-1 Executable file
View File

@@ -0,0 +1,42 @@
#! /bin/sh
: ${LS=ls}
: ${MV=mv}
: ${MKDIR=mkdir}
: ${MKNOD=mknod}
: ${RM=rm}
: ${TOUCH=touch}
. $srcdir/setup
if test -z $other_partition_tmpdir; then
exit 77
fi
null=.mv-null
dir=.mv-dir
test_failure=0
$RM -f $null || test_failure=1
$MKNOD $null p || test_failure=1
$MKDIR -p $dir/a/b/c $dir/d/e/f || test_failure=1
$TOUCH $dir/a/b/c/file1 $dir/d/e/f/file2 || test_failure=1
if test $test_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
fail=0
$MV $null $dir $other_partition_tmpdir || fail=1
# Make sure the files are gone.
test -f $null && fail=1
test -d $dir && fail=1
# cd $other_partition_tmpdir
# $LS -l -A -R $other_partition_tmpdir
$RM -rf $null $dir $other_partition_tmpdir
exit $fail

43
tests/mv/setup Executable file
View File

@@ -0,0 +1,43 @@
#! /bin/sh
# Use df to find a writable directory on a file system different from that
# of the current directory. If one is found, create a temporary directory
# inside it.
: ${DF=df}
: ${MKDIR=mkdir}
# Try these
: ${CANDIDATE_TMP_DIRS="$TMPDIR /tmp /var/tmp /usr/tmp $HOME"}
other_partition_tmpdir=
# WARNING: using sed like this to extract the mount point will fail
# if the mount point name contains `% '.
dot_mount_point=`$DF --no-sync -P . | sed -n '2s/.*% *//p'`
for d in $CANDIDATE_TMP_DIRS; do
d_mount_point=`$DF --no-sync -P $d | sed -n '2s/.*% *//p'`
# Same partition? Skip it.
test x$d_mount_point = x$dot_mount_point && continue
# See if we can create a directory in it.
if $MKDIR "$d/df-$$" > /dev/null 2>&1; then
other_partition_tmpdir="$d/df-$$"
break
fi
done
if test -z $other_partition_tmpdir; then
cat <<EOF 1>&2
This test requires a writable directory on a different disk partition,
and I couldn\'t find one. I tried these defaults:
$CANDIDATE_TMP_DIRS
Set your environment variable CANDIDATE_TMP_DIRS to make this test use
use a different list.
EOF
fi
test "$VERBOSE" = yes && set -x

View File

@@ -1,4 +1,4 @@
## Process this file with automake to produce Makefile.in.
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
##test-files-begin
x = pr
@@ -59,7 +59,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 1g.O \
margin-0.O margin-0.E
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -67,29 +67,20 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mk_script = $(srcdir)/../mk-script
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@

View File

@@ -70,7 +70,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -142,7 +141,7 @@ run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 1g.O \
12bc.O 12bc.E 12ma.O 12ma.E 12mb.O 12mb.E 12mc.O 12mc.E 12md.O 12md.E \
margin-0.O margin-0.E
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -150,7 +149,7 @@ editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
mk_script = $(srcdir)/../mk-script
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@@ -169,9 +168,8 @@ GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/pr-test/Makefile
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/pr/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
@@ -183,14 +181,14 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/pr-test
subdir = tests/pr
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/pr-test/Makefile
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/pr/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
@@ -275,28 +273,19 @@ install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(srcdir)/$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
$(srcdir)/$x-tests: $(mk_script) Test.pm
$(PERL) -w -- $(mk_script) ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
mk-script: ../../config.status
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script
@MAINT@ rm -f $@ $@t
@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $@t
@MAINT@ ./mk-script --list >> $@t
@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t
@MAINT@ mv $@t $@
Makefile.am: ../Makefile.am.in Test.pm $(mk_script)
rm -f $@ $@t
sed -n '1,/^##test-files-begin/p' $< > $@t
tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
echo "x = $$tool" >> $@t
$(PERL) -w -- $(mk_script) --list >> $@t
sed -n '/^##test-files-end/,$$p' $< >> $@t
mv $@t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -71,7 +71,6 @@ INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -106,7 +105,7 @@ GZIP = --best
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/rm/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)

View File

@@ -15,7 +15,9 @@ tmp=$RM_TMPDIR/t-rm.$$
test_failure=0
mkdir $tmp $tmp/a $tmp/b $tmp/c || test_failure=1
touch $tmp/a/a $tmp/b/bb $tmp/c/cc || test_failure=1
> $tmp/a/a || test_failure=1
> $tmp/b/bb || test_failure=1
> $tmp/c/cc || test_failure=1
if test $test_failure = 1; then
echo 'failure in testing framework'

View File

@@ -13,10 +13,30 @@ if test "$VERBOSE" = yes; then
fi
tmp=$TMPDIR/t-rm.$$
mkdir $tmp
mkdir $tmp/a $tmp/a/a
touch $tmp/b
test_failure=0
mkdir $tmp || test_failure=1
mkdir $tmp/a $tmp/a/a || test_failure=1
> $tmp/b || test_failure=1
cat <<EOF > $tmp/$test.E || test_failure=1
removing any entries of directory $tmp/a
removing any entries of directory $tmp/a/a
removing the directory itself: $tmp/a/a
removing the directory itself: $tmp/a
removing non-directory $tmp/b
EOF
if test $test_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
LANGUAGE=C
export LANGUAGE
LANG=C
export LANG
fail=0
$RM --verbose -r $tmp/a $tmp/b > $tmp/$test.O || fail=1
@@ -27,12 +47,6 @@ for d in $dirs; do
fi
done
cat <<EOF > $tmp/$test.E
$tmp/a
$tmp/a/a
$tmp/b
EOF
# Compare expected and actual output.
cmp $tmp/$test.E $tmp/$test.O || fail=1

View File

@@ -13,7 +13,23 @@ fi
tmp=$TMPDIR/t-rm.$$
mkdir $tmp $tmp/a $tmp/a/b
touch $tmp/a/f $tmp/a/b/g
> $tmp/a/f
> $tmp/a/b/g
# FIXME: if this fails, it's a framework failure
cat <<EOF > $tmp/$test.E
removing any entries of directory $tmp/a
removing any entries of directory $tmp/a/b
removing non-directory $tmp/a/b/g
removing the directory itself: $tmp/a/b
removing non-directory $tmp/a/f
removing the directory itself: $tmp/a
EOF
LANGUAGE=C
export LANGUAGE
LANG=C
export LANG
fail=0
$RM --verbose -r $tmp/a > $tmp/$test.O || fail=1
@@ -22,13 +38,6 @@ if test -d $tmp/a; then
fail=1
fi
cat <<EOF > $tmp/$test.E
$tmp/a
$tmp/a/b
$tmp/a/b/g
$tmp/a/f
EOF
# Compare expected and actual output.
cmp $tmp/$test.E $tmp/$test.O || fail=1

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