Compare commits

...

264 Commits

Author SHA1 Message Date
Jim Meyering
c4b800d7b6 *** empty log message *** 2000-01-09 16:17:26 +00:00
Jim Meyering
913e134b2d *** empty log message *** 2000-01-09 08:26:42 +00:00
Jim Meyering
5f2d0e3d6c *** empty log message *** 2000-01-09 08:26:15 +00:00
Jim Meyering
58cba22668 (do_link): Produce the same sort of one-line output for
`--backup --verbose' as cp, mv, install.  Before this, the backup
file name wasn't printed at all.
2000-01-09 08:23:51 +00:00
Jim Meyering
efe3229edb This affects cp, install, and mv.
(copy_internal): When making backup files in verbose
mode, print the backup file name on the same line as the rest of the
information, e.g., `a -> b (backup: b.~13~)' rather than on a line
by itself.
2000-01-09 08:20:45 +00:00
Jim Meyering
1279be6f8a *** empty log message *** 2000-01-08 18:03:08 +00:00
Jim Meyering
c852bc40d3 *** empty log message *** 2000-01-08 18:02:47 +00:00
Jim Meyering
e02fd60260 (PAGES_OPTION, COLUMNS_OPTION): Define these and use them instead of
`CHAR_MAX + n'.
2000-01-08 18:02:42 +00:00
Jim Meyering
299882b8a4 (OUTPUT_DELIMITER_OPTION): Define this and use it instead of `CHAR_MAX + n'. 2000-01-08 18:02:09 +00:00
Jim Meyering
fee7991cbc remove stray define before _LIBC 2000-01-08 17:53:35 +00:00
Jim Meyering
d486a2e744 *** empty log message *** 2000-01-08 17:53:21 +00:00
Jim Meyering
6752f5570a *** empty log message *** 2000-01-08 17:23:22 +00:00
Jim Meyering
00c9ad3937 . 2000-01-08 16:48:29 +00:00
Jim Meyering
9a0a8e29b0 *** empty log message *** 2000-01-08 16:46:20 +00:00
Jim Meyering
e5f283604b (TESTS_ENVIRONMENT): Add pwd/ prefix
to exported PATH value (though not strictly necessary, here).
2000-01-08 16:46:11 +00:00
Jim Meyering
1650a9459a *** empty log message *** 2000-01-08 16:44:27 +00:00
Jim Meyering
58edea6508 (error): Use __strerror_r's return value only if HAVE_WORKING_STRERROR_R.
(error_at_line): Likewise.
2000-01-08 16:44:19 +00:00
Jim Meyering
d15ab2c1be (null_AM_MAKEFLAGS): Define.
(my-distcheck): Use it to avoid distributing out of date files
whose derivation would require a maintainer tool.
2000-01-08 16:38:13 +00:00
Jim Meyering
cabbdf7bbf . 2000-01-08 16:35:26 +00:00
Jim Meyering
92999d559c . 2000-01-08 16:34:24 +00:00
Jim Meyering
625ce6a036 . 2000-01-08 16:32:02 +00:00
Jim Meyering
dfbeb59dc0 *** empty log message *** 2000-01-08 16:31:29 +00:00
Jim Meyering
b8342a9a20 (jm_FUNC_STRERROR_R): New file/macro. 2000-01-08 16:30:49 +00:00
Jim Meyering
2170503967 (jm_FUNC_STRERROR_R): Require it. 2000-01-08 16:25:57 +00:00
Jim Meyering
5693e5c586 Sync with the GNU C library. 2000-01-07 14:29:26 +00:00
Jim Meyering
b830d441bb . 2000-01-07 12:27:31 +00:00
Jim Meyering
923a32a0a8 tweak comment 2000-01-07 09:18:15 +00:00
Jim Meyering
a86b522044 *** empty log message *** 2000-01-07 08:56:48 +00:00
Jim Meyering
11eebed20f (TESTS_ENVIRONMENT): Add pwd/ prefix to exported PATH value (though not strictly necessary, here). 2000-01-07 08:56:38 +00:00
Jim Meyering
9bcff27f18 *** empty log message *** 2000-01-07 08:26:13 +00:00
Jim Meyering
858254d559 (TESTS_ENVIRONMENT): Add pwd/ prefix
to exported PATH value (though not strictly necessary, here).
2000-01-07 08:25:47 +00:00
Jim Meyering
f90f8cea87 (TESTS_ENVIRONMENT): Add pwd/ prefix
to exported PATH value (though not strictly necessary, here).
2000-01-07 08:25:26 +00:00
Jim Meyering
30a1c917c7 (TESTS_ENVIRONMENT): Add pwd/ prefix
to exported PATH value (though not strictly necessary, here).
2000-01-07 08:24:38 +00:00
Jim Meyering
36a3a59284 (TESTS_ENVIRONMENT): Add pwd/ prefix
to exported PATH value (though not strictly necessary, here).
2000-01-07 08:24:16 +00:00
Jim Meyering
aac32d403c add copyright/no-warranty comment 2000-01-07 07:33:19 +00:00
Jim Meyering
8606b093e4 *** empty log message *** 2000-01-07 07:31:03 +00:00
Jim Meyering
4e4c0e24d5 tweak copyright line 2000-01-07 07:03:01 +00:00
Jim Meyering
76bc7db5e2 (strpbrk): Ansideclify.
Use `#if' instead of `#ifdef' for `HAVE_CONFIG_H'.
2000-01-07 07:01:45 +00:00
Jim Meyering
fd3e041f5b Use #if' instead of #ifdef' for `HAVE_CONFIG_H'.
Capitalize all macro parameters.
(memcasecmp): Ansideclify.
Don't cast away `const'ness of parameters.
Suggestions from Franois Pinard.
2000-01-07 06:59:36 +00:00
Jim Meyering
ce2bd26821 . 2000-01-06 23:13:49 +00:00
Jim Meyering
1b470586fd . 2000-01-06 23:11:55 +00:00
Jim Meyering
198bd22923 . 2000-01-06 23:10:51 +00:00
Jim Meyering
8c5a80b069 . 2000-01-06 23:10:22 +00:00
Jim Meyering
a2e08f3047 *** empty log message *** 2000-01-06 22:58:02 +00:00
Jim Meyering
eff6393e39 Import version 1.020. 2000-01-06 22:49:01 +00:00
Jim Meyering
bbe0894eb2 . 2000-01-06 22:40:59 +00:00
Jim Meyering
c2d329d6c8 *** empty log message *** 2000-01-06 21:39:58 +00:00
Jim Meyering
136a8efd10 Use jm_CHECK_TYPE_STRUCT_UTIMBUF, renamed from jm_STRUCT_UTIMBUF. 2000-01-06 21:39:28 +00:00
Jim Meyering
567dae8b9c *** empty log message *** 2000-01-06 21:32:03 +00:00
Jim Meyering
f8c6ea241d Sync with the GNU C Library. 2000-01-06 21:31:48 +00:00
Jim Meyering
6784d83a62 Add #pragma STDC FENV_ACCESS ON if C99. 2000-01-06 21:01:06 +00:00
Jim Meyering
2f8c0d5542 Sync tm_diff with the GNU C Library.
(TM_YEAR_BASE): Renamed from TM_YEAR_ORIGIN.  All uses changed.
(tm_diff): Renamed from difftm.  All uses changed.
Replace body with that taken from GNU C Library 2.1.3pre1.
(get_date): Prefer tm_gmtoff to tm_diff if available.
2000-01-06 18:25:03 +00:00
Jim Meyering
1150e89832 *** empty log message *** 2000-01-06 18:24:51 +00:00
Jim Meyering
dd282c588b . 2000-01-06 17:13:39 +00:00
Jim Meyering
8301c1310b *** empty log message *** 2000-01-06 16:01:57 +00:00
Jim Meyering
8c0752d9be Tell the user just before sleeping for 7 seconds. 2000-01-06 16:01:43 +00:00
Jim Meyering
d9b2187a8c *** empty log message *** 2000-01-06 15:59:06 +00:00
Jim Meyering
d50599ae1a *** empty log message *** 2000-01-06 15:58:55 +00:00
Jim Meyering
6cb491d9df (TESTS): Remove fflush. It didn't
test the losing behavior, and left a stray tail process to boot.
2000-01-06 15:58:47 +00:00
Jim Meyering
21b43e0fe9 add blank line 2000-01-06 08:35:45 +00:00
Jim Meyering
2315cbdeaa (apply_suffix): Comment. 2000-01-06 08:35:21 +00:00
Jim Meyering
eee26242bb fix typo in comment 2000-01-06 08:29:10 +00:00
Jim Meyering
757861331e Minor code cleanup.
(clock_get_realtime): Return argument, for convenience.
(main): Use this to simplify main sleep loop.
2000-01-06 08:28:39 +00:00
Jim Meyering
e1cc2ace3c *** empty log message *** 2000-01-05 14:08:05 +00:00
Jim Meyering
f8d2a3f723 *** empty log message *** 2000-01-05 12:19:48 +00:00
Jim Meyering
3a673ed728 . 2000-01-05 12:19:04 +00:00
Jim Meyering
fd0797a4e4 Include nanosleep.h.
(AUTHORS): Add Paul Eggert.
2000-01-05 12:17:59 +00:00
Jim Meyering
3b979cf095 Add #pragma STDC FENV_ACCESS ON if C99.
(<fenv.h>): Include if available.
(main): Always round floating-point interval calculations upwards,
as we must sleep for at least the specified time.
Do the right thing with NaNs.
2000-01-05 12:17:19 +00:00
Jim Meyering
7f1c659ce3 whoops. fix typos 2000-01-05 12:06:39 +00:00
Jim Meyering
ec266f43d5 Include nanosleep.h.
Don't include time.h or sys/time.h here.
2000-01-05 12:03:53 +00:00
Jim Meyering
1885aeaaa4 *** empty log message *** 2000-01-05 12:03:06 +00:00
Jim Meyering
a2bee2bc6f (savedir): Don't store past the end of an array if
name_size is zero and the directory is empty.
2000-01-04 22:54:54 +00:00
Jim Meyering
1e01103713 *** empty log message *** 2000-01-04 17:18:15 +00:00
Jim Meyering
ce17dc2e94 Reflect s/jm_STRUCT_/jm_CHECK_TYPE_STRUCT_/ renamings. 2000-01-04 17:18:05 +00:00
Jim Meyering
6ed0893953 bump serial # 2000-01-04 17:16:48 +00:00
Jim Meyering
483ed4cbfd *** empty log message *** 2000-01-04 17:16:34 +00:00
Jim Meyering
b75698cf72 (jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Rename from jm_STRUCT_DIRENT_D_TYPE. 2000-01-04 17:16:26 +00:00
Jim Meyering
c26299c3d2 (jm_CHECK_TYPE_STRUCT_DIRENT_D_INO): Rename from jm_STRUCT_DIRENT_D_INO. 2000-01-04 17:15:32 +00:00
Jim Meyering
82ca413ae4 (jm_CHECK_TYPE_STRUCT_UTIMBUF): Rename from jm_STRUCT_UTIMBUF. 2000-01-04 17:13:58 +00:00
Jim Meyering
0d30a49178 (jm_CHECK_TYPE_STRUCT_TIMESPEC): Require it. 2000-01-04 17:12:45 +00:00
Jim Meyering
cdff473cd3 *** empty log message *** 2000-01-04 17:12:12 +00:00
Jim Meyering
9a74f64d12 . 2000-01-04 15:11:03 +00:00
Jim Meyering
8714cce36a (PREV_VERSION): Tweak so it handles e.g., 2.0a -> 2.0.
(alpha): Create xdelta diffs.
2000-01-04 13:20:15 +00:00
Jim Meyering
1a7010a87f (PREV_VERSION): Tweak so it handles e.g., 2.0a -> 2.0. 2000-01-04 12:24:49 +00:00
Jim Meyering
556a7ac657 *** empty log message *** 2000-01-03 19:59:04 +00:00
Jim Meyering
eed8a2f5e1 tweak comment 2000-01-03 19:58:56 +00:00
Jim Meyering
2ff3485a8d (jm_FUNC_NANOSLEEP): Search for nanosleep in -lrt
(for Solaris 7) and in -lposix4 (for Solaris 2.5.1).
2000-01-03 19:58:09 +00:00
Jim Meyering
3206a63225 *** empty log message *** 2000-01-02 16:00:44 +00:00
Jim Meyering
ef4c445a55 . 2000-01-02 15:59:32 +00:00
Jim Meyering
20ca1d8601 *** empty log message *** 2000-01-02 15:57:02 +00:00
Jim Meyering
60ff88e110 *** empty log message *** 2000-01-02 09:59:01 +00:00
Jim Meyering
6e5a32d58f Escape `$' in $3 of dnl comment. I no longer remember if this is necessary. 2000-01-02 09:58:53 +00:00
Jim Meyering
5f55b410a6 *** empty log message *** 2000-01-02 09:53:03 +00:00
Jim Meyering
27f7343bf6 *** empty log message *** 2000-01-02 09:52:32 +00:00
Jim Meyering
141036e2ea sleep accepts arbitrary floating point numbers. 2000-01-02 09:50:15 +00:00
Jim Meyering
34c324d786 update usage 2000-01-02 09:31:15 +00:00
Jim Meyering
9df5f7720b *** empty log message *** 2000-01-02 09:13:17 +00:00
Jim Meyering
f2de5d5212 *** empty log message *** 2000-01-02 09:12:55 +00:00
Jim Meyering
c5ed5e05ea . 2000-01-02 09:11:55 +00:00
Jim Meyering
7092835d3b *** empty log message *** 2000-01-02 08:57:49 +00:00
Jim Meyering
af6d4ad6ca Remove non-POSIX warning about trailing-slashed symlink-to-directory. 2000-01-02 08:53:30 +00:00
Jim Meyering
70cc369588 New option: --strip-trailing-slashes. 2000-01-02 08:51:39 +00:00
Jim Meyering
b3faf79a75 *** empty log message *** 2000-01-02 08:45:43 +00:00
Jim Meyering
50de4d0751 *** empty log message *** 2000-01-02 07:41:02 +00:00
Jim Meyering
60f3f576c7 (#pragma alloca): Add if _AIX is defined.
(path-concat.h): Include.
(show_point): If HAVE_REALPATH or HAVE_RESOLVEPATH is defined,
find the real absolute path for PATH, and use that to find the
mount point.

(show_point): Prefer non-dummy entries in shortcuts, too.
Disable bogus mount dirs instead of restatting them each time.
2000-01-02 07:40:24 +00:00
Jim Meyering
05fcf7df27 (my_strftime): Some old compilers object to
'\a', so don't bother optimizing for it.
2000-01-02 07:09:54 +00:00
Jim Meyering
d5d6d965ed *** empty log message *** 2000-01-01 20:00:28 +00:00
Jim Meyering
d9fd3ba617 . 2000-01-01 19:56:56 +00:00
Jim Meyering
8c3df2e678 *** empty log message *** 2000-01-01 09:43:40 +00:00
Jim Meyering
847d050688 *** empty log message *** 1999-12-30 09:09:38 +00:00
Jim Meyering
18f381afea *** empty log message *** 1999-12-30 09:09:03 +00:00
Jim Meyering
1128d1dffb *** empty log message *** 1999-12-30 09:07:31 +00:00
Jim Meyering
1d54f66fd0 (remove_parents, main): Don't pass errno to error
when printing "removing directory" message.  Failure of rmdir is
handled elsewhere.
1999-12-30 09:07:13 +00:00
Jim Meyering
84226463b1 . 1999-12-27 16:31:56 +00:00
Jim Meyering
b32cecce88 . 1999-12-27 16:30:45 +00:00
Jim Meyering
99c51ad97e minor var. renamings 1999-12-27 16:30:20 +00:00
Jim Meyering
4c746d7a4c tweak --help 1999-12-27 15:57:26 +00:00
Jim Meyering
dc33452012 *** empty log message *** 1999-12-27 14:17:39 +00:00
Jim Meyering
f71e656070 *** empty log message *** 1999-12-26 10:19:40 +00:00
Jim Meyering
34c6851c4a *** empty log message *** 1999-12-26 10:16:18 +00:00
Jim Meyering
b1dee02eb1 *** empty log message *** 1999-12-26 10:03:46 +00:00
Jim Meyering
0335111c76 (jm_FUNC_NANOSLEEP): New file/macro. 1999-12-26 10:02:31 +00:00
Jim Meyering
2dc33d421e *** empty log message *** 1999-12-26 09:40:16 +00:00
Jim Meyering
0ac76a646b *** empty log message *** 1999-12-25 22:15:23 +00:00
Jim Meyering
64003d937b Use < rather than >.
(main): Normalize ts_stop.
1999-12-25 20:00:21 +00:00
Jim Meyering
936a26728a . 1999-12-23 15:28:02 +00:00
Jim Meyering
5f22e8234b *** empty log message *** 1999-12-23 15:09:17 +00:00
Jim Meyering
0ecbb73025 (USE_CLOCK_GETTIME): Define.
[USE_CLOCK_GETTIME]: Include sys/time.h.
(timespec_subtract): New function.
(clock_get_realtime): New function.
(sighandler): Remove function.
(main): Reimplement again, using nanosleep and clock_gettime.
1999-12-23 14:34:38 +00:00
Jim Meyering
fc7ceba21b *** empty log message *** 1999-12-23 14:25:17 +00:00
Jim Meyering
c5494ca49a *** empty log message *** 1999-12-23 11:56:32 +00:00
Jim Meyering
c94e214238 Check for clock_gettime (moved from fileutils/configure.in)
Check for gettimeofday.
1999-12-23 11:55:58 +00:00
Jim Meyering
5db04594ae *** empty log message *** 1999-12-23 11:54:36 +00:00
Jim Meyering
eb19369c84 *** empty log message *** 1999-12-23 09:56:01 +00:00
Jim Meyering
1c49904e91 *** empty log message *** 1999-12-23 09:51:50 +00:00
Jim Meyering
d134d00bb4 . 1999-12-23 09:50:31 +00:00
Jim Meyering
9cd6962a4a . 1999-12-23 09:49:59 +00:00
Jim Meyering
21039f0b39 *** empty log message *** 1999-12-23 09:34:57 +00:00
Jim Meyering
ff9eed5ff5 (usage): Correct typos.
List new --target-directory=... usage.
Reported by Gran Uddeborg
1999-12-23 09:34:48 +00:00
Jim Meyering
176efa5092 (usage): List new --target-directory=... usage. 1999-12-23 09:34:25 +00:00
Jim Meyering
1206a834dd rewrite expression (equivalently) at request of Paul Eggert 1999-12-22 20:49:19 +00:00
Jim Meyering
bda1bae801 *** empty log message *** 1999-12-22 16:51:48 +00:00
Jim Meyering
67e3d46292 *** empty log message *** 1999-12-22 16:32:24 +00:00
Jim Meyering
3551f63a62 (ceil_percent): Remove.
(show_dev): Avoid overflow problems when calculating percent.
Do not display negative percents.
1999-12-22 16:32:07 +00:00
Jim Meyering
38d48aa7e9 *** empty log message *** 1999-12-22 14:30:45 +00:00
Jim Meyering
94aebe4774 Use $file, not $tmp/file. Exit 77 if run as root. 1999-12-22 14:30:23 +00:00
Jim Meyering
759da836f6 *** empty log message *** 1999-12-22 11:18:06 +00:00
Jim Meyering
222389a6d0 *** empty log message *** 1999-12-22 11:15:26 +00:00
Jim Meyering
621a5a5d61 (regress-1): New test for the above. 1999-12-22 11:15:15 +00:00
Jim Meyering
1796cbe0c6 *** empty log message *** 1999-12-22 11:14:30 +00:00
Jim Meyering
aa07786952 (get_date): Fix typo in time_t overflow test.
From Michael Stone.
1999-12-22 11:14:05 +00:00
Jim Meyering
771ec09cd4 . 1999-12-20 10:42:32 +00:00
Jim Meyering
f9dd65cfc8 Remove kludge, now that I'm using the fixed autoconf-2.14a-1999-12-20. 1999-12-20 10:37:27 +00:00
Jim Meyering
372ce8d3ce *** empty log message *** 1999-12-20 10:11:28 +00:00
Jim Meyering
7769c416ef tweak comment 1999-12-19 15:51:32 +00:00
Jim Meyering
c077ecf83c tweak comment 1999-12-19 15:21:19 +00:00
Jim Meyering
50075bf532 *** empty log message *** 1999-12-19 10:49:15 +00:00
Jim Meyering
b04f00f3d4 (lstat.c): Adapt rule to handle new parts of xstat.in.
(lstat.c): Likewise.
1999-12-19 10:46:19 +00:00
Jim Meyering
036b3bdae7 (slash_aware_lstat): New function.
(rpl_@xstat@): Use it.
1999-12-19 10:45:50 +00:00
Jim Meyering
f802f28675 *** empty log message *** 1999-12-19 10:43:18 +00:00
Jim Meyering
4a1f449cbe *** empty log message *** 1999-12-19 10:42:51 +00:00
Jim Meyering
0d9e008da2 . 1999-12-19 10:25:06 +00:00
Jim Meyering
7902c47089 *** empty log message *** 1999-12-19 10:23:58 +00:00
Jim Meyering
566fb840b3 *** empty log message *** 1999-12-19 10:23:47 +00:00
Jim Meyering
3d58863d57 [! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Use lstat wrapper.
[Notice the new test in m4/lstat-slash.m4. ]
(main): Back out change from 1999-02-19 that made ls remove
trailing slashes from command line arguments to accommodate early
versions of Linux.  Now, `ls symlink-to-dir/' acts like
`ls symlink-to-dir/.' thus following the symbolic link, as POSIX says
it should.  Suggestion from Bruno Haible and Andreas Schwab.
1999-12-19 10:23:26 +00:00
Jim Meyering
a595998975 . 1999-12-19 10:22:47 +00:00
Jim Meyering
c8707dcc2f . 1999-12-19 10:21:51 +00:00
Jim Meyering
4d8a95eff3 (TESTS): Add symlink-slash. 1999-12-19 10:21:34 +00:00
Jim Meyering
fa468393ae remove unused test= stmt 1999-12-19 09:41:08 +00:00
Jim Meyering
dd1a7723a6 *** empty log message *** 1999-12-19 09:37:22 +00:00
Jim Meyering
0c578407e0 bump serial number 1999-12-19 09:37:06 +00:00
Jim Meyering
bce84b024a Use the new macro: jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK. 1999-12-19 09:36:55 +00:00
Jim Meyering
a260bc04c8 *** empty log message *** 1999-12-19 09:34:29 +00:00
Jim Meyering
68a35b96ce *** empty log message *** 1999-12-19 09:33:18 +00:00
Jim Meyering
a9afc5a7d0 *** empty log message *** 1999-12-18 23:00:58 +00:00
Jim Meyering
96c183f34f *** empty log message *** 1999-12-18 22:41:36 +00:00
Jim Meyering
b9aa56bec4 *** empty log message *** 1999-12-18 16:04:47 +00:00
Jim Meyering
04aa739146 (wipename): When repeatedly renaming a file, making the name shorter
and shorter, skip to the next shorter length length if a rename fails (e.g. due to
permission denied).  Otherwise, this loop would iterate for so long that shred would
appear to be stuck in an infinite loop for any but the shortest file names.
1999-12-18 16:00:49 +00:00
Jim Meyering
ac31ad442b *** empty log message *** 1999-12-18 11:48:43 +00:00
Jim Meyering
a47deedda7 (print_entry): Correct do_lookup test so that who
prints whatever host information it has, even without --lookup.
1999-12-18 11:48:37 +00:00
Jim Meyering
a9c3d9197f *** empty log message *** 1999-12-15 10:15:36 +00:00
Jim Meyering
4d90b0efc9 (decode_switches): If -c or -u is specified and not -l (or any other
option that implies -l), and no sort-type was specified,
then sort by the ctime (-c) or atime (-u).  Part of this change reverts
the 1998-01-10 delta.
(usage): Update to reflect this change.
Reported by Paul Slootman via Michael Stone.
1999-12-15 08:38:54 +00:00
Jim Meyering
c8ad493e6b . 1999-12-14 09:00:08 +00:00
Jim Meyering
99aa95f945 *** empty log message *** 1999-12-13 22:37:15 +00:00
Jim Meyering
927b1d42fb *** empty log message *** 1999-12-13 15:08:21 +00:00
Jim Meyering
b5123778b7 *** empty log message *** 1999-12-13 15:04:27 +00:00
Jim Meyering
5c2322aacc *** empty log message *** 1999-12-13 15:03:51 +00:00
Jim Meyering
0c7c8c2992 *** empty log message *** 1999-12-13 07:33:13 +00:00
Jim Meyering
c8d452098b (make_path): Consistently use error to output
the verbose, `created directory ...' messages.
Reported by Bernhard Rosenkraenzer.
1999-12-13 07:30:57 +00:00
Jim Meyering
3182653495 *** empty log message *** 1999-12-13 07:29:13 +00:00
Jim Meyering
7efcffd2e6 *** empty log message *** 1999-12-13 06:45:13 +00:00
Jim Meyering
63324e5e7e Move 120+ lines of stat.h-related macros from system.h (not shared)
to sys2.h, which is shared between fileutils, sh-utils, textutils.
* src/system.h: Move them from here...
* src/sys2.h: ... to here.
1999-12-12 21:49:25 +00:00
Jim Meyering
488028199d (S_IRUSR, S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH): Define
if not defined.  This was necessary on a NeXT Turbostation running
Mach 3.3.  Reported by Nelson H. F. Beebe.
1999-12-12 21:45:34 +00:00
Jim Meyering
c71815ac7b *** empty log message *** 1999-12-12 20:26:48 +00:00
Jim Meyering
6ff905699a . 1999-12-10 16:30:28 +00:00
Jim Meyering
d3d701080b . 1999-12-10 16:29:54 +00:00
Jim Meyering
c6025b9d1e . 1999-12-10 15:22:55 +00:00
Jim Meyering
b026aa85d0 (_jm_STRFTIME_PREREQS): Use 3-arg form of AC_DEFINE for HAVE_TM_GMTOFF. 1999-12-10 14:35:38 +00:00
Jim Meyering
4c0b11a8e7 *** empty log message *** 1999-12-09 16:53:41 +00:00
Jim Meyering
5ac2b8e39b . 1999-12-09 16:42:00 +00:00
Jim Meyering
5214179c29 . 1999-12-09 16:38:32 +00:00
Jim Meyering
e8ff25dd70 *** empty log message *** 1999-12-09 15:55:11 +00:00
Jim Meyering
fc8e7363d2 Require that File::Compare be available, too.
Too many systems seem to lack it.
1999-12-09 15:54:59 +00:00
Jim Meyering
022194de49 Add checks for most of the cpp macros tested in GNU's strftime.c.
Prompted by a patch from Paul Eggert.
1999-12-09 15:54:20 +00:00
Jim Meyering
eb06f705a1 Use 1>&2 rather than `1<&-'.
Suggestion from Volker Borchert.
1999-12-09 15:52:49 +00:00
Jim Meyering
aeabe74421 (IGNORE_FAIL_ON_NON_EMPTY_OPTION): Likewise. 1999-12-09 15:52:09 +00:00
Jim Meyering
46b6c26e4f (BLOCK_SIZE_OPTION, EXCLUDE_OPTION, MAX_DEPTH_OPTION):
Define these and use them instead of `CHAR_MAX + n'.
1999-12-09 15:46:39 +00:00
Jim Meyering
919f2ce3da (BLOCK_SIZE_OPTION, SYNC_OPTION, NO_SYNC_OPTION): Define
these and use them instead of `CHAR_MAX + n'.
1999-12-09 15:43:41 +00:00
Jim Meyering
6cbabe63d4 (anonymous enum): Define TIME_OPTION, and ...
(longopts): ...use it here instead of `CHAR_MAX + 1'.
(main): Likewise.
1999-12-09 15:39:38 +00:00
Jim Meyering
1aa50fd72e (enum): Remove useless CHAR_MAX + 2 1999-12-09 15:35:41 +00:00
Jim Meyering
6845fc7c96 Test more of the framework (touch's -a and -m
options) before running the actual ls test.
1999-12-08 17:05:59 +00:00
Jim Meyering
84339c827f s/test_failure/framework_failure/g 1999-12-08 16:50:22 +00:00
Jim Meyering
be3748ddad (TESTS): Add fflush. 1999-12-05 23:31:34 +00:00
Jim Meyering
392a965229 Remove ftp.enst.fr. 1999-12-05 22:59:30 +00:00
Jim Meyering
5cb18377bc *** empty log message *** 1999-12-05 22:36:11 +00:00
Jim Meyering
93c2c18a80 (main): Flush stdout before switching to unbuffered mode
and calling tail_forever.  Required only on Solaris2.7 -- on other
systems, using setvbuf to switch to unbufferd mode does the flush.
1999-12-05 22:36:02 +00:00
Jim Meyering
dd002c22fd *** empty log message *** 1999-12-05 16:45:27 +00:00
Jim Meyering
f447e97462 . 1999-12-05 16:39:39 +00:00
Jim Meyering
3abc240e82 *** empty log message *** 1999-12-05 15:14:18 +00:00
Jim Meyering
ff8f4dde22 *** empty log message *** 1999-12-05 15:13:40 +00:00
Jim Meyering
f880990daf Revert the previous change.
(copy_internal): In move mode, if the rename attempt
fails, then unlink any existing destination file.  This makes a
cross-device `mv' more consistent with the intra-device behavior.
This change is required by POSIX to make a cross-device move act with
semantics similar to those of the rename syscall.  For example now
`mv' can move a file onto a symlink to itself when that symlink
is on a separate partition.  With fileutils-4.0j, it would fail with
a diagnostic saying they were the same file.
Reported by Bruno Haible.
1999-12-05 15:13:21 +00:00
Jim Meyering
7306126ef0 *** empty log message *** 1999-12-04 17:46:39 +00:00
Jim Meyering
305e2306be . 1999-12-04 17:46:06 +00:00
Jim Meyering
2b10e67d59 (TESTS): Add to-symlink. 1999-12-04 17:45:45 +00:00
Jim Meyering
dc74b3a1e7 Make sure that the copying code used in an inter-partition
move unlinks a destination symlink before opening it.
1999-12-04 17:44:59 +00:00
Jim Meyering
2f21a269fe *** empty log message *** 1999-12-04 17:34:39 +00:00
Jim Meyering
69408d229e *** empty log message *** 1999-12-04 17:34:05 +00:00
Jim Meyering
f05badd230 (trap): Be careful to close $actual before
removing the containing directory.  Otherwise, on some systems rmdir
fails to remove the containing directory.
1999-12-04 17:33:49 +00:00
Jim Meyering
6763fa97d2 *** empty log message *** 1999-12-04 17:31:29 +00:00
Jim Meyering
b1b10e1e40 List --full-time dates upon failure. 1999-12-04 17:31:23 +00:00
Jim Meyering
5810f4bee5 . 1999-12-04 17:30:24 +00:00
Jim Meyering
91b5e686d5 Adapt to reflect this change in behavior.
Make sure the VERSION_CONTROL envvar is not set.
Run diff if comparison fails.
1999-12-04 17:30:16 +00:00
Jim Meyering
8c096b86ef Use mv, ls, rm, not $MV, $LS, $RM. 1999-12-04 17:24:19 +00:00
Jim Meyering
698fd02798 (copy_internal): Be consistent with intra-device behavior
and *do* allow `mv' to move a file onto a symlink to itself when that
symlink is on a separate partition.  With fileutils-4.0j, it would
fail with a diagnostic saying they were the same file.
Reported by Bruno Haible.
1999-12-04 17:21:47 +00:00
Jim Meyering
28bac510d9 *** empty log message *** 1999-12-04 17:21:06 +00:00
Jim Meyering
2413369d22 *** empty log message *** 1999-12-04 17:05:27 +00:00
Jim Meyering
091109470c Give the right diagnostic when failing to create a file in an
unwritable directory.

(touch): Record errno upon failed errno and use that
saved value if a subsequent fstat, stat or utime call fails.
Reported by Wichert Akkerman via Michael Stone.
1999-12-04 17:03:43 +00:00
Jim Meyering
9481a7bd36 *** empty log message *** 1999-12-04 16:56:07 +00:00
Jim Meyering
2be3dc067a (check_symlink_color): New variable.
(main): Set it if we need to check for dangling symlinks when
displaying colors.
(gobble_file): Check check_symlink_color instead of print_with_color.
1999-12-04 16:55:27 +00:00
Jim Meyering
c4542a7e8c (usage): Shorten help for --show-control-chars. 1999-11-30 21:09:35 +00:00
Jim Meyering
6c9e0d702a *** empty log message *** 1999-11-30 16:09:58 +00:00
Jim Meyering
062906c83a Don't include math.h or float.h.
Don't use DBL_MAX.
Use TIME_T_MAX instead.
1999-11-28 19:59:18 +00:00
Jim Meyering
2c3fa56cef *** empty log message *** 1999-11-28 19:57:54 +00:00
Jim Meyering
346edb7361 *** empty log message *** 1999-11-28 19:56:38 +00:00
Jim Meyering
b9c91d0570 don't include assert.h 1999-11-28 14:04:12 +00:00
Jim Meyering
e20a9b89d2 Round more carefully so we never call nanosleep with more than 999,999,999
nanoseconds.
Comment out assertion because it uses on EINTR.
1999-11-28 14:03:43 +00:00
Jim Meyering
0baa523154 Rewrite to use nanosleep (hence, timer stops when sleep is suspended)
and to remove gettimeofday/signal cruft.
Improve overflow checking.
1999-11-28 13:35:00 +00:00
Jim Meyering
d5f7b2a2db *** empty log message *** 1999-11-28 08:08:51 +00:00
Jim Meyering
4c05896b20 better error checking
add FIXME comments for non-portable constructs
1999-11-28 08:00:58 +00:00
Jim Meyering
ec974f5c39 remove another printf stmt 1999-11-27 20:03:05 +00:00
Jim Meyering
15d2e7a86b remove printf stmts 1999-11-27 20:02:38 +00:00
Jim Meyering
069610a0f0 fix typos 1999-11-27 20:01:22 +00:00
Jim Meyering
5617251659 Rewrite to allow fractional seconds and to handle SIGCONT.
(main): Rewrite.
(sighandler): New function.
(apply_suffix): New function.
(timeval_subtract): New function.
1999-11-27 20:00:54 +00:00
Jim Meyering
398516f242 (usage): Add elipses to show that sleep allows more than one argument. 1999-11-27 17:10:15 +00:00
Jim Meyering
8e1452ffea remove brackets around required sleep argument 1999-11-27 17:04:29 +00:00
Jim Meyering
6b36a017db (argdecode): Move definition to precede use.
Remove prototype.
1999-11-27 15:02:27 +00:00
Jim Meyering
30d2b031ab *** empty log message *** 1999-11-27 10:15:46 +00:00
Jim Meyering
f72f631fa0 Don't set/use MV, etc. 1999-11-27 10:14:53 +00:00
Jim Meyering
d10b18f2b9 *** empty log message *** 1999-11-27 10:14:24 +00:00
Jim Meyering
511cd5b6ae Don't set/use MV, etc. 1999-11-27 10:14:04 +00:00
Jim Meyering
09282a24f6 Don't set/use RM and MV. 1999-11-27 10:11:25 +00:00
Jim Meyering
f36a801a9a Don't set/use LS MV MKDIR MKNOD RM TOUCH 1999-11-27 10:10:02 +00:00
Jim Meyering
1e219d6b71 Don't set/use DF or MKDIR. 1999-11-27 10:08:55 +00:00
Jim Meyering
2e0f5a2bac *** empty log message *** 1999-11-27 10:05:25 +00:00
Jim Meyering
9234f12d32 (TESTS): Add partition-perm. 1999-11-27 10:05:11 +00:00
127 changed files with 2975 additions and 807 deletions

View File

@@ -38,6 +38,15 @@ cvs-dist: maintainer-check
cvs tag -c $(this-cvs-tag)
$(MAKE) dist
# Use this to make sure we don't run these programs when building
# from a virgin tgz file, below.
null_AM_MAKEFLAGS = \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
MAKEINFO=false
t=./=test
my-distcheck:
-rm -rf $(t)
@@ -48,6 +57,7 @@ my-distcheck:
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='-Wformat -Werror' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(MAKE) check \
&& rm -rf $(DEPDIR) \
@@ -62,24 +72,21 @@ my-distcheck:
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
# FIXME: this works only for Gnits-style test releases.
PREV_VERSION := $(shell echo $(VERSION)|tr a-z Xa-y)
PREV_VERSION := $(shell echo $(VERSION)|tr b-z a-y|sed 's/a$$//')
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
v = Version
a_host=alpha.gnu.org
b_host=tug.org
c_host=ftp.enst.fr
a_url_dir=gnu/fetish
b_url_dir=gnu/fetish
c_url_dir=pub/gnu/gnits/fetish
a_real_dir=/fs/share/ftp/gnu/fetish
b_real_dir=/home/ftp/pub/gnu/fetish
c_real_dir=/pub/gnu/gnits/fetish
url_dir_list = $(foreach x,a b c,ftp://$($(x)_host)/$($(x)_url_dir))
real_dir_list = $(foreach x,a b c,ftp://$($(x)_host)$($(x)_real_dir))
url_dir_list = $(foreach x,a b,ftp://$($(x)_host)/$($(x)_url_dir))
real_dir_list = $(foreach x,a b,ftp://$($(x)_host)$($(x)_real_dir))
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
@@ -116,16 +123,24 @@ announcement: NEWS ChangeLog $(distdir).tar.gz
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
)
release-archive-dir = ../release
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
alpha:
$(MAKE) po-check
$(MAKE) cvs-dist
$(MAKE) -s announcement > /tmp/announce-$(distdir)
ln $(distdir).tar.gz ../release
chmod a-w $(distdir).tar.gz
cd $(release-archive-dir) \
&& xdelta delta -9 $(prev-tgz) $(distdir).tar.gz $(xd-delta) || :
ln $(release-archive-dir)/$(xd-delta) .
chmod a-w $(release-archive-dir)/$(xd-delta)
@echo =====================================
@for url in $(real_dir_list); do \
echo "ncftp -u $$url/"; \
done
@echo '# put $(distdir).tar.gz'
@echo '# mput $(xd-delta) $(distdir).tar.gz'
@echo '# send the /tmp/announcement e-mail'
@echo =====================================

8
THANKS
View File

@@ -8,7 +8,7 @@ Akim Demaille: demaille@inf.enst.fr
Alain Magloire: alain@qnx.com
Alexey Solovyov: alekso@math.uu.se
Andreas Jaeger: jaeger@gnu.org
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
Andreas Schwab: schwab@suse.de
Andres Soolo: andres@soolo.matti.ee
Andrew Dalke: dalke@bioreason.com
Andrew Tridgell: tridge@samba.org
@@ -17,6 +17,7 @@ Arne Henrik Juul: arnej@imf.unit.no
Bauke Jan Douma: bjdouma@xs4all.nl
Bengt Martensson: bengt@mathematik.uni-Bremen.de
Bernd Leibing: bernd.leibing@rz.uni-ulm.de
Bernhard Rosenkraenzer: bero@redhat.de
Bjorn Helgaas: helgaas@rsn.hp.com
Bob McCracken: kerouac@ravenet.com
Bob Proulx: rwp@fc.hp.com
@@ -48,12 +49,14 @@ Jamie Lokier: jamie@imbolc.ucc.ie
Janos Farkas: chexum@shadow.banki.hu
Jesse Thilo: jgt2@eecs.lehigh.edu
Joakim Rosqvist: dvljrt@cs.umu.se
Joe Orton: joe@orton.demon.co.uk
Johan Danielsson: joda@pdc.kth.se
John Bley: jbb6@acpub.duke.edu
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
John Gotts: jgotts@umich.edu
Jürgen Fluk: louis@dachau.marco.de
jvogel: jvogel@linkny.com
Kalle Olavi Niemitalo: tosi@stekt.oulu.fi
Karl Heuer: kwzh@gnu.org
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
Larry McVoy: lm@sgi.com
@@ -74,6 +77,7 @@ Michael ???:michael@roka.net
Michael Veksler: mveksler@techunix.technion.ac.il
Michael Stone: mstone@debian.org
Miles Bader: miles@gnu.ai.mit.edu
Nelson H. F. Beebe: beebe@math.utah.edu
Noel Cragg: noel@red-bean.com
Olav Morkrid: olav@funcom.com
Per Kristian Hove: perhov@math.ntnu.no
@@ -81,6 +85,7 @@ Peter Eriksson: peter@ifm.liu.se
Peter Moulder: reiter@netspace.net.au
Peter Samuelson: psamuels@sampo.creighton.edu
Paul Eggert: eggert@twinsun.com
Paul Slootman: paul@debian.org
Philippe De Muyter: phdm@macqel.be
Rainer Orth: ro@TechFak.Uni-Bielefeld.DE
Richard Braakman: dark@xs4all.nl
@@ -98,4 +103,5 @@ Ulrich Drepper: drepper@cygnus.com
Vin Shelton: acs@alumni.princeton.edu
Volker Borchert: bt@teknon.de
Wayne Stewart: wstewa@atl.com
Wichert Akkerman: wichert@cistron.nl
William Bader: william@nscs.fast.net

View File

@@ -300,7 +300,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
info-am: $(INFO_DEPS)
info: info-am

View File

@@ -3041,7 +3041,7 @@ the values of the command line arguments.
Synopsis:
@example
sleep [@var{number}[smhd]]@dots{}
sleep @var{number}[smhd]@dots{}
@end example
@cindex time units
@@ -3059,6 +3059,10 @@ hours
days
@end table
Historical implementations of @code{sleep} have required that
@var{number} be an integer. However, GNU @code{sleep} accepts
arbitrary floating point numbers.
The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.

View File

@@ -33,9 +33,19 @@ DISTCLEANFILES = lstat.c stat.c
EXTRA_DIST = xstat.in
lstat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/lstat/g' $(srcdir)/xstat.in > $@-t
sed \
-e '/@IGNORE@/d' \
-e 's/@xstat@/lstat/g' \
-e '/_LSTAT_ONLY@/d' \
-e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
$(srcdir)/xstat.in > $@-t
mv $@-t $@
stat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
sed \
-e '/@IGNORE@/d' \
-e 's/@xstat@/stat/g' \
-e '/_STAT_ONLY@/d' \
-e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
$(srcdir)/xstat.in > $@-t
mv $@-t $@

View File

@@ -169,10 +169,10 @@ DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in TODO alloca.c \
chown.c dup2.c error.c error.h euidaccess.c fileblocks.c fnmatch.c \
fsusage.c ftruncate.c getdate.c getgroups.c getline.c group-member.c \
lchown.c malloc.c memchr.c memcmp.c memcpy.c memmove.c memset.c mkdir.c \
mktime.c mountlist.c obstack.c obstack.h realloc.c regex.c rmdir.c \
rpmatch.c stpcpy.c strcasecmp.c strdup.c strftime.c strncasecmp.c \
strndup.c strstr.c strtol.c strtoul.c strtoull.c strtoumax.c \
strverscmp.c utime.c
mktime.c mountlist.c nanosleep.c obstack.c obstack.h realloc.c regex.c \
rmdir.c rpmatch.c stpcpy.c strcasecmp.c strdup.c strftime.c \
strncasecmp.c strndup.c strstr.c strtol.c strtoul.c strtoull.c \
strtoumax.c strverscmp.c utime.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -193,8 +193,8 @@ $(DEPDIR)/lchown.Po $(DEPDIR)/long-options$U.Po $(DEPDIR)/lstat.Po \
$(DEPDIR)/makepath$U.Po $(DEPDIR)/malloc.Po $(DEPDIR)/memchr.Po \
$(DEPDIR)/memcmp.Po $(DEPDIR)/memcpy.Po $(DEPDIR)/memmove.Po \
$(DEPDIR)/memset.Po $(DEPDIR)/mkdir.Po $(DEPDIR)/mktime.Po \
$(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po $(DEPDIR)/obstack.Po \
$(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po \
$(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po $(DEPDIR)/nanosleep.Po \
$(DEPDIR)/obstack.Po $(DEPDIR)/path-concat$U.Po $(DEPDIR)/posixtm$U.Po \
$(DEPDIR)/quotearg$U.Po $(DEPDIR)/realloc.Po $(DEPDIR)/regex.Po \
$(DEPDIR)/rmdir.Po $(DEPDIR)/rpmatch.Po $(DEPDIR)/safe-read$U.Po \
$(DEPDIR)/same$U.Po $(DEPDIR)/save-cwd$U.Po $(DEPDIR)/savedir$U.Po \
@@ -342,6 +342,8 @@ modechange_.c: modechange.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/modechange.c; then echo $(srcdir)/modechange.c; else echo modechange.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > modechange_.c
mountlist_.c: mountlist.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mountlist.c; then echo $(srcdir)/mountlist.c; else echo mountlist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > mountlist_.c
nanosleep_.c: nanosleep.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nanosleep.c; then echo $(srcdir)/nanosleep.c; else echo nanosleep.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > nanosleep_.c
obstack_.c: obstack.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > obstack_.c
path-concat_.c: path-concat.c $(ANSI2KNR)
@@ -421,13 +423,13 @@ full-write_.o getdate_.o getgroups_.o getline_.o getopt_.o getopt1_.o \
group-member_.o hash_.o human_.o idcache_.o isdir_.o lchown_.o \
long-options_.o lstat_.o makepath_.o malloc_.o memchr_.o memcmp_.o \
memcpy_.o memmove_.o memset_.o mkdir_.o mktime_.o modechange_.o \
mountlist_.o obstack_.o path-concat_.o posixtm_.o quotearg_.o \
realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o same_.o \
save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o strdup_.o \
strftime_.o stripslash_.o strncasecmp_.o strndup_.o strstr_.o strtol_.o \
strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o userspec_.o utime_.o \
version-etc_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o xstrtoul_.o \
xstrtoumax_.o yesno_.o : $(ANSI2KNR)
mountlist_.o nanosleep_.o obstack_.o path-concat_.o posixtm_.o \
quotearg_.o realloc_.o regex_.o rmdir_.o rpmatch_.o safe-read_.o \
same_.o save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o \
strdup_.o strftime_.o stripslash_.o strncasecmp_.o strndup_.o strstr_.o \
strtol_.o strtoul_.o strtoull_.o strtoumax_.o strverscmp_.o userspec_.o \
utime_.o version-etc_.o xgetcwd_.o xmalloc_.o xstrdup_.o xstrtol_.o \
xstrtoul_.o xstrtoumax_.o yesno_.o : $(ANSI2KNR)
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
@@ -482,7 +484,6 @@ distdir: $(DISTFILES)
fi; \
done
@AMDEP@include $(DEPDIR)/addext$U.Po
@AMDEP@include $(DEPDIR)/alloca.Po
@AMDEP@include $(DEPDIR)/argmatch$U.Po
@@ -525,6 +526,7 @@ distdir: $(DISTFILES)
@AMDEP@include $(DEPDIR)/mktime.Po
@AMDEP@include $(DEPDIR)/modechange$U.Po
@AMDEP@include $(DEPDIR)/mountlist.Po
@AMDEP@include $(DEPDIR)/nanosleep.Po
@AMDEP@include $(DEPDIR)/obstack.Po
@AMDEP@include $(DEPDIR)/path-concat$U.Po
@AMDEP@include $(DEPDIR)/posixtm$U.Po
@@ -657,11 +659,21 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
lstat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/lstat/g' $(srcdir)/xstat.in > $@-t
sed \
-e '/@IGNORE@/d' \
-e 's/@xstat@/lstat/g' \
-e '/_LSTAT_ONLY@/d' \
-e '/@BEGIN_STAT_ONLY@/,/@END_STAT_ONLY@/d' \
$(srcdir)/xstat.in > $@-t
mv $@-t $@
stat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
sed \
-e '/@IGNORE@/d' \
-e 's/@xstat@/stat/g' \
-e '/_STAT_ONLY@/d' \
-e '/@BEGIN_LSTAT_ONLY@/,/@END_LSTAT_ONLY@/d' \
$(srcdir)/xstat.in > $@-t
mv $@-t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
Copyright (C) 1990,91,92,93,94,95,96,97,98, 99 Free Software Foundation, Inc.
Copyright (C) 1990-2000 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@@ -150,12 +150,16 @@ error (status, errnum, message, va_alist)
++error_message_count;
if (errnum)
{
#if defined HAVE_STRERROR_R || defined _LIBC
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
# if HAVE_WORKING_STRERROR_R || _LIBC
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
# else
/* Don't use __strerror_r's return value because on some systems
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
__strerror_r (errnum, errbuf, sizeof errbuf);
fprintf (stderr, ": %s", errbuf);
# endif
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif
@@ -228,12 +232,16 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
++error_message_count;
if (errnum)
{
#if defined HAVE_STRERROR_R || defined _LIBC
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
# if HAVE_WORKING_STRERROR_R || _LIBC
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
# else
/* Don't use __strerror_r's return value because on some systems
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
__strerror_r (errnum, errbuf, sizeof errbuf);
fprintf (stderr, ": %s", errbuf);
# endif
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif

View File

@@ -1,5 +1,5 @@
/* euidaccess -- check if effective user id can access file
Copyright (C) 1990, 1991, 1995, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1995, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -66,6 +66,9 @@ gid_t getegid ();
#ifndef errno
extern int errno;
#endif
#ifndef __set_errno
# define __set_errno(val) errno = (val)
#endif
#if defined(EACCES) && !defined(EACCESS)
# define EACCESS EACCES
@@ -93,6 +96,7 @@ extern int errno;
#ifdef _LIBC
# define group_member __group_member
# define euidaccess __euidaccess
#else
@@ -102,15 +106,6 @@ static uid_t uid;
/* The user's real group id. */
static gid_t gid;
/* The user's effective user id. */
static uid_t euid;
/* The user's effective group id. */
static gid_t egid;
/* Nonzero if UID, GID, EUID, and EGID have valid values. */
static int have_ids = 0;
# if HAVE_GETGROUPS
int group_member ();
# else
@@ -119,6 +114,15 @@ int group_member ();
#endif
/* The user's effective user id. */
static uid_t euid;
/* The user's effective group id. */
static gid_t egid;
/* Nonzero if UID, GID, EUID, and EGID have valid values. */
static int have_ids;
/* Return 0 if the user has permission of type MODE on file PATH;
otherwise, return -1 and set `errno' to EACCESS.
@@ -133,8 +137,9 @@ euidaccess (const char *path, int mode)
int granted;
#ifdef _LIBC
uid_t uid = getuid (), euid = geteuid ();
gid_t gid = getgid (), egid = getegid ();
if (! __libc_enable_secure)
/* If we are not set-uid or set-gid, access does the same. */
return __access (path, mode);
#else
if (have_ids == 0)
{
@@ -144,11 +149,11 @@ euidaccess (const char *path, int mode)
euid = geteuid ();
egid = getegid ();
}
#endif
if (uid == euid && gid == egid)
/* If we are not set-uid or set-gid, access does the same. */
return access (path, mode);
#endif
if (stat (path, &stats))
return -1;
@@ -161,6 +166,16 @@ euidaccess (const char *path, int mode)
if (mode == F_OK)
return 0; /* The file exists. */
#ifdef _LIBC
/* Now we need the IDs. */
if (have_ids == 0)
{
have_ids = 1;
euid = __geteuid ();
egid = __getegid ();
}
#endif
/* The super-user can read and write any file, and execute any file
that anyone can execute. */
if (euid == 0 && ((mode & X_OK) == 0
@@ -175,6 +190,40 @@ euidaccess (const char *path, int mode)
granted = (stats.st_mode & mode);
if (granted == mode)
return 0;
errno = EACCESS;
__set_errno (EACCESS);
return -1;
}
#undef euidaccess
#ifdef weak_alias
weak_alias (__euidaccess, euidaccess)
#endif
#ifdef TEST
# include <stdio.h>
# include <errno.h>
# include "error.h"
char *program_name;
int
main (argc, argv)
int argc;
char **argv;
{
char *file;
int mode;
int err;
program_name = argv[0];
if (argc < 3)
abort ();
file = argv[1];
mode = atoi (argv[2]);
err = euidaccess (file, mode);
printf ("%d\n", err);
if (err != 0)
error (0, errno, "%s", file);
exit (0);
}
#endif

View File

@@ -82,7 +82,7 @@
#endif
#define EPOCH_YEAR 1970
#define TM_YEAR_ORIGIN 1900
#define TM_YEAR_BASE 1900
#define HOUR(x) ((x) * 60)
@@ -99,7 +99,7 @@ enum { MERam, MERpm, MER24 };
/* Information passed to and from the parser. */
struct parser_control
{
{
/* The input string remaining to be parsed. */
const char *input;
@@ -664,26 +664,32 @@ lookup_zone (struct parser_control const *pc, char const *name)
return 0;
}
/* Yield A - B, measured in seconds. */
#if ! HAVE_TM_GMTOFF
/* Yield the difference between *A and *B,
measured in seconds, ignoring leap seconds.
The body of this function is taken directly from the GNU C Library;
see src/strftime.c. */
static int
difftm (struct tm *a, struct tm *b)
tm_diff (struct tm const *a, struct tm const *b)
{
int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
int days = (
/* difference in day of year */
a->tm_yday - b->tm_yday
/* + intervening leap days */
+ ((ay >> 2) - (by >> 2))
- (ay / 100 - by / 100)
+ ((ay / 100 >> 2) - (by / 100 >> 2))
/* + difference in years * 365 */
+ (int) (ay - by) * 365
);
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid int overflow in leap day calculations,
but it's OK to assume that A and B are close to each other. */
int a4 = (a->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (a->tm_year & 3);
int b4 = (b->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (b->tm_year & 3);
int a100 = a4 / 25 - (a4 % 25 < 0);
int b100 = b4 / 25 - (b4 % 25 < 0);
int a400 = a100 >> 2;
int b400 = b100 >> 2;
int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
int years = a->tm_year - b->tm_year;
int days = (365 * years + intervening_leap_days
+ (a->tm_yday - b->tm_yday));
return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ (a->tm_min - b->tm_min))
+ (a->tm_sec - b->tm_sec));
}
#endif /* ! HAVE_TM_GMTOFF */
static table const *
lookup_word (struct parser_control const *pc, char *word)
@@ -848,7 +854,7 @@ get_date (const char *p, const time_t *now)
return -1;
pc.input = p;
pc.year = tmp->tm_year + TM_YEAR_ORIGIN;
pc.year = tmp->tm_year + TM_YEAR_BASE;
pc.month = tmp->tm_mon + 1;
pc.day = tmp->tm_mday;
pc.hour = tmp->tm_hour;
@@ -934,7 +940,7 @@ get_date (const char *p, const time_t *now)
|| (pc.local_zones_seen && 1 < pc.local_isdst))
return -1;
tm.tm_year = to_year (pc.year) - TM_YEAR_ORIGIN + pc.rel_year;
tm.tm_year = to_year (pc.year) - TM_YEAR_BASE + pc.rel_year;
tm.tm_mon = pc.month - 1 + pc.rel_month;
tm.tm_mday = pc.day + pc.rel_day;
if (pc.times_seen || (pc.rels_seen && ! pc.dates_seen && ! pc.days_seen))
@@ -981,7 +987,7 @@ get_date (const char *p, const time_t *now)
if (pc.zones_seen)
{
tm = tm0;
if (tm.tm_year <= EPOCH_YEAR - TM_YEAR_ORIGIN)
if (tm.tm_year <= EPOCH_YEAR - TM_YEAR_BASE)
{
tm.tm_mday++;
pc.time_zone += 24 * 60;
@@ -1009,12 +1015,16 @@ get_date (const char *p, const time_t *now)
if (pc.zones_seen)
{
int delta;
int delta = pc.time_zone * 60;
#ifdef HAVE_TM_GMTOFF
delta -= tm.tm_gmtoff;
#else
struct tm *gmt = gmtime (&Start);
if (! gmt)
return -1;
delta = pc.time_zone * 60 + difftm (gmt, &tm);
if ((Start - delta < Start) != (delta < 0))
delta -= tm_diff (&tm, gmt);
#endif
if ((Start < Start - delta) != (delta < 0))
return -1; /* time_t overflow */
Start -= delta;
}

View File

@@ -308,7 +308,7 @@ make_path (const char *argpath,
if (newly_created_dir)
{
if (verbose_fmt_string)
fprintf (stderr, verbose_fmt_string, dirpath);
error (0, 0, verbose_fmt_string, dirpath);
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)

View File

@@ -1,5 +1,5 @@
/* Case-insensitive buffer comparator.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,9 +15,9 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Jim Meyering (meyering@na-net.ornl.gov) */
/* Written by Jim Meyering. */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
@@ -25,16 +25,16 @@
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
# define IN_CTYPE_DOMAIN(Char) 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
# define IN_CTYPE_DOMAIN(Char) isascii(Char)
#endif
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
#define ISLOWER(Char) (IN_CTYPE_DOMAIN (Char) && islower (Char))
#if _LIBC || STDC_HEADERS
# define TOUPPER(c) toupper (c)
# define TOUPPER(Char) toupper (Char)
#else
# define TOUPPER(c) (ISLOWER (c) ? toupper (c) : (c))
# define TOUPPER(Char) (ISLOWER (Char) ? toupper (Char) : (Char))
#endif
#include "memcasecmp.h"
@@ -44,14 +44,11 @@
join -i works with sort -f. */
int
memcasecmp (vs1, vs2, n)
const void *vs1;
const void *vs2;
size_t n;
memcasecmp (const void *vs1, const void *vs2, size_t n)
{
unsigned int i;
unsigned char *s1 = (unsigned char *) vs1;
unsigned char *s2 = (unsigned char *) vs2;
unsigned char const *s1 = (unsigned char const *) vs1;
unsigned char const *s2 = (unsigned char const *) vs2;
for (i = 0; i < n; i++)
{
unsigned char u1 = *s1++;

102
lib/nanosleep.c Normal file
View File

@@ -0,0 +1,102 @@
/* Provide a replacement for the POSIX nanosleep function.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
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 */
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "nanosleep.h"
static int suspended;
int first_call = 1;
/* Handle SIGCONT. */
static void
sighandler (int sig)
{
suspended = 1;
}
/* FIXME: comment */
static void
my_usleep (const struct timespec *ts_delay)
{
struct timeval tv_delay;
tv_delay.tv_sec = ts_delay->tv_sec;
tv_delay.tv_usec = ts_delay->tv_nsec / 1000;
select (0, (void *) 0, (void *) 0, (void *) 0, &tv_delay);
}
/* FIXME: comment */
int
nanosleep (const struct timespec *requested_delay,
struct timespec *remaining_delay)
{
#ifdef SA_INTERRUPT
struct sigaction oldact, newact;
#endif
suspended = 0;
/* set up sig handler */
if (first_call)
{
#ifdef SA_INTERRUPT
newact.sa_handler = sighandler;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
sigaction (SIGCONT, NULL, &oldact);
if (oldact.sa_handler != SIG_IGN)
sigaction (SIGCONT, &newact, NULL);
#else
if (signal (SIGCONT, SIG_IGN) != SIG_IGN)
signal (SIGCONT, sighandler);
#endif
first_call = 0;
}
my_usleep (requested_delay);
if (suspended)
{
/* Calculate time remaining. */
/* FIXME: the code in sleep doesn't use this, so there's no
rush to implement it. */
errno = EINTR;
}
/* FIXME: Restore sig handler? */
return suspended;
}

57
lib/nanosleep.h Normal file
View File

@@ -0,0 +1,57 @@
/* Copyright (C) 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if ! defined NANOSLEEP_H
# define NANOSLEEP_H
# if 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
# include <sys/types.h>
# if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
# endif
# if ! HAVE_STRUCT_TIMESPEC
/* Some systems don't define this struct, e.g., AIX 4.1, Ultrix 4.3. */
struct timespec
{
time_t tv_sec;
long tv_nsec;
};
# endif
int
nanosleep PARAMS ((const struct timespec *requested_delay,
struct timespec *remaining_delay));
#endif

View File

@@ -1,3 +1,22 @@
/* Determine whether two file names refer to the same file.
Copyright (C) 1997-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#if HAVE_CONFIG_H
# include <config.h>
#endif

View File

@@ -1,3 +1,20 @@
/* Determine whether two file names refer to the same file.
Copyright (C) 1997-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef SAME_H_
# define SAME_H_ 1

View File

@@ -1,5 +1,5 @@
/* savedir.c -- save the list of files in a directory in a string
Copyright (C) 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -87,6 +87,10 @@ savedir (const char *dir, off_t name_size)
if (dirp == NULL)
return NULL;
/* Be sure name_size is at least `1' so there's room for
the final NUL byte. */
name_size += !name_size;
name_space = (char *) malloc (name_size);
if (name_space == NULL)
{

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 2000 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -16,15 +16,13 @@
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
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Find the first ocurrence in S of any character in ACCEPT. */
char *
strpbrk (s, accept)
register const char *s;
register const char *accept;
strpbrk (const char *s, const char *accept)
{
while (*s != '\0')
{

View File

@@ -4,7 +4,7 @@
/* Work around the bug in some systems whereby @xstat@ succeeds when
given the zero-length file name argument. The @xstat@ from SunOS4.1.4
has this bug.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1997-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,58 @@
#ifndef errno
extern int errno;
#endif
@BEGIN_LSTAT_ONLY@
#ifdef STAT_MACROS_BROKEN
# undef S_ISLNK
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif
char *xmalloc ();
/* lstat works different on Linux and Solaris systems. POSIX (see
`pathname resolution' in the glossary) requires that programs like `ls'
take into consideration the fact that FILE has a trailing slash when
FILE is a symbolic link. On Linux systems, the lstat function already
has the desired semantics (in treating `lstat("symlink/",sbuf)' just like
`lstat("symlink/.",sbuf)', but on Solaris it does not.
If FILE has a trailing slash and specifies a symbolic link,
then append a `.' to FILE and call lstat a second time. */
static int
slash_aware_lstat (const char *file, struct stat *sbuf)
{
size_t len;
char *new_file;
int lstat_result = lstat (file, sbuf);
if (lstat_result != 0 || !S_ISLNK (sbuf->st_mode))
return lstat_result;
len = strlen (file);
if (file[len - 1] != '/')
return lstat_result;
/* FILE refers to a symbolic link and the name ends with a slash.
Append a `.' to FILE and repeat the lstat call. */
/* Add one for the `.' we might have to append, and one more
for the trailing NUL. */
new_file = xmalloc (len + 1 + 1);
memcpy (new_file, file, len);
new_file[len] = '.';
new_file[len + 1] = 0;
lstat_result = lstat (new_file, sbuf);
free (new_file);
return lstat_result;
}
@END_LSTAT_ONLY@
/* This is a wrapper for @xstat@(2).
If FILE is the empty string, fail with errno == ENOENT.
@@ -38,6 +90,11 @@ extern int errno;
This works around the bug in some systems whereby @xstat@ succeeds when
given the zero-length file name argument. The @xstat@ from SunOS4.1.4
has this bug. */
@BEGIN_LSTAT_ONLY@
/* This function also provides a version of lstat with consistent semantics
when FILE specifies a symbolic link and has a trailing slash. */
@END_LSTAT_ONLY@
int
rpl_@xstat@ (const char *file, struct stat *sbuf)
@@ -48,5 +105,10 @@ rpl_@xstat@ (const char *file, struct stat *sbuf)
return -1;
}
return @xstat@ (file, sbuf);
@BEGIN_LSTAT_ONLY@
return slash_aware_lstat (file, sbuf);
@END_LSTAT_ONLY@
@BEGIN_STAT_ONLY@
return stat (file, sbuf);
@END_STAT_ONLY@
}

View File

@@ -1,5 +1,5 @@
/* xstrtod.c - error-checking interface to strtod
Copyright (C) 1996, 1999 Free Software Foundation, Inc.
Copyright (C) 1996, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,6 +32,11 @@ double strtod ();
#include <limits.h>
#include "xstrtod.h"
/* Tell the compiler that non-default rounding modes are used. */
#if 199901 <= __STDC_VERSION__
#pragma STDC FENV_ACCESS ON
#endif
/* An interface to strtod that encapsulates all the error checking
one should usually perform. Like strtod, but upon successful
conversion put the result in *RESULT and return zero. Return

View File

@@ -1,5 +1,5 @@
/* A more useful interface to strtol.
Copyright 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1998-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,3 +1,62 @@
2000-01-08 Jim Meyering <meyering@ascend.com>
* strerror_r.m4 (jm_FUNC_STRERROR_R): New file/macro.
* jm-macros.m4 (jm_FUNC_STRERROR_R): Require it.
2000-01-04 Jim Meyering <meyering@ascend.com>
* d-type.m4 (jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Rename from
jm_STRUCT_DIRENT_D_TYPE.
* d-ino.m4: (jm_CHECK_TYPE_STRUCT_DIRENT_D_INO): Rename from
jm_STRUCT_DIRENT_D_INO.
* utimbuf.m4 (jm_CHECK_TYPE_STRUCT_UTIMBUF): Rename from
jm_STRUCT_UTIMBUF.
* jm-macros.m4: Reflect s/jm_STRUCT_/jm_CHECK_TYPE_STRUCT_/ renamings.
* utime.m4: Likewise.
* timespec.m4 (jm_CHECK_TYPE_STRUCT_TIMESPEC): New file, macro.
* jm-macros.m4 (jm_CHECK_TYPE_STRUCT_TIMESPEC): Require it.
2000-01-03 Paul Eggert <eggert@twinsun.com>
* nanosleep.m4 (jm_FUNC_NANOSLEEP): Search for nanosleep in -lrt
(for Solaris 7) and in -lposix4 (for Solaris 2.5.1).
2000-01-02 Jim Meyering <meyering@ascend.com>
* search-libs.m4: Escape `$' in $3 of dnl comment. I no longer
remember if this is necessary.
1999-12-26 Jim Meyering <meyering@ascend.com>
* jm-macros.m4: Use it here.
* nanosleep.m4 (jm_FUNC_NANOSLEEP): New file/macro.
1999-12-23 Jim Meyering <meyering@ascend.com>
* jm-macros.m4: Check for clock_gettime (moved from
fileutils/configure.in)
Check for gettimeofday.
1999-12-20 Jim Meyering <meyering@ascend.com>
* strftime.m4: Remove kludge, now that I'm using the fixed
autoconf-2.14a-1999-12-20.
1999-12-19 Jim Meyering <meyering@ascend.com>
* lstat-slash.m4: New file.
* jm-macros.m4: Use the new macro:
jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK.
1999-12-07 Jim Meyering <meyering@ascend.com>
* perl.m4: Require that File::Compare be available, too.
Too many systems seem to lack it.
* strftime.m4: Add checks for most of the cpp macros tested in
GNU's strftime.c. Prompted by a patch from Paul Eggert.
1999-11-18 Paul Eggert <eggert@twinsun.com>
* m4/largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around a

View File

@@ -31,9 +31,11 @@ lchown.m4 \
lcmessage.m4 \
link-follow.m4 \
ls-mntd-fs.m4 \
lstat-slash.m4 \
lstat.m4 \
malloc.m4 \
memcmp.m4 \
nanosleep.m4 \
perl.m4 \
prereq.m4 \
progtest.m4 \
@@ -45,7 +47,9 @@ search-libs.m4 \
st_dm_mode.m4 \
st_mtim.m4 \
stat.m4 \
strerror_r.m4 \
strftime.m4 \
timespec.m4 \
uintmax_t.m4 \
ulonglong.m4 \
uptime.m4 \

View File

@@ -131,9 +131,11 @@ lchown.m4 \
lcmessage.m4 \
link-follow.m4 \
ls-mntd-fs.m4 \
lstat-slash.m4 \
lstat.m4 \
malloc.m4 \
memcmp.m4 \
nanosleep.m4 \
perl.m4 \
prereq.m4 \
progtest.m4 \
@@ -145,7 +147,9 @@ search-libs.m4 \
st_dm_mode.m4 \
st_mtim.m4 \
stat.m4 \
strerror_r.m4 \
strftime.m4 \
timespec.m4 \
uintmax_t.m4 \
ulonglong.m4 \
uptime.m4 \
@@ -191,7 +195,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:

View File

@@ -1,11 +1,11 @@
#serial 2
#serial 3
dnl From Jim Meyering.
dnl
dnl Check whether struct dirent has a member named d_ino.
dnl
AC_DEFUN(jm_STRUCT_DIRENT_D_INO,
AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_INO,
[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_CACHE_CHECK([for d_ino member in directory struct],
jm_cv_struct_dirent_d_ino,

View File

@@ -1,11 +1,11 @@
#serial 2
#serial 3
dnl From Jim Meyering.
dnl
dnl Check whether struct dirent has a member named d_type.
dnl
AC_DEFUN(jm_STRUCT_DIRENT_D_TYPE,
AC_DEFUN(jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE,
[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_CACHE_CHECK([for d_type member in directory struct],
jm_cv_struct_dirent_d_type,

View File

@@ -1,4 +1,4 @@
#serial 10
#serial 12
dnl Misc type-related macros for fileutils, sh-utils, textutils.
@@ -19,9 +19,9 @@ AC_DEFUN(jm_MACROS,
AC_REQUIRE([jm_BISON])
AC_REQUIRE([jm_ASSERT])
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
AC_REQUIRE([jm_STRUCT_UTIMBUF])
AC_REQUIRE([jm_STRUCT_DIRENT_D_TYPE])
AC_REQUIRE([jm_STRUCT_DIRENT_D_INO])
AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])
AC_REQUIRE([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO])
AC_REQUIRE([jm_CHECK_DECLS])
AC_REQUIRE([jm_PREREQ])
@@ -30,9 +30,12 @@ AC_DEFUN(jm_MACROS,
AC_REQUIRE([jm_FUNC_CHOWN])
AC_REQUIRE([jm_FUNC_MKTIME])
AC_REQUIRE([jm_FUNC_LSTAT])
AC_REQUIRE([jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
AC_REQUIRE([jm_FUNC_STAT])
AC_REQUIRE([jm_FUNC_REALLOC])
AC_REQUIRE([jm_FUNC_MALLOC])
AC_REQUIRE([jm_FUNC_STRERROR_R])
AC_REQUIRE([jm_FUNC_NANOSLEEP])
AC_REQUIRE([jm_FUNC_READDIR])
AC_REQUIRE([jm_FUNC_MEMCMP])
AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
@@ -62,6 +65,13 @@ AC_DEFUN(jm_MACROS,
dnl ...: warning: AC_TRY_RUN called without default to allow cross compiling
AC_FUNC_SETVBUF_REVERSED
# used by sleep and shred
# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
AC_CHECK_FUNCS(clock_gettime)
AC_CHECK_FUNCS(gettimeofday)
AM_FUNC_GETLINE
if test $am_cv_func_working_getline != yes; then
AC_CHECK_FUNCS(getdelim)
@@ -88,6 +98,7 @@ AC_DEFUN(jm_CHECK_ALL_TYPES,
AC_HEADER_STAT
AC_STRUCT_ST_MTIM_NSEC
AC_STRUCT_ST_DM_MODE
AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
AC_TYPE_GETGROUPS
AC_TYPE_MODE_T

57
m4/lstat-slash.m4 Normal file
View File

@@ -0,0 +1,57 @@
#serial 1
dnl From Jim Meyering.
dnl FIXME: describe
AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
[
AC_CACHE_CHECK(
[whether lstat dereferences a symlink specified with a trailing slash],
jm_cv_func_lstat_dereferences_slashed_symlink,
[
rm -f conftest.sym conftest.file
: > conftest.file
if ln -s conftest.file conftest.sym; then
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/stat.h>
int
main ()
{
struct stat sbuf;
/* Linux will dereference the symlink and fail.
That is better in the sense that it means we will not
have to compile and use the lstat wrapper. */
exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
}
],
jm_cv_func_lstat_dereferences_slashed_symlink=yes,
jm_cv_func_lstat_dereferences_slashed_symlink=no,
dnl When crosscompiling, be pessimistic so we will end up using the
dnl replacement version of lstat that checkes for trailing slashes
dnl and calls lstat a second time when necessary.
jm_cv_func_lstat_dereferences_slashed_symlink=no
)
else
# If the `ln -s' command failed, then we probably don't even
# have an lstat function.
jm_cv_func_lstat_dereferences_slashed_symlink=no
fi
])
test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \
&& zero_one=1 \
|| zero_one=0
AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one,
[Define if lstat dereferences a symlink specified with a trailing slash])
if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; then
AC_SUBST(LIBOBJS)
# Append lstat.o if it's not already in $LIBOBJS.
case "$LIBOBJS" in
*lstat.$ac_objext*) ;;
*) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
esac
fi
])

39
m4/nanosleep.m4 Normal file
View File

@@ -0,0 +1,39 @@
#serial 2
dnl From Jim Meyering.
dnl Check for the nanosleep function.
dnl If not found, use the supplied replacement.
dnl
AC_DEFUN(jm_FUNC_NANOSLEEP,
[
# Solaris 2.5.1 needs -lposix4 to get the nanosleep function.
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
AC_SEARCH_LIBS(nanosleep, [rt posix4])
AC_CACHE_CHECK([whether nanosleep works],
jm_cv_func_nanosleep_works,
[AC_TRY_RUN([
# include <time.h>
int
main ()
{
struct timespec ts_sleep, ts_remaining;
ts_sleep.tv_sec = 0;
ts_sleep.tv_nsec = 1;
exit (nanosleep (&ts_sleep, &ts_remaining) == 0 ? 0 : 1);
}
],
jm_cv_func_nanosleep_works=yes,
jm_cv_func_nanosleep_works=no,
dnl When crosscompiling, assume the worst.
jm_cv_func_nanosleep_works=yes)
])
if test $jm_cv_func_nanosleep_works = no; then
AC_SUBST(LIBOBJS)
LIBOBJS="$LIBOBJS nanosleep.$ac_objext"
AC_DEFINE_UNQUOTED(nanosleep, gnu_nanosleep,
[Define to gnu_nanosleep if the replacement function should be used.])
fi
])

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
dnl From Jim Meyering.
dnl Find a new-enough version of Perl.
@@ -24,7 +24,7 @@ AC_DEFUN(jm_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
if ( $perl -e 'require 5.003; use File::Compare' ) > /dev/null 2>&1; then
PERL=$perl
found=yes
break
@@ -33,7 +33,9 @@ AC_DEFUN(jm_PERL,
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.] )
*** You don't seem to have perl5.003 or newer installed, or you lack
*** a usable version of the Perl File::Compare module. As a result,
*** you may be unable to run a few tests or to regenerate certain
*** files if you modify the sources from which they are derived.
] )
])

View File

@@ -1,8 +1,8 @@
#serial 2
#serial 3
dnl A replacement for autoconf's macro by the same name. This version
dnl uses `ac_lib' rather than `i' for the loop variable, but more importantly
dnl moves the ACTION-IF-FOUND ($3) into the inner `if'-block so that it is
dnl moves the ACTION-IF-FOUND ([$]3) into the inner `if'-block so that it is
dnl run only if one of the listed libraries ends up being used (and not in
dnl the `none required' case.
dnl I hope it's only temporary while we wait for that version to be fixed.

40
m4/strerror_r.m4 Normal file
View File

@@ -0,0 +1,40 @@
#serial 1
dnl From Jim Meyering.
dnl Determine whether the strerror_r implementation is one of
dnl the broken ones that returns `int' rather than `char*'.
dnl Actually, this tests only whether it returns a scalar
dnl or an array, but that should be enough.
dnl On at least DEC UNIX 4.0[A-D], strerror_r returns `int'.
dnl This is used by lib/error.c.
AC_DEFUN(jm_FUNC_STRERROR_R,
[
# Check strerror_r
AC_CHECK_FUNCS([strerror_r])
if test $ac_cv_func_strerror_r = yes; then
AC_CHECK_HEADERS(string.h)
AC_CACHE_CHECK([for working strerror_r],
jm_cv_func_working_strerror_r,
[
AC_TRY_COMPILE(
[
# include <stdio.h>
# if HAVE_STRING_H
# include <string.h>
# endif
],
[
int buf; /* avoiding square brackets makes this easier */
char x = *strerror_r (0, buf, sizeof buf);
],
jm_cv_func_working_strerror_r=yes,
jm_cv_func_working_strerror_r=no
)
if test $jm_cv_func_working_strerror_r = yes; then
AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
[Define to 1 if strerror_r returns a string.])
fi
])
fi
])

View File

@@ -1,14 +1,25 @@
#serial 6
#serial 8
dnl This macro is intended to be used solely in this file.
dnl These are the prerequisite macros for GNU's strftime.c replacement.
dnl FIXME: the list is far from complete
AC_DEFUN(_jm_STRFTIME_PREREQS,
[
dnl strftime.c uses localtime_r if it exists. Check for it.
AC_CHECK_FUNCS(localtime_r)
dnl FIXME: add tests for everything in strftime.c: e.g., HAVE_BCOPY,
dnl HAVE_TZNAME, HAVE_TZSET, HAVE_TM_ZONE, etc.
AC_CHECK_HEADERS(limits.h)
AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
# This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
AC_STRUCT_TIMEZONE
AC_CHECK_FUNCS(mblen mbrlen)
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
[AC_DEFINE(HAVE_TM_GMTOFF, 1,
[Define if struct tm has the tm_gmtoff member.])],
,
[#include <time.h>])
])
dnl Determine if the strftime function has all the features of the GNU one.

23
m4/timespec.m4 Normal file
View File

@@ -0,0 +1,23 @@
#serial 1
dnl From Jim Meyering
dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared in time.h.
AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
[
AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
[AC_TRY_COMPILE(
[
#include <time.h>
],
[static struct timespec x; x.tv_sec = x.tv_nsec;],
fu_cv_sys_struct_timespec=yes,
fu_cv_sys_struct_timespec=no)
])
if test $fu_cv_sys_struct_timespec = yes; then
AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
[Define if struct timespec is declared in <time.h>. ])
fi
])

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
dnl From Jim Meyering
@@ -6,7 +6,7 @@ dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
dnl usually in <utime.h>.
dnl Some systems have utime.h but don't declare the struct anywhere.
AC_DEFUN(jm_STRUCT_UTIMBUF,
AC_DEFUN(jm_CHECK_TYPE_STRUCT_UTIMBUF,
[
AC_CHECK_HEADERS(utime.h)
AC_REQUIRE([AC_HEADER_TIME])

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
dnl From Jim Meyering
dnl Replace the utime function on systems that need it.
@@ -8,7 +8,7 @@ dnl FIXME
AC_DEFUN(jm_FUNC_UTIME,
[
AC_CHECK_HEADERS(utime.h)
AC_REQUIRE([jm_STRUCT_UTIMBUF])
AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
AC_REQUIRE([AC_FUNC_UTIME_NULL])
if test $ac_cv_func_utime_null = no; then

View File

@@ -1,4 +1,4 @@
#!/sw/tools/bin/perl -w
#!/usr/bin/perl -w
# Generate a short man page from --help and --version output.
# Copyright © 1997, 98, 99 Free Software Foundation, Inc.
@@ -27,7 +27,7 @@ use Text::Tabs qw(expand);
use POSIX qw(strftime setlocale LC_TIME);
my $this_program = 'help2man';
my $this_version = '1.019';
my $this_version = '1.020';
my $version_info = <<EOT;
$this_program $this_version
@@ -239,7 +239,8 @@ if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| *or: +\S).*)*)//m)
for (@syn)
{
$synopsis .= ".br\n" if $synopsis;
s/(\S+) *//;
s!^\S*/!!;
s/^(\S+) *//;
$synopsis .= ".B $1\n";
s/\s+$//;
s/(([][]|\.\.+)+)/\\fR$1\\fI/g;

View File

@@ -1,5 +1,266 @@
2000-01-09 Jim Meyering <meyering@lucent.com>
* Version 4.0n.
* src/ln.c (do_link): Produce the same sort of one-line output for
`--backup --verbose' as cp, mv, install. Before this, the backup
file name wasn't printed at all.
This affects cp, install, and mv.
* src/copy.c (copy_internal): When making backup files in verbose
mode, print the backup file name on the same line as the rest of the
information, e.g., `a -> b (backup: b.~13~)' rather than on a separate
line by itself. Suggestion from Karl Berry.
2000-01-08 Jim Meyering <meyering@ascend.com>
* lib/error.c (error): Use __strerror_r's return value only if
HAVE_WORKING_STRERROR_R.
(error_at_line): Likewise.
* Makefile.maint (null_AM_MAKEFLAGS): Define.
(my-distcheck): Use it to avoid distributing out of date files
whose derivation would require a maintainer tool.
2000-01-07 Jim Meyering <meyering@ascend.com>
* lib/euidaccess.c: Sync with the GNU C library.
* tests/dir/Makefile.am: (TESTS_ENVIRONMENT): Add `pwd`/ prefix
to exported PATH value (though not strictly necessary, here).
* tests/dd/Makefile.am: Likewise.
* tests/dircolors/Makefile.am: Likewise.
* tests/rm/Makefile.am: Likewise.
* tests/rmdir/Makefile.am: Likewise.
* tests/shred/Makefile.am: Likewise.
* tests/touch/Makefile.am: Likewise.
* tests/shred/Makefile.am: Likewise.
2000-01-06 Jim Meyering <meyering@ascend.com>
* man/help2man: Import version 1.020.
* lib/strftime.c: Sync with the GNU C Library.
2000-01-06 Paul Eggert <eggert@set.twinsun.com>
* tar/lib/getdate.y: Sync tm_diff with the GNU C Library.
(TM_YEAR_BASE): Renamed from TM_YEAR_ORIGIN. All uses changed.
(tm_diff): Renamed from difftm. All uses changed.
Replace body with that taken from GNU C Library 2.1.3pre1.
(get_date): Prefer tm_gmtoff to tm_diff if available.
2000-01-04 Paul Eggert <eggert@twinsun.com>
* savedir.c (savedir): Don't store past the end of an array if
name_size is zero and the directory is empty.
* Makefile.maint (PREV_VERSION): Tweak so it handles e.g., 2.0a -> 2.0.
(alpha): Create xdelta diffs.
2000-01-02 Jim Meyering <meyering@ascend.com>
* Version 4.0m.
* src/mv.c: New option: --strip-trailing-slashes.
1999-11-18 Paul Eggert <eggert@twinsun.com>
* lib/strftime.c (my_strftime): Some old compilers object to
'\a', so don't bother optimizing for it.
2000-01-01 Paul Eggert <eggert@twinsun.com>
Fix bug: `df PATH' sometimes misbehaves when there is an
inaccessible mount point unrelated to PATH.
* configure.in (AC_CHECK_FUNCS): Add realpath, resolvepath.
* src/df.c (#pragma alloca): Add if _AIX is defined.
(path-concat.h): Include.
(show_point): If HAVE_REALPATH or HAVE_RESOLVEPATH is defined,
find the real absolute path for PATH, and use that to find the
mount point.
(show_point): Prefer non-dummy entries in shortcuts, too.
Disable bogus mount dirs instead of restatting them each time.
1999-12-30 Jim Meyering <meyering@ascend.com>
1999-12-17 Kalle Olavi Niemitalo <tosi@stekt.oulu.fi>
* src/rmdir.c (remove_parents, main): Don't pass errno to error
when printing "removing directory" message. Failure of rmdir is
handled elsewhere.
1999-12-23 Jim Meyering <meyering@ascend.com>
* configure.in: Remove clock_gettime tests.
Now they're in m4/jm-macros.m4.
* src/ln.c (usage): Correct typos.
List new --target-directory=... usage.
Reported by Göran Uddeborg
* src/mv.c (usage): List new --target-directory=... usage.
1999-12-22 Jim Meyering <meyering@ascend.com>
* lib/getdate.y (get_date): Fix typo in time_t overflow test.
From Michael Stone.
1999-12-21 Andreas Schwab <schwab@suse.de>
* tests/shred/remove: Use $file, not $tmp/file. Exit 77 if run as
root.
1999-12-20 Paul Eggert <eggert@twinsun.com>
* src/df.c (ceil_percent): Remove.
(show_dev): Avoid overflow problems when calculating percent.
Do not display negative percents.
1999-12-19 Jim Meyering <meyering@ascend.com>
* Version 4.0l.
* doc/fileutils.texi: Clarify and combine descriptions of -c and of
--time=ctime.
Likewise for -u/--time=atime.
* src/ls.c [! LSTAT_FOLLOWS_SLASHED_SYMLINK]: Use lstat wrapper.
[Notice the new configure-time test in m4/lstat-slash.m4. ]
(main): Back out change from 1999-02-19 that made ls remove
trailing slashes from command line arguments to accommodate early
versions of Linux. Now, `ls symlink-to-dir/' acts like
`ls symlink-to-dir/.' thus following the symbolic link, as POSIX says
it should. Suggestion from Bruno Haible and Andreas Schwab.
* lib/xstat.in (slash_aware_lstat): New function.
(rpl_@xstat@): Use it.
* lib/Makefile.am (lstat.c): Adapt rule to handle new parts of xstat.in.
(lstat.c): Likewise.
Make sure ls does the right thing with symlinks and trailing slashes.
* tests/ls/Makefile.am (TESTS): Add symlink-slash.
* tests/ls/symlink-slash: New test, for above-fixed bug.
1999-12-18 Jim Meyering <meyering@ascend.com>
* src/shred.c (wipename): When repeatedly renaming a file, making the
name shorter and shorter, skip to the next shorter length length if a
rename fails (e.g. due to permission denied). Otherwise, this loop
would iterate for so long that shred would appear to be stuck in an
infinite loop for any but the shortest file names.
Reported by Joe Orton.
* configure.in (AC_OUTPUT): Add tests/shred/Makefile.
* tests/Makefile.am (SUBDIRS): Add shred.
* tests/shred: New directory
* tests/shred/remove: New file. Tests for the above-fixed bug.
1999-12-13 Jim Meyering <meyering@ascend.com>
* lib/makepath.c (make_path): Consistently use `error' to output
the verbose, `created directory ...' messages.
Reported by Bernhard Rosenkraenzer.
1999-12-12 Jim Meyering <meyering@ascend.com>
Move 120+ lines of stat.h-related macros from system.h (not shared)
to sys2.h, which is shared between fileutils, sh-utils, textutils.
* src/system.h: Move them from here...
* src/sys2.h: ... to here.
* src/system.h (S_IRUSR, S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH): Define
if not defined. This was necessary on a NeXT Turbostation running
Mach 3.3. Reported by Nelson H. F. Beebe.
* src/ls.c (decode_switches): If -c or -u is specified and not -l
(or any other option that implies -l), and no sort-type was specified,
then sort by the ctime (-c) or atime (-u). Part of this change reverts
the 1998-01-10 delta.
(usage): Update to reflect this change.
Reported by Paul Slootman via Michael Stone.
1999-12-09 Jim Meyering <meyering@ascend.com>
* src/df.c (BLOCK_SIZE_OPTION, SYNC_OPTION, NO_SYNC_OPTION): Define
these and use them instead of `CHAR_MAX + n'.
* src/du.c (BLOCK_SIZE_OPTION, EXCLUDE_OPTION, MAX_DEPTH_OPTION):
Likewise.
* src/touch.c (TIME_OPTION): Likewise.
* src/rmdir.c (IGNORE_FAIL_ON_NON_EMPTY_OPTION): Likewise.
* tests/ls/time-1: Test more of the framework (touch's -a and -m
options) before running the actual ls test.
1999-12-07 Jim Meyering <meyering@ascend.com>
* tests/cp/cp-mv-backup: Use 1>&2 rather than `1<&-'.
Suggestion from Volker Borchert.
1999-12-05 Jim Meyering <meyering@ascend.com>
* Makefile.maint: Remove ftp.enst.fr.
1999-12-04 Jim Meyering <meyering@ascend.com>
* Version 4.0k.
* tests/mv/into-self-2: Adapt to reflect this change in behavior.
Make sure the VERSION_CONTROL envvar is not set.
Run diff if comparison fails.
* src/copy.c (copy_internal): In move mode, if the rename attempt
fails, then unlink any existing destination file. This makes a
cross-device `mv' more consistent with the intra-device behavior.
This change is required by POSIX to make a cross-device move act with
semantics similar to those of the rename syscall. For example now
`mv' can move a file onto a symlink to itself when that symlink
is on a separate partition. With fileutils-4.0j, it would fail with
a diagnostic saying they were the same file.
Reported by Bruno Haible.
* tests/mv/to-symlink: New file. Adds test for the above.
* tests/mv/Makefile.am (TESTS): Add to-symlink.
* tests/cp/cp-mv-backup (trap): Be careful to close $actual before
removing the containing directory. Otherwise, on some systems rmdir
fails to remove the containing directory.
* tests/ls/time-1: List --full-time dates upon failure.
1999-12-02 Andreas Schwab <schwab@suse.de>
* src/ls.c (check_symlink_color): New variable.
(main): Set it if we need to check for dangling symlinks when
displaying colors.
(gobble_file): Check check_symlink_color instead of print_with_color.
1999-11-30 Paul Eggert <eggert@twinsun.com>
* src/ls.c (usage): Shorten help for --show-control-chars.
1999-11-30 Jim Meyering <meyering@ascend.com>
Give the right diagnostic when failing to create a file in an
unwritable directory.
* src/touch.c (touch): Record errno upon failed errno and use that
saved value if a subsequent fstat, stat or utime call fails.
Reported by Wichert Akkerman via Michael Stone.
1999-11-27 Jim Meyering <meyering@ascend.com>
Clean up test scripts.
* tests/mv/setup: Don't set/use DF or MKDIR. Use df and mkdir instead.
* tests/mv/mv-special-1: Likewise for these: LS MV MKDIR MKNOD RM TOUCH
* tests/mv/backup-is-src: Likewise for RM and MV.
* tests/mv/hard-link-1: Likewise.
* tests/mv/into-self: Likewise.
* tests/mv/into-self-3: Likewise.
Add test for 1999-05-23 change to src/copy.c (copy_internal).
* tests/mv/partition-perm: New file.
* tests/mv/Makefile.am (TESTS): Add partition-perm.
* Version 4.0j.
1999-11-22 Paul Eggert <eggert@twinsun.com>
@@ -121,7 +382,7 @@
* tests/ln/misc: Use --b=simple, not the now-deprecated `-V simple'.
* tests/ln/backup-1: Likewise.
* configure.in (AC_OUTPUT): Add tests/dd/Makefile.
* configure.in (AC_OUTPUT): Add tests/rmdir/Makefile.
* tests/Makefile.am (SUBDIRS): Add rmdir.
* tests/rmdir: New directory
* tests/rmdir/ignore: New file.
@@ -591,7 +852,6 @@
1999-05-23 Jim Meyering <meyering@ascend.com>
FIXME: add a test for this
* src/copy.c (copy_internal): Don't apply the umask in move_mode.
Otherwise, `mv' would not preserve the permissions when copying
between partitions. Reported by David Godfrey

View File

@@ -1,4 +1,28 @@
Changes in release 4.1:
[4.0n]
* cp, install, ln, and mv: when making backup files in verbose mode, these
commands now print the backup file name on the same line as the rest of the
information, e.g., `a -> b (backup: b.~13~)' rather than on a separate line
as all but ln used to do. ln didn't output the backup file name at all.
[4.0m]
* mv accepts new option: --strip-trailing-slashes (soon, many other
programs will, too)
* df no longer hangs when there is inaccessible mount point unrelated to PATH
* rmdir --verbose no longer prints extra, bogus diagnosic upon failure
* fix df bug that made it print bogus values in the `Use%' column.
* touch -d once again parses dates with `hh:mm ZONE' time zone info.
[4.0l]
* ls -l honors a trailing slash on a symlink argument, per POSIX.
* shred no longer appears to infloop when asked to remove files in
unwritable directories
* `ls -ul' and `ls -uc' sort by name once again, as they should
[4.0k]
* mv may now be used to move a file onto a symlink to itself when that
symlink is on a separate partition. With fileutils-4.0j, it would
fail with a diagnostic saying they were the same file.
* touch would fail with the misleading diagnostic `no such file' when asked
to create a file in an unwritable directory. Now it says something like
`permission denied' or `read-only file system'.
[4.0j]
* mkdir may now be used to set special bits e.g., `mkdir -m o+t dir' works
* touch can now change the time(s) of a file you own even if you don't have

View File

@@ -1,3 +1,122 @@
2000-01-07 Jim Meyering <meyering@ascend.com>
* tests/basename/Makefile.am (TESTS_ENVIRONMENT): Add `pwd`/ prefix
to exported PATH value (though not strictly necessary, here).
* tests/factor/Makefile.am (TESTS_ENVIRONMENT): Likewise.
* tests/seq/Makefile.am (TESTS_ENVIRONMENT): Likewise.
* tests/stty/Makefile.am (TESTS_ENVIRONMENT): Likewise.
2000-01-06 Paul Eggert <eggert@set.twinsun.com>
* tar/lib/getdate.y: Sync tm_diff with the GNU C Library.
(TM_YEAR_BASE): Renamed from TM_YEAR_ORIGIN. All uses changed.
(tm_diff): Renamed from difftm. All uses changed.
Replace body with that taken from GNU C Library 2.1.3pre1.
(get_date): Prefer tm_gmtoff to tm_diff if available.
2000-01-05 Paul Eggert <eggert@twinsun.com>
Minor code cleanup.
* src/sleep.c (clock_get_realtime): Return argument, for convenience.
(main): Use this to simplify main sleep loop.
2000-01-05 Jim Meyering <meyering@ascend.com>
Some systems lack a definition of struct timespec (AIX, Ultrix)
Reported by Christian Krackowizer.
* lib/Makefile.am (noinst_HEADERS): Add nanosleep.h.
* lib/nanosleep.h: New file.
* lib/nanosleep.c: Include it.
Don't include time.h or sys/time.h here.
* src/sleep.c: Include it.
(AUTHORS): Add Paul Eggert.
2000-01-04 Jim Meyering <meyering@ascend.com>
* lib/nanosleep.c: Include both time.h and sys/time.h only
#if TIME_WITH_SYS_TIME.
2000-01-03 Paul Eggert <eggert@twinsun.com>
Fix some porting and rounding problems with the new `sleep' code.
* configure.in (AC_CHECK_HEADERS): Add fenv.h.
(FESETROUND_LIBM): New macro.
* lib/xstrtod.c: Add #pragma STDC FENV_ACCESS ON if C99.
* src/sleep.c: Likewise.
* src/Makefile.am (sleep_LDADD, sleep_DEPENDENCIES): New macros.
* src/sleep.c (<fenv.h>): Include if available.
(main): Always round floating-point interval calculations upwards,
as we must sleep for at least the specified time.
Do the right thing with NaNs.
(main): Sleep forever if the time calculations overflow.
(apply_suffix): Don't assert that *s <= TIME_T_MAX.
(clock_get_realtime): Fix typo; address was improperly taken.
2000-01-02 Jim Meyering <meyering@ascend.com>
* Version 2.0b.
* lib/Makefile.in: Regenerate.
* Version 2.0a.
1999-12-26 Jim Meyering <meyering@ascend.com>
* lib/nanosleep.c (nanosleep): New file.
1999-12-23 Jim Meyering <meyering@ascend.com>
* src/sleep.c (USE_CLOCK_GETTIME): Define.
[USE_CLOCK_GETTIME]: Include sys/time.h.
(timespec_subtract): New function.
(clock_get_realtime): New function.
(sighandler): Remove function.
(main): Reimplement again, using nanosleep and clock_gettime.
* configure.in: Remove check for gettimeofday.
Now it's in m4/jm-macros.m4
* man/Makefile.summ: Remove now-unused summaries.
1999-12-22 Jim Meyering <meyering@ascend.com>
* lib/getdate.y (get_date): Fix typo in time_t overflow test.
From Michael Stone.
* tests/date/Test.pm (regress-1): New test for the above.
1999-12-18 Jim Meyering <meyering@ascend.com>
* src/who.c (print_entry): Correct do_lookup test so that who
prints whatever host information it has, even without --lookup.
Reported by Bill Peters.
1999-12-12 Jim Meyering <meyering@ascend.com>
Move 120+ lines of stat.h-related macros from system.h (not shared)
to sys2.h, which is shared between fileutils, sh-utils, textutils.
* src/system.h: Move them from here...
* src/sys2.h: ... to here.
1999-11-27 Jim Meyering <meyering@ascend.com>
Rewrite to allow fractional seconds and to handle SIGCONT.
* src/sleep.c (main): Rewrite.
(sighandler): New function.
(apply_suffix): New function.
(timeval_subtract): New function.
Reported by Raul Miller.
* src/sleep.c (argdecode): Move definition to precede use.
Remove prototype.
(usage): Add elipses to show that sleep allows more than one argument.
1999-11-22 Jim Meyering <meyering@ascend.com>
* lib/Makefile.am (DISTCLEANFILES): Add lstat.c and stat.c.

View File

@@ -1,4 +1,14 @@
Changes in release 2.1
[2.0c]
* fix portability problems with nanosleep.c and with the new code in sleep.c
[2.0b]
* Regenerate lib/Makefile.in so that nanosleep.c is distributed.
[2.0a]
* sleep accepts floating point arguments on command line
* sleep's clock continues counting down when sleep is suspended
* when a suspended sleep process is resumed, it continues sleeping if
there is any time remaining
* who once again prints whatever host information it has, even without --lookup
Changes in release 2.0
* disable stty tests (otherwise they fail) when `make check' is run via rsh
[1.16m]

View File

@@ -1,3 +1,60 @@
2000-01-08 Jim Meyering <meyering@ascend.com>
More nits.
* src/cut.c (OUTPUT_DELIMITER_OPTION): Define this and use it
instead of `CHAR_MAX + n'.
* src/pr.c (PAGES_OPTION, COLUMNS_OPTION): Likewise.
2000-01-07 Jim Meyering <meyering@ascend.com>
* tests/tsort/Makefile.am (TESTS_ENVIRONMENT): Add `pwd`/ prefix
to exported PATH value (though not strictly necessary, here).
* tests/md5sum/Makefile.am: Likewise.
Nits.
* lib/memcasecmp.c: Use `#if' instead of `#ifdef' for `HAVE_CONFIG_H'.
Capitalize all macro parameters.
(memcasecmp): Ansideclify.
Don't cast away `const'ness of parameters.
* lib/strpbrk.c (strpbrk): Ansideclify.
Use `#if' instead of `#ifdef' for `HAVE_CONFIG_H'.
Suggestions from François Pinard.
2000-01-06 Jim Meyering <meyering@ascend.com>
* tests/tail-2/assert: Tell the user just before sleeping for 7 seconds.
* tests/tail-2/Makefile.am (TESTS): Remove fflush test. It didn't
test the losing behavior, and left a stray tail process to boot.
2000-01-01 Jim Meyering <meyering@ascend.com>
* Version 2.0a.
* lib/Makefile.am (lstat.c): Adapt rule to handle new parts of xstat.in.
1999-12-12 Jim Meyering <meyering@ascend.com>
Move 120+ lines of stat.h-related macros from system.h (not shared)
to sys2.h, which is shared between fileutils, sh-utils, textutils.
* src/system.h: Move them from here...
* src/sys2.h: ... to here.
1999-12-09 Jim Meyering <meyering@ascend.com>
* configure.in (ALL_LINGUAS): Add Galician (gl).
1999-12-06 Jim Meyering <meyering@ascend.com>
* tests/tail-2/fflush: New test for latest change.
* tests/tail-2/Makefile.am (TESTS): Add fflush.
1999-10-26 Marc Boucher <marc@mbsi.ca>
* src/tail.c (main): Flush stdout before switching to unbuffered mode
and calling tail_forever. Required only on Solaris2.7 -- on other
systems, using setvbuf to switch to unbufferd mode does the flush.
1999-11-22 Jim Meyering <meyering@ascend.com>
* lib/Makefile.am (DISTCLEANFILES): Put $(BUILT_SOURCES) here rather
@@ -77,6 +134,10 @@
* man/Makefile.maint ($(man_MANS)): Remove use of --name=... option.
* man/*.x: Include one-line summary in [NAME] section.
* man/Makefile.summ (cat-summary): Remove now-unused file.
* man/Makefile.am (EXTRA_DIST): Remove Makefile.summ.
* man/Makefile.maint: Include Makefile.summ with leading `-'.
This file is shared by fileutils and sh-utils, both of which still
have the file (albeit nearly empty now).
Suggestion for clean-up from Akim Demaille.
1999-11-01 Jim Meyering <meyering@ascend.com>

View File

@@ -1,4 +1,5 @@
Changes in release 2.1
[2.0b]
[2.0a]
* `tail --follow=name' no longer gets a failed assertion for a
dev,inode-reusing race condition

View File

@@ -1,5 +1,5 @@
/* copy.c -- core functions for copying files and directories
Copyright (C) 89, 90, 91, 1995-1999 Free Software Foundation.
Copyright (C) 89, 90, 91, 1995-2000 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -370,7 +370,9 @@ copy_internal (const char *src_path, const char *dst_path,
int src_type;
char *earlier_file;
char *dst_backup = NULL;
int backup_succeeded = 0;
int fix_mode = 0;
int rename_errno;
if (move_mode && rename_succeeded)
*rename_succeeded = 0;
@@ -428,12 +430,13 @@ copy_internal (const char *src_path, const char *dst_path,
/* If we'll remove DST_PATH first, then this doesn't matter. */
&& ! x->force
/* Allow them to be the same (and don't set `same') if
we're in move mode and the target is a symlink
on the same partition. */
/* Allow them to be the same (and don't set `same') if we're
in move mode and the target is a symlink. That is ok, since
we remove any existing destination file before opening it --
via `rename' if they're on the same file system,
via `unlink(DST_PATH)' otherwise. */
&& !(move_mode
&& S_ISLNK (dst_sb.st_mode)
&& src_sb.st_dev == dst_sb.st_dev)
&& S_ISLNK (dst_sb.st_mode))
/* If we're making a backup, we'll detect the problem case in
copy_reg because SRC_PATH will no longer exist. Allowing
@@ -544,13 +547,13 @@ copy_internal (const char *src_path, const char *dst_path,
return 1;
}
else
dst_backup = NULL;
{
dst_backup = NULL;
}
}
else
{
/* rename succeeded */
if (x->verbose)
printf (_("%s -> %s (backup)\n"), dst_path, dst_backup);
backup_succeeded = 1;
}
new_dst = 1;
}
@@ -592,7 +595,12 @@ copy_internal (const char *src_path, const char *dst_path,
directory. So --verbose should not announce anything until we're
sure we'll create a directory. */
if (x->verbose && !S_ISDIR (src_type))
printf ("%s -> %s\n", src_path, dst_path);
{
printf ("%s -> %s", src_path, dst_path);
if (backup_succeeded)
printf (_(" (backup: %s)"), dst_backup);
putchar ('\n');
}
/* Did we copy this inode somewhere else (in this command line argument)
and therefore this is a second hard link to the inode? */
@@ -656,6 +664,20 @@ copy_internal (const char *src_path, const char *dst_path,
/* Ignore other types of failure (e.g. EXDEV), since the following
code will try to perform a copy, then remove. */
/* Save this value of errno to use in case the unlink fails. */
rename_errno = errno;
/* The rename attempt has failed. Remove any existing destination
file so that a cross-device `mv' acts as if it were really using
the rename syscall. */
if (unlink (dst_path) && errno != ENOENT)
{
/* Use the value of errno from the failed rename. */
error (0, rename_errno, _("cannot move `%s' to `%s'"),
src_path, dst_path);
return 1;
}
}
if (S_ISDIR (src_type))

View File

@@ -60,7 +60,7 @@ struct dir_attr
enum
{
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1,
SPARSE_OPTION = CHAR_MAX + 2
SPARSE_OPTION
};
int stat ();
@@ -151,7 +151,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\
-R, --recursive copy directories recursively\n\
-s, --symbolic-link make symbolic links instead of copying\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
--target-directory=DIR move all SOURCE arguments into directory DIR\n\
--target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY\n\
-u, --update copy only when the SOURCE file is newer\n\
than the destination file or when the\n\
destination file is missing\n\

View File

@@ -171,6 +171,13 @@ static char *output_delimiter_string;
/* Nonzero if we have ever read standard input. */
static int have_read_stdin;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
OUTPUT_DELIMITER_OPTION = CHAR_MAX + 1
};
static struct option const longopts[] =
{
{"bytes", required_argument, 0, 'b'},
@@ -178,7 +185,7 @@ static struct option const longopts[] =
{"fields", required_argument, 0, 'f'},
{"delimiter", required_argument, 0, 'd'},
{"only-delimited", no_argument, 0, 's'},
{"output-delimiter", required_argument, 0, CHAR_MAX + 1},
{"output-delimiter", required_argument, 0, OUTPUT_DELIMITER_OPTION},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
@@ -736,7 +743,7 @@ main (int argc, char **argv)
delim_specified = 1;
break;
case CHAR_MAX + 1:
case OUTPUT_DELIMITER_OPTION:
/* Interpret --output-delimiter='' to mean
`use the NUL byte as the delimiter.' */
output_delimiter_length = (optarg[0] == '\0'

224
src/df.c
View File

@@ -1,5 +1,5 @@
/* df - summarize free disk space
Copyright (C) 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,10 @@
--human-readable and --megabyte options added by lm@sgi.com.
--si and large file support added by eggert@twinsun.com. */
#ifdef _AIX
#pragma alloca
#endif
#include <config.h>
#if HAVE_INTTYPES_H
# include <inttypes.h>
@@ -34,6 +38,7 @@
#include "fsusage.h"
#include "human.h"
#include "mountlist.h"
#include "path-concat.h"
#include "save-cwd.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -110,10 +115,19 @@ static struct mount_entry *mount_list;
/* If nonzero, print filesystem type as well. */
static int print_type;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
SYNC_OPTION = CHAR_MAX + 1,
NO_SYNC_OPTION,
BLOCK_SIZE_OPTION
};
static struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"block-size", required_argument, NULL, CHAR_MAX + 3},
{"block-size", required_argument, NULL, BLOCK_SIZE_OPTION},
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
@@ -122,8 +136,8 @@ static struct option const long_options[] =
{"megabytes", no_argument, NULL, 'm'},
{"portability", no_argument, NULL, 'P'},
{"print-type", no_argument, NULL, 'T'},
{"sync", no_argument, NULL, CHAR_MAX + 1},
{"no-sync", no_argument, NULL, CHAR_MAX + 2},
{"sync", no_argument, NULL, SYNC_OPTION},
{"no-sync", no_argument, NULL, NO_SYNC_OPTION},
{"type", required_argument, NULL, 't'},
{"exclude-type", required_argument, NULL, 'x'},
{GETOPT_HELP_OPTION_DECL},
@@ -218,31 +232,6 @@ df_readable (int negative, uintmax_t n, char *buf,
}
}
/* Return the ceiling of N * 100 / D. Avoid the ceil function, so that
we needn't link the math library. */
static double
ceil_percent (uintmax_t n, uintmax_t d)
{
if (n <= (uintmax_t) -1 / 100)
{
uintmax_t n100 = n * 100;
return n100 / d + (n100 % d != 0);
}
else
{
/* Avoid integer overflow. We should use multiple precision
arithmetic here, but we'll be lazy and resort to floating
point. This can yield answers that are slightly off. In
practice it is quite rare to overflow uintmax_t, so this is
good enough for now. */
double pct = n * 100.0 / d;
double ipct = (int) pct;
if (ipct - 1 < pct && pct <= ipct + 1)
pct = ipct + (ipct < pct);
return pct;
}
}
/* 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.
@@ -268,7 +257,7 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
uintmax_t available_to_root;
uintmax_t used;
int negate_used;
uintmax_t nonroot_total;
double pct = -1;
if (me_remote && show_local_fs)
return;
@@ -364,15 +353,36 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
width, df_readable (negate_available, available,
buf[2], input_units, output_units));
if (used == -1 || available == -1
|| ! (nonroot_total = ((negate_used ? - used : used)
+ (negate_available ? - available : available))))
printf ("%*s", use_width, "- ");
if (used != -1 && available != -1)
{
/* The following floating-point calculations can suffer from
minor rounding errors, but making them precise requires
multiple precision arithmetic, and it's not worth the
aggravation. */
double u = used;
double a = available;
double nonroot_total = ((negate_used ? - u : u)
+ (negate_available ? - a : a));
if (nonroot_total)
{
pct = u * 100 / nonroot_total;
if (posix_format)
{
/* Like `pct = ceil (pct);', but avoid ceil so that
the math library needn't be linked. */
double ipct = (long) pct;
if (ipct - 1 < pct && pct <= ipct + 1)
pct = ipct + (ipct < pct);
}
}
}
if (0 <= pct)
printf ("%*.0f%%", use_width - 1, pct);
else
printf ("%*.0f%%", use_width - 1,
(posix_format
? ceil_percent (used, nonroot_total)
: used * 100.0 / nonroot_total));
printf ("%*s", use_width, "- ");
if (mount_point)
{
@@ -489,6 +499,7 @@ show_point (const char *point, const struct stat *statp)
struct stat disk_stats;
struct mount_entry *me;
struct mount_entry *matching_dummy = NULL;
char *needs_freeing = NULL;
/* If POINT is an absolute path name, see if we can find the
mount point without performing any extra stat calls at all. */
@@ -498,13 +509,104 @@ show_point (const char *point, const struct stat *statp)
{
if (STREQ (me->me_mountdir, point))
{
show_dev (me->me_devname, me->me_mountdir, me->me_type,
me->me_dummy, me->me_remote);
return;
/* Prefer non-dummy entries. */
if (! me->me_dummy)
goto show_me;
matching_dummy = me;
}
}
if (matching_dummy)
goto show_matching_dummy;
}
#if HAVE_REALPATH || HAVE_RESOLVEPATH
/* Calculate the real absolute path for POINT, and use that to find
the mount point. This avoids statting unavailable mount points,
which can hang df. */
{
char const *abspoint = point;
char *resolved;
ssize_t resolved_len;
struct mount_entry *best_match = NULL;
# if HAVE_RESOLVEPATH
/* All known hosts with resolvepath (e.g. Solaris 7) don't turn
relative names into absolute ones, so prepend the working
directory if the path is not absolute. */
if (*point != '/')
{
static char const *wd;
if (! wd)
{
struct stat pwd_stats;
struct stat dot_stats;
/* Use PWD if it is correct; this is usually cheaper than
xgetcwd. */
wd = getenv ("PWD");
if (! (wd
&& stat (wd, &pwd_stats) == 0
&& stat (".", &dot_stats) == 0
&& SAME_INODE (pwd_stats, dot_stats)))
wd = xgetcwd ();
}
if (wd)
{
needs_freeing = path_concat (wd, point, NULL);
if (needs_freeing)
abspoint = needs_freeing;
}
}
# endif
# if HAVE_RESOLVEPATH
{
size_t resolved_size = strlen (abspoint);
do
{
resolved_size = 2 * resolved_size + 1;
resolved = alloca (resolved_size);
resolved_len = resolvepath (abspoint, resolved, resolved_size);
}
while (resolved_len == resolved_size);
}
# else
resolved = alloca (PATH_MAX + 1);
resolved = realpath (abspoint, resolved);
resolved_len = resolved ? strlen (resolved) : -1;
# endif
if (1 <= resolved_len && resolved[0] == '/')
{
size_t best_match_len = 0;
for (me = mount_list; me; me = me->me_next)
if (! me->me_dummy)
{
size_t len = strlen (me->me_mountdir);
if (best_match_len < len && len <= resolved_len
&& (len == 1 /* root file system */
|| ((len == resolved_len || resolved[len] == '/')
&& strncmp (me->me_mountdir, resolved, len) == 0)))
{
best_match = me;
best_match_len = len;
}
}
}
if (best_match)
{
me = best_match;
goto show_me;
}
}
#endif
for (me = mount_list; me; me = me->me_next)
{
if (me->me_dev == (dev_t) -1)
@@ -523,29 +625,22 @@ show_point (const char *point, const struct stat *statp)
if (statp->st_dev == me->me_dev)
{
/* Skip bogus mtab entries. */
if (stat (me->me_mountdir, &disk_stats) != 0 ||
disk_stats.st_dev != me->me_dev)
continue;
/* Prefer non-dummy entries. */
if (me->me_dummy)
if (stat (me->me_mountdir, &disk_stats) != 0
|| disk_stats.st_dev != me->me_dev)
{
matching_dummy = me;
me->me_dev = (dev_t) -2;
continue;
}
show_dev (me->me_devname, me->me_mountdir, me->me_type,
me->me_dummy, me->me_remote);
return;
/* Prefer non-dummy entries. */
if (! me->me_dummy)
goto show_me;
matching_dummy = me;
}
}
if (matching_dummy)
{
show_dev (matching_dummy->me_devname, matching_dummy->me_mountdir,
matching_dummy->me_type, 1, matching_dummy->me_remote);
return;
}
goto show_matching_dummy;
/* We couldn't find the mount entry corresponding to POINT. Go ahead and
print as much info as we can; methods that require the device to be
@@ -561,6 +656,17 @@ show_point (const char *point, const struct stat *statp)
else
error (0, errno, "%s", point);
}
goto free_then_return;
show_matching_dummy:
me = matching_dummy;
show_me:
show_dev (me->me_devname, me->me_mountdir, me->me_type, me->me_dummy,
me->me_remote);
free_then_return:
if (needs_freeing)
free (needs_freeing);
}
/* Determine what kind of node PATH is and show the disk usage
@@ -708,14 +814,14 @@ main (int argc, char **argv)
case 'P':
posix_format = 1;
break;
case CHAR_MAX + 1:
case SYNC_OPTION:
require_sync = 1;
break;
case CHAR_MAX + 2:
case NO_SYNC_OPTION:
require_sync = 0;
break;
case CHAR_MAX + 3:
case BLOCK_SIZE_OPTION:
human_block_size (optarg, 1, &output_block_size);
break;

View File

@@ -161,20 +161,29 @@ static struct exclude *exclude;
/* Grand total size of all args, in units of ST_NBLOCKSIZE-byte blocks. */
static uintmax_t tot_size = 0;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
EXCLUDE_OPTION = CHAR_MAX + 1,
BLOCK_SIZE_OPTION,
MAX_DEPTH_OPTION
};
static struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"block-size", required_argument, 0, CHAR_MAX + 2},
{"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
{"bytes", no_argument, NULL, 'b'},
{"count-links", no_argument, NULL, 'l'},
{"dereference", no_argument, NULL, 'L'},
{"dereference-args", no_argument, NULL, 'D'},
{"exclude", required_argument, 0, CHAR_MAX + 1},
{"exclude", required_argument, 0, EXCLUDE_OPTION},
{"exclude-from", required_argument, 0, 'X'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, 0, 'H'},
{"kilobytes", no_argument, NULL, 'k'},
{"max-depth", required_argument, NULL, CHAR_MAX + 3},
{"max-depth", required_argument, NULL, MAX_DEPTH_OPTION},
{"megabytes", no_argument, NULL, 'm'},
{"one-file-system", no_argument, NULL, 'x'},
{"separate-dirs", no_argument, NULL, 'S'},
@@ -695,7 +704,7 @@ main (int argc, char **argv)
output_block_size = 1024;
break;
case CHAR_MAX + 3: /* --max-depth=N */
case MAX_DEPTH_OPTION: /* --max-depth=N */
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
error (1, 0, _("invalid maximum depth `%s'"), optarg);
@@ -737,11 +746,11 @@ main (int argc, char **argv)
error (1, errno, "%s", optarg);
break;
case CHAR_MAX + 1:
case EXCLUDE_OPTION:
add_exclude (exclude, optarg);
break;
case CHAR_MAX + 2:
case BLOCK_SIZE_OPTION:
human_block_size (optarg, 1, &output_block_size);
break;

View File

@@ -1,5 +1,5 @@
/* `ln' program to create links between files.
Copyright (C) 86, 89, 90, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 86, 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -151,6 +151,7 @@ do_link (const char *source, const char *dest)
struct stat dest_stats;
char *dest_backup = NULL;
int lstat_status;
int backup_succeeded = 0;
/* Use stat here instead of lstat.
On SVR4, link does not follow symlinks, so this check disallows
@@ -276,6 +277,10 @@ do_link (const char *source, const char *dest)
else
dest_backup = NULL;
}
else
{
backup_succeeded = 1;
}
}
/* Try to unlink DEST even if we may have renamed it. In some unusual
@@ -295,7 +300,12 @@ do_link (const char *source, const char *dest)
}
if (verbose)
printf (_("create %s %s to %s\n"), link_type_string, dest, source);
{
printf (_("create %s %s to %s"), link_type_string, dest, source);
if (backup_succeeded)
printf (_(" (backup: %s)"), dest_backup);
putchar ('\n');
}
if ((*linkfunc) (source, dest) == 0)
{
@@ -324,8 +334,9 @@ usage (int status)
printf (_("\
Usage: %s [OPTION]... TARGET [LINK_NAME]\n\
or: %s [OPTION]... TARGET... DIRECTORY\n\
or: %s [OPTION]... --target-directory=DIRECTORY TARGET...\n\
"),
program_name, program_name);
program_name, program_name, program_name);
printf (_("\
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\
@@ -340,7 +351,8 @@ with --symbolic. When creating hard links, each TARGET must exist.\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\
--target-directory=DIR move all SOURCE arguments into directory DIR\n\
--target-directory=DIRECTORY specify the DIRECTORY in which to create\n\
the links\n\
-v, --verbose print name of each file before linking\n\
--help display this help and exit\n\
--version output version information and exit\n\

View File

@@ -143,6 +143,15 @@
# define S_ISDOOR(Mode) 0
#endif
/* Arrange to make lstat calls go through the wrapper function
on systems with an lstat function that does not dereference symlinks
that are specified with a trailing slash. */
#if ! LSTAT_FOLLOWS_SLASHED_SYMLINK
int rpl_lstat PARAMS((const char *, struct stat *));
# undef lstat
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
#endif
enum filetype
{
symbolic_link,
@@ -202,7 +211,6 @@ time_t time ();
char *getgroup ();
char *getuser ();
void strip_trailing_slashes ();
static size_t quote_name PARAMS ((FILE *out, const char *name,
struct quoting_options const *options));
@@ -478,6 +486,11 @@ static struct color_ext_type *color_ext_list = NULL;
/* Buffer for color sequences */
static char *color_buf;
/* Nonzero means to check for orphaned symbolic link, for displaying
colors. */
static int check_symlink_color;
/* Nonzero means mention the inode number of each file. -i */
static int print_inode;
@@ -763,6 +776,11 @@ main (int argc, char **argv)
{
parse_ls_color ();
prep_non_filename_text ();
/* Avoid following symbolic links when possible. */
if (color_indicator[C_ORPHAN].string != NULL
|| (color_indicator[C_MISSING].string != NULL
&& format == long_format))
check_symlink_color = 1;
}
format_needs_stat = sort_type == sort_time || sort_type == sort_size
@@ -786,7 +804,6 @@ main (int argc, char **argv)
dir_defaulted = 0;
for (; i < argc; i++)
{
strip_trailing_slashes (argv[i]);
gobble_file (argv[i], 1, "");
}
@@ -858,6 +875,9 @@ decode_switches (int argc, char **argv)
int i;
long int tmp_long;
/* Record whether there is an option specifying sort type. */
int sort_type_specified = 0;
qmark_funny_chars = 0;
/* initialize all switches to default settings */
@@ -980,7 +1000,6 @@ decode_switches (int argc, char **argv)
case 'c':
time_type = time_ctime;
sort_type = sort_time;
break;
case 'd':
@@ -992,6 +1011,7 @@ decode_switches (int argc, char **argv)
all_files = 1;
really_all_files = 1;
sort_type = sort_none;
sort_type_specified = 1;
/* disable -l */
if (format == long_format)
format = (isatty (STDOUT_FILENO) ? many_per_line : one_per_line);
@@ -1054,15 +1074,16 @@ decode_switches (int argc, char **argv)
case 't':
sort_type = sort_time;
sort_type_specified = 1;
break;
case 'u':
sort_type = sort_time;
time_type = time_atime;
break;
case 'v':
sort_type = sort_version;
sort_type_specified = 1;
break;
case 'w':
@@ -1125,6 +1146,7 @@ decode_switches (int argc, char **argv)
case 'S':
sort_type = sort_size;
sort_type_specified = 1;
break;
case 'T':
@@ -1137,10 +1159,12 @@ decode_switches (int argc, char **argv)
case 'U':
sort_type = sort_none;
sort_type_specified = 1;
break;
case 'X':
sort_type = sort_extension;
sort_type_specified = 1;
break;
case '1':
@@ -1149,6 +1173,7 @@ decode_switches (int argc, char **argv)
case 10: /* --sort */
sort_type = XARGMATCH ("--sort", optarg, sort_args, sort_types);
sort_type_specified = 1;
break;
case 11: /* --time */
@@ -1220,6 +1245,20 @@ decode_switches (int argc, char **argv)
dirname_quoting_options = clone_quoting_options (NULL);
set_char_quoting (dirname_quoting_options, ':', 1);
/* If -c or -u is specified and not -l (or any other option that implies -l),
and no sort-type was specified, then sort by the ctime (-c) or atime (-u).
The behavior of ls when using either -c or -u but with neither -l nor -t
appears to be unspecified by POSIX. So, with GNU ls, `-u' alone means
sort by atime (this is the one that's not specified by the POSIX spec),
-lu means show atime and sort by name, -lut means show atime and sort
by atime. */
if ((time_type == time_ctime || time_type == time_atime)
&& !sort_type_specified && format != long_format)
{
sort_type = sort_time;
}
return optind;
}
@@ -1764,7 +1803,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
}
if (S_ISLNK (files[files_index].stat.st_mode)
&& (explicit_arg || format == long_format || print_with_color))
&& (explicit_arg || format == long_format || check_symlink_color))
{
char *linkpath;
struct stat linkstats;
@@ -1777,7 +1816,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
if (linkpath
&& ((explicit_arg && format != long_format)
|| indicator_style != none
|| print_with_color)
|| check_symlink_color)
&& stat (linkpath, &linkstats) == 0)
{
files[files_index].linkok = 1;
@@ -2874,7 +2913,10 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
-b, --escape print octal escapes for nongraphic characters\n\
--block-size=SIZE use SIZE-byte blocks\n\
-B, --ignore-backups do not list implied entries ending with ~\n\
-c sort by change time; with -l: show ctime\n\
-c with -lt: sort by, and show, ctime (time of last\n\
modification of file status information)\n\
with -l: show ctime and sort by name\n\
otherwise: sort by ctime\n\
-C list entries by columns\n\
--color[=WHEN] control whether color is used to distinguish file\n\
types. WHEN may be `never', `always', or `auto'\n\
@@ -2905,10 +2947,8 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
-o use long listing format without group info\n\
-p, --file-type append indicator (one of /=@|) to entries\n\
-q, --hide-control-chars print ? instead of non graphic characters\n\
(This is the default unless the output is a\n\
terminal and the program is `ls'; otherwise,\n\
the default is --show-control-chars)\n\
--show-control-chars show non graphic characters as-is (default)\n\
--show-control-chars show non graphic characters as-is (default\n\
unless program is `ls' and output is a terminal)\n\
-Q, --quote-name enclose entry names in double quotes\n\
--quoting-style=WORD use quoting style WORD for entry names:\n\
literal, locale, shell, shell-always, c, escape\n\
@@ -2926,7 +2966,9 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\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 with -lt: sort by, and show, access time\n\
with -l: show access time and sort by name\n\
otherwise: sort by access time\n\
-U do not sort; list entries in directory order\n\
-v sort by version\n\
-w, --width=COLS assume screen width instead of current value\n\

View File

@@ -1,5 +1,5 @@
/* mv -- move or rename files
Copyright (C) 86, 89, 90, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 86, 89, 90, 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -70,7 +70,8 @@
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1
TARGET_DIRECTORY_OPTION = CHAR_MAX + 1,
STRIP_TRAILING_SLASHES_OPTION
};
int euidaccess ();
@@ -82,11 +83,14 @@ int yesno ();
/* The name this program was run with. */
char *program_name;
static int remove_trailing_slashes;
static struct option const long_options[] =
{
{"backup", optional_argument, NULL, 'b'},
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
{"strip-trailing-slash", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION},
{"suffix", required_argument, NULL, 'S'},
{"target-directory", required_argument, NULL, TARGET_DIRECTORY_OPTION},
{"update", no_argument, NULL, 'u'},
@@ -288,6 +292,16 @@ movefile (char *source, char *dest, int dest_is_dir,
int dest_had_trailing_slash = strip_trailing_slashes_2 (dest);
int fail;
/* This code was introduced to handle the ambiguity in the semantics
of mv that is induced by the varying semantics of the rename function.
Some systems (e.g., Linux) have a rename function that honors a
trailing slash, while others (like Solaris 5,6,7) have a rename
function that ignores a trailing slash. I believe the Linux
rename semantics are POSIX and susv2 compliant. */
if (remove_trailing_slashes)
strip_trailing_slashes_2 (source);
/* In addition to when DEST is a directory, if DEST has a trailing
slash and neither SOURCE nor DEST is a directory, presume the target
is DEST/`basename source`. This converts `mv x y/' to `mv x y/x'.
@@ -333,16 +347,19 @@ usage (int status)
printf (_("\
Usage: %s [OPTION]... SOURCE DEST\n\
or: %s [OPTION]... SOURCE... DIRECTORY\n\
or: %s [OPTION]... --target-directory=DIRECTORY SOURCE...\n\
"),
program_name, program_name);
program_name, program_name, program_name);
printf (_("\
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\
\n\
-b, --backup[=CONTROL] make backup before removal\n\
-f, --force remove existing destinations, never prompt\n\
-i, --interactive prompt before overwrite\n\
--strip-trailing-slashes remove any trailing slashes from each SOURCE\n\
argument\n\
-S, --suffix=SUFFIX override the usual backup suffix\n\
--target-directory=DIR move all SOURCE arguments into directory DIR\n\
--target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY\n\
-u, --update move only older or brand new non-directories\n\
-v, --verbose explain what is being done\n\
--help display this help and exit\n\
@@ -420,6 +437,9 @@ main (int argc, char **argv)
x.interactive = 1;
x.force = 0;
break;
case STRIP_TRAILING_SLASHES_OPTION:
remove_trailing_slashes = 1;
break;
case TARGET_DIRECTORY_OPTION:
target_directory = optarg;
break;

View File

@@ -1,5 +1,5 @@
/* pr -- convert text files for printing.
Copyright (C) 88, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 88, 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -725,11 +725,19 @@ static int last_line = FALSE;
-h HEADER using pr test-suite */
static int test_suite;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
PAGES_OPTION = CHAR_MAX + 1,
COLUMNS_OPTION
};
static struct option const long_options[] =
{
{"test", no_argument, &test_suite, 1},
{"pages", required_argument, NULL, CHAR_MAX + 1},
{"columns", required_argument, NULL, CHAR_MAX + 2},
{"pages", required_argument, NULL, PAGES_OPTION},
{"columns", required_argument, NULL, COLUMNS_OPTION},
{"across", no_argument, NULL, 'a'},
{"show-control-chars", no_argument, NULL, 'c'},
{"double-space", no_argument, NULL, 'd'},
@@ -901,7 +909,7 @@ main (int argc, char **argv)
case 0: /* getopt long option */
break;
case CHAR_MAX + 1: /* --pages=FIRST_PAGE[:LAST_PAGE] */
case PAGES_OPTION: /* --pages=FIRST_PAGE[:LAST_PAGE] */
{ /* dominates old opt +... */
if (optarg)
first_last_page (optarg);
@@ -911,7 +919,7 @@ main (int argc, char **argv)
break;
}
case CHAR_MAX + 2: /* --columns=COLUMN */
case COLUMNS_OPTION: /* --columns=COLUMN */
{
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK

View File

@@ -58,11 +58,19 @@ static int ignore_fail_on_non_empty;
/* If nonzero, output a diagnostic for every directory processed. */
static int verbose;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
IGNORE_FAIL_ON_NON_EMPTY_OPTION = CHAR_MAX + 1
};
static struct option const longopts[] =
{
/* Don't name this `--force' because it's not close enough in meaning
to e.g. rm's -f option. */
{"ignore-fail-on-non-empty", no_argument, NULL, CHAR_MAX + 1},
{"ignore-fail-on-non-empty", no_argument, NULL,
IGNORE_FAIL_ON_NON_EMPTY_OPTION},
{"path", no_argument, NULL, 'p'},
{"parents", no_argument, NULL, 'p'},
@@ -105,7 +113,7 @@ remove_parents (char *path)
/* Give a diagnostic for each attempted removal if --verbose. */
if (verbose)
error (0, errno, _("removing directory, %s"), path);
error (0, 0, _("removing directory, %s"), path);
fail = rmdir (path);
@@ -177,7 +185,7 @@ main (int argc, char **argv)
case 'p':
empty_paths = 1;
break;
case CHAR_MAX + 1:
case IGNORE_FAIL_ON_NON_EMPTY_OPTION:
ignore_fail_on_non_empty = 1;
break;
case 14:
@@ -207,7 +215,7 @@ main (int argc, char **argv)
/* Give a diagnostic for each attempted removal if --verbose. */
if (verbose)
error (0, errno, _("removing directory, %s"), dir);
error (0, 0, _("removing directory, %s"), dir);
fail = rmdir (dir);

View File

@@ -1589,22 +1589,34 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
do
{
struct stat st;
if (lstat (newname, &st) < 0 && rename (oldname, newname) == 0)
if (lstat (newname, &st) < 0)
{
if (dir_fd < 0
|| (fdatasync (dir_fd) < 0 && fsync (dir_fd) < 0))
sync (); /* Force directory out */
if (flags->verbose)
if (rename (oldname, newname) == 0)
{
/*
* People seem to understand this better than talking
* about renaming oldname. newname doesn't need
* quoting because we picked it.
*/
error (0, 0, _("%s: renamed to `%s'"), qoldname, newname);
if (dir_fd < 0
|| (fdatasync (dir_fd) < 0 && fsync (dir_fd) < 0))
sync (); /* Force directory out */
if (flags->verbose)
{
/*
* People seem to understand this better than talking
* about renaming oldname. newname doesn't need
* quoting because we picked it.
*/
error (0, 0, _("%s: renamed to `%s'"), qoldname, newname);
}
memcpy (oldname + (base - newname), base, len + 1);
break;
}
memcpy (oldname + (base - newname), base, len + 1);
break;
else
{
/* The rename failed: give up on this length. */
break;
}
}
else
{
/* newname exists, so increment BASE so we use another */
}
}
while (!incname (base, len));

View File

@@ -1,5 +1,5 @@
/* sleep - delay for a specified amount of time.
Copyright (C) 84, 1991-1997, 1999 Free Software Foundation, Inc.
Copyright (C) 84, 1991-1997, 1999-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,19 +17,39 @@
#include <config.h>
#include <stdio.h>
#include <assert.h>
#include <sys/types.h>
#include <time.h>
#include <getopt.h>
#define USE_CLOCK_GETTIME (defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME)
#if ! USE_CLOCK_GETTIME
# include <sys/time.h>
#endif
#ifndef TIME_T_MAX
# define TIME_T_MAX TYPE_MAXIMUM (time_t)
#endif
#include "system.h"
#include "error.h"
#include "long-options.h"
#include "nanosleep.h"
#include "xstrtod.h"
#if HAVE_FENV_H
# include <fenv.h>
#endif
/* Tell the compiler that non-default rounding modes are used. */
#if 199901 <= __STDC_VERSION__
#pragma STDC FENV_ACCESS ON
#endif
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "sleep"
#define AUTHORS "FIXME: unknown"
static long argdecode PARAMS ((const char *s));
#define AUTHORS "Jim Meyering and Paul Eggert"
/* The name by which this program was run. */
char *program_name;
@@ -48,11 +68,12 @@ usage (int status)
else
{
printf (_("\
Usage: %s NUMBER[SUFFIX]\n\
Usage: %s NUMBER[SUFFIX]...\n\
or: %s OPTION\n\
Pause for NUMBER seconds.\n\
SUFFIX may be s for seconds (the default), m for minutes,\n\
h for hours or d for days.\n\
Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default),\n\
`m' for minutes, `h' for hours or `d' for days. Unlike most implementations\n\
that require NUMBER be an integer, here NUMBER may be an arbitrary floating\n\
point number.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -63,12 +84,114 @@ h for hours or d for days.\n\
exit (status);
}
/* Given a floating point value *X, and a suffix character, SUFFIX_CHAR,
scale *X by the multiplier implied by SUFFIX_CHAR. SUFFIX_CHAR may
be the NUL byte or `s' to denote seconds, `m' for minutes, `h' for
hours, or `d' for days. If SUFFIX_CHAR is invalid, don't modify *X
and return nonzero. Otherwise return zero. */
static int
apply_suffix (double *x, char suffix_char)
{
unsigned int multiplier;
switch (suffix_char)
{
case 0:
case 's':
multiplier = 1;
break;
case 'm':
multiplier = 60;
break;
case 'h':
multiplier = 60 * 60;
break;
case 'd':
multiplier = 60 * 60 * 24;
break;
default:
multiplier = 0;
}
if (multiplier == 0)
return 1;
*x *= multiplier;
return 0;
}
/* Subtract the `struct timespec' values X and Y,
storing the difference in DIFF.
Return 1 if the difference is positive, otherwise 0.
Derived from code in the GNU libc manual. */
static int
timespec_subtract (struct timespec *diff,
const struct timespec *x, struct timespec *y)
{
/* Perform the carry for the later subtraction by updating Y. */
if (x->tv_nsec < y->tv_nsec)
{
int nsec = (y->tv_nsec - x->tv_nsec) / 1000000000 + 1;
y->tv_nsec -= 1000000000 * nsec;
y->tv_sec += nsec;
}
if (1000000000 < x->tv_nsec - y->tv_nsec)
{
int nsec = (y->tv_nsec - x->tv_nsec) / 1000000000;
y->tv_nsec += 1000000000 * nsec;
y->tv_sec -= nsec;
}
/* Compute the time remaining to wait.
`tv_nsec' is certainly positive. */
diff->tv_sec = x->tv_sec - y->tv_sec;
diff->tv_nsec = x->tv_nsec - y->tv_nsec;
/* Return 1 if result is positive. */
return y->tv_sec < x->tv_sec;
}
static struct timespec *
clock_get_realtime (struct timespec *ts)
{
int fail;
#if USE_CLOCK_GETTIME
fail = clock_gettime (CLOCK_REALTIME, ts);
#else
struct timeval tv;
fail = gettimeofday (&tv, NULL);
if (!fail)
{
ts->tv_sec = tv.tv_sec;
ts->tv_nsec = 1000 * tv.tv_usec;
}
#endif
if (fail)
error (1, errno, _("cannot read realtime clock"));
return ts;
}
int
main (int argc, char **argv)
{
int i;
unsigned seconds = 0;
double seconds = 0.0;
double ns;
int c;
int fail = 0;
int forever;
struct timespec ts_start;
struct timespec ts_stop;
struct timespec ts_sleep;
/* Record start time. */
clock_get_realtime (&ts_start);
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -96,43 +219,81 @@ main (int argc, char **argv)
usage (1);
}
for (i = 1; i < argc; i++)
seconds += argdecode (argv[i]);
#ifdef FE_UPWARD
/* Always round up, since we must sleep for at least the specified
interval. */
fesetround (FE_UPWARD);
#endif
sleep (seconds);
for (i = optind; i < argc; i++)
{
double s;
const char *p;
if (xstrtod (argv[i], &p, &s)
/* Nonnegative interval. */
|| ! (0 <= s)
/* No extra chars after the number and an optional s,m,h,d char. */
|| (*p && *(p+1))
/* Check any suffix char and update S based on the suffix. */
|| apply_suffix (&s, *p))
{
error (0, 0, _("invalid time interval `%s'"), argv[i]);
fail = 1;
}
seconds += s;
}
if (fail)
usage (1);
/* Separate whole seconds from nanoseconds.
Be careful to detect any overflow. */
ts_sleep.tv_sec = seconds;
ns = 1e9 * (seconds - ts_sleep.tv_sec);
forever = ! (ts_sleep.tv_sec <= seconds && 0 <= ns && ns <= 1e9);
ts_sleep.tv_nsec = ns;
/* Round up to the next whole number, if necessary, so that we
always sleep for at least the requested amount of time. */
ts_sleep.tv_nsec += (ts_sleep.tv_nsec < ns);
/* Normalize the interval length. nanosleep requires this. */
if (1000000000 <= ts_sleep.tv_nsec)
{
time_t t = ts_sleep.tv_sec + 1;
/* Detect integer overflow. */
forever |= (t < ts_sleep.tv_sec);
ts_sleep.tv_sec = t;
ts_sleep.tv_nsec -= 1000000000;
}
ts_stop.tv_sec = ts_start.tv_sec + ts_sleep.tv_sec;
ts_stop.tv_nsec = ts_start.tv_nsec + ts_sleep.tv_nsec;
if (1000000000 <= ts_stop.tv_nsec)
{
++ts_stop.tv_sec;
ts_stop.tv_nsec -= 1000000000;
}
/* Detect integer overflow. */
forever |= (ts_stop.tv_sec < ts_start.tv_sec
|| (ts_stop.tv_sec == ts_start.tv_sec
&& ts_stop.tv_nsec < ts_start.tv_nsec));
if (forever)
{
/* Fix ts_sleep and ts_stop, which may be garbage due to overflow. */
ts_sleep.tv_sec = ts_stop.tv_sec = TIME_T_MAX;
ts_sleep.tv_nsec = ts_stop.tv_nsec = 999999999;
}
while (nanosleep (&ts_sleep, NULL) != 0
&& timespec_subtract (&ts_sleep, &ts_stop,
clock_get_realtime (&ts_start)))
continue;
exit (0);
}
static long
argdecode (const char *s)
{
long value;
register const char *p = s;
register char c;
value = 0;
while ((c = *p++) >= '0' && c <= '9')
value = value * 10 + c - '0';
switch (c)
{
case 's':
break;
case 'm':
value *= 60;
break;
case 'h':
value *= 60 * 60;
break;
case 'd':
value *= 60 * 60 * 24;
break;
default:
p--;
}
if (*p)
error (1, 0, _("invalid time interval `%s'"), s);
return value;
}

View File

@@ -3,6 +3,136 @@
more time, I'll merge the remaining things in system.h and everything
in this file will go back there. */
#if STAT_MACROS_BROKEN
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# undef S_ISDOOR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISMPB
# undef S_ISMPC
# undef S_ISNWK
# undef S_ISREG
# undef S_ISSOCK
#endif /* STAT_MACROS_BROKEN. */
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
#if !defined(S_ISCHR) && defined(S_IFCHR)
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISFIFO) && defined(S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
#endif
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
#if !defined(S_ISDOOR) && defined(S_IFDOOR) /* Solaris 2.5 and up */
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
#endif
#if !S_ISUID
# define S_ISUID 04000
#endif
#if !S_ISGID
# define S_ISGID 02000
#endif
/* S_ISVTX is a common extension to POSIX.1. */
#ifndef S_ISVTX
# define S_ISVTX 01000
#endif
#if !S_IRUSR && S_IREAD
# define S_IRUSR S_IREAD
#endif
#if !S_IRUSR
# define S_IRUSR 00400
#endif
#if !S_IRGRP
# define S_IRGRP (S_IRUSR >> 3)
#endif
#if !S_IROTH
# define S_IROTH (S_IRUSR >> 6)
#endif
#if !S_IWUSR && S_IWRITE
# define S_IWUSR S_IWRITE
#endif
#if !S_IWUSR
# define S_IWUSR 00200
#endif
#if !S_IWGRP
# define S_IWGRP (S_IWUSR >> 3)
#endif
#if !S_IWOTH
# define S_IWOTH (S_IWUSR >> 6)
#endif
#if !S_IXUSR && S_IEXEC
# define S_IXUSR S_IEXEC
#endif
#if !S_IXUSR
# define S_IXUSR 00100
#endif
#if !S_IXGRP
# define S_IXGRP (S_IXUSR >> 3)
#endif
#if !S_IXOTH
# define S_IXOTH (S_IXUSR >> 6)
#endif
#if !S_IRWXU
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#endif
#if !S_IRWXG
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#endif
#if !S_IRWXO
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#endif
/* S_IXUGO is a common extension to POSIX.1. */
#if !S_IXUGO
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
/* All the mode bits that can be affected by chmod. */
#define CHMOD_MODE_BITS \
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
#if ST_MTIM_NSEC
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
#else
# define ST_TIME_CMP_NS(a, b, ns) 0
#endif
#define ST_TIME_CMP(a, b, s, ns) \
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
#ifndef RETSIGTYPE
# define RETSIGTYPE void
#endif

View File

@@ -19,127 +19,6 @@
#include <sys/stat.h>
#if STAT_MACROS_BROKEN
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# undef S_ISDOOR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISMPB
# undef S_ISMPC
# undef S_ISNWK
# undef S_ISREG
# undef S_ISSOCK
#endif /* STAT_MACROS_BROKEN. */
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
#if !defined(S_ISCHR) && defined(S_IFCHR)
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
#if !defined(S_ISDIR) && defined(S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISFIFO) && defined(S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
#endif
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
#if !defined(S_ISDOOR) && defined(S_IFDOOR) /* Solaris 2.5 and up */
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
#endif
#if !S_ISUID
# define S_ISUID 04000
#endif
#if !S_ISGID
# define S_ISGID 02000
#endif
/* S_ISVTX is a common extension to POSIX.1. */
#ifndef S_ISVTX
# define S_ISVTX 01000
#endif
#if !S_IWUSR
# if S_IWRITE
# define S_IWUSR S_IWRITE
# else
# define S_IWUSR 00200
# endif
#endif
#ifndef S_IWUSR
# ifdef S_IWRITE
# define S_IWUSR S_IWRITE
# else
# define S_IWUSR 00200
# endif
#endif
#ifndef S_IEXEC
# define S_IEXEC S_IXUSR
#endif
#ifndef S_IXUSR
# define S_IXUSR S_IEXEC
#endif
#ifndef S_IXGRP
# define S_IXGRP (S_IEXEC >> 3)
#endif
#ifndef S_IXOTH
# define S_IXOTH (S_IEXEC >> 6)
#endif
#ifndef S_IRWXU
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
#endif
#ifndef S_IRWXG
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
#endif
#ifndef S_IRWXO
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
#endif
/* S_IXUGO is a common extension to POSIX.1. */
#ifndef S_IXUGO
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
/* All the mode bits that can be affected by chmod. */
#define CHMOD_MODE_BITS \
(S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
#if ST_MTIM_NSEC
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
#else
# define ST_TIME_CMP_NS(a, b, ns) 0
#endif
#define ST_TIME_CMP(a, b, s, ns) \
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
#if !defined(HAVE_MKFIFO)
# define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
#endif

View File

@@ -1526,6 +1526,10 @@ main (int argc, char **argv)
if (forever)
{
/* This fflush appears to be required only on Solaris2.7. */
if (fflush (stdout) < 0)
error (EXIT_FAILURE, errno, _("write error"));
SETVBUF (stdout, NULL, _IONBF, 0);
tail_forever (F, n_files);
}

View File

@@ -78,9 +78,16 @@ static char *ref_file;
/* Info about the reference file. */
static struct stat ref_stats;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
TIME_OPTION = CHAR_MAX + 1
};
static struct option const longopts[] =
{
{"time", required_argument, 0, CHAR_MAX + 1},
{"time", required_argument, 0, TIME_OPTION},
{"no-create", no_argument, 0, 'c'},
{"date", required_argument, 0, 'd'},
{"file", required_argument, 0, 'r'}, /* FIXME: phase out --file */
@@ -111,12 +118,15 @@ touch (const char *file)
int status;
struct stat sbuf;
int fd = -1;
int open_errno = 0;
if (! no_create)
{
/* Try to open FILE, creating it if necessary. */
fd = open (file, O_WRONLY | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd == -1)
open_errno = errno;
}
if (! amtime_now)
@@ -127,7 +137,7 @@ touch (const char *file)
or FILE is inaccessible or a directory, so we have to use stat. */
if (fd != -1 ? fstat (fd, &sbuf) : stat (file, &sbuf))
{
error (0, errno, "%s", file);
error (0, open_errno ? open_errno : errno, "%s", file);
close (fd);
return 1;
}
@@ -172,7 +182,7 @@ touch (const char *file)
if (status)
{
error (0, errno, "%s", file);
error (0, open_errno ? open_errno : errno, "%s", file);
return 1;
}
@@ -273,7 +283,7 @@ main (int argc, char **argv)
date_set++;
break;
case CHAR_MAX + 1: /* --time */
case TIME_OPTION: /* --time */
change_times |= XARGMATCH ("--time", optarg,
time_args, time_masks);
break;

View File

@@ -175,7 +175,7 @@ print_entry (const STRUCT_UTMP *utmp_ent)
printf (" . ");
}
#if HAVE_UT_HOST
if (utmp_ent->ut_host[0] && do_lookup)
if (utmp_ent->ut_host[0])
{
char ut_host[sizeof (utmp_ent->ut_host) + 1];
char *host = 0, *display = 0;
@@ -189,9 +189,12 @@ print_entry (const STRUCT_UTMP *utmp_ent)
if (display)
*display++ = '\0';
if (*ut_host)
/* See if we can canonicalize it. */
host = canon_host (ut_host);
if (*ut_host && do_lookup)
{
/* See if we can canonicalize it. */
host = canon_host (ut_host);
}
if (! host)
host = ut_host;

View File

@@ -7,5 +7,5 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=basename

View File

@@ -59,14 +59,18 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AMDEP = @AMDEP@
AMTAR = @AMTAR@
AMTARFLAGS = @AMTARFLAGS@
AWK = @AWK@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DATADIRNAME = @DATADIRNAME@
DEPDIR = @DEPDIR@
FESETROUND_LIBM = @FESETROUND_LIBM@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -115,7 +119,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=basename
subdir = tests/basename
@@ -145,22 +149,16 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
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/basename/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pR $$d/$$file $(distdir); \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \
@@ -248,6 +246,7 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-rm -f Makefile.in
mostlyclean-am: mostlyclean-generic
mostlyclean: mostlyclean-am

View File

@@ -145,7 +145,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -148,7 +148,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -15,7 +15,11 @@ pwd=`pwd`
dir=cpmvbak-$$
actual=$dir/actual
expected=$dir/expected
trap "cd $pwd; rm -rf $dir" 0 1 2 3 15
# Be careful to close $actual before removing the containing directory.
# Use `1>&2' rather than `1<&-' since the latter appears not to work
# with /bin/sh from powerpc-ibm-aix4.2.0.0.
trap "cd $pwd; exec 1>&2; rm -rf $dir" 0 1 2 3 15
mkdir $dir
unset VERSION_CONTROL SIMPLE_BACKUP_SUFFIX

View File

@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
install_sh = @install_sh@
l = @l@
@@ -172,7 +173,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -9,7 +9,7 @@ W92-3.X millen-1.X rel-0.X rel-1a.X rel-1b.X rel-2a.X rel-2b.X rel-2c.X \
rel-2d.X rel-2e.X rel-2f.X rel-2g.X rel-3a.X next-s.X next-m.X next-h.X \
next-d.X next-w.X next-mo.X next-y.X utc-0.X utc-0a.X utc-1.I utc-1.X \
utc-1a.I utc-1a.X date2sec-0.X date2sec-0a.X date2sec-1.X sec2date-0.X \
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X regress-1.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 8.O 8.E 9.O \
9.E leap-1.O leap-1.E U95-1.O U95-1.E U95-2.O U95-2.E U95-3.O U95-3.E U92-1.O \
U92-1.E U92-2.O U92-2.E U92-3.O U92-3.E V92-1.O V92-1.E V92-2.O V92-2.E \
@@ -22,7 +22,7 @@ next-w.E next-mo.O next-mo.E next-y.O next-y.E utc-0.O utc-0.E utc-0a.O \
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 this-m.O this-m.E this-h.O this-h.E this-w.O this-w.E this-mo.O \
this-mo.E this-y.O this-y.E risks-1.O risks-1.E
this-mo.E this-y.O this-y.E risks-1.O risks-1.E regress-1.O regress-1.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)

View File

@@ -59,14 +59,18 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AMDEP = @AMDEP@
AMTAR = @AMTAR@
AMTARFLAGS = @AMTARFLAGS@
AWK = @AWK@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DATADIRNAME = @DATADIRNAME@
DEPDIR = @DEPDIR@
FESETROUND_LIBM = @FESETROUND_LIBM@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -115,7 +119,7 @@ W92-3.X millen-1.X rel-0.X rel-1a.X rel-1b.X rel-2a.X rel-2b.X rel-2c.X \
rel-2d.X rel-2e.X rel-2f.X rel-2g.X rel-3a.X next-s.X next-m.X next-h.X \
next-d.X next-w.X next-mo.X next-y.X utc-0.X utc-0a.X utc-1.I utc-1.X \
utc-1a.I utc-1a.X date2sec-0.X date2sec-0a.X date2sec-1.X sec2date-0.X \
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X
this-m.X this-h.X this-w.X this-mo.X this-y.X risks-1.X regress-1.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 8.O 8.E 9.O \
9.E leap-1.O leap-1.E U95-1.O U95-1.E U95-2.O U95-2.E U95-3.O U95-3.E U92-1.O \
@@ -129,7 +133,7 @@ next-w.E next-mo.O next-mo.E next-y.O next-y.E utc-0.O utc-0.E utc-0a.O \
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 this-m.O this-m.E this-h.O this-h.E this-w.O this-w.E this-mo.O \
this-mo.E this-y.O this-y.E risks-1.O risks-1.E
this-mo.E this-y.O this-y.E risks-1.O risks-1.E regress-1.O regress-1.E
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
@@ -173,22 +177,16 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
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/date/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pR $$d/$$file $(distdir); \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \
@@ -277,6 +275,7 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-rm -f Makefile.in
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
mostlyclean-am: mostlyclean-generic

View File

@@ -113,6 +113,9 @@ sub test_vector
['risks-1', "-d 'Nov 10 1996' $fmt", {}, "1996-11-10 00:00:00", 0],
['regress-1', "-u -d '1996-11-10 0:00:00 +0' $fmt", {},
"1996-11-10 00:00:00", 0],
# FIXME: add a lot more...
);
@@ -127,6 +130,10 @@ sub test_vector
$Test::env{'utc-0'} = ['TZ=UTC+4'];
# This one would pass if TZ (with any, or even no, value) were in
# the environment.
$Test::env{'regress-1'} = ['LANG=C'];
$Test::env{'utc-1'} = ['TZ=UTC+1'];
$Test::input_via{'utc-1'} = {REDIR => 0};
$Test::input_via{'utc-1a'} = {REDIR => 0};

View File

@@ -953,8 +953,25 @@ else
esac
fi
test -s risks-1.E || rm -f risks-1.E
LANG=C $xx -u -d '1996-11-10 0:00:00 +0' '+%Y-%m-%d %T' > regress-1.O 2> regress-1.E
code=$?
if test $code != 0 ; then
$echo "Test regress-1(LANG=C) failed: ../../src/date return code $code differs from expected value 0" 1>&2
errors=`expr $errors + 1`
else
cmp regress-1.O $srcdir/regress-1.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed regress-1(LANG=C)"; fi ;;
1) $echo "Test regress-1(LANG=C) failed: files regress-1.O and $srcdir/regress-1.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test regress-1(LANG=C) may have failed." 1>&2;
$echo The command "cmp regress-1.O $srcdir/regress-1.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s regress-1.E || rm -f regress-1.E
if test $errors = 0 ; then
$echo Passed all 55 tests. 1>&2
$echo Passed all 56 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi

View File

@@ -6,7 +6,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=ls
TESTS = misc

View File

@@ -107,7 +107,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=ls
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -6,7 +6,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=dircolors
TESTS = simple

View File

@@ -107,7 +107,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=dircolors
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -7,5 +7,5 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=factor

View File

@@ -59,14 +59,18 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AMDEP = @AMDEP@
AMTAR = @AMTAR@
AMTARFLAGS = @AMTARFLAGS@
AWK = @AWK@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DATADIRNAME = @DATADIRNAME@
DEPDIR = @DEPDIR@
FESETROUND_LIBM = @FESETROUND_LIBM@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -115,7 +119,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=factor
subdir = tests/factor
@@ -145,22 +149,16 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
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/factor/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pR $$d/$$file $(distdir); \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \
@@ -248,6 +246,7 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-rm -f Makefile.in
mostlyclean-am: mostlyclean-generic
mostlyclean: mostlyclean-am

View File

@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
install_sh = @install_sh@
l = @l@
@@ -167,7 +168,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -148,7 +148,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
install_sh = @install_sh@
l = @l@
@@ -172,7 +173,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -145,7 +145,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -6,7 +6,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=ls
TESTS = tests

View File

@@ -107,7 +107,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=ls
@@ -149,7 +149,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = 1.2 gnits
TESTS = rt-1 time-1
TESTS = rt-1 time-1 symlink-slash
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \

View File

@@ -103,7 +103,7 @@ l = @l@
AUTOMAKE_OPTIONS = 1.2 gnits
TESTS = rt-1 time-1
TESTS = rt-1 time-1 symlink-slash
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
@@ -148,7 +148,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

35
tests/ls/symlink-slash Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
# Do dereference a symlink arg if its name is written with a trailing slash.
if test "$VERBOSE" = yes; then
set -x
ls --version
fi
tmp=t-ls.$$
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
mkdir dir || framework_failure=1
ln -s dir symlink || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
LANGUAGE=C; export LANGUAGE
LANG=C; export LANG
fail=0
set `ls -l symlink/`
# Prior to fileutils-4.0k, the following would have output `... symlink -> dir'.
test "$*" = 'total 0' && : || fail=1
cd ..
rm -rf $tmp
exit $fail

View File

@@ -1,8 +1,6 @@
#!/bin/sh
# Test some of ls's sorting options.
test=time-1
if test "$VERBOSE" = yes; then
set -x
ls --version
@@ -10,9 +8,9 @@ fi
tmp=t-ls.$$
test_failure=0
mkdir $tmp || test_failure=1
cd $tmp || test_failure=1
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
t1='1998-01-15 21:00'
t2='1998-01-15 22:00'
@@ -22,15 +20,15 @@ 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 -m -d "$t3" a || framework_failure=1
touch -m -d "$t2" b || framework_failure=1
touch -m -d "$t1" c || framework_failure=1
touch -a -d "$u3" c || test_failure=1
touch -a -d "$u2" b || test_failure=1
touch -a -d "$u3" c || framework_failure=1
touch -a -d "$u2" b || framework_failure=1
# Make sure A has ctime at least 1 second more recent than C's.
sleep 2
touch -a -d "$u1" a || test_failure=1
touch -a -d "$u1" a || framework_failure=1
fail=0
@@ -43,21 +41,51 @@ test "$*" = 'a c' || fail=1
sleep 2
# Create a link, updating c's ctime.
ln c d || test_failure=1
ln c d || framework_failure=1
if test $test_failure = 1; then
# Before we go any further, verify that touch's -m option works.
set -- `ls --full -l a`
case "$*" in
*'Jan 15 23:00:00 1998 a') ;;
*)
# This might be what's making HPUX 11 systems fail this test.
cat >&2 << \EOF
A basic test of touch -a has just failed, so the subsequent
tests in this file will not be run.
EOF
framework_failure=1
;;
esac
# Now test touch's -a option.
set -- `ls --full -lu a`
case "$*" in
*'Jan 14 11:00:00 1998 a') ;;
*)
# This might be what's making HPUX 11 systems fail this test.
cat >&2 << \EOF
A basic test of touch -m has just failed, so the subsequent
tests in this file will not be run.
EOF
framework_failure=1
;;
esac
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
set `ls -u a b c`
set `ls -ut a b c`
test "$*" = 'c b a' && : || fail=1
test $fail = 1 && ls -l --full-time --time=access a b c
set `ls -t a b c`
test "$*" = 'a b c' && : || fail=1
test $fail = 1 && ls -l --full-time a b c
# Now, C should have ctime more recent than A.
set `ls -c a c`
set `ls -ct a c`
if test "$*" = 'c a'; then
: ok
else

View File

@@ -6,7 +6,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=md5sum
TESTS = basic-1 newline-1

View File

@@ -97,6 +97,7 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
install_sh = @install_sh@
l = @l@
@@ -106,7 +107,7 @@ TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PATH=`pwd`/../../src:$$PATH \
PROG=md5sum
@@ -148,7 +149,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -143,7 +143,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -2,7 +2,7 @@
AUTOMAKE_OPTIONS = 1.3 gnits
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
i-1 hard-link-1 force
i-1 hard-link-1 force partition-perm to-symlink
EXTRA_DIST = $(TESTS) setup
TESTS_ENVIRONMENT = \

View File

@@ -104,7 +104,7 @@ l = @l@
AUTOMAKE_OPTIONS = 1.3 gnits
TESTS = mv-special-1 into-self into-self-2 into-self-3 backup-is-src \
i-1 hard-link-1 force
i-1 hard-link-1 force partition-perm to-symlink
EXTRA_DIST = $(TESTS) setup
@@ -158,7 +158,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; \
srcdir=$(srcdir); export srcdir; \

View File

@@ -1,12 +1,9 @@
#!/bin/sh
# Force mv to use the copying code.
: ${MV=mv}
: ${RM=rm}
if test "$VERBOSE" = yes; then
set -x
$MV --version
mv --version
fi
. $srcdir/setup
@@ -19,7 +16,7 @@ a="$other_partition_tmpdir/a"
a2="$other_partition_tmpdir/a~"
framework_failure=0
$RM -f $a $a2 || framework_failure=1
rm -f $a $a2 || framework_failure=1
echo a > $a || framework_failure=1
echo a2 > $a2 || framework_failure=1
@@ -37,10 +34,10 @@ LANG=C
export LANG
# This mv command should exit nonzero.
$MV --b=simple $a2 $a > out 2>&1 && fail=1
mv --b=simple $a2 $a > out 2>&1 && fail=1
sed \
-e "s,$MV:,XXX:," \
-e "s,mv:,XXX:," \
-e "s,$a,YYY," \
-e "s,$a2,ZZZ," \
out > out2
@@ -51,6 +48,6 @@ EOF
cmp out2 exp || fail=1
$RM -fr out out2 exp $a $a2 $other_partition_tmpdir
rm -fr out out2 exp $a $a2 $other_partition_tmpdir
exit $fail

View File

@@ -2,15 +2,9 @@
# move a directory containing hard-linked files and
# make sure the links are preserved
: ${MV=mv}
: ${RM=rm}
: ${MKDIR=mkdir}
: ${LN=ln}
: ${LS=ls}
if test "$VERBOSE" = yes; then
set -x
$MV --version
mv --version
fi
. $srcdir/setup
@@ -22,9 +16,9 @@ fi
dir=hlink
framework_failure=0
$MKDIR $dir || framework_failure=1
mkdir $dir || framework_failure=1
> $dir/a || framework_failure=1
$LN $dir/a $dir/b || framework_failure=1
ln $dir/a $dir/b || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
@@ -39,16 +33,16 @@ export LC_ALL
LANG=C
export LANG
$MV $dir $other_partition_tmpdir || fail=1
mv $dir $other_partition_tmpdir || fail=1
# Display inode numbers, one per line.
$LS -1i $other_partition_tmpdir/$dir > out || fail=1
ls -1i $other_partition_tmpdir/$dir > out || fail=1
# Make sure the inode numbers are the same.
a=`sed -n 's/ a$//p' out`
b=`sed -n 's/ b$//p' out`
test "$a" = "$b" || fail=1
$RM -fr out $dir $other_partition_tmpdir
rm -fr out $dir $other_partition_tmpdir
exit $fail

View File

@@ -1,14 +1,9 @@
#! /bin/sh
# Demonstrate how mv fails when it tries to move a directory into itself.
: ${MV=mv}
: ${MKDIR=mkdir}
: ${RM=rm}
: ${TOUCH=touch}
if test "$VERBOSE" = yes; then
set -x
$MV --version
mv --version
fi
dir=into-self-dir
@@ -16,9 +11,9 @@ file=into-self-file
test_failure=0
$RM -rf $dir $file || test_failure=1
$MKDIR -p $dir/a/b || test_failure=1
$TOUCH $file || test_failure=1
rm -rf $dir $file || test_failure=1
mkdir -p $dir/a/b || test_failure=1
touch $file || test_failure=1
if test $test_failure = 1; then
echo 'failure in testing framework'
@@ -36,10 +31,10 @@ LANG=C
export LANG
# This mv command should fail.
$MV $dir $file $dir > out 2>&1 && fail=1
mv $dir $file $dir > out 2>&1 && fail=1
sed \
-e "s,$MV:,XXX:," \
-e "s,mv:,XXX:," \
-e "s,$dir,SRC," \
-e "s,$dir/$dir,DEST," \
out > out2
@@ -57,6 +52,6 @@ test -d $dir || fail=1
test -d $dir/$dir && fail=1
# Make sure the file has been moved to the right place.
test -f $dir/$file || fail=1
$RM -rf $dir $file out out2 exp
rm -rf $dir $file out out2 exp
exit $fail

View File

@@ -17,6 +17,11 @@ fi
file="$other_partition_tmpdir/file"
symlink=symlink
fail=0
trap 'rm -fr out out2 exp $file $symlink $other_partition_tmpdir; exit $fail' \
0 1 2 3 15
framework_failure=0
rm -f $file $symlink || framework_failure=1
echo whatever > $file || framework_failure=1
@@ -35,11 +40,19 @@ export LC_ALL
LANG=C
export LANG
unset VERSION_CONTROL
if test "${VERSION_CONTROL+set}" = set; then
echo '$0: the VERSION_CONTROL envvar is set --' \
' unset it and rerun this test' >&2
exit 1
fi
# This mv command should exit nonzero.
mv $symlink $file > out 2>&1 && fail=1
# And so should this one.
mv $file $symlink >> out 2>&1 && fail=1
# This should succeed.
mv $file $symlink || fail=1
sed \
-e "s,mv:,XXX:," \
@@ -49,12 +62,10 @@ sed \
cat > exp <<\EOF
XXX: `ZZZ' and `YYY' are the same file
XXX: `YYY' and `ZZZ' are the same file
EOF
#'
cmp out2 exp || fail=1
rm -fr out out2 exp $file $symlink $other_partition_tmpdir
test $fail = 1 && diff out2 exp 2> /dev/null
exit $fail

View File

@@ -6,14 +6,14 @@
if test "$VERBOSE" = yes; then
set -x
$MV --version
mv --version
fi
dir1=is3-dir1
dir2=is3-dir2
framework_failure=0
$RM -rf $dir1 $dir2 || framework_failure=1
rm -rf $dir1 $dir2 || framework_failure=1
mkdir $dir1 $dir2 || framework_failure=1
if test $framework_failure = 1; then
@@ -30,10 +30,10 @@ LANG=C
export LANG
# This mv command should exit nonzero.
$MV $dir1 $dir2 $dir2 > out 2>&1 && fail=1
mv $dir1 $dir2 $dir2 > out 2>&1 && fail=1
sed \
-e "s,$MV:,XXX:,g" \
-e "s,mv:,XXX:,g" \
-e "s,$dir2,ZZZ,g" \
out > out2
@@ -43,6 +43,6 @@ EOF
cmp out2 exp || fail=1
$RM -fr out out2 exp $dir1 $dir2
rm -fr out out2 exp $dir1 $dir2
exit $fail

View File

@@ -1,12 +1,5 @@
#! /bin/sh
: ${LS=ls}
: ${MV=mv}
: ${MKDIR=mkdir}
: ${MKNOD=mknod}
: ${RM=rm}
: ${TOUCH=touch}
. $srcdir/setup
if test -z "$other_partition_tmpdir"; then
@@ -18,10 +11,10 @@ dir=.mv-dir
framework_failure=0
$RM -f $null || framework_failure=1
$MKNOD $null p || framework_failure=1
$MKDIR -p $dir/a/b/c $dir/d/e/f || framework_failure=1
$TOUCH $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
rm -f $null || framework_failure=1
mknod $null p || framework_failure=1
mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure=1
touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
@@ -37,13 +30,13 @@ LANG=C
export LANG
fail=0
$MV --verbose $null $dir $other_partition_tmpdir > out || fail=1
mv --verbose $null $dir $other_partition_tmpdir > out || fail=1
# Make sure the files are gone.
test -f $null && fail=1
test -d $dir && fail=1
# Make sure they were moved.
# Since `test -e' is not portable, use `ls'.
$LS $other_partition_tmpdir/$null > /dev/null || fail=1
ls $other_partition_tmpdir/$null > /dev/null || fail=1
test -d $other_partition_tmpdir/$dir/a/b/c || fail=1
sed "s,$other_partition_tmpdir,XXX," out > out2
@@ -81,8 +74,8 @@ EOF
cmp out2 exp || fail=1
# cd $other_partition_tmpdir
# $LS -l -A -R $other_partition_tmpdir
# ls -l -A -R $other_partition_tmpdir
$RM -rf $null $dir $other_partition_tmpdir out out2 exp
rm -rf $null $dir $other_partition_tmpdir out out2 exp
exit $fail

52
tests/mv/partition-perm Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# Make sure permissions are preserved when moving from one partition to another.
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
. $srcdir/setup
if test -z "$other_partition_tmpdir"; then
exit 77
fi
LANGUAGE=C; export LANGUAGE
LANG=C; export LANG
pwd=`pwd`
dir=p-perm-$$
trap "cd $pwd; rm -rf $dir $other_partition_tmpdir" 0 1 2 3 15
mkdir $dir
unset VERSION_CONTROL SIMPLE_BACKUP_SUFFIX
if test "${VERSION_CONTROL+set}" = set; then
echo '$0: the VERSION_CONTROL envvar is set --' \
' unset it and rerun this test' >&2
exit 1
fi
if test "${SIMPLE_BACKUP_SUFFIX+set}" = set; then
echo '$0: the SIMPLE_BACKUP_SUFFIX envvar is set --' \
' unset it and rerun this test' >&2
>&2
exit 1
fi
cd $dir
: > file
chmod a=rwx file
umask 777
mv file $other_partition_tmpdir
fail=0
test -f file && fail=1
test -f $other_partition_tmpdir/file || fail=1
# This would have failed with the mv from fileutils-4.0i.
test -r $other_partition_tmpdir/file || fail=1
exit $fail

View File

@@ -4,9 +4,6 @@
# of the current directory. If one is found, create a temporary directory
# inside it.
: ${DF=df}
: ${MKDIR=mkdir}
: ${CANDIDATE_TMP_DIRS=not_set}
# Work around a bug in the way Ultrix4.3a's /bin/sh handles multi-word
@@ -18,15 +15,15 @@ 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'`
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'`
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
if mkdir "$d/df-$$" > /dev/null 2>&1; then
other_partition_tmpdir="$d/df-$$"
break
fi

50
tests/mv/to-symlink Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/sh
# Make sure that the copying code used in an inter-partition
# move unlinks a destination symlink before opening it.
if test "$VERBOSE" = yes; then
set -x
mv --version
fi
. $srcdir/setup
if test -z "$other_partition_tmpdir"; then
exit 77
fi
rem_file="$other_partition_tmpdir/file"
rem_symlink="$other_partition_tmpdir/symlink"
file=to-sym-$$
fail=0
trap 'rm -fr $file $other_partition_tmpdir; exit $fail' 0 1 2 3 15
framework_failure=0
rm -f $file || framework_failure=1
echo local > $file || framework_failure=1
echo remote > $rem_file || framework_failure=1
ln -s $rem_file $rem_symlink || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
exit 1
fi
unset VERSION_CONTROL
if test "${VERSION_CONTROL+set}" = set; then
echo '$0: the VERSION_CONTROL envvar is set --' \
' unset it and rerun this test' >&2
exit 1
fi
# This mv command should succeed, unlinking the symlink
# before copying.
mv $file $rem_symlink || fail=1
# Make sure $rem_file is unmodified.
test `cat $rem_file` = remote || fail=1
exit $fail

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