Compare commits

...

474 Commits

Author SHA1 Message Date
Jim Meyering
c453666c3a use double parens on AC_CHECK_MEMBERS 2000-01-30 21:19:00 +00:00
Jim Meyering
cbe550de62 (writable-files): Check $(xd-delta), too. 2000-01-30 21:10:24 +00:00
Jim Meyering
333d061276 *** empty log message *** 2000-01-30 20:56:57 +00:00
Jim Meyering
b0be1bfab9 do it right 2000-01-30 18:33:17 +00:00
Jim Meyering
c58c8f5fcf (writable-files): New target.
(my-distcheck): Depend on it.
(alpha): Likewise.
2000-01-30 18:27:51 +00:00
Jim Meyering
9733e004ef *** empty log message *** 2000-01-30 16:48:25 +00:00
Jim Meyering
fd3817b9dc Clean up some kludgy old shadow password tests. 2000-01-30 16:48:19 +00:00
Jim Meyering
744efcce69 (utmp_includes): Define.
Check for ut_user and ut_name members in both struct utmpx
and struct utmp.
2000-01-30 16:47:31 +00:00
Jim Meyering
3d64706c7e redo it on per-header basis 2000-01-30 16:45:17 +00:00
Jim Meyering
774786b0cd *** empty log message *** 2000-01-30 16:41:30 +00:00
Jim Meyering
22cb099f3c (extract_trimmed_name): Use UT_USER instead of hard-coding
uses of ->ut_name.  The latter doesn't work with new Linux header files
where only utmpx.ut_user is declared.
2000-01-30 16:41:25 +00:00
Jim Meyering
b737ed325a (UT_USER): Define. Accessor macro for the member named ut_user or ut_name. 2000-01-30 16:39:08 +00:00
Jim Meyering
fedbe363a9 *** empty log message *** 2000-01-30 15:02:56 +00:00
Jim Meyering
5df431d118 *** empty log message *** 2000-01-30 15:01:02 +00:00
Jim Meyering
b43184c5e5 (my-distcheck): Depend on po-check, so I'll be warned
about any required changes at `make distcheck' time rather than at
`make alpha' time.
2000-01-30 15:00:57 +00:00
Jim Meyering
ab365a8297 *** empty log message *** 2000-01-30 12:21:37 +00:00
Jim Meyering
f573721b82 *** empty log message *** 2000-01-30 12:17:37 +00:00
Jim Meyering
1c1efebc1d *** empty log message *** 2000-01-30 12:17:07 +00:00
Jim Meyering
be27aed1ec . 2000-01-30 12:13:26 +00:00
Jim Meyering
cf16d34a4d . 2000-01-30 12:12:36 +00:00
Jim Meyering
8d6ec015de *** empty log message *** 2000-01-30 12:12:00 +00:00
Jim Meyering
5c4b305870 *** empty log message *** 2000-01-30 12:09:42 +00:00
Jim Meyering
62ec3fd688 (ST_NBLOCKS): Use st_size only for regular files and
for directories.  From H. J. Lu.
2000-01-30 12:09:30 +00:00
Jim Meyering
eda468af14 *** empty log message *** 2000-01-30 12:08:36 +00:00
Jim Meyering
8775803a9d (main): Exit with nonzero status if ftruncate fails. 2000-01-30 12:01:39 +00:00
Jim Meyering
8c6fe7ba06 *** empty log message *** 2000-01-30 12:00:14 +00:00
Jim Meyering
2e962bb26f *** empty log message *** 2000-01-30 11:59:50 +00:00
Jim Meyering
3f8032ddc9 *** empty log message *** 2000-01-30 11:57:08 +00:00
Jim Meyering
7a4fca9d77 whoops: s/jm_MACROS/jm_LIB_CHECK/ 2000-01-29 17:05:03 +00:00
Jim Meyering
c1aaa6492f *** empty log message *** 2000-01-29 17:00:03 +00:00
Jim Meyering
f8f48d0023 . 2000-01-29 16:59:09 +00:00
Jim Meyering
e446ebf6c3 New file containing library-related checks from
fileutils and sh-utils (textutils had none).
2000-01-29 14:11:35 +00:00
Jim Meyering
273d5d4925 *** empty log message *** 2000-01-29 14:10:51 +00:00
Jim Meyering
bd8333c63d *** empty log message *** 2000-01-29 11:07:24 +00:00
Jim Meyering
d176b68faa add lots of seq examples 2000-01-29 11:06:42 +00:00
Jim Meyering
f6b673d543 patch from Bruno demonstrating how to use seq to produce integer
output or output in non-decimal
2000-01-29 10:09:40 +00:00
Jim Meyering
bb84498a89 back out bruno's %d, %u, etc. changes 2000-01-29 10:06:12 +00:00
Jim Meyering
90eddc5478 *** empty log message *** 2000-01-29 10:05:42 +00:00
Jim Meyering
e3fa0cb53b Back out most of the 2000-01-21 and 01-22 changes.
[Instead, merely give examples showing how to accomplish the same
task with fewer limitations using existing tools. ]
Suggestion from Bruno Haible.
(valid_format): Rename from check_format.
2000-01-29 10:05:35 +00:00
Jim Meyering
62205d8c7e Back out the 2000-01-21 change.
Remove associated tests and add two equal-width ones.
2000-01-29 09:57:31 +00:00
Jim Meyering
6cac32ec7f *** empty log message *** 2000-01-29 09:56:32 +00:00
Jim Meyering
4db6224838 Set COLUMNS envvar, just to be safe. 2000-01-29 09:50:49 +00:00
Jim Meyering
ba088349be (screen_columns): Change #if-0 (test code, mistakenly committed in last delta)
back to #ifdef TIOCGWINSZ.
2000-01-29 09:50:14 +00:00
Jim Meyering
bbcd510bc5 *** empty log message *** 2000-01-28 22:04:47 +00:00
Jim Meyering
489f1925be Change format of warning message to look more like that
from the missing script.  Suggestion from Franois Pinard.
2000-01-28 22:04:41 +00:00
Jim Meyering
d813adbf1f *** empty log message *** 2000-01-28 08:32:14 +00:00
Jim Meyering
13707ac76a (wrapf): Emit a newline only if 0 < current_col.
(screen_columns): Use xstrtol, not atoi.
If get_win_size fails and $COLUMNS == 0, then return 80, not `0'.
2000-01-28 08:32:01 +00:00
Jim Meyering
b631b5c3ac (detect_loop): Update incomplete comment.
From Mark Kettenis.
2000-01-26 21:47:06 +00:00
Jim Meyering
06b0be15bb *** empty log message *** 2000-01-25 12:07:14 +00:00
Jim Meyering
1f18465289 Change expected output for cycle-1 and cycle-2 tests. 2000-01-25 12:07:02 +00:00
Jim Meyering
a8b0898ba5 tsort now works more like the traditional UNIX tsort. Before it would
exit when it found a loop.  Now it continues and outputs all items.

(exit_status): New variable.
(loop): New varibale.
(count_items, scan_zeroes): Change return type to int.
(detect_loop): Complete rewrite to correctly implement detection
of loops.  Also change return type to int.
(recurse_tree): Stop if ACTION returns non-zero.  This involves
changing the return type of this function and ACTION to int.
(walk_tree): Change return type of ACTION to int.
(tsort): Continue sort after a loop has been detected (and
broken).  Set exit_status to 1 if a loop was detected.
(main): Use exit_status to determine exit code.
2000-01-25 12:03:15 +00:00
Jim Meyering
9a2ff5e31c *** empty log message *** 2000-01-25 12:02:16 +00:00
Jim Meyering
03caa431a0 *** empty log message *** 2000-01-25 07:26:20 +00:00
Jim Meyering
231f8fc887 Require AC_HEADER_TIME, and include sys/time.h as well
as time.h in the compile check.
2000-01-25 07:26:14 +00:00
Jim Meyering
15ee939c3c bump serial 2000-01-25 07:25:49 +00:00
Jim Meyering
893fdf84e8 Fix typo in cross-compiling case: s/yes/no/. 2000-01-25 07:25:38 +00:00
Jim Meyering
f57f26e36a Require AC_HEADER_TIME rather than simply using it. 2000-01-25 07:21:57 +00:00
Jim Meyering
7d31261496 . 2000-01-25 07:20:58 +00:00
Jim Meyering
b67de020d9 *** empty log message *** 2000-01-24 13:58:45 +00:00
Jim Meyering
06eee4e253 (usage): Describe behavior when LINK_NAME is omitted.
From Michael Stone.
2000-01-24 13:58:38 +00:00
Jim Meyering
efa9563f3d (main): Don't expect array index `n_files - 1' to evaluate
to `-1' for unsigned int n_files == 0.  Doing so lead to a segfault on
alpha.  From Michael Stone.
2000-01-24 13:48:12 +00:00
Jim Meyering
ae5c430364 *** empty log message *** 2000-01-23 16:25:35 +00:00
Jim Meyering
fe3a834b9f Move df-related tests here from fileutils/configure.in 2000-01-23 16:23:50 +00:00
Jim Meyering
d32cf4d872 . 2000-01-23 16:20:48 +00:00
Jim Meyering
9e30aaca79 *** empty log message *** 2000-01-23 16:20:34 +00:00
Jim Meyering
26c96331b2 s/list_mounted_fs/ac_list_mounted_fs/
(jm_LIST_MOUNTED_FILESYSTEMS): Take two parameters.
2000-01-23 16:20:21 +00:00
Jim Meyering
81df043fdd (jm_FILE_SYSTEM_USAGE): Take two parameters. 2000-01-23 14:49:09 +00:00
Jim Meyering
d495aaf3e7 s/space/ac_fsusage_space/. 2000-01-23 14:12:45 +00:00
Jim Meyering
3705d57846 Extracted from fileutils/configure.in. 2000-01-23 14:08:35 +00:00
Jim Meyering
d5eb5821c6 . 2000-01-23 14:01:32 +00:00
Jim Meyering
48efd1644d (jm_CHECK_ALL_TYPES): Require AC_HEADER_MAJOR and AC_HEADER_DIRENT. 2000-01-23 10:55:10 +00:00
Jim Meyering
a9d4aadb5e *** empty log message *** 2000-01-23 10:55:00 +00:00
Jim Meyering
ce0262560b *** empty log message *** 2000-01-23 10:35:49 +00:00
Jim Meyering
505805856e (jm_FUNC_FTRUNCATE): AC_REQUIRE it. 2000-01-23 10:34:42 +00:00
Jim Meyering
aef5ff97f7 *** empty log message *** 2000-01-23 10:34:04 +00:00
Jim Meyering
7d7c104722 *** empty log message *** 2000-01-23 10:23:26 +00:00
Jim Meyering
d0a520d367 (AC_SUBST(DF_PROG)): Moved from fileutils/configure.in. 2000-01-23 10:23:23 +00:00
Jim Meyering
4d5960cf1f *** empty log message *** 2000-01-23 10:19:30 +00:00
Jim Meyering
5adc8fd591 (AM_FUNC_STRTOD): Added (from textutils', sh-utils' configure.in).
(AC_SUBST(POW_LIBM)): Likewise.
2000-01-23 10:19:26 +00:00
Jim Meyering
47b4e7f1aa *** empty log message *** 2000-01-23 10:18:15 +00:00
Jim Meyering
46980c56e0 (AC_CHECK_FUNCS): Merge all checks from fileutils, textutils, sh-utils. 2000-01-23 10:13:25 +00:00
Jim Meyering
86f00ce878 *** empty log message *** 2000-01-23 10:09:22 +00:00
Jim Meyering
2c702c93fe *** empty log message *** 2000-01-23 09:53:53 +00:00
Jim Meyering
c91b47d64f (libfetish_a_SOURCES): Remove explicit mention of obstack.c. 2000-01-23 09:53:48 +00:00
Jim Meyering
9e4428a605 (AM_FUNC_OBSTACK): Add (from fileutils/configure.in). 2000-01-23 09:52:35 +00:00
Jim Meyering
b76b69c8a2 *** empty log message *** 2000-01-23 09:52:02 +00:00
Jim Meyering
4f0cb8adcb *** empty log message *** 2000-01-23 09:31:09 +00:00
Jim Meyering
cbe1109277 (OPTIONAL_BIN_PROGS, OPTIONAL_BIN_ZCRIPTS, MAN):
AC_SUBST these here, rather than just in sh-util/configure.in, so
that the now-shared-by-fileutils-and-textutils lib/Makefile.am are
all the same.
2000-01-23 09:31:06 +00:00
Jim Meyering
08e09e9ab4 version-control: never 2000-01-23 09:19:33 +00:00
Jim Meyering
f3f4a60164 . 2000-01-23 09:08:39 +00:00
Jim Meyering
dce8ba11dd . 2000-01-22 22:55:11 +00:00
Jim Meyering
45d534215a (keycompare): Use global, hard_LC_COLLATE in place of
local that is sometimes undeclared.
2000-01-22 22:54:51 +00:00
Jim Meyering
1a50efcd03 *** empty log message *** 2000-01-22 22:43:37 +00:00
Jim Meyering
86a839108c [! HAVE_DECL_STRTOUL]: Declare strtoul.
[! HAVE_DECL_STRTOULL]: Declare strtoull.
Required for some AIX systems.  Reported by Christian Krackowizer.
[TESTING] (main): New function.
2000-01-22 22:43:31 +00:00
Jim Meyering
aebba9cd1d [! HAVE_DECL_STRTOUL]: Declare strtoul.
[! HAVE_DECL_STRTOULL]: Declare strtoull.
Required for some AIX systems.  Reported by Christian Krackowizer.
2000-01-22 22:41:02 +00:00
Jim Meyering
42e962a284 *** empty log message *** 2000-01-22 22:26:17 +00:00
Jim Meyering
0de00b9e6a Call AC_PROG_CC_STDC just before AC_C_CONST. 2000-01-22 22:25:25 +00:00
Jim Meyering
f23d5119d8 *** empty log message *** 2000-01-22 22:21:32 +00:00
Jim Meyering
0d9735fbb4 *** empty log message *** 2000-01-22 22:20:08 +00:00
Jim Meyering
0b7e06d203 [HAVE_WCTYPE_H]: Include <wctype.h>. 2000-01-22 22:19:48 +00:00
Jim Meyering
968d5b2bbf (jm_PREREQ_QUOTEARG): Add wctype.h. 2000-01-22 22:19:12 +00:00
Jim Meyering
abab15deb9 *** empty log message *** 2000-01-22 22:08:50 +00:00
Jim Meyering
570080ef25 Merge the three lists of headers. 2000-01-22 22:08:08 +00:00
Jim Meyering
595bfc8a83 *** empty log message *** 2000-01-22 22:05:13 +00:00
Jim Meyering
dfb0540bb1 (AC_CHECK_HEADERS): Add checks from textutils' configure.in 2000-01-22 22:04:33 +00:00
Jim Meyering
c099a14fac *** empty log message *** 2000-01-22 22:03:12 +00:00
Jim Meyering
c219eb2daf (AC_CHECK_HEADERS): Add checks from sh-utils' configure.in 2000-01-22 22:03:01 +00:00
Jim Meyering
c9c2cdda8b *** empty log message *** 2000-01-22 22:00:31 +00:00
Jim Meyering
58da7aa5b3 (AC_CHECK_HEADERS): Add checks from fileutils' configure.in 2000-01-22 22:00:17 +00:00
Jim Meyering
7bce838dab *** empty log message *** 2000-01-22 21:52:02 +00:00
Jim Meyering
24c45a756e (jm_PREREQ_ADDEXT): New macro. Parts moved here from fileutils' configure.in. 2000-01-22 21:51:57 +00:00
Jim Meyering
d4db66a0fb *** empty log message *** 2000-01-22 21:29:10 +00:00
Jim Meyering
09f1b5f940 (dir_name): Support for DOS-style file names with drive letters. 2000-01-22 21:29:02 +00:00
Jim Meyering
a2e435c395 tack on the one from fileutils/lib 2000-01-22 18:03:21 +00:00
Jim Meyering
e1cc8122af . 2000-01-22 14:27:13 +00:00
Jim Meyering
8ce9f19835 Remove kludgy `test -z $ac_...AC_CHECK_HEADERS(...)' code.
Moved tests into their own function (_jm_DECL_HEADERS) in check-decl.m4.
2000-01-22 14:24:50 +00:00
Jim Meyering
f5ff12fcbc (_jm_DECL_HEADERS): Define new function.
(jm_CHECK_DECLARATIONS): Require it.
2000-01-22 14:22:42 +00:00
Jim Meyering
c7bd32731e Revert to using #if HAVE_STDLIB_H
to guard inclusion of <stdlib.h>.
2000-01-22 14:07:23 +00:00
Jim Meyering
0f9105c7be Guard inclusion of <stdlib.h> with `#if STDC_HEADERS',
not `#if HAVE_STDLIB_H'.  The former wasn't defined.
Use #if rather than #ifdef.

Add HAVE_DECL_STRTOUL and HAVE_DECL_STRTOULL.
(jm_CHECK_DECLARATIONS): Add strtoul strtoull.
2000-01-22 13:53:10 +00:00
Jim Meyering
c4a0e46616 *** empty log message *** 2000-01-22 13:15:39 +00:00
Jim Meyering
a33ca24833 *** empty log message *** 2000-01-22 13:14:17 +00:00
Jim Meyering
465e3422e8 (seq --format): Mention that integer formats are accepted, too. 2000-01-22 13:13:45 +00:00
Jim Meyering
1a8bedfeb7 *** empty log message *** 2000-01-22 13:07:25 +00:00
Jim Meyering
88e049caf5 *** empty log message *** 2000-01-22 13:06:59 +00:00
Jim Meyering
8ecfdb48a9 *** empty log message *** 2000-01-22 12:37:01 +00:00
Jim Meyering
c88a1e4466 Topologically sort the functions and remove fwd declarations. 2000-01-22 12:36:35 +00:00
Jim Meyering
4186d5762f (enum Format_type): Declare.
(format_type): New global to take place of intconv.
(DO_printf): New macro.
(main): Use it.
2000-01-22 11:14:22 +00:00
Jim Meyering
c951e3f2c9 Add new tests for the new functionality. 2000-01-22 11:10:40 +00:00
Jim Meyering
e48c320244 Add support for octal and hexadecimal output.
(intconv): New variable.
(usage): Update.
(main): Call scan_arg instead of scan_double_arg. Call check_format
before scan_arg.
(scan_int_arg, scan_arg): New functions.
(check_format): Add intconv argument. Accept %d, %u, %o, %x, %X.
(print_numbers): If intconv is true, pass an int argument to printf.
2000-01-22 10:09:29 +00:00
Jim Meyering
625a560403 . 2000-01-22 09:44:23 +00:00
Jim Meyering
f3a2399998 *** empty log message *** 2000-01-22 09:43:37 +00:00
Jim Meyering
fc32116042 (ISDIGIT): Define.
(strverscmp): Use ISDIGIT, not isdigit.
2000-01-22 09:43:23 +00:00
Jim Meyering
1a779705e8 . 2000-01-22 09:42:33 +00:00
Jim Meyering
6df5aa20d7 (o-rep-1, o-rep-2): New tests. 2000-01-22 09:42:14 +00:00
Jim Meyering
d29115d80f ("xstrtol.h"): Include.
(Filter): Rename from PFL.
(non_neg_strtol): Remove function.
(find_bracketed_repeat): Use xstrtoul instead of non_neg_strtol.
(squeeze_filter, set_initialize, main): Use size_t and ssize_t in
place of long and int in several decls.
(read_and_delete, read_and_xlate): Likewise, and remove assertion.
2000-01-22 09:31:19 +00:00
Jim Meyering
89d8c4e859 *** empty log message *** 2000-01-21 15:08:14 +00:00
Jim Meyering
4ba6864c31 Correct copying notice to use GPL, per author's request.
(AUTHORS): Add djm.
2000-01-21 15:08:08 +00:00
Jim Meyering
dc6a5317bc Correct copying notice to use GPL, per author's request. 2000-01-21 15:07:53 +00:00
Jim Meyering
98379bfc4f *** empty log message *** 2000-01-21 14:39:07 +00:00
Jim Meyering
cfa079e41d *** empty log message *** 2000-01-21 07:33:33 +00:00
Jim Meyering
553fe00983 (PFI): Return long', not int'.
(PFL): Rename from PFI now that it returns long.
(squeeze_filter): Declare as `long': i, nr, out_len.
2000-01-21 07:33:25 +00:00
Jim Meyering
c4acbcc996 Tweak sort performance.
(hard_LC_CTYPE): Remove.
(keylist): Renamed from keyhead.  Now a pointer, not a
mostly-unused struct.  All uses changed.
(findlines, keycompare, CMP_WITH_IGNORE, compare, checkfp, mergefps,
sort): Tune and use a more consistent style for reallocation.
(keycompare, main): Don't worry about LC_CTYPE;
it's buggy with multibyte chars anyway.
(compare): Invoke alloca (0) after each call to keycompare,
not just the ones that return nonzero.  This avoids a memory
leak on architectures without builtin alloca that occurs
sometimes when a file contains all duplicate lines.
2000-01-19 22:43:33 +00:00
Jim Meyering
e8611c5714 *** empty log message *** 2000-01-19 20:41:06 +00:00
Jim Meyering
9393315a06 (jm_FUNC_NANOSLEEP): Include <sys/time.h>, too.
Use AC_HEADER_TIME.  Volker Borchert reported that OpenBSD-2.3/sparc
defines `struct timespec' in <sys/time.h>
2000-01-19 20:40:51 +00:00
Jim Meyering
7990f92f15 *** empty log message *** 2000-01-19 14:01:03 +00:00
Jim Meyering
2435963a1f *** empty log message *** 2000-01-19 13:57:51 +00:00
Jim Meyering
469d21a9d3 Remove uses of changequote altogether. 2000-01-19 13:57:42 +00:00
Jim Meyering
ddcb373abc . 2000-01-19 08:17:47 +00:00
Jim Meyering
e0a66a6600 . 2000-01-19 08:17:16 +00:00
Jim Meyering
d448da43d6 . 2000-01-19 07:56:52 +00:00
Jim Meyering
870858ccad (interrupt_handler, main):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
2000-01-18 07:37:57 +00:00
Jim Meyering
fa25e451f9 *** empty log message *** 2000-01-18 07:37:17 +00:00
Jim Meyering
3e115cf2b5 (sighandler, main):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
2000-01-18 07:36:53 +00:00
Jim Meyering
41a7e7c193 *** empty log message *** 2000-01-18 07:28:59 +00:00
Jim Meyering
8024f33e45 (interrupt_handler):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
(install_handler): Use SA_NOCLDSTOP, not _POSIX_VERSION,
to decide whether to call sigaction; this fixes an old typo.
2000-01-18 07:28:47 +00:00
Jim Meyering
1fe0bff2f4 *** empty log message *** 2000-01-18 07:26:07 +00:00
Jim Meyering
c829e00d78 (nanosleep):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it.  Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
2000-01-18 07:25:53 +00:00
Jim Meyering
95b4ba5e0d *** empty log message *** 2000-01-17 22:37:32 +00:00
Jim Meyering
f106184dd2 . 2000-01-17 22:36:01 +00:00
Jim Meyering
93a834533b *** empty log message *** 2000-01-17 10:00:37 +00:00
Jim Meyering
2c3cad16b2 fix typo 2000-01-17 10:00:30 +00:00
Jim Meyering
7f54d0b6b7 Revert this change (they're not the same):
Use new AC_C_PROTOTYPES instead of AM_C_PROTOTYPES.
2000-01-17 10:00:19 +00:00
Jim Meyering
751d1a1888 *** empty log message *** 2000-01-17 08:03:25 +00:00
Jim Meyering
47be9d6b2f revert last change, now that quotearg.c is fixed 2000-01-17 08:03:12 +00:00
Jim Meyering
4d034357da (quotearg_buffer_restyled): Do not quote
alert, backslash, formfeed, and vertical tab unnecessarily in
shell quoting style.
2000-01-17 08:01:40 +00:00
Jim Meyering
ea51a6cbaa *** empty log message *** 2000-01-17 08:01:30 +00:00
Jim Meyering
065c2a2cda *** empty log message *** 2000-01-16 22:15:50 +00:00
Jim Meyering
e9296ad49f Sync with sh-utils/lib/Makefile.am. 2000-01-16 22:15:32 +00:00
Jim Meyering
588bb7b9e2 *** empty log message *** 2000-01-16 20:42:46 +00:00
Jim Meyering
53000596a9 (usage): Correct error in %V description.
From Wolfram Kleff.
2000-01-16 20:41:29 +00:00
Jim Meyering
ccd763bee2 alphabetize a little 2000-01-16 20:15:58 +00:00
Jim Meyering
0c4d4d0081 *** empty log message *** 2000-01-16 17:01:26 +00:00
Jim Meyering
ac9b999873 . 2000-01-16 17:00:22 +00:00
Jim Meyering
7a8e14b287 Remove these for now (they're with related code in sh-utils' configure.in)
AM_SYS_POSIX_TERMIOS
  jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
2000-01-16 16:48:57 +00:00
Jim Meyering
38b49a265f Require AM_FUNC_GETLOADAVG, jm_SYS_PROC_UPTIME, AM_SYS_POSIX_TERMIOS, and
jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL.
2000-01-16 16:42:24 +00:00
Jim Meyering
fb6ad846b4 Require jm_FUNC_GROUP_MEMBER, jm_FUNC_PUTENV,
AM_FUNC_ERROR_AT_LINE, jm_FUNC_GNU_STRFTIME, jm_FUNC_MKTIME,
jm_FUNC_GETGROUPS AC_FUNC_VPRINTF, and AC_FUNC_ALLOCA.
2000-01-16 16:39:20 +00:00
Jim Meyering
67cf2e1e2e *** empty log message *** 2000-01-16 16:36:58 +00:00
Jim Meyering
2b47bcaca6 . 2000-01-16 13:09:25 +00:00
Jim Meyering
11d24c8713 . 2000-01-16 13:08:07 +00:00
Jim Meyering
7c99efe376 *** empty log message *** 2000-01-16 12:59:09 +00:00
Jim Meyering
6bcc673201 Use changequote(<<,>>)', rather than changequote(, )'
because the latter didn't work.
2000-01-16 12:59:00 +00:00
Jim Meyering
337515e1ed *** empty log message *** 2000-01-16 12:47:42 +00:00
Jim Meyering
fda148fb1b Adapt to work with recently updated quotearg.c. 2000-01-16 12:47:34 +00:00
Jim Meyering
e7d71e0725 . 2000-01-16 12:40:26 +00:00
Jim Meyering
110b79479d Use new AC_C_PROTOTYPES instead of AM_C_PROTOTYPES. 2000-01-16 12:39:31 +00:00
Jim Meyering
e64e8130b1 *** empty log message *** 2000-01-16 12:36:53 +00:00
Jim Meyering
5fae922bab Sync with the version from emacs-20.5.
(<string.h>): Include if HAVE_STRING_H.
(<stdlib.h>): Include if HAVE_STDLIB_H.
(alloca): Abort if malloc fails.
2000-01-16 12:35:49 +00:00
Jim Meyering
840aee01de . 2000-01-15 16:09:56 +00:00
Jim Meyering
dfc6a234b0 . 2000-01-15 15:58:54 +00:00
Jim Meyering
b07aaa6cd0 sheesh: fix it right this time: gethostname getusershell 2000-01-15 13:57:04 +00:00
Jim Meyering
9e8497dd61 Fix typo
s/stpbrk/strpbrk
2000-01-15 12:13:13 +00:00
Jim Meyering
6a483c24a8 (AC_REPLACE_FUNCS):
Add these: euidaccess memcmp mkdir rmdir rpmatch strndup strverscmp.
2000-01-15 12:07:53 +00:00
Jim Meyering
590f2decc5 *** empty log message *** 2000-01-15 12:06:03 +00:00
Jim Meyering
489dafa7bc (AC_REPLACE_FUNCS): Add strpbrk. 2000-01-15 12:02:58 +00:00
Jim Meyering
8ee46f4bf8 *** empty log message *** 2000-01-15 12:00:16 +00:00
Jim Meyering
b6040be40a (AC_REPLACE_FUNCS):
Add these, too: stime strcspn stpcpy strstr strtol strtoul.
2000-01-15 11:59:15 +00:00
Jim Meyering
116bfa584d *** empty log message *** 2000-01-15 11:57:46 +00:00
Jim Meyering
c3f357adf5 Quote multibyte characters correctly.
(ISGRAPH): Remove.
(ISPRINT): New macro.
(<wchar.h>): Include if HAVE_MBRTOWC && HAVE_WCHAR_H.
(isprint, mbrtowc, mbsinit, mbstate_t): New macros,
defined if ! (HAVE_MBRTOWC && HAVE_WCHAR_H).
(quotearg_buffer_restyled): New function, with most of the old
quotearg_buffer's contents.
Major rewrite to support multibyte characters.
(quotearg_buffer): Now just calls quotearg_buffer_restyled.
2000-01-15 11:57:11 +00:00
Jim Meyering
78992ab94f fix typo in last change 2000-01-15 11:48:10 +00:00
Jim Meyering
48bbfe2e71 (AC_REPLACE_FUNCS): Add memcpy and memset. 2000-01-15 11:47:12 +00:00
Jim Meyering
f02fa3aa3e *** empty log message *** 2000-01-15 11:45:52 +00:00
Jim Meyering
616361c4f6 *** empty log message *** 2000-01-15 11:44:11 +00:00
Jim Meyering
48e3ed52ee (AC_REPLACE_FUNCS): Add gethostname and getusershell 2000-01-15 11:41:08 +00:00
Jim Meyering
46d6db5426 *** empty log message *** 2000-01-15 11:14:42 +00:00
Jim Meyering
4841119c1a (TAB_STOP_SENTINEL): Define.
(unexpand): Use it instead of INT_MAX.
Declare column and pending to be `unsigned'.
Increment pending and column counters only if column is smaller
than TAB_STOP_SENTINEL.
2000-01-15 11:13:44 +00:00
Jim Meyering
8c0c6b0468 *** empty log message *** 2000-01-15 10:24:53 +00:00
Jim Meyering
5159046f88 *** empty log message *** 2000-01-15 10:24:10 +00:00
Jim Meyering
0d5f220029 *** empty log message *** 2000-01-15 09:51:23 +00:00
Jim Meyering
afd24c5869 *** empty log message *** 2000-01-15 09:08:07 +00:00
Jim Meyering
9bb0428a59 tweak comment 2000-01-15 07:07:41 +00:00
Jim Meyering
cf0a18b69d *** empty log message *** 2000-01-14 10:32:13 +00:00
Jim Meyering
6c7d8fd5b5 *** empty log message *** 2000-01-14 10:31:48 +00:00
Jim Meyering
3eb8c1fea4 *** empty log message *** 2000-01-14 07:05:58 +00:00
Jim Meyering
3ee8530a1e *** empty log message *** 2000-01-13 23:04:41 +00:00
Jim Meyering
66cbf09569 remove md5sum residue 2000-01-13 23:03:08 +00:00
Jim Meyering
3152cf6f82 *** empty log message *** 2000-01-13 23:02:32 +00:00
Jim Meyering
0567a5d9c8 *** empty log message *** 2000-01-13 23:01:14 +00:00
Jim Meyering
a69a2d6856 (fillbuf): Avoid quadratic behavior with long lines.
Also, stop worrying about ancient memchr bug (misbehavior when
size is zero), since other code doesn't worry either.
2000-01-13 07:34:44 +00:00
Jim Meyering
35ed98cc06 *** empty log message *** 2000-01-12 14:00:50 +00:00
Jim Meyering
ff626bd3c0 Make the warning that this shred test may not
be run as root more prominent.  Suggestion from Volker Borchert.
2000-01-12 14:00:22 +00:00
Jim Meyering
b52f383a7f *** empty log message *** 2000-01-12 08:17:41 +00:00
Jim Meyering
b14089f76b (jm_PREREQ_READUTMP): New macro.
(jm_PREREQ): Use it.
2000-01-12 08:17:30 +00:00
Jim Meyering
3df9479ab4 *** empty log message *** 2000-01-12 08:07:29 +00:00
Jim Meyering
bbe32e1637 (jm_PREREQ_CANON_HOST): Move code from su/configure.in. 2000-01-12 08:06:27 +00:00
Jim Meyering
79732f800d (jm_PREREQ_CANON_HOST): New macro.
(jm_PREREQ): Use it.
2000-01-12 07:58:22 +00:00
Jim Meyering
c186123316 *** empty log message *** 2000-01-12 07:27:34 +00:00
Jim Meyering
e50dab4ad9 *** empty log message *** 2000-01-12 06:58:30 +00:00
Jim Meyering
5d0f90dff7 *** empty log message *** 2000-01-12 06:56:54 +00:00
Jim Meyering
f3b0ab5eba (jm_PREREQ_QUOTEARG): New macro.
(jm_PREREQ): Use it.
2000-01-12 06:53:32 +00:00
Jim Meyering
551ab8474b (mode_compile): Use uintmax_t, not unsigned
long, to parse numeric modes.  Check for any unknown bits, not
just unknown bits left of the leftmost known bit.
2000-01-12 06:49:59 +00:00
Jim Meyering
12d6e4b1cd Update copyright notice. 2000-01-12 06:46:46 +00:00
Jim Meyering
a5ab3d9aac Sync with latest FSF version (fixing a minor Y2k problem). 2000-01-12 06:41:36 +00:00
Jim Meyering
fbe7dca27f Port to autoconf 2.13. 2000-01-12 06:40:10 +00:00
Jim Meyering
0d47b4be52 Sync to the slightly more general version of GNU tar. 2000-01-12 06:37:30 +00:00
Jim Meyering
59457bee16 (count_entry): Adjust to new calling convention for excluded_filename.
(main): Likewise, for add_exclude_file.
2000-01-12 06:36:56 +00:00
Jim Meyering
a3b2c5389c *** empty log message *** 2000-01-11 14:06:07 +00:00
Jim Meyering
1c4c285999 (memcpy): Protoize. 2000-01-11 14:05:28 +00:00
Jim Meyering
1b84791bc8 s/fu/fetish/ 2000-01-11 08:43:16 +00:00
Jim Meyering
126e14b161 (hash_initialize): Fix typo in comment. 2000-01-11 07:48:23 +00:00
Jim Meyering
80fd95a91d . 2000-01-11 07:28:22 +00:00
Jim Meyering
ca974b3755 *** empty log message *** 2000-01-10 12:52:18 +00:00
Jim Meyering
9f5307f1d3 *** empty log message *** 2000-01-10 11:53:22 +00:00
Jim Meyering
97085c8df7 *** empty log message *** 2000-01-10 11:53:16 +00:00
Jim Meyering
de1cb33196 *** empty log message *** 2000-01-10 11:36:05 +00:00
Jim Meyering
741c7303a5 (alpha): Use scp, not ncftp. 2000-01-10 11:35:44 +00:00
Jim Meyering
f23b3eb47a *** empty log message *** 2000-01-10 09:37:50 +00:00
Jim Meyering
f488edddf7 . 2000-01-10 09:21:14 +00:00
Jim Meyering
60dabf5cd1 . 2000-01-10 09:20:49 +00:00
Jim Meyering
44381ed288 *** empty log message *** 2000-01-10 08:11:56 +00:00
Jim Meyering
4717bb93f2 (announcement): Include URLs for xdelta files. 2000-01-10 08:11:41 +00:00
Jim Meyering
9442b6050b *** empty log message *** 2000-01-10 07:31:52 +00:00
Jim Meyering
6adb0e4d56 *** empty log message *** 2000-01-10 07:31:31 +00:00
Jim Meyering
6f06aad852 (noinst_HEADERS): Add nanosleep.h. 2000-01-10 07:31:14 +00:00
Jim Meyering
baf8720297 *** empty log message *** 2000-01-10 07:27:52 +00:00
Jim Meyering
94966b9515 *** empty log message *** 2000-01-09 16:21:39 +00:00
Jim Meyering
55d80ad41a *** empty log message *** 2000-01-09 16:20:44 +00:00
Jim Meyering
7b9c964fde *** empty log message *** 2000-01-09 16:17:52 +00:00
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
164 changed files with 5944 additions and 12704 deletions

View File

@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
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
@@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View File

@@ -38,8 +38,18 @@ 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:
my-distcheck: writable-files po-check
-rm -rf $(t)
mkdir $(t)
GZIP=$(GZIP) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
@@ -48,6 +58,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 +73,20 @@ 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))
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
@@ -92,6 +99,10 @@ rel-check:
echo "$(md5) -" > $$md5_tmp; \
md5sum -c $$md5_tmp < $$tarz
release-archive-dir = ../release
prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz
xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
announcement: NEWS ChangeLog $(distdir).tar.gz
@( \
echo Subject: $(distdir) released; \
@@ -102,6 +113,12 @@ announcement: NEWS ChangeLog $(distdir).tar.gz
echo " $$url/$(distdir).tar.gz"; \
done; \
echo; \
echo And here are xdelta-style diffs; \
echo; \
for url in $(url_dir_list); do \
echo " $$url/$(xd-delta)"; \
done; \
echo; \
echo "$(md5) $(distdir).tar.gz"; \
echo; \
echo NEWS:; \
@@ -116,16 +133,28 @@ announcement: NEWS ChangeLog $(distdir).tar.gz
-e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
)
alpha:
$(MAKE) po-check
writable-files:
for file in $(distdir).tar.gz $(xd-delta) \
../release/$(distdir).tar.gz ../release/$(xd-delta); do \
test -e $$file || continue; \
test -w $$file \
|| { echo ERROR: $$file is not writable; fail=1; }; \
done; \
test "$$fail" && exit 1 || :
alpha: writable-files 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 =====================================
@echo 'scp $(xd-delta) $(distdir).tar.gz \'
@echo ' $(b_host):$(b_real_dir)'
@echo '# send the /tmp/announcement e-mail'
@echo =====================================
@echo =====================================

6
THANKS
View File

@@ -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
@@ -38,6 +39,7 @@ Germano Leichsenring: germano@jedi.cs.kobe-u.ac.jp
Göran Uddeborg: goeran@uddeborg.pp.se
Greg McGary: gkm@eng.ascend.com
Gabor Z. Papp: gzp@gzp.org.hu
H. J. Lu: hjl@valinux.com
Holger Berger: hberger@ess.nec.de
Hugh Daniel: hugh@xanadu.com
James: james@albion.glarp.com
@@ -48,12 +50,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 +78,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 +86,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

View File

@@ -73,6 +73,7 @@ DEPDIR = @DEPDIR@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNU_PACKAGE = @GNU_PACKAGE@
@@ -83,13 +84,19 @@ INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
KMEM_GROUP = @KMEM_GROUP@
LIBOBJS = @LIBOBJS@
MAN = @MAN@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
NEED_SETGID = @NEED_SETGID@
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -300,7 +307,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

@@ -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}.
@@ -3139,8 +3143,8 @@ The program accepts the following options. Also see @ref{Common options}.
@opindex --format=@var{format}
@cindex formatting of numbers in @code{seq}
Print all numbers using @var{format}; default @samp{%g}.
@var{format} must contain exactly one of the standarding float output
formats @samp{%e}, @samp{%f}, or @samp{%g}.
@var{format} must contain exactly one of the standarding floating point
output formats @samp{%e}, @samp{%f}, or @samp{%g}.
@item -s @var{string}
@itemx --separator=@var{string}
@@ -3155,6 +3159,66 @@ Print all numbers with the same width, by padding with leading zeroes.
@end table
If you want to use @code{seq} to print sequences of large integer values,
don't use the default @samp{%g} format since it can result in
loss of precision:
@example
$ seq 1000000 1000001
1e+06
1e+06
@end example
Instead, you can use the format, @samp{%1.f},
to print large decimal numbers with no exponent and no decimal point.
@example
$ seq --format=%1.f 1000000 1000001
1000000
1000001
@end example
If you want hexadecimal output, you can use @code{printf}
to perform the conversion:
@example
$ printf %x'\n' `seq -f %1.f 1048575 1024 1050623`
fffff
1003ff
1007ff
@end example
For very long lists of numbers, use xargs to avoid
system limitations on the length of an argument list:
@example
$ seq -f %1.f 1000000 | xargs printf %x'\n' |tail -3
f423e
f423f
f4240
@end example
To generate octal output, use the printf @code{%o} format instead
of @code{%x}. Note however that using printf works only for numbers
smaller than @code{2^32}:
@example
$ printf "%x\n" `seq -f %1.f 4294967295 4294967296`
ffffffff
bash: printf: 4294967296: Numerical result out of range
@end example
On most systems, seq can produce whole-number output for values up to
@code{2^53}, so here's a more general approach to base conversion that
also happens to be more robust for such large numbers. It works by
using @code{bc} and setting its output radix variable, @var{obase},
to @samp{16} in this case to produce hexadecimal output.
@example
$ (echo obase=16; seq -f %1.f 4294967295 4294967296)|bc
FFFFFFFF
100000000
@end example
@node Index
@unnumbered Index

View File

@@ -19,3 +19,168 @@ n
p (he->h_addrtype)
n
q
r a:b
b main
r a:b
n
s
n
p separator
n
l 128
c
q
r meyering:store
p *username
p *username[separator - name]
p separator - name
p username[separator - name]
r ''
l
q
r ''
l
q
r meyering
b main
r meyering
n
r
n
s
n
p u
n
n
q
r ''
r meyering
up
l
q
b main
b a.out 1
r a.out 1
n
s
fin
s
n
p uid
p gid
p euid
p egid
n
p mode
p path
fin
r -v -c 10 -n 20 -x 80 < in-2
up
up
p &dummy
p *ovp
p *(int*)*ovp
p ((struct item*)*ovp)->key
p old_vec@10
r -v -c 10 -n 20 -x 80 < in-3
p *(int*)*ovp
up
dow
p *(int*)*ovp
up
p *(int*)*ovp
i loca
dow
p key
p dummy
p &dummy
up
p old_vec
p *ovp
p ovp
p ovp - old_vec
p *old_vec@10
p *old_vec@13
b hash_insert_item
r
b hash_insert_item_at
r
n
p fail
p *(ht->vec)@13
p *(ht->ht_vec)@13
p ((struct item*)(ht->ht_vec)[10])->key
b hash_delete_item
b hash_delete_item_at
c
n
p slot
p item
n
n
p *(ht->ht_vec)@13
p &dummy
p dummy
n
s
n
n
p *(ht->ht_vec)@13
n
p new_size
n
p *old_vec@13
p old_vec@13
n
p *old_vec@13
n
p *old_vec@13
n
l
n
p ovp - old_vec
n
p ovp - old_vec
n
p ovp - old_vec
p *old_vec@13
p &dummy
q
r 444444444444 44444444444
b human_readable
r
n
q
b main
r 444444444444 44444444444
n
p a
p b
r 34343434 3434343434
c
r
n
n
p a
p b
r 343434343 343434343
c
q
b posixtime
r
n
s
n
p len
n
p pair
p len
n
b year
y
c
c
p n
up
p len
q

50
lib/ChangeLog Normal file
View File

@@ -0,0 +1,50 @@
2000-01-30 Jim Meyering <meyering@lucent.com>
* readutmp.c (extract_trimmed_name): Use UT_USER instead of hard-coding
uses of ->ut_name. The latter doesn't work with new Linux header files
where only utmpx.ut_user is declared.
* readutmp.h (UT_USER): Define.
2000-01-23 Jim Meyering <meyering@lucent.com>
* Makefile.am (libfetish_a_SOURCES): Remove explicit mention of
obstack.c.
2000-01-22 Jim Meyering <meyering@lucent.com>
* strtoumax.c: [! HAVE_DECL_STRTOUL]: Declare strtoul.
[! HAVE_DECL_STRTOULL]: Declare strtoull.
Required for some AIX systems. Reported by Christian Krackowizer.
[TESTING] (main): New function.
1997-10-17 Eli Zaretskii <eliz@is.elta.co.il>
* dirname.c (dir_name): Support for DOS-style file names with drive
letters.
* quotearg.c [HAVE_WCTYPE_H]: Include <wctype.h> for decl of iswprint.
* strverscmp.c (ISDIGIT): Define.
(strverscmp): Use ISDIGIT, not isdigit.
2000-01-17 Paul Eggert <eggert@twinsun.com>
* nanosleep.c (nanosleep):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it. Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
2000-01-17 Jim Meyering <meyering@lucent.com>
* interlock: Remove unused file. Reported by François Pinard.
2000-01-16 Paul Eggert <eggert@twinsun.com>
* lib/quotearg.c (quotearg_buffer_restyled): Do not quote
alert, backslash, formfeed, and vertical tab unnecessarily in
shell quoting style.
Local Variables:
version-control: never
End:

View File

@@ -2,30 +2,32 @@
AUTOMAKE_OPTIONS = ../src/ansi2knr
noinst_LIBRARIES = libfu.a
noinst_LIBRARIES = libfetish.a
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
isdir.c long-options.c makepath.c modechange.c hash.c path-concat.c \
quotearg.c safe-read.c same.c save-cwd.c savedir.c stripslash.c userspec.c \
version-etc.c xgetcwd.c xmalloc.c xstrdup.c \
xstrtol.c xstrtoul.c xstrtoumax.c yesno.c
libfetish_a_SOURCES = \
getdate.y posixtm.c addext.c argmatch.c backupfile.c basename.c \
canon-host.c closeout.c dirname.c exclude.c filemode.c diacrit.c \
full-write.c getopt.c getopt1.c getugroups.c hard-locale.c hash.c \
human.c idcache.c isdir.c linebuffer.c long-options.c makepath.c \
md5.c memcasecmp.c memcoll.c modechange.c path-concat.c \
quotearg.c readtokens.c readutmp.c safe-read.c same.c save-cwd.c \
savedir.c stripslash.c userspec.c version-etc.c xgetcwd.c xgethostname.c \
xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c xstrtoumax.c yesno.c
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
libfetish_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h getpagesize.h \
group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
posixtm.h quotearg.h regex.h safe-read.h same.h save-cwd.h \
savedir.h strverscmp.h \
version-etc.h xalloc.h xstrtol.h
noinst_HEADERS = \
argmatch.h backupfile.h bumpalloc.h closeout.h diacrit.h dirname.h error.h \
exclude.h filemode.h fnmatch.h fsusage.h getdate.h getline.h getopt.h \
getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
linebuffer.h long-options.h md5.h memcasecmp.h memcoll.h \
makepath.h modechange.h mountlist.h nanosleep.h obstack.h \
path-concat.h pathmax.h posixtm.h quotearg.h readtokens.h \
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h \
strverscmp.h version-etc.h xalloc.h xstrtod.h xstrtol.h
BUILT_SOURCES = getdate.c lstat.c stat.c
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
@@ -33,9 +35,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

@@ -73,6 +73,7 @@ DEPDIR = @DEPDIR@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNU_PACKAGE = @GNU_PACKAGE@
@@ -83,14 +84,20 @@ INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
KMEM_GROUP = @KMEM_GROUP@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MAN = @MAN@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
NEED_SETGID = @NEED_SETGID@
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -103,31 +110,33 @@ l = @l@
AUTOMAKE_OPTIONS = ../src/ansi2knr
noinst_LIBRARIES = libfu.a
noinst_LIBRARIES = libfetish.a
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
isdir.c long-options.c makepath.c modechange.c hash.c path-concat.c \
quotearg.c safe-read.c same.c save-cwd.c savedir.c stripslash.c userspec.c \
version-etc.c xgetcwd.c xmalloc.c xstrdup.c \
xstrtol.c xstrtoul.c xstrtoumax.c yesno.c
libfetish_a_SOURCES = \
getdate.y posixtm.c addext.c argmatch.c backupfile.c basename.c \
canon-host.c closeout.c dirname.c exclude.c filemode.c diacrit.c \
full-write.c getopt.c getopt1.c getugroups.c hard-locale.c hash.c \
human.c idcache.c isdir.c linebuffer.c long-options.c makepath.c \
md5.c memcasecmp.c memcoll.c modechange.c path-concat.c \
quotearg.c readtokens.c readutmp.c safe-read.c same.c save-cwd.c \
savedir.c stripslash.c userspec.c version-etc.c xgetcwd.c xgethostname.c \
xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c xstrtoumax.c yesno.c
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
libfetish_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h getpagesize.h \
group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
posixtm.h quotearg.h regex.h safe-read.h same.h save-cwd.h \
savedir.h strverscmp.h \
version-etc.h xalloc.h xstrtol.h
noinst_HEADERS = \
argmatch.h backupfile.h bumpalloc.h closeout.h diacrit.h dirname.h error.h \
exclude.h filemode.h fnmatch.h fsusage.h getdate.h getline.h getopt.h \
getpagesize.h group-member.h hard-locale.h hash.h human.h lchown.h \
linebuffer.h long-options.h md5.h memcasecmp.h memcoll.h \
makepath.h modechange.h mountlist.h nanosleep.h obstack.h \
path-concat.h pathmax.h posixtm.h quotearg.h readtokens.h \
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h \
strverscmp.h version-etc.h xalloc.h xstrtod.h xstrtol.h
BUILT_SOURCES = getdate.c lstat.c stat.c
@@ -147,32 +156,35 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ANSI2KNR = ../src/ansi2knr
libfu_a_AR = $(AR) cru
am_libfu_a_OBJECTS = getdate$U.o posixtm$U.o getopt$U.o getopt1$U.o \
addext$U.o argmatch$U.o backupfile$U.o basename$U.o closeout$U.o \
dirname$U.o exclude$U.o filemode$U.o full-write$U.o human$U.o \
idcache$U.o isdir$U.o long-options$U.o makepath$U.o modechange$U.o \
hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o same$U.o \
save-cwd$U.o savedir$U.o stripslash$U.o userspec$U.o version-etc$U.o \
xgetcwd$U.o xmalloc$U.o xstrdup$U.o xstrtol$U.o xstrtoul$U.o \
xstrtoumax$U.o yesno$U.o
libfu_a_OBJECTS = $(am_libfu_a_OBJECTS)
libfetish_a_AR = $(AR) cru
am_libfetish_a_OBJECTS = getdate$U.o posixtm$U.o addext$U.o \
argmatch$U.o backupfile$U.o basename$U.o canon-host$U.o closeout$U.o \
dirname$U.o exclude$U.o filemode$U.o diacrit$U.o full-write$U.o \
getopt$U.o getopt1$U.o getugroups$U.o hard-locale$U.o hash$U.o \
human$U.o idcache$U.o isdir$U.o linebuffer$U.o long-options$U.o \
makepath$U.o md5$U.o memcasecmp$U.o memcoll$U.o modechange$U.o \
path-concat$U.o quotearg$U.o readtokens$U.o readutmp$U.o safe-read$U.o \
same$U.o save-cwd$U.o savedir$U.o stripslash$U.o userspec$U.o \
version-etc$U.o xgetcwd$U.o xgethostname$U.o xmalloc$U.o xstrdup$U.o \
xstrtod$U.o xstrtol$U.o xstrtoul$U.o xstrtoumax$U.o yesno$U.o
libfetish_a_OBJECTS = $(am_libfetish_a_OBJECTS)
AR = ar
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CFLAGS = @CFLAGS@
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libfu_a_SOURCES)
DIST_SOURCES = $(libfetish_a_SOURCES)
HEADERS = $(noinst_HEADERS)
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
DIST_COMMON = $(noinst_HEADERS) ChangeLog 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 gethostname.c \
getline.c getloadavg.c getusershell.c group-member.c lchown.c malloc.c \
memchr.c memcmp.c memcpy.c memmove.c memset.c mkdir.c mktime.c \
mountlist.c nanosleep.c obstack.c obstack.h putenv.c realloc.c regex.c \
rmdir.c rpmatch.c stime.c stpcpy.c strcasecmp.c strcspn.c strdup.c \
strftime.c strncasecmp.c strndup.c strpbrk.c strstr.c strtod.c strtol.c \
strtoul.c strtoull.c strtoumax.c strverscmp.c utime.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -181,33 +193,41 @@ GZIP_ENV = --best
depcomp = $(SHELL) $(top_srcdir)/depcomp
DEP_FILES = @AMDEP@ $(DEPDIR)/addext$U.Po $(DEPDIR)/alloca.Po \
$(DEPDIR)/argmatch$U.Po $(DEPDIR)/backupfile$U.Po \
$(DEPDIR)/basename$U.Po $(DEPDIR)/chown.Po $(DEPDIR)/closeout$U.Po \
$(DEPDIR)/dirname$U.Po $(DEPDIR)/dup2.Po $(DEPDIR)/error.Po \
$(DEPDIR)/euidaccess.Po $(DEPDIR)/exclude$U.Po $(DEPDIR)/fileblocks.Po \
$(DEPDIR)/filemode$U.Po $(DEPDIR)/fnmatch.Po $(DEPDIR)/fsusage.Po \
$(DEPDIR)/ftruncate.Po $(DEPDIR)/full-write$U.Po $(DEPDIR)/getdate$U.Po \
$(DEPDIR)/getgroups.Po $(DEPDIR)/getline.Po $(DEPDIR)/getopt$U.Po \
$(DEPDIR)/getopt1$U.Po $(DEPDIR)/group-member.Po $(DEPDIR)/hash$U.Po \
$(DEPDIR)/human$U.Po $(DEPDIR)/idcache$U.Po $(DEPDIR)/isdir$U.Po \
$(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)/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 \
$(DEPDIR)/stat.Po $(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po \
$(DEPDIR)/basename$U.Po $(DEPDIR)/canon-host$U.Po $(DEPDIR)/chown.Po \
$(DEPDIR)/closeout$U.Po $(DEPDIR)/diacrit$U.Po $(DEPDIR)/dirname$U.Po \
$(DEPDIR)/dup2.Po $(DEPDIR)/error.Po $(DEPDIR)/euidaccess.Po \
$(DEPDIR)/exclude$U.Po $(DEPDIR)/fileblocks.Po $(DEPDIR)/filemode$U.Po \
$(DEPDIR)/fnmatch.Po $(DEPDIR)/fsusage.Po $(DEPDIR)/ftruncate.Po \
$(DEPDIR)/full-write$U.Po $(DEPDIR)/getdate$U.Po $(DEPDIR)/getgroups.Po \
$(DEPDIR)/gethostname.Po $(DEPDIR)/getline.Po $(DEPDIR)/getloadavg.Po \
$(DEPDIR)/getopt$U.Po $(DEPDIR)/getopt1$U.Po $(DEPDIR)/getugroups$U.Po \
$(DEPDIR)/getusershell.Po $(DEPDIR)/group-member.Po \
$(DEPDIR)/hard-locale$U.Po $(DEPDIR)/hash$U.Po $(DEPDIR)/human$U.Po \
$(DEPDIR)/idcache$U.Po $(DEPDIR)/isdir$U.Po $(DEPDIR)/lchown.Po \
$(DEPDIR)/linebuffer$U.Po $(DEPDIR)/long-options$U.Po \
$(DEPDIR)/lstat.Po $(DEPDIR)/makepath$U.Po $(DEPDIR)/malloc.Po \
$(DEPDIR)/md5$U.Po $(DEPDIR)/memcasecmp$U.Po $(DEPDIR)/memchr.Po \
$(DEPDIR)/memcmp.Po $(DEPDIR)/memcoll$U.Po $(DEPDIR)/memcpy.Po \
$(DEPDIR)/memmove.Po $(DEPDIR)/memset.Po $(DEPDIR)/mkdir.Po \
$(DEPDIR)/mktime.Po $(DEPDIR)/modechange$U.Po $(DEPDIR)/mountlist.Po \
$(DEPDIR)/nanosleep.Po $(DEPDIR)/obstack.Po $(DEPDIR)/path-concat$U.Po \
$(DEPDIR)/posixtm$U.Po $(DEPDIR)/putenv.Po $(DEPDIR)/quotearg$U.Po \
$(DEPDIR)/readtokens$U.Po $(DEPDIR)/readutmp$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 $(DEPDIR)/stat.Po $(DEPDIR)/stime.Po \
$(DEPDIR)/stpcpy.Po $(DEPDIR)/strcasecmp.Po $(DEPDIR)/strcspn.Po \
$(DEPDIR)/strdup.Po $(DEPDIR)/strftime.Po $(DEPDIR)/stripslash$U.Po \
$(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po $(DEPDIR)/strstr.Po \
$(DEPDIR)/strtol.Po $(DEPDIR)/strtoul.Po $(DEPDIR)/strtoull.Po \
$(DEPDIR)/strtoumax.Po $(DEPDIR)/strverscmp.Po $(DEPDIR)/userspec$U.Po \
$(DEPDIR)/utime.Po $(DEPDIR)/version-etc$U.Po $(DEPDIR)/xgetcwd$U.Po \
$(DEPDIR)/xmalloc$U.Po $(DEPDIR)/xstrdup$U.Po $(DEPDIR)/xstrtol$U.Po \
$(DEPDIR)/strncasecmp.Po $(DEPDIR)/strndup.Po $(DEPDIR)/strpbrk.Po \
$(DEPDIR)/strstr.Po $(DEPDIR)/strtod.Po $(DEPDIR)/strtol.Po \
$(DEPDIR)/strtoul.Po $(DEPDIR)/strtoull.Po $(DEPDIR)/strtoumax.Po \
$(DEPDIR)/strverscmp.Po $(DEPDIR)/userspec$U.Po $(DEPDIR)/utime.Po \
$(DEPDIR)/version-etc$U.Po $(DEPDIR)/xgetcwd$U.Po \
$(DEPDIR)/xgethostname$U.Po $(DEPDIR)/xmalloc$U.Po \
$(DEPDIR)/xstrdup$U.Po $(DEPDIR)/xstrtod$U.Po $(DEPDIR)/xstrtol$U.Po \
$(DEPDIR)/xstrtoul$U.Po $(DEPDIR)/xstrtoumax$U.Po $(DEPDIR)/yesno$U.Po
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(am_libfu_a_OBJECTS)
SOURCES = $(libfetish_a_SOURCES)
OBJECTS = $(am_libfetish_a_OBJECTS)
all: all-redirect
.SUFFIXES:
@@ -254,10 +274,10 @@ distclean-kr:
maintainer-clean-kr:
libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
-rm -f libfu.a
$(libfu_a_AR) libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(RANLIB) libfu.a
libfetish.a: $(libfetish_a_OBJECTS) $(libfetish_a_DEPENDENCIES)
-rm -f libfetish.a
$(libfetish_a_AR) libfetish.a $(libfetish_a_OBJECTS) $(libfetish_a_LIBADD)
$(RANLIB) libfetish.a
addext_.c: addext.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > addext_.c
alloca_.c: alloca.c $(ANSI2KNR)
@@ -268,10 +288,14 @@ backupfile_.c: backupfile.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/backupfile.c; then echo $(srcdir)/backupfile.c; else echo backupfile.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > backupfile_.c
basename_.c: basename.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/basename.c; then echo $(srcdir)/basename.c; else echo basename.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > basename_.c
canon-host_.c: canon-host.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/canon-host.c; then echo $(srcdir)/canon-host.c; else echo canon-host.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > canon-host_.c
chown_.c: chown.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/chown.c; then echo $(srcdir)/chown.c; else echo chown.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > chown_.c
closeout_.c: closeout.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/closeout.c; then echo $(srcdir)/closeout.c; else echo closeout.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > closeout_.c
diacrit_.c: diacrit.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/diacrit.c; then echo $(srcdir)/diacrit.c; else echo diacrit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > diacrit_.c
dirname_.c: dirname.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dirname.c; then echo $(srcdir)/dirname.c; else echo dirname.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > dirname_.c
dup2_.c: dup2.c $(ANSI2KNR)
@@ -298,14 +322,24 @@ getdate_.c: getdate.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getdate.c; then echo $(srcdir)/getdate.c; else echo getdate.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getdate_.c
getgroups_.c: getgroups.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getgroups.c; then echo $(srcdir)/getgroups.c; else echo getgroups.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getgroups_.c
gethostname_.c: gethostname.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gethostname.c; then echo $(srcdir)/gethostname.c; else echo gethostname.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gethostname_.c
getline_.c: getline.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getline.c; then echo $(srcdir)/getline.c; else echo getline.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getline_.c
getloadavg_.c: getloadavg.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getloadavg.c; then echo $(srcdir)/getloadavg.c; else echo getloadavg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getloadavg_.c
getopt_.c: getopt.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c
getopt1_.c: getopt1.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c
getugroups_.c: getugroups.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getugroups.c; then echo $(srcdir)/getugroups.c; else echo getugroups.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getugroups_.c
getusershell_.c: getusershell.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getusershell.c; then echo $(srcdir)/getusershell.c; else echo getusershell.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getusershell_.c
group-member_.c: group-member.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/group-member.c; then echo $(srcdir)/group-member.c; else echo group-member.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > group-member_.c
hard-locale_.c: hard-locale.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hard-locale.c; then echo $(srcdir)/hard-locale.c; else echo hard-locale.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > hard-locale_.c
hash_.c: hash.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > hash_.c
human_.c: human.c $(ANSI2KNR)
@@ -316,6 +350,8 @@ isdir_.c: isdir.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/isdir.c; then echo $(srcdir)/isdir.c; else echo isdir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > isdir_.c
lchown_.c: lchown.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lchown.c; then echo $(srcdir)/lchown.c; else echo lchown.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lchown_.c
linebuffer_.c: linebuffer.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/linebuffer.c; then echo $(srcdir)/linebuffer.c; else echo linebuffer.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > linebuffer_.c
long-options_.c: long-options.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/long-options.c; then echo $(srcdir)/long-options.c; else echo long-options.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > long-options_.c
lstat_.c: lstat.c $(ANSI2KNR)
@@ -324,10 +360,16 @@ makepath_.c: makepath.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > makepath_.c
malloc_.c: malloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > malloc_.c
md5_.c: md5.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/md5.c; then echo $(srcdir)/md5.c; else echo md5.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > md5_.c
memcasecmp_.c: memcasecmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcasecmp.c; then echo $(srcdir)/memcasecmp.c; else echo memcasecmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcasecmp_.c
memchr_.c: memchr.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memchr.c; then echo $(srcdir)/memchr.c; else echo memchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memchr_.c
memcmp_.c: memcmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcmp.c; then echo $(srcdir)/memcmp.c; else echo memcmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcmp_.c
memcoll_.c: memcoll.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcoll.c; then echo $(srcdir)/memcoll.c; else echo memcoll.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcoll_.c
memcpy_.c: memcpy.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > memcpy_.c
memmove_.c: memmove.c $(ANSI2KNR)
@@ -342,14 +384,22 @@ 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)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/path-concat.c; then echo $(srcdir)/path-concat.c; else echo path-concat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > path-concat_.c
posixtm_.c: posixtm.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > posixtm_.c
putenv_.c: putenv.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/putenv.c; then echo $(srcdir)/putenv.c; else echo putenv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > putenv_.c
quotearg_.c: quotearg.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > quotearg_.c
readtokens_.c: readtokens.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/readtokens.c; then echo $(srcdir)/readtokens.c; else echo readtokens.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > readtokens_.c
readutmp_.c: readutmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/readutmp.c; then echo $(srcdir)/readutmp.c; else echo readutmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > readutmp_.c
realloc_.c: realloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > realloc_.c
regex_.c: regex.c $(ANSI2KNR)
@@ -368,10 +418,14 @@ savedir_.c: savedir.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/savedir.c; then echo $(srcdir)/savedir.c; else echo savedir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > savedir_.c
stat_.c: stat.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stat.c; then echo $(srcdir)/stat.c; else echo stat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stat_.c
stime_.c: stime.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stime.c; then echo $(srcdir)/stime.c; else echo stime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stime_.c
stpcpy_.c: stpcpy.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stpcpy_.c
strcasecmp_.c: strcasecmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strcasecmp.c; then echo $(srcdir)/strcasecmp.c; else echo strcasecmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strcasecmp_.c
strcspn_.c: strcspn.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strcspn.c; then echo $(srcdir)/strcspn.c; else echo strcspn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strcspn_.c
strdup_.c: strdup.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strdup_.c
strftime_.c: strftime.c $(ANSI2KNR)
@@ -382,8 +436,12 @@ strncasecmp_.c: strncasecmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strncasecmp.c; then echo $(srcdir)/strncasecmp.c; else echo strncasecmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strncasecmp_.c
strndup_.c: strndup.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strndup_.c
strpbrk_.c: strpbrk.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strpbrk.c; then echo $(srcdir)/strpbrk.c; else echo strpbrk.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strpbrk_.c
strstr_.c: strstr.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strstr.c; then echo $(srcdir)/strstr.c; else echo strstr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strstr_.c
strtod_.c: strtod.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtod.c; then echo $(srcdir)/strtod.c; else echo strtod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strtod_.c
strtol_.c: strtol.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtol.c; then echo $(srcdir)/strtol.c; else echo strtol.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strtol_.c
strtoul_.c: strtoul.c $(ANSI2KNR)
@@ -402,10 +460,14 @@ version-etc_.c: version-etc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version-etc.c; then echo $(srcdir)/version-etc.c; else echo version-etc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > version-etc_.c
xgetcwd_.c: xgetcwd.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xgetcwd.c; then echo $(srcdir)/xgetcwd.c; else echo xgetcwd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xgetcwd_.c
xgethostname_.c: xgethostname.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xgethostname.c; then echo $(srcdir)/xgethostname.c; else echo xgethostname.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xgethostname_.c
xmalloc_.c: xmalloc.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xmalloc_.c
xstrdup_.c: xstrdup.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrdup_.c
xstrtod_.c: xstrtod.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtod.c; then echo $(srcdir)/xstrtod.c; else echo xstrtod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrtod_.c
xstrtol_.c: xstrtol.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtol.c; then echo $(srcdir)/xstrtol.c; else echo xstrtol.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrtol_.c
xstrtoul_.c: xstrtoul.c $(ANSI2KNR)
@@ -414,20 +476,24 @@ xstrtoumax_.c: xstrtoumax.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtoumax.c; then echo $(srcdir)/xstrtoumax.c; else echo xstrtoumax.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrtoumax_.c
yesno_.c: yesno.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/yesno.c; then echo $(srcdir)/yesno.c; else echo yesno.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > yesno_.c
addext_.o alloca_.o argmatch_.o backupfile_.o basename_.o chown_.o \
closeout_.o dirname_.o dup2_.o error_.o euidaccess_.o exclude_.o \
fileblocks_.o filemode_.o fnmatch_.o fsusage_.o ftruncate_.o \
full-write_.o getdate_.o getgroups_.o 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)
addext_.o alloca_.o argmatch_.o backupfile_.o basename_.o canon-host_.o \
chown_.o closeout_.o diacrit_.o dirname_.o dup2_.o error_.o \
euidaccess_.o exclude_.o fileblocks_.o filemode_.o fnmatch_.o \
fsusage_.o ftruncate_.o full-write_.o getdate_.o getgroups_.o \
gethostname_.o getline_.o getloadavg_.o getopt_.o getopt1_.o \
getugroups_.o getusershell_.o group-member_.o hard-locale_.o hash_.o \
human_.o idcache_.o isdir_.o lchown_.o linebuffer_.o long-options_.o \
lstat_.o makepath_.o malloc_.o md5_.o memcasecmp_.o memchr_.o memcmp_.o \
memcoll_.o memcpy_.o memmove_.o memset_.o mkdir_.o mktime_.o \
modechange_.o mountlist_.o nanosleep_.o obstack_.o path-concat_.o \
posixtm_.o putenv_.o quotearg_.o readtokens_.o readutmp_.o realloc_.o \
regex_.o rmdir_.o rpmatch_.o safe-read_.o same_.o save-cwd_.o \
savedir_.o stat_.o stime_.o stpcpy_.o strcasecmp_.o strcspn_.o \
strdup_.o strftime_.o stripslash_.o strncasecmp_.o strndup_.o \
strpbrk_.o strstr_.o strtod_.o strtol_.o strtoul_.o strtoull_.o \
strtoumax_.o strverscmp_.o userspec_.o utime_.o version-etc_.o \
xgetcwd_.o xgethostname_.o xmalloc_.o xstrdup_.o xstrtod_.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,14 +548,15 @@ distdir: $(DISTFILES)
fi; \
done
@AMDEP@include $(DEPDIR)/addext$U.Po
@AMDEP@include $(DEPDIR)/alloca.Po
@AMDEP@include $(DEPDIR)/argmatch$U.Po
@AMDEP@include $(DEPDIR)/backupfile$U.Po
@AMDEP@include $(DEPDIR)/basename$U.Po
@AMDEP@include $(DEPDIR)/canon-host$U.Po
@AMDEP@include $(DEPDIR)/chown.Po
@AMDEP@include $(DEPDIR)/closeout$U.Po
@AMDEP@include $(DEPDIR)/diacrit$U.Po
@AMDEP@include $(DEPDIR)/dirname$U.Po
@AMDEP@include $(DEPDIR)/dup2.Po
@AMDEP@include $(DEPDIR)/error.Po
@@ -503,21 +570,30 @@ distdir: $(DISTFILES)
@AMDEP@include $(DEPDIR)/full-write$U.Po
@AMDEP@include $(DEPDIR)/getdate$U.Po
@AMDEP@include $(DEPDIR)/getgroups.Po
@AMDEP@include $(DEPDIR)/gethostname.Po
@AMDEP@include $(DEPDIR)/getline.Po
@AMDEP@include $(DEPDIR)/getloadavg.Po
@AMDEP@include $(DEPDIR)/getopt$U.Po
@AMDEP@include $(DEPDIR)/getopt1$U.Po
@AMDEP@include $(DEPDIR)/getugroups$U.Po
@AMDEP@include $(DEPDIR)/getusershell.Po
@AMDEP@include $(DEPDIR)/group-member.Po
@AMDEP@include $(DEPDIR)/hard-locale$U.Po
@AMDEP@include $(DEPDIR)/hash$U.Po
@AMDEP@include $(DEPDIR)/human$U.Po
@AMDEP@include $(DEPDIR)/idcache$U.Po
@AMDEP@include $(DEPDIR)/isdir$U.Po
@AMDEP@include $(DEPDIR)/lchown.Po
@AMDEP@include $(DEPDIR)/linebuffer$U.Po
@AMDEP@include $(DEPDIR)/long-options$U.Po
@AMDEP@include $(DEPDIR)/lstat.Po
@AMDEP@include $(DEPDIR)/makepath$U.Po
@AMDEP@include $(DEPDIR)/malloc.Po
@AMDEP@include $(DEPDIR)/md5$U.Po
@AMDEP@include $(DEPDIR)/memcasecmp$U.Po
@AMDEP@include $(DEPDIR)/memchr.Po
@AMDEP@include $(DEPDIR)/memcmp.Po
@AMDEP@include $(DEPDIR)/memcoll$U.Po
@AMDEP@include $(DEPDIR)/memcpy.Po
@AMDEP@include $(DEPDIR)/memmove.Po
@AMDEP@include $(DEPDIR)/memset.Po
@@ -525,10 +601,14 @@ 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
@AMDEP@include $(DEPDIR)/putenv.Po
@AMDEP@include $(DEPDIR)/quotearg$U.Po
@AMDEP@include $(DEPDIR)/readtokens$U.Po
@AMDEP@include $(DEPDIR)/readutmp$U.Po
@AMDEP@include $(DEPDIR)/realloc.Po
@AMDEP@include $(DEPDIR)/regex.Po
@AMDEP@include $(DEPDIR)/rmdir.Po
@@ -538,14 +618,18 @@ distdir: $(DISTFILES)
@AMDEP@include $(DEPDIR)/save-cwd$U.Po
@AMDEP@include $(DEPDIR)/savedir$U.Po
@AMDEP@include $(DEPDIR)/stat.Po
@AMDEP@include $(DEPDIR)/stime.Po
@AMDEP@include $(DEPDIR)/stpcpy.Po
@AMDEP@include $(DEPDIR)/strcasecmp.Po
@AMDEP@include $(DEPDIR)/strcspn.Po
@AMDEP@include $(DEPDIR)/strdup.Po
@AMDEP@include $(DEPDIR)/strftime.Po
@AMDEP@include $(DEPDIR)/stripslash$U.Po
@AMDEP@include $(DEPDIR)/strncasecmp.Po
@AMDEP@include $(DEPDIR)/strndup.Po
@AMDEP@include $(DEPDIR)/strpbrk.Po
@AMDEP@include $(DEPDIR)/strstr.Po
@AMDEP@include $(DEPDIR)/strtod.Po
@AMDEP@include $(DEPDIR)/strtol.Po
@AMDEP@include $(DEPDIR)/strtoul.Po
@AMDEP@include $(DEPDIR)/strtoull.Po
@@ -555,8 +639,10 @@ distdir: $(DISTFILES)
@AMDEP@include $(DEPDIR)/utime.Po
@AMDEP@include $(DEPDIR)/version-etc$U.Po
@AMDEP@include $(DEPDIR)/xgetcwd$U.Po
@AMDEP@include $(DEPDIR)/xgethostname$U.Po
@AMDEP@include $(DEPDIR)/xmalloc$U.Po
@AMDEP@include $(DEPDIR)/xstrdup$U.Po
@AMDEP@include $(DEPDIR)/xstrtod$U.Po
@AMDEP@include $(DEPDIR)/xstrtol$U.Po
@AMDEP@include $(DEPDIR)/xstrtoul$U.Po
@AMDEP@include $(DEPDIR)/xstrtoumax$U.Po
@@ -574,7 +660,7 @@ maintainer-clean-depend:
@AMDEP@CCDEPMODE = @CCDEPMODE@
.c.o:
@AMDEP@ source='$<' object='$@' @AMDEPBACKSLASH@
@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c -o $@ $<
@@ -657,11 +743,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

@@ -25,6 +25,13 @@
# include <config.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef emacs
# include "blockinput.h"
#endif
@@ -210,6 +217,9 @@ alloca (unsigned size)
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
if (new == 0)
abort();
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;

View File

@@ -57,8 +57,17 @@ dir_name (const char *path)
else
{
/* Remove any trailing slashes from the result. */
#ifdef MSDOS
char *lim = (path[0] >= 'A' && path[0] <= 'z' && path[1] == ':')
? path + 2 : path;
/* If canonicalized "d:/path", leave alone the root case "d:/". */
while (slash > lim && *slash == '/')
--slash;
#else
while (slash > path && *slash == '/')
--slash;
#endif
length = slash - path + 1;
}

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

@@ -1,5 +1,5 @@
/* exclude.c -- exclude file names
Copyright 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
Copyright 1992, 1993, 1994, 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
@@ -54,14 +54,14 @@ new_exclude (void)
}
int
excluded_filename (struct exclude const *ex, char const *f)
excluded_filename (struct exclude const *ex, char const *f, int options)
{
char const * const *exclude = ex->exclude;
int exclude_count = ex->exclude_count;
int i;
for (i = 0; i < exclude_count; i++)
if (fnmatch (exclude[i], f, 0) == 0)
if (fnmatch (exclude[i], f, options) == 0)
return 1;
return 0;
@@ -79,7 +79,8 @@ add_exclude (struct exclude *ex, char const *pattern)
}
int
add_exclude_file (struct exclude *ex, char const *filename, char line_end)
add_exclude_file (void (*add_func) PARAMS ((struct exclude *, char const *)),
struct exclude *ex, char const *filename, char line_end)
{
int use_stdin = filename[0] == '-' && !filename[1];
FILE *in;
@@ -118,7 +119,7 @@ add_exclude_file (struct exclude *ex, char const *filename, char line_end)
if (p < lim ? *p == line_end : buf < p && p[-1])
{
*p = '\0';
add_exclude (ex, pattern);
(*add_func) (ex, pattern);
pattern = p + 1;
}

View File

@@ -1,5 +1,5 @@
/* exclude.h -- declarations for excluding file names
Copyright 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
Copyright 1992, 1993, 1994, 1997, 1999 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,5 +30,6 @@ struct exclude;
struct exclude *new_exclude PARAMS ((void));
void add_exclude PARAMS ((struct exclude *, char const *));
int add_exclude_file PARAMS ((struct exclude *, char const *, char));
int excluded_filename PARAMS ((struct exclude const *, char const *));
int add_exclude_file PARAMS ((void (*) (struct exclude *, char const *),
struct exclude *, char const *, char));
int excluded_filename PARAMS ((struct exclude const *, char const *, int));

View File

@@ -1,6 +1,6 @@
%{
/* Parse a string into an internal time stamp.
Copyright 1999 Free Software Foundation, Inc.
Copyright 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
@@ -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

@@ -445,8 +445,8 @@ hash_reset_tuning (Hash_tuning *tuning)
/* For the given hash TABLE, check the user supplied tuning structure for
reasonable values, and return true if there is no gross error with it.
Otherwise, definitvely reset the TUNING field to some acceptable default in
the hash table (that is, the user loses the right of further modifying
Otherwise, definitively reset the TUNING field to some acceptable default
in the hash table (that is, the user loses the right of further modifying
tuning arguments), and return false. */
static bool
@@ -468,15 +468,14 @@ check_tuning (Hash_table *table)
return false;
}
/* Allocate and return a new hash table, or NULL upon failure. The
initial number of buckets is automatically selected so as to _guarantee_ that
you may insert at least CANDIDATE different user entries before any growth
of the hash table size occurs. So, if have a reasonably tight a-priori
upper bound on the
number of entries you intend to insert in the hash table, you may save some
table memory and insertion time, by specifying it here. If the
IS_N_BUCKETS field of the TUNING structure is true, the CANDIDATE argument
has its meaning changed to the wanted number of buckets.
/* Allocate and return a new hash table, or NULL upon failure. The initial
number of buckets is automatically selected so as to _guarantee_ that you
may insert at least CANDIDATE different user entries before any growth of
the hash table size occurs. So, if have a reasonably tight a-priori upper
bound on the number of entries you intend to insert in the hash table, you
may save some table memory and insertion time, by specifying it here. If
the IS_N_BUCKETS field of the TUNING structure is true, the CANDIDATE
argument has its meaning changed to the wanted number of buckets.
TUNING points to a structure of user-supplied values, in case some fine
tuning is wanted over the default behavior of the hasher. If TUNING is
@@ -769,8 +768,8 @@ hash_find_entry (Hash_table *table, const void *entry,
/* For an already existing hash table, change the number of buckets through
specifying CANDIDATE. The contents of the hash table are preserved. The
new number of buckets is automatically selected so as to _guarantee_ that the
table may receive at least CANDIDATE different user entries, including
new number of buckets is automatically selected so as to _guarantee_ that
the table may receive at least CANDIDATE different user entries, including
those already in the table, before any other growth of the hash table size
occurs. If TUNING->IS_N_BUCKETS is true, then CANDIDATE specifies the
exact number of buckets desired. */

View File

@@ -1,46 +0,0 @@
#! /bin/sh
# interlock - wrap program invocation in lock to allow
# parallel builds to work.
# Written by Tom Tromey <tromey@cygnus.com>, Aug 10 1996
#
# 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.
# Usage:
# interlock lock-dir-name program args-to-program...
dirname="$1"
program="$2"
shift
shift
while (mkdir $dirname > /dev/null 2>&1 && exit 1 || exit 0); do
# Wait a bit.
sleep 1
done
# Race condition here: if interrupted after the loop but before this
# trap, the lock can be left around.
trap "rmdir $dirname > /dev/null 2>&1" 1 2 3 15
# We have the lock, so run the program.
$program ${1+"$@"}
ret=$?
# Release the lock.
rmdir $dirname > /dev/null 2>&1
exit $ret

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++;

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 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
@@ -25,10 +25,7 @@
Return DESTADDR. */
char *
memcpy (destaddr, srcaddr, len)
char *destaddr;
const char *srcaddr;
int len;
memcpy (char *destaddr, const char *srcaddr, int len)
{
char *dest = destaddr;

View File

@@ -1,5 +1,5 @@
/* modechange.c -- file mode manipulation
Copyright (C) 1989, 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1989, 1990, 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
@@ -157,7 +157,7 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
{
struct mode_change *head; /* First element of the linked list. */
struct mode_change *tail; /* An element of the linked list. */
unsigned long mode_value; /* The mode value, if octal. */
uintmax_t mode_value; /* The mode value, if octal. */
char *string_end; /* Pointer to end of parsed value. */
mode_t umask_value; /* The umask value (surprise). */
@@ -166,10 +166,10 @@ mode_compile (const char *mode_string, unsigned int masked_ops)
tail = NULL;
#endif
if (xstrtoul (mode_string, &string_end, 8, &mode_value, "") == LONGINT_OK)
if (xstrtoumax (mode_string, &string_end, 8, &mode_value, "") == LONGINT_OK)
{
struct mode_change *p;
if (mode_value > CHMOD_MODE_BITS)
if (mode_value != (mode_value & CHMOD_MODE_BITS))
return MODE_INVALID;
p = make_node_op_equals ((mode_t) mode_value);
if (p == NULL)

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_NOCLDSTOP
struct sigaction oldact, newact;
#endif
suspended = 0;
/* set up sig handler */
if (first_call)
{
#ifdef SA_NOCLDSTOP
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,5 +1,5 @@
/* quotearg.c - quote arguments for output
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,8 +17,6 @@
/* Written by Paul Eggert <eggert@twinsun.com> */
/* FIXME: Multibyte characters are not supported yet. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
@@ -33,11 +31,7 @@
#else
# define ISASCII(c) isascii (c)
#endif
#ifdef isgraph
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#else
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#endif
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#if ENABLE_NLS
# include <libintl.h>
@@ -64,6 +58,19 @@
# include <string.h>
#endif
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
#if HAVE_MBRTOWC && HAVE_WCHAR_H
# include <wchar.h>
#else
# define iswprint(wc) 1
# define mbrtowc(pwc, s, n, ps) 1
# define mbsinit(ps) 1
# define mbstate_t int
#endif
#define INT_BITS (sizeof (int) * CHAR_BIT)
struct quoting_options
@@ -71,7 +78,7 @@ struct quoting_options
/* Basic quoting style. */
enum quoting_style style;
/* Quote the chararacters indicated by this bit vector even if the
/* Quote the characters indicated by this bit vector even if the
quoting style would not normally require them to be quoted. */
int quote_these_too[((UCHAR_MAX + 1) / INT_BITS
+ ((UCHAR_MAX + 1) % INT_BITS != 0))];
@@ -89,7 +96,7 @@ char const *const quoting_style_args[] =
0
};
/* Correspondances to quoting style names. */
/* Correspondences to quoting style names. */
enum quoting_style const quoting_style_vals[] =
{
literal_quoting_style,
@@ -146,6 +153,293 @@ set_char_quoting (struct quoting_options *o, char c, int i)
return r;
}
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
argument ARG (of size ARGSIZE), using QUOTING_STYLE and the
non-quoting-style part of O to control quoting.
Terminate the output with a null character, and return the written
size of the output, not counting the terminating null.
If BUFFERSIZE is too small to store the output string, return the
value that would have been returned had BUFFERSIZE been large enough.
If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,
ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting
style specified by O, and O may not be null. */
static size_t
quotearg_buffer_restyled (char *buffer, size_t buffersize,
char const *arg, size_t argsize,
enum quoting_style quoting_style,
struct quoting_options const *o)
{
size_t i;
size_t len = 0;
char const *quote_string = 0;
size_t quote_string_len = 0;
int backslash_escapes = 0;
#define STORE(c) \
do \
{ \
if (len < buffersize) \
buffer[len] = (c); \
len++; \
} \
while (0)
switch (quoting_style)
{
case c_quoting_style:
STORE ('"');
backslash_escapes = 1;
quote_string = "\"";
quote_string_len = 1;
break;
case escape_quoting_style:
backslash_escapes = 1;
break;
case locale_quoting_style:
for (quote_string = _("`"); *quote_string; quote_string++)
STORE (*quote_string);
backslash_escapes = 1;
quote_string = _("'");
quote_string_len = strlen (quote_string);
break;
case shell_always_quoting_style:
STORE ('\'');
quote_string = "'";
quote_string_len = 1;
break;
default:
break;
}
for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++)
{
unsigned char c;
unsigned char esc;
if (backslash_escapes
&& quote_string_len
&& i + quote_string_len <= argsize
&& memcmp (arg + i, quote_string, quote_string_len) == 0)
STORE ('\\');
c = arg[i];
switch (c)
{
case '?':
switch (quoting_style)
{
case shell_quoting_style:
goto use_shell_always_quoting_style;
case c_quoting_style:
if (i + 2 < argsize && arg[i + 1] == '?')
switch (arg[i + 2])
{
case '!': case '\'':
case '(': case ')': case '-': case '/':
case '<': case '=': case '>':
/* Escape the second '?' in what would otherwise be
a trigraph. */
i += 2;
c = arg[i + 2];
STORE ('?');
STORE ('\\');
STORE ('?');
break;
}
break;
default:
break;
}
break;
#if HAVE_C_BACKSLASH_A
case '\a': esc = 'a'; goto c_escape;
#endif
case '\b': esc = 'b'; goto c_escape;
case '\f': esc = 'f'; goto c_escape;
case '\n': esc = 'n'; goto c_and_shell_escape;
case '\r': esc = 'r'; goto c_and_shell_escape;
case '\t': esc = 't'; goto c_and_shell_escape;
case '\v': esc = 'v'; goto c_escape;
case '\\': esc = c; goto c_and_shell_escape;
c_and_shell_escape:
if (quoting_style == shell_quoting_style)
goto use_shell_always_quoting_style;
c_escape:
if (backslash_escapes)
{
c = esc;
goto store_escape;
}
break;
case '#': case '~':
if (i != 0)
break;
/* Fall through. */
case ' ':
case '!': /* special in bash */
case '"': case '$': case '&':
case '(': case ')': case '*': case ';':
case '<': case '>': case '[':
case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
case '`': case '|':
/* A shell special character. In theory, '$' and '`' could
be the first bytes of multibyte characters, which means
we should check them with mbrtowc, but in practice this
doesn't happen so it's not worth worrying about. */
if (quoting_style == shell_quoting_style)
goto use_shell_always_quoting_style;
break;
case '\'':
switch (quoting_style)
{
case shell_quoting_style:
goto use_shell_always_quoting_style;
case shell_always_quoting_style:
STORE ('\'');
STORE ('\\');
STORE ('\'');
break;
default:
break;
}
break;
case '%': case '+': case ',': case '-': case '.': case '/':
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case ':': case '=':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z': case ']': case '_': case 'a': case 'b':
case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case '{': case '}':
/* These characters don't cause problems, no matter what the
quoting style is. They cannot start multibyte sequences. */
break;
default:
/* If we have a multibyte sequence, copy it until we reach
its end, find an error, or come back to the initial shift
state. For C-like styles, if the sequence has
unprintable characters, escape the whole sequence, since
we can't easily escape single characters within it. */
{
/* Length of multibyte sequence found so far. */
size_t m = 0;
int printable = 1;
mbstate_t mbstate;
memset (&mbstate, 0, sizeof mbstate);
if (argsize == (size_t) -1)
argsize = strlen (arg);
do
{
wchar_t w;
size_t bytes = mbrtowc (&w, &arg[i + m],
argsize - (i + m), &mbstate);
if (bytes == 0)
break;
else if (bytes == (size_t) -1)
{
printable = 0;
break;
}
else if (bytes == (size_t) -2)
{
printable = 0;
while (i + m < argsize && arg[i + m])
m++;
break;
}
else
{
if (! iswprint (w))
printable = 0;
m += bytes;
}
}
while (! mbsinit (&mbstate));
if (m <= 1)
{
/* Escape a unibyte character like a multibyte
sequence if using backslash escapes, and if the
character is not printable. */
m = backslash_escapes && ! ISPRINT (c);
printable = 0;
}
if (m)
{
/* Output a multibyte sequence, or an escaped
unprintable unibyte character. */
size_t imax = i + m - 1;
for (;;)
{
if (backslash_escapes && ! printable)
{
STORE ('\\');
STORE ('0' + (c >> 6));
STORE ('0' + ((c >> 3) & 7));
c = '0' + (c & 7);
}
if (i == imax)
break;
STORE (c);
c = arg[++i];
}
goto store_c;
}
}
}
if (! (backslash_escapes
&& o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
goto store_c;
store_escape:
STORE ('\\');
store_c:
STORE (c);
}
if (quote_string)
for (; *quote_string; quote_string++)
STORE (*quote_string);
if (len < buffersize)
buffer[len] = '\0';
return len;
use_shell_always_quoting_style:
return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
shell_always_quoting_style, o);
}
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
argument ARG (of size ARGSIZE), using O to control quoting.
If O is null, use the default.
@@ -159,161 +453,9 @@ quotearg_buffer (char *buffer, size_t buffersize,
char const *arg, size_t argsize,
struct quoting_options const *o)
{
unsigned char c;
size_t i;
size_t len = 0;
char const *quote_string;
size_t quote_string_len;
struct quoting_options const *p = o ? o : &default_quoting_options;
enum quoting_style quoting_style = p->style;
#define STORE(c) \
do \
{ \
if (len < buffersize) \
buffer[len] = (c); \
len++; \
} \
while (0)
switch (quoting_style)
{
case shell_quoting_style:
if (! (argsize == (size_t) -1 ? arg[0] == '\0' : argsize == 0))
{
switch (arg[0])
{
case '#': case '~':
break;
default:
for (i = 0; ; i++)
{
if (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize)
goto done;
c = arg[i];
switch (c)
{
case '\t': case '\n': case ' ':
case '!': /* special in csh */
case '"': case '$': case '&': case '\'':
case '(': case ')': case '*': case ';':
case '<': case '>': case '?': case '[': case '\\':
case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
case '`': case '|':
goto needs_quoting;
}
if (p->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
goto needs_quoting;
STORE (c);
}
needs_quoting:;
len = 0;
break;
}
}
/* Fall through. */
case shell_always_quoting_style:
STORE ('\'');
quote_string = "'";
quote_string_len = 1;
break;
case c_quoting_style:
STORE ('"');
quote_string = "\"";
quote_string_len = 1;
break;
case locale_quoting_style:
for (quote_string = _("`"); *quote_string; quote_string++)
STORE (*quote_string);
quote_string = _("'");
quote_string_len = strlen (quote_string);
break;
default:
quote_string = 0;
quote_string_len = 0;
break;
}
for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++)
{
c = arg[i];
switch (quoting_style)
{
case literal_quoting_style:
break;
case shell_quoting_style:
case shell_always_quoting_style:
if (c == '\'')
{
STORE ('\'');
STORE ('\\');
STORE ('\'');
}
break;
case c_quoting_style:
case escape_quoting_style:
case locale_quoting_style:
switch (c)
{
case '?': /* Do not generate trigraphs. */
case '\\': goto store_escape;
/* Not all C compilers know what \a means. */
case 7 : c = 'a'; goto store_escape;
case '\b': c = 'b'; goto store_escape;
case '\f': c = 'f'; goto store_escape;
case '\n': c = 'n'; goto store_escape;
case '\r': c = 'r'; goto store_escape;
case '\t': c = 't'; goto store_escape;
case '\v': c = 'v'; goto store_escape;
case ' ': break;
default:
if (quote_string_len
&& strncmp (arg + i, quote_string, quote_string_len) == 0)
goto store_escape;
if (!ISGRAPH (c))
{
STORE ('\\');
STORE ('0' + (c >> 6));
STORE ('0' + ((c >> 3) & 7));
c = '0' + (c & 7);
goto store_c;
}
break;
}
if (! (p->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
goto store_c;
store_escape:
STORE ('\\');
}
store_c:
STORE (c);
}
if (quote_string)
for (; *quote_string; quote_string++)
STORE (*quote_string);
done:
if (len < buffersize)
buffer[len] = '\0';
return len;
return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
p->style, p);
}
/* Use storage slot N to return a quoted version of the string ARG.

View File

@@ -1,5 +1,5 @@
/* GNU's read utmp module.
Copyright (C) 1992-1999 Free Software Foundation, Inc.
Copyright (C) 1992-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
@@ -41,11 +41,11 @@ extract_trimmed_name (const STRUCT_UTMP *ut)
{
char *p, *trimmed_name;
trimmed_name = xmalloc (sizeof (ut->ut_name) + 1);
strncpy (trimmed_name, ut->ut_name, sizeof (ut->ut_name));
trimmed_name = xmalloc (sizeof (UT_USER (ut)) + 1);
strncpy (trimmed_name, UT_USER (ut), sizeof (UT_USER (ut)));
/* Append a trailing space character. Some systems pad names shorter than
the maximum with spaces, others pad with NULs. Remove any spaces. */
trimmed_name[sizeof (ut->ut_name)] = ' ';
trimmed_name[sizeof (UT_USER (ut))] = ' ';
p = strchr (trimmed_name, ' ');
if (p != NULL)
*p = '\0';

View File

@@ -1,5 +1,5 @@
/* Declarations for GNU's read utmp module.
Copyright (C) 1992-1999 Free Software Foundation, Inc.
Copyright (C) 1992-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
@@ -48,6 +48,29 @@
# define UTMP_NAME_FUNCTION utmpname
# endif
/* Accessor macro for the member named ut_user or ut_name. */
# ifdef HAVE_UTMPX_H
# if HAVE_STRUCT_UTMPX_UT_USER
# define UT_USER(Utmp) Utmp->ut_user
# endif
# if HAVE_STRUCT_UTMPX_UT_NAME
# undef UT_USER
# define UT_USER(Utmp) Utmp->ut_name
# endif
# else
# if HAVE_STRUCT_UTMP_UT_USER
# define UT_USER(Utmp) Utmp->ut_user
# endif
# if HAVE_STRUCT_UTMP_UT_NAME
# undef UT_USER
# define UT_USER(Utmp) Utmp->ut_name
# endif
# endif
typedef struct UTMP_STRUCT_NAME STRUCT_UTMP;
# include <time.h>

7185
lib/rx.c

File diff suppressed because it is too large Load Diff

3732
lib/rx.h

File diff suppressed because it is too large Load Diff

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

@@ -37,8 +37,12 @@
# endif
#endif
#if HAVE_UNSIGNED_LONG_LONG && ! HAVE_STRTOULL
unsigned long long strtoull PARAMS ((char const *, char **, int));
#ifndef HAVE_DECL_STRTOUL
unsigned long long strtoul PARAMS ((char const *, char **, int));
#endif
#ifndef HAVE_DECL_STRTOULL
unsigned long long strtoull PARAMS ((char const *, char **, int));
#endif
uintmax_t
@@ -56,3 +60,16 @@ strtoumax (char const *ptr, char **endptr, int base)
abort ();
}
#ifdef TESTING
# include <stdio.h>
int
main ()
{
char *p, *endptr;
printf ("sizeof uintmax_t: %d\n", sizeof (uintmax_t));
printf ("sizeof strtoull(): %d\n", sizeof strtoull(p, &endptr, 10));
printf ("sizeof strtoul(): %d\n", sizeof strtoul(p, &endptr, 10));
exit (0);
}
#endif

View File

@@ -1,5 +1,5 @@
/* Compare strings while treating digits characters numerically.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-Francois Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
@@ -36,6 +36,15 @@
#define CMP 2
#define LEN 3
/* ISDIGIT differs from isdigit, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to isdigit unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
/* Compare S1 and S2 as strings holding indices/version numbers,
returning less than, equal to or greater than zero if S1 is less than,
@@ -83,17 +92,17 @@ strverscmp (const char *s1, const char *s2)
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
state = S_N | ((c1 == '0') + (isdigit (c1) != 0));
state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
while ((diff = c1 - c2) == 0 && c1 != '\0')
{
state = next_state[state];
c1 = *p1++;
c2 = *p2++;
state |= (c1 == '0') + (isdigit (c1) != 0);
state |= (c1 == '0') + (ISDIGIT (c1) != 0);
}
state = result_type[state << 2 | ((c2 == '0') + (isdigit (c2) != 0))];
state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
switch (state)
{
@@ -101,11 +110,11 @@ strverscmp (const char *s1, const char *s2)
return diff;
case LEN:
while (isdigit (*p1++))
if (!isdigit (*p2++))
while (ISDIGIT (*p1++))
if (!ISDIGIT (*p2++))
return 1;
return isdigit (*p2) ? -1 : diff;
return ISDIGIT (*p2) ? -1 : diff;
default:
return state;

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,183 @@
2000-01-30 Jim Meyering <meyering@lucent.com>
* lib-check.m4: Clean up some kludgy old shadow password tests.
* prereq.m4 (utmp_includes): Define.
Check for ut_user and ut_name members in both struct utmpx
and struct utmp.
2000-01-29 Jim Meyering <meyering@lucent.com>
* lib-check.m4: New file containing library-related checks from
fileutils and sh-utils (textutils had none).
2000-01-28 Jim Meyering <meyering@lucent.com>
* perl.m4: Change format of warning message to look more like that
from the missing script. Suggestion from François Pinard.
2000-01-25 Jim Meyering <meyering@lucent.com>
* timespec.m4: Require AC_HEADER_TIME, and include sys/time.h as well
as time.h in the compile check.
* nanosleep.m4: Require AC_HEADER_TIME rather than simply using it.
Fix typo in cross-compiling case: s/yes/no/.
2000-01-23 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: Move df-related tests here from fileutils/configure.in
* ls-mntd-fs.m4: s/list_mounted_fs/ac_list_mounted_fs/
(jm_LIST_MOUNTED_FILESYSTEMS): Take two parameters.
* fsusage.m4: New file. Extracted from fileutils/configure.in.
s/space/ac_fsusage_space/.
(jm_FILE_SYSTEM_USAGE): Take two parameters.
* ftruncate.m4: New file (derived from part of fileutils/configure.in).
* jm-macros.m4: (jm_FUNC_FTRUNCATE): AC_REQUIRE it.
(jm_CHECK_ALL_TYPES): Require AC_HEADER_MAJOR and AC_HEADER_DIRENT.
* jm-macros.m4: (OPTIONAL_BIN_PROGS, OPTIONAL_BIN_ZCRIPTS, MAN):
AC_SUBST these here, rather than just in sh-util/configure.in, so
that the now-shared-by-fileutils-and-textutils lib/Makefile.am are
all the same.
(AM_FUNC_OBSTACK): Add (from fileutils/configure.in).
(AC_CHECK_FUNCS): Merge all checks from fileutils, textutils, sh-utils.
(AM_FUNC_STRTOD): Added (from textutils', sh-utils' configure.in).
(AC_SUBST(POW_LIBM)): Likewise.
(AC_SUBST(DF_PROG)): Moved from fileutils/configure.in.
2000-01-22 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: Call AC_PROG_CC_STDC just before AC_C_CONST.
* prereq.m4 (jm_PREREQ_QUOTEARG): Add wctype.h.
* jm-macros.m4 (AC_CHECK_HEADERS): Add checks from fileutils'
configure.in
(AC_CHECK_HEADERS): Likewise for sh-utils.
(AC_CHECK_HEADERS): Likewise for textutils.
Merge the three lists of headers.
* prereq.m4 (jm_PREREQ_ADDEXT): New macro. Parts moved here
from fileutils' configure.in.
* decl.m4: Remove kludgy `test -z $ac_...AC_CHECK_HEADERS(...)' code.
Moved tests into their own function (_jm_DECL_HEADERS) in check-decl.m4.
* check-decl.m4: Use #if rather than #ifdef.
Add HAVE_DECL_STRTOUL and HAVE_DECL_STRTOULL.
(jm_CHECK_DECLARATIONS): Add strtoul strtoull.
(_jm_DECL_HEADERS): Define new function.
(jm_CHECK_DECLARATIONS): Require it.
2000-01-19 Jim Meyering <meyering@lucent.com>
* nanosleep.m4 (jm_FUNC_NANOSLEEP): Include <sys/time.h>, too.
Use AC_HEADER_TIME. Volker Borchert reported that OpenBSD-2.3/sparc
defines `struct timespec' in <sys/time.h>
* c-bs-a.m4: Remove uses of changequote altogether.
Thanks to Akim for explaining.
2000-01-16 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: Require jm_FUNC_GROUP_MEMBER, jm_FUNC_PUTENV,
AM_FUNC_ERROR_AT_LINE, jm_FUNC_GNU_STRFTIME, jm_FUNC_MKTIME,
jm_FUNC_GETGROUPS AC_FUNC_VPRINTF, AC_FUNC_ALLOCA,
AM_FUNC_GETLOADAVG, and jm_SYS_PROC_UPTIME.
2000-01-16 Jim Meyering <meyering@lucent.com>
* c-bs-a.m4: Use `changequote(<<,>>)', rather than `changequote(, )'
because the latter didn't work.
2000-01-15 Jim Meyering <meyering@lucent.com>
* jm-macros.m4 (AC_REPLACE_FUNCS): Add gethostname and getusershell.
(AC_REPLACE_FUNCS): Add memcpy and memset.
Add these, too: stime strcspn stpcpy strstr strtol strtoul.
Add strpbrk.
Add these: euidaccess memcmp mkdir rmdir rpmatch strndup strverscmp.
2000-01-12 Jim Meyering <meyering@lucent.com>
* prereq.m4 (jm_PREREQ_CANON_HOST): New macro.
(jm_PREREQ): Use it.
(jm_PREREQ_READUTMP): New macro.
(jm_PREREQ): Use it.
2000-01-11 Paul Eggert <eggert@twinsun.com>
Quote multibyte characters correctly.
* m4/c-bs-a.m4: New file.
* m4/prereq.m4 (jm_PREREQ_QUOTEARG): New macro.
(jm_PREREQ): Use it.
2000-01-11 Paul Eggert <eggert@twinsun.com>
* m4/uintmax_t.m4: Port to autoconf 2.13.
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

@@ -5,6 +5,7 @@ EXTRA_DIST = README Makefile.am.in \
afs.m4 \
assert.m4 \
bison.m4 \
c-bs-a.m4 \
check-decl.m4 \
chown.m4 \
d-ino.m4 \
@@ -13,6 +14,8 @@ decl.m4 \
error.m4 \
fnmatch.m4 \
fstypename.m4 \
fsusage.m4 \
ftruncate.m4 \
getgroups.m4 \
getline.m4 \
getloadavg.m4 \
@@ -29,11 +32,14 @@ jm-winsz2.m4 \
largefile.m4 \
lchown.m4 \
lcmessage.m4 \
lib-check.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 +51,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

@@ -73,6 +73,7 @@ DEPDIR = @DEPDIR@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNU_PACKAGE = @GNU_PACKAGE@
@@ -83,14 +84,20 @@ INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
KMEM_GROUP = @KMEM_GROUP@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MAN = @MAN@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
NEED_SETGID = @NEED_SETGID@
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -105,6 +112,7 @@ EXTRA_DIST = README Makefile.am.in \
afs.m4 \
assert.m4 \
bison.m4 \
c-bs-a.m4 \
check-decl.m4 \
chown.m4 \
d-ino.m4 \
@@ -113,6 +121,8 @@ decl.m4 \
error.m4 \
fnmatch.m4 \
fstypename.m4 \
fsusage.m4 \
ftruncate.m4 \
getgroups.m4 \
getline.m4 \
getloadavg.m4 \
@@ -129,11 +139,14 @@ jm-winsz2.m4 \
largefile.m4 \
lchown.m4 \
lcmessage.m4 \
lib-check.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 +158,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 +206,6 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:

23
m4/c-bs-a.m4 Normal file
View File

@@ -0,0 +1,23 @@
#serial 3
dnl From Paul Eggert.
AC_DEFUN(AC_C_BACKSLASH_A,
[
AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
[AC_TRY_COMPILE([],
[
#if '\a' == 'a'
syntax error;
#endif
char buf['\a' == 'a' ? -1 : 1];
buf[0] = '\a';
return buf[0] != "\a"[0];
],
ac_cv_c_backslash_a=yes,
ac_cv_c_backslash_a=no)])
if test $ac_cv_c_backslash_a = yes; then
AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
[Define if backslash-a works in C strings.])
fi
])

View File

@@ -1,26 +1,27 @@
#serial 5
#serial 6
dnl This is just a wrapper function to encapsulate this kludge.
dnl Putting it in a separate file like this helps share it between
dnl different packages.
AC_DEFUN(jm_CHECK_DECLS,
[
AC_REQUIRE([_jm_DECL_HEADERS])
headers='
#include <stdio.h>
#ifdef HAVE_STRING_H
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
# if HAVE_STRINGS_H
# include <strings.h>
# endif
#endif
#ifdef HAVE_STDLIB_H
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
'
@@ -38,8 +39,18 @@ AC_DEFUN(jm_CHECK_DECLS,
AC_DEFINE(HAVE_DECL_REALLOC, 1, [Define if this function is declared.])
AC_DEFINE(HAVE_DECL_STPCPY, 1, [Define if this function is declared.])
AC_DEFINE(HAVE_DECL_STRSTR, 1, [Define if this function is declared.])
AC_DEFINE(HAVE_DECL_STRTOUL, 1, [Define if this function is declared.])
AC_DEFINE(HAVE_DECL_STRTOULL, 1, [Define if this function is declared.])
fi
jm_CHECK_DECLARATIONS($headers, free lseek malloc \
memchr realloc stpcpy strstr)
memchr realloc stpcpy strstr strtoul strtoull)
])
dnl FIXME: when autoconf has support for it.
dnl This is a little helper so we can require these header checks.
AC_DEFUN(_jm_DECL_HEADERS,
[
AC_REQUIRE([AC_HEADER_STDC])
AC_CHECK_HEADERS(memory.h string.h strings.h stdlib.h unistd.h)
])

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,13 +1,7 @@
#serial 3
#serial 5
AC_DEFUN(jm_CHECK_DECLARATION,
[
AC_REQUIRE([AC_HEADER_STDC])dnl
test -z "$ac_cv_header_memory_h" && AC_CHECK_HEADERS(memory.h)
test -z "$ac_cv_header_string_h" && AC_CHECK_HEADERS(string.h)
test -z "$ac_cv_header_strings_h" && AC_CHECK_HEADERS(strings.h)
test -z "$ac_cv_header_stdlib_h" && AC_CHECK_HEADERS(stdlib.h)
test -z "$ac_cv_header_unistd_h" && AC_CHECK_HEADERS(unistd.h)
AC_MSG_CHECKING([whether $1 is declared])
AC_CACHE_VAL(jm_cv_func_decl_$1,
[AC_TRY_COMPILE($2,

192
m4/fsusage.m4 Normal file
View File

@@ -0,0 +1,192 @@
#serial 1
# From fileutils/configure.in
# Try to determine how a program can obtain filesystem usage information.
# If successful, define the appropriate symbol (see fsusage.c) and
# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
#
# jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
AC_DEFUN(jm_FILE_SYSTEM_USAGE,
[
AC_CHECKING(how to get filesystem space usage)
ac_fsusage_space=no
# Perform only the link test since it seems there are no variants of the
# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
# because that got a false positive on SCO OSR5. Adding the declaration
# of a `struct statvfs' causes this test to fail (as it should) on such
# systems. That system is reported to work fine with STAT_STATFS4 which
# is what it gets when this test fails.
if test $ac_fsusage_space = no; then
# SVR4
AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
[AC_TRY_LINK([#include <sys/types.h>
#include <sys/statvfs.h>],
[struct statvfs fsd; statvfs (0, &fsd);],
fu_cv_sys_stat_statvfs=yes,
fu_cv_sys_stat_statvfs=no)])
if test $fu_cv_sys_stat_statvfs = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATVFS, 1,
[ Define if there is a function named statvfs. (SVR4)])
fi
fi
if test $ac_fsusage_space = no; then
# DEC Alpha running OSF/1
AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
[AC_TRY_RUN([
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mount.h>
main ()
{
struct statfs fsd;
fsd.f_fsize = 0;
exit (statfs (".", &fsd, sizeof (struct statfs)));
}],
fu_cv_sys_stat_statfs3_osf1=yes,
fu_cv_sys_stat_statfs3_osf1=no,
fu_cv_sys_stat_statfs3_osf1=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS3_OSF1, 1,
[ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
fi
fi
if test $ac_fsusage_space = no; then
# AIX
AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
member (AIX, 4.3BSD)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
[AC_TRY_RUN([
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
main ()
{
struct statfs fsd;
fsd.f_bsize = 0;
exit (statfs (".", &fsd));
}],
fu_cv_sys_stat_statfs2_bsize=yes,
fu_cv_sys_stat_statfs2_bsize=no,
fu_cv_sys_stat_statfs2_bsize=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
if test $fu_cv_sys_stat_statfs2_bsize = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS2_BSIZE, 1,
[ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
(4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
fi
fi
if test $ac_fsusage_space = no; then
# SVR3
AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
[AC_TRY_RUN([#include <sys/types.h>
#include <sys/statfs.h>
main ()
{
struct statfs fsd;
exit (statfs (".", &fsd, sizeof fsd, 0));
}],
fu_cv_sys_stat_statfs4=yes,
fu_cv_sys_stat_statfs4=no,
fu_cv_sys_stat_statfs4=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
if test $fu_cv_sys_stat_statfs4 = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS4, 1,
[ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
fi
fi
if test $ac_fsusage_space = no; then
# 4.4BSD and NetBSD
AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
member (4.4BSD and NetBSD)])
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
[AC_TRY_RUN([#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
main ()
{
struct statfs fsd;
fsd.f_fsize = 0;
exit (statfs (".", &fsd));
}],
fu_cv_sys_stat_statfs2_fsize=yes,
fu_cv_sys_stat_statfs2_fsize=no,
fu_cv_sys_stat_statfs2_fsize=no)])
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
if test $fu_cv_sys_stat_statfs2_fsize = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS2_FSIZE, 1,
[ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
(4.4BSD, NetBSD)])
fi
fi
if test $ac_fsusage_space = no; then
# Ultrix
AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
[AC_TRY_RUN([#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_FS_TYPES_H
#include <sys/fs_types.h>
#endif
main ()
{
struct fs_data fsd;
/* Ultrix's statfs returns 1 for success,
0 for not mounted, -1 for failure. */
exit (statfs (".", &fsd) != 1);
}],
fu_cv_sys_stat_fs_data=yes,
fu_cv_sys_stat_fs_data=no,
fu_cv_sys_stat_fs_data=no)])
AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
if test $fu_cv_sys_stat_fs_data = yes; then
ac_fsusage_space=yes
AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
[ Define if statfs takes 2 args and the second argument has
type struct fs_data. (Ultrix)])
fi
fi
if test $ac_fsusage_space = no; then
# SVR2
AC_TRY_CPP([#include <sys/filsys.h>],
AC_DEFINE(STAT_READ_FILSYS, 1,
[ Define if there is no specific function for reading filesystems usage
information and you have the <sys/filsys.h> header file. (SVR2)])
ac_fsusage_space=yes)
fi
AC_SHELL_IFELSE([test $ac_fsusage_space = yes], [$1], [$2])dnl
])

27
m4/ftruncate.m4 Normal file
View File

@@ -0,0 +1,27 @@
#serial 1
# See if we need to emulate a missing ftruncate function using fcntl.
AC_DEFUN(jm_FUNC_FTRUNCATE,
[
AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
if test "$ftruncate_missing" = yes; then
AC_CHECK_HEADERS(unistd.h)
AC_MSG_CHECKING([fcntl emulation of ftruncate])
AC_CACHE_VAL(fu_cv_sys_ftruncate_emulation,
[AC_TRY_LINK([
#include <sys/types.h>
#include <fcntl.h>], [
#if !defined(F_CHSIZE) && !defined(F_FREESP)
chsize();
#endif
],
fu_cv_sys_ftruncate_emulation=yes,
fu_cv_sys_ftruncate_emulation=no)])
AC_MSG_RESULT($fu_cv_sys_ftruncate_emulation)
if test $fu_cv_sys_ftruncate_emulation = yes; then
LIBOBJS="$LIBOBJS ftruncate.$ac_objext"
fi
fi
])

View File

@@ -1,4 +1,4 @@
#serial 10
#serial 12
dnl Misc type-related macros for fileutils, sh-utils, textutils.
@@ -11,17 +11,59 @@ AC_DEFUN(jm_MACROS,
[The concatenation of the strings `GNU ', and PACKAGE.])
AC_SUBST(GNU_PACKAGE)
AC_SUBST(OPTIONAL_BIN_PROGS)
AC_SUBST(OPTIONAL_BIN_ZCRIPTS)
AC_SUBST(MAN)
AC_SUBST(DF_PROG)
dnl This macro actually runs replacement code. See isc-posix.m4.
AC_REQUIRE([AC_ISC_POSIX])dnl
AC_CHECK_HEADERS( \
errno.h \
fcntl.h \
fenv.h \
float.h \
limits.h \
memory.h \
mntent.h \
mnttab.h \
netdb.h \
paths.h \
stdlib.h \
string.h \
sys/acl.h \
sys/filsys.h \
sys/fs/s5param.h \
sys/fs_types.h \
sys/fstyp.h \
sys/ioctl.h \
sys/mntent.h \
sys/mount.h \
sys/param.h \
sys/socket.h \
sys/statfs.h \
sys/statvfs.h \
sys/systeminfo.h \
sys/time.h \
sys/timeb.h \
sys/vfs.h \
sys/wait.h \
syslog.h \
termios.h \
unistd.h \
utime.h \
values.h \
)
jm_INCLUDED_REGEX([lib/regex.c])
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,25 +72,45 @@ 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])
AC_REQUIRE([jm_FUNC_FNMATCH])
AC_REQUIRE([jm_FUNC_GROUP_MEMBER])
AC_REQUIRE([jm_FUNC_PUTENV])
AC_REQUIRE([jm_AFS])
AC_REQUIRE([jm_AC_PREREQ_XSTRTOUMAX])
AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
AC_REQUIRE([AM_FUNC_ERROR_AT_LINE])
AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
AC_REQUIRE([jm_FUNC_MKTIME])
AC_REQUIRE([jm_FUNC_GETGROUPS])
test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
AC_REQUIRE([AC_FUNC_VPRINTF])
AC_REQUIRE([AC_FUNC_ALLOCA])
AC_REQUIRE([AM_FUNC_GETLOADAVG])
AC_REQUIRE([jm_SYS_PROC_UPTIME])
AC_REQUIRE([jm_FUNC_FTRUNCATE])
AC_REPLACE_FUNCS(strcasecmp strncasecmp)
AC_REPLACE_FUNCS(dup2)
AC_REPLACE_FUNCS(gethostname getusershell)
AC_REPLACE_FUNCS(stime strcspn stpcpy strstr strtol strtoul)
AC_REPLACE_FUNCS(strpbrk)
AC_REPLACE_FUNCS(euidaccess memcmp mkdir rmdir rpmatch strndup strverscmp)
dnl used by e.g. intl/*domain.c and lib/canon-host.c
AC_REPLACE_FUNCS(strdup)
AC_REPLACE_FUNCS(memchr)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(memchr memmove memcpy memset)
AC_CHECK_FUNCS(getpagesize)
# By default, argmatch should fail calling usage (1).
@@ -62,10 +124,66 @@ 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)
AC_REQUIRE([AC_FUNC_CLOSEDIR_VOID])
AC_REQUIRE([jm_FUNC_UTIME])
AC_CHECK_FUNCS( \
acl \
bcopy \
endgrent \
endpwent \
fchdir \
fdatasync \
fseeko \
ftime \
ftruncate \
getcwd \
gethrtime \
getmntinfo \
hasmntopt \
isascii \
lchown \
listmntent \
localeconv \
memcpy \
mempcpy \
mkfifo \
realpath \
resolvepath \
sethostname \
strchr \
strerror \
strrchr \
sysinfo \
tzset \
)
AM_FUNC_GETLINE
if test $am_cv_func_working_getline != yes; then
AC_CHECK_FUNCS(getdelim)
fi
AM_FUNC_OBSTACK
AM_FUNC_STRTOD
AC_SUBST(POW_LIBM)
test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm
# These tests are for df.
jm_LIST_MOUNTED_FILESYSTEMS([list_mounted_fs=yes], [list_mounted_fs=no])
jm_FSTYPENAME
jm_FILE_SYSTEM_USAGE([space=yes], [space=no])
if test $list_mounted_fs = yes && test $space = yes; then
DF_PROG="df"
LIBOBJS="$LIBOBJS fsusage.$ac_objext"
LIBOBJS="$LIBOBJS mountlist.$ac_objext"
fi
])
@@ -73,6 +191,7 @@ AC_DEFUN(jm_CHECK_ALL_TYPES,
[
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_PROG_CC_STDC
AC_C_CONST
AC_C_INLINE
AC_C_LONG_DOUBLE
@@ -88,6 +207,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
@@ -104,4 +224,8 @@ AC_DEFUN(jm_CHECK_ALL_TYPES,
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
AC_REQUIRE([AC_HEADER_MAJOR])
AC_REQUIRE([AC_HEADER_DIRENT])
])

56
m4/lib-check.m4 Normal file
View File

@@ -0,0 +1,56 @@
#serial 2
dnl Misc lib-related macros for fileutils, sh-utils, textutils.
AC_DEFUN(jm_LIB_CHECK,
[
# Check for libypsec.a on Dolphin M88K machines.
AC_CHECK_LIB(ypsec, main)
# m88k running dgux 5.4 needs this
AC_CHECK_LIB(ldgc, main)
# Some programs need to link with -lm. printf does if it uses
# lib/strtod.c which uses pow. And seq uses the math functions,
# floor, modf, rint. And factor uses sqrt. And sleep uses fesetround.
# Save a copy of $LIBS and add $FLOOR_LIBM before these tests
# Check for these math functions used by seq.
ac_su_saved_lib="$LIBS"
LIBS="$LIBS -lm"
AC_CHECK_FUNCS(floor modf rint)
LIBS="$ac_su_saved_lib"
AC_SUBST(SQRT_LIBM)
AC_CHECK_FUNCS(sqrt)
if test $ac_cv_func_sqrt = no; then
AC_CHECK_LIB(m, sqrt, [SQRT_LIBM=-lm])
fi
AC_SUBST(FESETROUND_LIBM)
AC_CHECK_FUNCS(fesetround)
if test $ac_cv_func_fesetround = no; then
AC_CHECK_LIB(m, fesetround, [FESETROUND_LIBM=-lm])
fi
# The -lsun library is required for YP support on Irix-4.0.5 systems.
# m88k/svr3 DolphinOS systems using YP need -lypsec for id.
AC_SEARCH_LIBS(yp_match, [sun ypsec])
# SysV needs -lsec, older versions of Linux need -lshadow for
# shadow passwords.
AC_SEARCH_LIBS(getspnam, [shadow sec])
# Requirements for su.c.
AC_CHECK_MEMBERS((struct passwd.sp_pwdp))
AC_CHECK_FUNCS(getspnam)
AC_CHECK_HEADERS(shadow.h)
# SCO-ODT-3.0 is reported to need -lufc for crypt.
# NetBSD needs -lcrypt for crypt.
ac_su_saved_lib="$LIBS"
AC_SEARCH_LIBS(crypt, [ufc crypt], [LIB_CRYPT="$ac_cv_search_crypt"])
LIBS="$ac_su_saved_lib"
AC_SUBST(LIB_CRYPT)
])

View File

@@ -13,10 +13,11 @@ dnl
AC_PREREQ(2.14a)
# jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS,
[
# Determine how to get the list of mounted filesystems.
list_mounted_fs=
ac_list_mounted_fs=
# If the getmntent function is available but not in the standard library,
# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
@@ -31,7 +32,7 @@ AC_FUNC_GETMNTENT
# I think there is too great a chance that some non-Cray system has a
# function named listmntent to risk the false positive.
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# Cray UNICOS 9
AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
@@ -47,7 +48,7 @@ yes
)
AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
if test $fu_cv_sys_mounted_cray_listmntent = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_LISTMNTENT, 1,
[Define if there is a function named listmntent that can be used to
list all mounted filesystems. (UNICOS)])
@@ -59,7 +60,7 @@ if test $ac_cv_func_getmntent = yes; then
# This system has the getmntent function.
# Determine whether it's the one-argument variant or the two-argument one.
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# 4.3BSD, SunOS, HP-UX, Dynix, Irix
AC_MSG_CHECKING([for one-argument getmntent function])
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
@@ -68,7 +69,7 @@ if test $ac_cv_func_getmntent = yes; then
|| fu_cv_sys_mounted_getmntent1=no])
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
if test $fu_cv_sys_mounted_getmntent1 = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_GETMNTENT1, 1,
[Define if there is a function named getmntent for reading the list
of mounted filesystems, and that function takes a single argument.
@@ -76,7 +77,7 @@ if test $ac_cv_func_getmntent = yes; then
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# SVR4
AC_MSG_CHECKING([for two-argument getmntent function])
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
@@ -85,20 +86,20 @@ if test $ac_cv_func_getmntent = yes; then
fu_cv_sys_mounted_getmntent2=no)])
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
if test $fu_cv_sys_mounted_getmntent2 = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_GETMNTENT2, 1,
[Define if there is a function named getmntent for reading the list of
mounted filesystems, and that function takes two arguments. (SVR4)])
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# DEC Alpha running OSF/1.
AC_MSG_CHECKING([for getfsstat function])
AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
@@ -112,14 +113,14 @@ if test -z "$list_mounted_fs"; then
fu_cv_sys_mounted_getsstat=no)])
AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
if test $fu_cv_sys_mounted_getsstat = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_GETFSSTAT, 1,
[Define if there is a function named getfsstat for reading the
list of mounted filesystems. (DEC Alpha running OSF/1)])
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# AIX.
AC_MSG_CHECKING([for mntctl function and struct vmount])
AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
@@ -128,7 +129,7 @@ if test -z "$list_mounted_fs"; then
fu_cv_sys_mounted_vmount=no)])
AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
if test $fu_cv_sys_mounted_vmount = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_VMOUNT, 1,
[Define if there is a function named mntctl that can be used to read
the list of mounted filesystems, and there is a system header file
@@ -136,7 +137,7 @@ if test -z "$list_mounted_fs"; then
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# SVR3
AC_MSG_CHECKING([for FIXME existence of three headers])
AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
@@ -148,7 +149,7 @@ if test -z "$list_mounted_fs"; then
fu_cv_sys_mounted_fread_fstyp=no)])
AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
if test $fu_cv_sys_mounted_fread_fstyp = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
[Define if (like SVR2) there is no specific function for reading the
list of mounted filesystems, and your system has these header files:
@@ -156,7 +157,7 @@ if test -z "$list_mounted_fs"; then
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# 4.4BSD and DEC OSF/1.
AC_MSG_CHECKING([for getmntinfo function])
AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
@@ -172,7 +173,7 @@ if test -z "$list_mounted_fs"; then
])
AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
if test $fu_cv_sys_mounted_getmntinfo = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_GETMNTINFO, 1,
[Define if there is a function named getmntinfo for reading the
list of mounted filesystems. (4.4BSD)])
@@ -181,7 +182,7 @@ fi
# FIXME: add a test for netbsd-1.1 here
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# Ultrix
AC_MSG_CHECKING([for getmnt function])
AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
@@ -192,14 +193,14 @@ if test -z "$list_mounted_fs"; then
fu_cv_sys_mounted_getmnt=no)])
AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
if test $fu_cv_sys_mounted_getmnt = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_GETMNT, 1,
[Define if there is a function named getmnt for reading the list of
mounted filesystems. (Ultrix)])
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
# SVR2
AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
AC_CACHE_VAL(fu_cv_sys_mounted_fread,
@@ -208,17 +209,19 @@ if test -z "$list_mounted_fs"; then
fu_cv_sys_mounted_fread=no)])
AC_MSG_RESULT($fu_cv_sys_mounted_fread)
if test $fu_cv_sys_mounted_fread = yes; then
list_mounted_fs=found
ac_list_mounted_fs=found
AC_DEFINE(MOUNTED_FREAD, 1,
[Define if there is no specific function for reading the list of
mounted filesystems. fread will be used to read /etc/mnttab. (SVR2) ])
fi
fi
if test -z "$list_mounted_fs"; then
if test -z "$ac_list_mounted_fs"; then
AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
# FIXME -- no need to abort building the whole package
# Can't build mountlist.c or anything that needs its functions
fi
AC_SHELL_IFELSE([test $ac_list_mounted_fs = found], [$1], [$2])dnl
])

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
])

50
m4/nanosleep.m4 Normal file
View File

@@ -0,0 +1,50 @@
#serial 4
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_REQUIRE([AC_HEADER_TIME])
AC_TRY_RUN([
# 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
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=no)
])
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 3
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.] )
WARNING: 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,15 +1,71 @@
#serial 2
#serial 5
dnl These are the prerequisite macros for files in the lib/
dnl directories of the fileutils, sh-utils, and textutils packages.
AC_DEFUN(jm_PREREQ,
[
jm_PREREQ_ADDEXT
jm_PREREQ_CANON_HOST
jm_PREREQ_ERROR
jm_PREREQ_QUOTEARG
jm_PREREQ_READUTMP
jm_PREREQ_REGEX
])
dnl FIXME: maybe put this in a separate file
AC_DEFUN(jm_PREREQ_ADDEXT,
[
dnl For addext.c.
AC_SYS_LONG_FILE_NAMES
AC_CHECK_FUNC(pathconf)
AC_CHECK_HEADERS(limits.h string.h unistd.h)
])
AC_DEFUN(jm_PREREQ_CANON_HOST,
[
dnl Add any libraries as early as possible.
dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
dnl so we have to add -lnsl to LIBS before checking for that function.
AC_SEARCH_LIBS(gethostbyname, [inet nsl])
dnl These come from -lnsl on Solaris5.5.1.
AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
netinet/in.h arpa/inet.h)
])
AC_DEFUN(jm_PREREQ_QUOTEARG,
[
AC_CHECK_FUNCS(isascii mbrtowc)
AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
AC_HEADER_STDC
AC_C_BACKSLASH_A
AM_C_PROTOTYPES
])
AC_DEFUN(jm_PREREQ_READUTMP,
[
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h utmpx.h sys/param.h)
AC_CHECK_FUNCS(utmpname)
AM_C_PROTOTYPES
utmp_includes="\
$ac_includes_default
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
#else
# include <utmp.h>
#endif
"
AC_CHECK_MEMBERS((struct utmpx.ut_user),,,[$utmp_includes])
AC_CHECK_MEMBERS((struct utmp.ut_user),,,[$utmp_includes])
AC_CHECK_MEMBERS((struct utmpx.ut_name),,,[$utmp_includes])
AC_CHECK_MEMBERS((struct utmp.ut_name),,,[$utmp_includes])
])
AC_DEFUN(jm_PREREQ_REGEX,
[
dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.

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 2
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] and HP-UX B.10.20, strerror_r
dnl returns `int'. 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.

34
m4/timespec.m4 Normal file
View File

@@ -0,0 +1,34 @@
#serial 3
dnl From Jim Meyering
dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
dnl in time.h or sys/time.h.
AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
[
AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
AC_REQUIRE([AC_HEADER_TIME])
[AC_TRY_COMPILE(
[
# 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
],
[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,8 +1,8 @@
#serial 4
#serial 5
dnl From Paul Eggert.
AC_PREREQ(2.14a)
AC_PREREQ(2.13)
# Define uintmax_t to `unsigned long' or `unsigned long long'
# if <inttypes.h> does not exist.
@@ -16,7 +16,7 @@ AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
&& ac_type='unsigned long long' \
|| ac_type='unsigned long'
AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
[ Define to `unsigned long' or `unsigned long long'
[ Define to unsigned long or unsigned long long
if <inttypes.h> doesn't define.])
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,3 +1,331 @@
2000-01-30 Jim Meyering <meyering@lucent.com>
* Version 4.0p.
* configure.in: Move library-related tests into m4/lib-check.m4.
* src/system.h (ST_NBLOCKS): Use st_size only for regular files and
for directories. From H. J. Lu.
* src/dd.c (main): Exit with nonzero status if ftruncate fails.
2000-01-24 Jim Meyering <meyering@lucent.com>
* src/ln.c (usage): Describe behavior when LINK_NAME is omitted.
From Michael Stone.
* src/mv.c (main): Don't expect array index `n_files - 1' to evaluate
to `-1' for unsigned int n_files == 0. Doing so lead to a segfault on
alpha. From Michael Stone.
2000-01-23 Jim Meyering <meyering@lucent.com>
* configure.in (AM_FUNC_OBSTACK): Remove. (move to m4/.)
Remove nearly all function checks (moved to m4/.)
(AC_SUBST(DF_PROG)): Move this to m4/.
(ftruncate test): Move into new file: m4/ftruncate.m4.
(AC_HEADER_MAJOR, AC_HEADER_DIRENT): Move into m4/.
Remove df-related tests. i.e., move jm_LIST_MOUNTED_FILESYSTEMS,
jm_FSTYPENAME, and jm_FILE_SYSTEM_USAGE) into m4/.
2000-01-22 Jim Meyering <meyering@lucent.com>
* configure.in: Move addext.c prerequisites from this file into m4/.
(AC_CHECK_HEADERS): Move these checks into m4/.
2000-01-17 Paul Eggert <eggert@twinsun.com>
* src/dd.c (interrupt_handler): Likewise.
(install_handler): Use SA_NOCLDSTOP, not _POSIX_VERSION,
to decide whether to call sigaction; this fixes an old typo.
2000-01-16 Jim Meyering <meyering@lucent.com>
* lib/Makefile.am: Sync with sh-utils/lib/Makefile.am.
* configure.in: Remove AM_FUNC_ERROR_AT_LINE, jm_FUNC_GNU_STRFTIME,
jm_FUNC_GROUP_MEMBER, jm_FUNC_GETGROUPS, AC_FUNC_VPRINTF, and
AC_FUNC_ALLOCA. They're now in m4/.
Sync with the version from emacs-20.5.
* lib/alloca.c
(<string.h>): Include if HAVE_STRING_H.
(<stdlib.h>): Include if HAVE_STDLIB_H.
(alloca): Abort if malloc fails.
Reported by Paul Eggert.
2000-01-15 Jim Meyering <meyering@lucent.com>
* configure.in (AC_REPLACE_FUNCS): Remove these: euidaccess memcpy
memcmp memset mkdir rmdir rpmatch stpcpy strndup strstr strtol
strtoul strverscmp. Now they're in m4/.
2000-01-12 Jim Meyering <meyering@lucent.com>
* tests/shred/remove: Make the warning that this shred test may not
be run as root more prominent. Suggestion from Volker Borchert.
2000-01-11 Paul Eggert <eggert@twinsun.com>
Quote multibyte characters correctly.
* lib/quotearg.c (ISGRAPH): Remove.
(ISPRINT): New macro.
(<wchar.h>): Include if HAVE_MBRTOWC && HAVE_WCHAR_H.
(isprint, mbrtowc, mbsinit, mbstate_t): New macros,
defined if ! (HAVE_MBRTOWC && HAVE_WCHAR_H).
(quotearg_buffer_restyled): New function, with most of the old
quotearg_buffer's contents.
Major rewrite to support multibyte characters.
(quotearg_buffer): Now just calls quotearg_buffer_restyled.
* m4/c-bs-a.m4: New file.
* m4/prereq.m4 (jm_PREREQ_QUOTEARG): New macro.
(jm_PREREQ): Use it.
2000-01-11 Paul Eggert <eggert@twinsun.com>
* lib/modechange.c (mode_compile): Use uintmax_t, not unsigned
long, to parse numeric modes. Check for any unknown bits, not
just unknown bits left of the leftmost known bit.
2000-01-11 Paul Eggert <eggert@twinsun.com>
* lib/getdate.y: Update copyright notice.
2000-01-11 Paul Eggert <eggert@twinsun.com>
* COPYING: Sync with latest FSF version (fixing a minor Y2k problem).
2000-01-11 Paul Eggert <eggert@twinsun.com>
* lib/exclude.c, lib/exclude.h: Sync to the slightly more
general version of GNU tar.
* src/du.c (count_entry):
Adjust to new calling convention for excluded_filename.
(main): Likewise, for add_exclude_file.
2000-01-11 Jim Meyering <meyering@lucent.com>
* lib/memcpy.c (memcpy): Protoize.
Prepare to sync lib/ directories of fileutils, sh-utils, and textutils.
* lib/Makefile.am: s/fu/fetish/
* src/Makefile.am: s/libfu/libfetish/
* lib/hash.c (hash_initialize): Fix typo in comment.
From François Pinard.
2000-01-10 Jim Meyering <meyering@lucent.com>
* Version 4.0o.
* lib/Makefile.am (noinst_HEADERS): Add nanosleep.h.
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.
@@ -179,7 +507,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.

View File

@@ -1,4 +1,29 @@
Changes in release 4.1:
[4.0p]
* various tools: quote multibyte characters correctly in diagnostics
* mv: portability fix for alpha
* dd: portability fix
* unified lib/: now that directory and most of the configuration framework
is common between fileutils, textutils, and sh-utils
[4.0o]
* Include lib/nanosleep.h.
[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

View File

@@ -1,3 +1,226 @@
2000-01-30 Jim Meyering <meyering@lucent.com>
* Version 2.0e.
* po/POTFILES.in: Add lib/makepath.c, lib/obstack.c, lib/rpmatch.c,
and lib/same.c.
2000-01-29 Jim Meyering <meyering@lucent.com>
* configure.in: Move library-related tests into m4/lib-check.m4.
Remove lib-check for cposix now that we use m4/isc-posix.m4.
* src/seq.c: Back out most of the 2000-01-21 and 01-22 changes.
[Instead, merely give examples showing how to accomplish the same
task with fewer limitations using existing tools. ]
Suggestion from Bruno Haible.
(valid_format): Rename from check_format.
* tests/seq/basic: Remove associated tests and add two equal-width ones.
* tests/stty/row-col-1: Set COLUMNS envvar, just to be safe.
2000-01-28 Jim Meyering <meyering@lucent.com>
* src/stty.c (wrapf): Emit a newline only if 0 < current_col.
(screen_columns): Use xstrtol, not atoi.
If get_win_size fails and $COLUMNS == 0, then return 80, not `0'.
2000-01-23 Jim Meyering <meyering@lucent.com>
* configure.in (OPTIONAL_BIN_PROGS, OPTIONAL_BIN_ZCRIPTS, MAN):
AC_SUBST these not here, but rather in m4/, so that the now-shared
lib/Makefile.am are all the same.
(AC_CHECK_FUNCS): Remove check for utmpname, since it's already
in m4/prereq.m4.
Remove many function checks (moved to m4/.)
* configure.in (AM_FUNC_STRTOD): Move to m4/.
(AC_SUBST(POW_LIBM)): Likewise.
* configure.in (SEQ_LIBM): Remove AC_SUBST of a constant.
* src/Makefile.am (seq_LDADD): Add -lm rather than constant $(SEQ_LIBM).
2000-01-22 Jim Meyering <meyering@lucent.com>
* src/sys2.h [! HAVE_DECL_STRTOUL]: Declare strtoul.
[! HAVE_DECL_STRTOULL]: Declare strtoull.
Required for some AIX systems. Reported by Christian Krackowizer.
* configure.in (ALL_LINGUAS): Add Slovenian (sl).
(AC_CHECK_HEADERS): Move these checks into m4/.
* src/seq.c (enum Format_type): Declare.
(format_type): New global to take place of intconv.
(format_str): Move global declaration...
(main): ... to here.
(check_format): Rename parameter to avoid shadowing global.
(DO_printf): New macro.
(main): Use it.
Topologically sort the functions and remove fwd declarations.
2000-01-21 Bruno Haible <haible@linuix.math.u-bordeaux.fr>
Add support for octal and hexadecimal output.
* seq.c (intconv): New variable.
(usage): Update.
(main): Call scan_arg instead of scan_double_arg. Call check_format
before scan_arg.
(scan_int_arg, scan_arg): New functions.
(check_format): Add intconv argument. Accept %d, %u, %o, %x, %X.
(print_numbers): If intconv is true, pass an int argument to printf.
2000-01-21 Jim Meyering <meyering@lucent.com>
* configure.in (ALL_LINGUAS): Add Galician (gl).
2000-01-16 Jim Meyering <meyering@lucent.com>
* lib/Makefile.am: Sync with fileutils/lib/Makefile.am.
* src/date.c (usage): Correct error in %V description.
From Wolfram Kleff.
* configure.in: Remove jm_FUNC_GROUP_MEMBER, jm_FUNC_PUTENV,
AM_FUNC_GETLOADAVG, jm_SYS_PROC_UPTIME, AM_SYS_POSIX_TERMIOS,
jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL.
2000-01-15 Jim Meyering <meyering@lucent.com>
* configure.in (AC_REPLACE_FUNCS): Remove gethostname, getusershell,
memcpy, and memset. Now that's done in m4/.
Remove these, too: stime strcspn stpcpy strstr strtol strtoul.
2000-01-12 Jim Meyering <meyering@lucent.com>
* configure.in: Remove the tests that are now in jm_PREREQ_CANON_HOST.
2000-01-11 Jim Meyering <meyering@lucent.com>
Sync lib/ directories of sh-utils, and textutils.
* lib/Makefile.am (libfetish_a_SOURCES): Add diacrit.c, hard-locale.c,
linebuffer.c, md5.c, memcasecmp.c, memcoll.c, obstack.c, safe-read.c
(noinst_HEADERS): Add bumpalloc.h, diacrit.h, hard-locale.h,
linebuffer.h, md5.h, memcasecmp.h, memcoll.h, obstack.h, safe-read.h.
* lib/Makefile.am: s/su/fetish/
* src/Makefile.am: s/libsu/libfetish/
2000-01-10 Jim Meyering <meyering@lucent.com>
* Version 2.0d.
* src/Makefile.am (sleep_LDADD): Add @POW_LIBM@, for systems that use
lib/strtod.c and need -lm to resolve its pow reference.
2000-01-07 Jim Meyering <meyering@ascend.com>
* Version 2.0c.
* 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.

View File

@@ -1,6 +1,22 @@
Changes in release 2.1
[2.0e]
* stty: fix long-standing bug that caused test failures on at least HPUX
systems when COLUMNS was set to zero
* still more portability fixes
* unified lib/: now that directory and most of the configuration framework
is common between fileutils, textutils, and sh-utils
[2.0d]
* fix portability problem with sleep vs lib/strtod.c's requirement for -lm
[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 continues sleeping after being suspended and continued
* 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,208 @@
2000-01-30 Jim Meyering <meyering@lucent.com>
* Version 2.0d.
* Makefile.maint (my-distcheck): Depend on po-check, so I'll be warned
about any required changes at `make distcheck' time rather than at
`make alpha' time.
(writable-files): New target.
(my-distcheck): Depend on it.
(alpha): Likewise.
* po/POTFILES.in: Add these: lib/makepath.c, lib/rpmatch.c,
and lib/same.c
2000-01-29 Jim Meyering <meyering@lucent.com>
* configure.in: Remove lib-check for cposix now that we use
m4/isc-posix.m4.
(jm_LIB_CHECK): Use this even though the library checks aren't
required for this patchage (so all three lib/Makefile.in files
will be the same).
2000-01-24 Mark Kettenis <kettenis@gnu.org>
* src/tsort.c (exit_status): New variable.
(loop): New varibale.
(count_items, scan_zeroes): Change return type to int.
(detect_loop): Complete rewrite to correctly implement detection
of loops. Also change return type to int.
(recurse_tree): Stop if ACTION returns non-zero. This involves
changing the return type of this function and ACTION to int.
(walk_tree): Change return type of ACTION to int.
(tsort): Continue sort after a loop has been detected (and
broken). Set exit_status to 1 if a loop was detected.
(main): Use exit_status to determine exit code.
* tests/tsort/basic-1: Change expected output for cycle-1 and
cycle-2 tests.
2000-01-23 Jim Meyering <meyering@lucent.com>
* configure.in (AM_FUNC_STRTOD): Move to m4/.
(AC_SUBST(POW_LIBM)): Likewise.
2000-01-22 Jim Meyering <meyering@lucent.com>
* src/sort.c (keycompare): Use global, hard_LC_COLLATE in place of
local that is sometimes undeclared.
* configure.in (ALL_LINGUAS): Add Brazilian Portuguese (pt_BR).
(AC_CHECK_HEADERS): Move these checks into m4/.
* src/tr.c ("xstrtol.h"): Include.
(Filter): Rename from PFL.
(non_neg_strtol): Remove function.
(find_bracketed_repeat): Use xstrtoul instead of non_neg_strtol.
(squeeze_filter, set_initialize, main): Use size_t and ssize_t in
place of long and int in several decls.
(read_and_delete, read_and_xlate): Likewise, and remove assertion.
* tests/tr/Test.pm: (o-rep-1, o-rep-2): New tests.
* src/cut.c: Correct copying notice to use GPL, per author's request.
* src/paste.c: Likewise.
(AUTHORS): Add djm.
1999-09-19 Bruno Haible <haible@clisp.cons.org>
* src/tr.c (PFI): Return `long', not `int'.
(PFL): Rename from PFI now that it returns long.
(squeeze_filter): Declare as `long': i, nr, out_len.
2000-01-17 Paul Eggert <eggert@twinsun.com>
Tweak sort performance.
* src/sort.c (hard_LC_CTYPE): Remove.
(keylist): Renamed from keyhead. Now a pointer, not a
mostly-unused struct. All uses changed.
(findlines, keycompare, CMP_WITH_IGNORE, compare, checkfp, mergefps,
sort): Tune and use a more consistent style for reallocation.
(keycompare, main): Don't worry about LC_CTYPE;
it's buggy with multibyte chars anyway.
(compare): Invoke alloca (0) after each call to keycompare,
not just the ones that return nonzero. This avoids a memory
leak on architectures without builtin alloca that occurs
sometimes when a file contains all duplicate lines.
2000-01-17 Paul Eggert <eggert@twinsun.com>
* src/csplit.c (interrupt_handler, main):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it. Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
* src/sort.c (sighandler, main): Likewise.
2000-01-16 Jim Meyering <meyering@lucent.com>
* lib/Makefile.am: Merge with fileutils/lib/Makefile.am.
* configure.in: Remove AM_FUNC_ERROR_AT_LINE, jm_FUNC_STRFTIME,
AC_FUNC_VPRINTF, and AC_FUNC_ALLOCA. Now they're in m4/.
2000-01-15 Jim Meyering <meyering@lucent.com>
* configure.in (AC_REPLACE_FUNCS): Remove these: memcpy memset stpcpy
strpbrk strtol strtoul. Now that's in m4/.
unexpand could infloop
* src/unexpand.c (TAB_STOP_SENTINEL): Define.
(unexpand): Use it instead of INT_MAX.
Declare column and pending to be `unsigned'.
Increment pending and column counters only if column is smaller
than TAB_STOP_SENTINEL.
* tests/Makefile.am (SUBDIRS): Add unexpand.
* tests/unexpand/basic-1: New tests for the above-fixed bug.
* configure.in (AC_OUTPUT): Add tests/unexpand/Makefile.
Reported by John Kodis.
2000-01-12 Paul Eggert <eggert@twinsun.com>
* src/sort.c (fillbuf): Avoid quadratic behavior with long lines.
Also, stop worrying about ancient memchr bug (misbehavior when
size is zero), since other code doesn't worry either.
2000-01-11 Jim Meyering <meyering@lucent.com>
Sync lib/ directories of sh-utils, and textutils.
* lib/Makefile.am (libfetish_a_SOURCES): Add getdate.y, posixtm.c,
basename.c, canon-host.c, readutmp.c, stripslash.c, xgetcwd.c,
xgethostname.c.
(noinst_HEADERS): Add getdate.h, group-member.h, posixtm.h,
pathmax.h, readutmp.h
* lib/Makefile.am: s/tu/fetish/
* src/Makefile.am: s/libtu/libfetish/
2000-01-10 Jim Meyering <meyering@lucent.com>
* Version 2.0c.
* Makefile.maint (announcement): Include URLs for xdelta files.
(alpha): Use scp, not ncftp.
* lib/Makefile.am (noinst_HEADERS): Add nanosleep.h.
2000-01-08 Jim Meyering <meyering@ascend.com>
* Version 2.0b.
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 +282,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,15 @@
Changes in release 2.1
[2.0d]
* preliminary sort performance improvements
* tsort now works more like the traditional UNIX tsort. Before it would
exit when it found a loop. Now it continues and outputs all items.
* unexpand no longer infloops on certain sequences of white space
* unified lib/: now that directory and most of the configuration framework
is common between fileutils, textutils, and sh-utils
[2.0c]
* include lib/nanosleep.h.
[2.0b]
* portability tweaks for error.c vs. systems with deficient strerror_r
[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,6 +370,7 @@ 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;
@@ -546,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;
}
@@ -594,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? */

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

@@ -1,5 +1,5 @@
/* csplit - split a file into sections determined by context lines
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
@@ -245,16 +245,16 @@ cleanup_fatal (void)
static RETSIGTYPE
interrupt_handler (int sig)
{
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
struct sigaction sigact;
sigact.sa_handler = SIG_DFL;
sigemptyset (&sigact.sa_mask);
sigact.sa_flags = 0;
sigaction (sig, &sigact, NULL);
#else /* !SA_INTERRUPT */
#else
signal (sig, SIG_DFL);
#endif /* SA_INTERRUPT */
#endif
cleanup ();
kill (getpid (), sig);
}
@@ -1374,7 +1374,7 @@ main (int argc, char **argv)
{
int optc;
unsigned long val;
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
struct sigaction oldact, newact;
#endif
@@ -1393,7 +1393,7 @@ main (int argc, char **argv)
/* Change the way xmalloc and xrealloc fail. */
xalloc_fail_func = cleanup;
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
newact.sa_handler = interrupt_handler;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
@@ -1413,7 +1413,7 @@ main (int argc, char **argv)
sigaction (SIGTERM, NULL, &oldact);
if (oldact.sa_handler != SIG_IGN)
sigaction (SIGTERM, &newact, NULL);
#else /* not SA_INTERRUPT */
#else
if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
signal (SIGHUP, interrupt_handler);
if (signal (SIGINT, SIG_IGN) != SIG_IGN)
@@ -1422,7 +1422,7 @@ main (int argc, char **argv)
signal (SIGQUIT, interrupt_handler);
if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
signal (SIGTERM, interrupt_handler);
#endif /* not SA_INTERRUPT */
#endif
while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, NULL)) != -1)
switch (optc)

View File

@@ -1,28 +1,26 @@
/* cut - remove parts of lines of files
Copyright (C) 1984, 1997, 1998, 1999 by David M. Ihnat
Copyright (C) 1984, 1997, 1998, 1999, 2000 by David M. Ihnat
This program is a total rewrite of the Bell Laboratories Unix(Tm)
command of the same name, as of System V. It contains no proprietary
code, and therefore may be used without violation of any proprietary
agreements whatsoever. However, you will notice that the program is
copyrighted by me. This is to assure the program does *not* fall
into the public domain. Thus, I may specify just what I am now:
This program may be freely copied and distributed, provided this notice
remains; it may not be sold for profit without express written consent of
the author.
Please note that I recreated the behavior of the Unix(Tm) 'cut' command
as faithfully as possible; however, I haven't run a full set of regression
tests. Thus, the user of this program accepts full responsibility for any
effects or loss; in particular, the author is not responsible for any losses,
explicit or incidental, that may be incurred through use of this program.
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.
I ask that any bugs (and, if possible, fixes) be reported to me when
possible. -David Ihnat (312) 784-4544 ignatz@homebru.chi.il.us
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.
POSIX changes, bug fixes, long-named options, and cleanup
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 David Ihnat. */
/* POSIX changes, bug fixes, long-named options, and cleanup
by David MacKenzie <djm@gnu.ai.mit.edu>.
Rewrite cut_fields and cut_bytes -- Jim Meyering (meyering@comco.com).
Rewrite cut_fields and cut_bytes -- Jim Meyering.
Options:
--bytes=byte-list
@@ -171,6 +169,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 +183,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 +741,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'

View File

@@ -1,5 +1,5 @@
/* date - print or set the system date and time
Copyright (C) 1989-1999 Free Software Foundation, Inc.
Copyright (C) 1989-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
@@ -165,7 +165,7 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
%%t a horizontal tab\n\
%%T time, 24-hour (hh:mm:ss)\n\
%%U week number of year with Sunday as first day of week (00..53)\n\
%%V week number of year with Monday as first day of week (01..52)\n\
%%V week number of year with Monday as first day of week (01..53)\n\
%%w day of week (0..6); 0 represents Sunday\n\
%%W week number of year with Monday as first day of week (00..53)\n\
%%x locale's date representation (mm/dd/yy)\n\

View File

@@ -1,5 +1,5 @@
/* dd -- convert a file while copying it.
Copyright (C) 85, 90, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 85, 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
@@ -381,16 +381,16 @@ quit (int code)
static RETSIGTYPE
interrupt_handler (int sig)
{
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
struct sigaction sigact;
sigact.sa_handler = SIG_DFL;
sigemptyset (&sigact.sa_mask);
sigact.sa_flags = 0;
sigaction (sig, &sigact, NULL);
#else /* !SA_INTERRUPT */
#else
signal (sig, SIG_DFL);
#endif /* SA_INTERRUPT */
#endif
cleanup ();
kill (getpid (), sig);
}
@@ -406,7 +406,7 @@ siginfo_handler (int sig ATTRIBUTE_UNUSED)
static void
install_handler (int sig_num, RETSIGTYPE (*sig_handler) (int sig))
{
#ifdef _POSIX_VERSION
#ifdef SA_NOCLDSTOP
struct sigaction sigact;
sigaction (sig_num, NULL, &sigact);
if (sigact.sa_handler != SIG_IGN)
@@ -1100,7 +1100,7 @@ main (int argc, char **argv)
if (o / output_blocksize != seek_record)
error (1, 0, _("file offset out of range"));
if (ftruncate (STDOUT_FILENO, o) < 0)
error (0, errno, "%s", output_file);
error (1, errno, "%s", output_file);
}
#endif
}

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

@@ -1,5 +1,5 @@
/* du -- summarize disk usage
Copyright (C) 88, 89, 90, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 88, 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
@@ -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'},
@@ -541,7 +550,7 @@ count_entry (const char *ent, int top, dev_t last_dev, int depth)
for (namep = name_space; *namep; namep += strlen (namep) + 1)
{
if (!excluded_filename (exclude, namep))
if (!excluded_filename (exclude, namep, 0))
{
str_concatc (path, namep);
size += count_entry (namep, 0, dir_dev, depth + 1);
@@ -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);
@@ -733,15 +742,15 @@ main (int argc, char **argv)
break;
case 'X':
if (add_exclude_file (exclude, optarg, '\n') != 0)
if (add_exclude_file (add_exclude, exclude, optarg, '\n') != 0)
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,13 +334,16 @@ 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\
in DIRECTORY to each TARGET. Create hard links by default, symbolic links\n\
with --symbolic. When creating hard links, each TARGET must exist.\n\
Create a link to the specified TARGET with optional LINK_NAME.\n\
If LINK_NAME is omitted, a link with the same basename as the TARGET is\n\
created in the current directory. When using the second form with more\n\
than one TARGET, the last argument must be a directory; create links\n\
in DIRECTORY to each TARGET. Create hard links by default, symbolic\n\
links with --symbolic. When creating hard links, each TARGET must exist.\n\
\n\
-b, --backup[=CONTROL] make a backup of each existing destination file\n\
-d, -F, --directory hard link directories (super-user only)\n\
@@ -340,7 +353,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));
@@ -796,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, "");
}
@@ -868,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 */
@@ -990,7 +1000,6 @@ decode_switches (int argc, char **argv)
case 'c':
time_type = time_ctime;
sort_type = sort_time;
break;
case 'd':
@@ -1002,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);
@@ -1064,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':
@@ -1135,6 +1146,7 @@ decode_switches (int argc, char **argv)
case 'S':
sort_type = sort_size;
sort_type_specified = 1;
break;
case 'T':
@@ -1147,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':
@@ -1159,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 */
@@ -1230,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;
}
@@ -2884,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\
@@ -2934,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;
@@ -444,12 +464,8 @@ main (int argc, char **argv)
file = argv + optind;
target_directory_specified = (target_directory != NULL);
if (target_directory == NULL)
{
/* Be careful below. When n_files is 0, this value will be
argv[0], `--', or an option string. */
target_directory = file[n_files - 1];
}
if (target_directory == NULL && n_files != 0)
target_directory = file[n_files - 1];
dest_is_dir = (n_files > 0 && isdir (target_directory));

View File

@@ -1,26 +1,23 @@
/* paste - merge lines of files
Copyright (C) 1984, 1997, 1998, 1999 by David M. Ihnat
Copyright (C) 1984, 1997, 1998, 1999, 2000 by David M. Ihnat
This program is a total rewrite of the Bell Laboratories Unix(Tm)
command of the same name, as of System V. It contains no proprietary
code, and therefore may be used without violation of any proprietary
agreements whatsoever. However, you will notice that the program is
copyrighted by me. This is to assure the program does *not* fall
into the public domain. Thus, I may specify just what I am now:
This program may be freely copied and distributed, provided this notice
remains; it may not be sold for profit without express written consent of
the author.
Please note that I recreated the behavior of the Unix(Tm) 'paste' command
as faithfully as possible, with minor exceptions; however,
I haven't run a full set of regression tests. Thus, the user of
this program accepts full responsibility for any effects or loss;
in particular, the author is not responsible for any losses,
explicit or incidental, that may be incurred through use of this program.
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.
I ask that any bugs (and, if possible, fixes) be reported to me when
possible. -David Ihnat (312) 784-4544 ignatz@homebru.chi.il.us
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.
The list of valid escape sequences has been expanded over the Unix
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 David Ihnat. */
/* The list of valid escape sequences has been expanded over the Unix
version, to include \b, \f, \r, and \v.
POSIX changes, bug fixes, long-named options, and cleanup
@@ -49,7 +46,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "paste"
#define AUTHORS "David M. Ihnat"
#define AUTHORS "David M. Ihnat and David MacKenzie"
/* Indicates that no delimiter should be added in the current position. */
#define EMPTY_DELIM '\0'

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);

378
src/seq.c
View File

@@ -1,5 +1,5 @@
/* seq - print sequence of numbers to standard output.
Copyright (C) 1994-1999 Free Software Foundation, Inc.
Copyright (C) 1994-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
#include "system.h"
#include "error.h"
#include "xstrtol.h"
#include "xstrtod.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -32,20 +33,9 @@
#define AUTHORS "Ulrich Drepper"
static double scan_double_arg PARAMS ((const char *arg));
static int check_format PARAMS ((const char *format_string));
static char *get_width_format PARAMS ((void));
static int print_numbers PARAMS ((const char *format_str));
/* If nonzero print all number with equal width. */
static int equal_width;
/* The printf(3) format used for output. */
static char *format_str;
/* The starting number. */
static double first;
/* The name that this program was run with. */
char *program_name;
@@ -61,6 +51,9 @@ static char *terminator = "\n";
Always "." if the localeconv function is not supported. */
static char *decimal_point = ".";
/* The starting number. */
static double first;
/* The increment. */
static double step;
@@ -103,148 +96,13 @@ If FIRST or INCREMENT is omitted, it defaults to 1.\n\
FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
INCREMENT should be positive if FIRST is smaller than LAST, and negative\n\
otherwise. When given, the FORMAT argument must contain exactly one of\n\
the printf-style, floating point output formats %%e, %%f, or %%g.\n\
the printf-style, floating point output formats %%e, %%f, %%g\n\
"));
puts (_("\nReport bugs to <bug-sh-utils@gnu.org>."));
}
exit (status);
}
int
main (int argc, char **argv)
{
int errs;
int optc;
int step_is_set;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
equal_width = 0;
format_str = NULL;
separator = "\n";
first = 1.0;
step_is_set = 0;
/* Figure out the locale's idea of a decimal point. */
#ifdef HAVE_LOCALECONV
{
struct lconv *locale;
locale = localeconv ();
/* Paranoia. */
if (locale && locale->decimal_point && locale->decimal_point[0] != '\0')
decimal_point = locale->decimal_point;
}
#endif
/* We have to handle negative numbers in the command line but this
conflicts with the command line arguments. So explicitly check first
whether the next argument looks like a negative number. */
while (optind < argc)
{
if (argv[optind][0] == '-'
&& ((optc = argv[optind][1]) == decimal_point[0]
|| ISDIGIT (optc)))
{
/* means negative number */
break;
}
optc = getopt_long (argc, argv, "+f:s:w", long_options, NULL);
if (optc == -1)
break;
switch (optc)
{
case 0:
break;
case 'f':
format_str = optarg;
break;
case 's':
separator = optarg;
break;
case 'w':
equal_width = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
/* NOTREACHED */
}
}
if (optind >= argc)
{
error (0, 0, _("too few arguments"));
usage (1);
/* NOTREACHED */
}
last = scan_double_arg (argv[optind++]);
if (optind < argc)
{
first = last;
last = scan_double_arg (argv[optind++]);
if (optind < argc)
{
step = last;
step_is_set = 1;
last = scan_double_arg (argv[optind++]);
if (optind < argc)
{
usage (1);
/* NOTREACHED */
}
}
}
if (format_str != NULL && equal_width)
{
error (0, 0, _("\
format string may not be specified when printing equal width strings"));
usage (1);
}
if (!step_is_set)
{
step = first <= last ? 1.0 : -1.0;
}
if (format_str != NULL)
{
if (!check_format (format_str))
{
error (0, 0, _("invalid format string: `%s'"), format_str);
usage (1);
}
}
else
{
if (equal_width)
format_str = get_width_format ();
else
format_str = "%g";
}
errs = print_numbers (format_str);
exit (errs);
/* NOTREACHED */
}
/* Read a double value from the command line.
Return if the string is correct else signal error. */
@@ -257,18 +115,16 @@ scan_double_arg (const char *arg)
{
error (0, 0, _("invalid floating point argument: %s"), arg);
usage (1);
/* NOTREACHED */
}
return ret_val;
}
/* Check whether the format string is valid for a single double
argument.
Return 0 if not, 1 if correct. */
/* Check whether the format string is valid for a single `double'
argument. Return 0 if not, 1 if correct. */
static int
check_format (const char *fmt)
valid_format (const char *fmt)
{
while (*fmt != '\0')
{
@@ -293,7 +149,7 @@ check_format (const char *fmt)
fmt += strspn (++fmt, "0123456789");
}
if (*fmt != 'e' && *fmt != 'f' && *fmt != 'g')
if (!(*fmt == 'e' || *fmt == 'f' || *fmt == 'g'))
return 0;
fmt++;
@@ -312,6 +168,64 @@ check_format (const char *fmt)
return 1;
}
/* Actually print the sequence of numbers in the specified range, with the
given or default stepping and format. */
static int
print_numbers (const char *fmt)
{
if (first > last)
{
int i;
if (step >= 0)
{
error (0, 0,
_("when the starting value is larger than the limit,\n\
the increment must be negative"));
usage (1);
}
printf (fmt, first);
for (i = 1; /* empty */; i++)
{
double x = first + i * step;
if (x < last)
break;
fputs (separator, stdout);
printf (fmt, x);
}
}
else
{
int i;
if (step <= 0)
{
error (0, 0,
_("when the starting value is smaller than the limit,\n\
the increment must be positive"));
usage (1);
}
printf (fmt, first);
for (i = 1; /* empty */; i++)
{
double x = first + i * step;
if (x > last)
break;
fputs (separator, stdout);
printf (fmt, x);
}
}
fputs (terminator, stdout);
return 0;
}
#if defined (HAVE_RINT) && defined (HAVE_MODF) && defined (HAVE_FLOOR)
/* Return a printf-style format string with which all selected numbers
@@ -406,62 +320,136 @@ get_width_format (void)
#endif
/* Actually print the sequence of numbers in the specified range, with the
given or default stepping and format. */
static int
print_numbers (const char *fmt)
int
main (int argc, char **argv)
{
if (first > last)
{
int i;
int errs;
int optc;
int step_is_set;
if (step >= 0)
/* The printf(3) format used for output. */
char *format_str = NULL;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
equal_width = 0;
separator = "\n";
first = 1.0;
step_is_set = 0;
/* Figure out the locale's idea of a decimal point. */
#ifdef HAVE_LOCALECONV
{
struct lconv *locale;
locale = localeconv ();
/* Paranoia. */
if (locale && locale->decimal_point && locale->decimal_point[0] != '\0')
decimal_point = locale->decimal_point;
}
#endif
/* We have to handle negative numbers in the command line but this
conflicts with the command line arguments. So explicitly check first
whether the next argument looks like a negative number. */
while (optind < argc)
{
if (argv[optind][0] == '-'
&& ((optc = argv[optind][1]) == decimal_point[0]
|| ISDIGIT (optc)))
{
error (0, 0,
_("when the starting value is larger than the limit,\n\
the increment must be negative"));
usage (1);
/* NOTREACHED */
/* means negative number */
break;
}
printf (fmt, first);
for (i = 1; /* empty */; i++)
optc = getopt_long (argc, argv, "+f:s:w", long_options, NULL);
if (optc == -1)
break;
switch (optc)
{
double x = first + i * step;
case 0:
break;
if (x < last)
break;
case 'f':
format_str = optarg;
break;
fputs (separator, stdout);
printf (fmt, x);
case 's':
separator = optarg;
break;
case 'w':
equal_width = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}
}
else
if (argc - optind < 1)
{
int i;
error (0, 0, _("too few arguments"));
usage (1);
}
if (step <= 0)
if (3 < argc - optind)
{
error (0, 0, _("too many arguments"));
usage (1);
}
if (format_str && !valid_format (format_str))
{
error (0, 0, _("invalid format string: `%s'"), format_str);
usage (1);
}
last = scan_double_arg (argv[optind++]);
if (optind < argc)
{
first = last;
last = scan_double_arg (argv[optind++]);
if (optind < argc)
{
error (0, 0,
_("when the starting value is smaller than the limit,\n\
the increment must be positive"));
usage (1);
/* NOTREACHED */
}
step = last;
step_is_set = 1;
last = scan_double_arg (argv[optind++]);
printf (fmt, first);
for (i = 1; /* empty */; i++)
{
double x = first + i * step;
if (x > last)
break;
fputs (separator, stdout);
printf (format_str, x);
}
}
fputs (terminator, stdout);
return 0;
if (format_str != NULL && equal_width)
{
error (0, 0, _("\
format string may not be specified when printing equal width strings"));
usage (1);
}
if (!step_is_set)
{
step = first <= last ? 1.0 : -1.0;
}
if (format_str == NULL)
{
if (equal_width)
format_str = get_width_format ();
else
format_str = "%g";
}
errs = print_numbers (format_str);
exit (errs);
}

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
@@ -22,6 +22,11 @@
#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
@@ -29,12 +34,22 @@
#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 "Jim Meyering"
#define AUTHORS "Jim Meyering and Paul Eggert"
/* The name by which this program was run. */
char *program_name;
@@ -55,9 +70,10 @@ usage (int status)
printf (_("\
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\
@@ -68,15 +84,17 @@ h for hours or d for days.\n\
exit (status);
}
/* FIXME: describe */
/* 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 *s, char suffix_char)
apply_suffix (double *x, char suffix_char)
{
unsigned int multiplier;
assert (*s <= TIME_T_MAX);
switch (suffix_char)
{
case 0:
@@ -99,20 +117,81 @@ apply_suffix (double *s, char suffix_char)
if (multiplier == 0)
return 1;
*s *= multiplier;
*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;
double seconds = 0.0;
double ns;
int c;
int fail = 0;
int interrupted;
struct timespec ts;
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, "");
@@ -140,48 +219,81 @@ main (int argc, char **argv)
usage (1);
}
#ifdef FE_UPWARD
/* Always round up, since we must sleep for at least the specified
interval. */
fesetround (FE_UPWARD);
#endif
for (i = optind; i < argc; i++)
{
double s;
const char *p;
if (xstrtod (argv[i], &p, &s)
/* No negative intervals. */
|| s < 0
/* S must fit in a time_t. */
|| s > TIME_T_MAX
/* No extra chars after the number and an optional s,m,h,d char. */
/* 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)
/* Make sure the sum fits in a time_t. */
|| (seconds += s) > TIME_T_MAX
)
|| apply_suffix (&s, *p))
{
error (0, 0, _("invalid time interval `%s'"), argv[i]);
fail = 1;
}
seconds += s;
}
if (fail)
usage (1);
/* Round to the nearest nanosecond here so that tv_nsec will be
no larger than 999,999,999. */
seconds += .0000000005;
/* 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;
/* Separate whole seconds from nanoseconds. */
ts.tv_sec = seconds;
ts.tv_nsec = (seconds - ts.tv_sec) * 1000000000;
/* 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);
while (1)
/* Normalize the interval length. nanosleep requires this. */
if (1000000000 <= ts_sleep.tv_nsec)
{
struct timespec remaining;
interrupted = nanosleep (&ts, &remaining);
/* assert (!interrupted || errno == EINTR); */
if (!interrupted)
break;
ts = remaining;
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);
}

View File

@@ -1,5 +1,5 @@
/* sort - sort lines of text (with all kinds of options).
Copyright (C) 88, 1991-1999 Free Software Foundation, Inc.
Copyright (C) 88, 1991-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
@@ -84,7 +84,6 @@ static int th_sep; /* if CHAR_MAX + 1, then there is no thousands separator */
/* Nonzero if the corresponding locales are hard. */
static int hard_LC_COLLATE;
static int hard_LC_CTYPE;
# if HAVE_NL_LANGINFO
static int hard_LC_TIME;
# endif
@@ -160,6 +159,13 @@ struct month
/* The name this program was run with. */
char *program_name;
/* FIXME: None of these tables work with multibyte character sets.
Also, there are many other bugs when handling multibyte characters,
or even unibyte encodings where line boundaries are not in the
initial shift state. One way to fix this is to rewrite `sort' to
use wide characters internally, but doing this with good
performance is a bit tricky. */
/* Table of white space. */
static int blanks[UCHAR_LIM];
@@ -169,8 +175,7 @@ static int nonprinting[UCHAR_LIM];
/* Table of non-dictionary characters (not letters, digits, or blanks). */
static int nondictionary[UCHAR_LIM];
/* Translation table folding lower case to upper.
FIXME: This doesn't work with multibyte character sets. */
/* Translation table folding lower case to upper. */
static char fold_toupper[UCHAR_LIM];
#define MONTHS_PER_YEAR 12
@@ -240,8 +245,8 @@ static int unique;
/* Nonzero if any of the input files are the standard input. */
static int have_read_stdin;
/* Lists of key field comparisons to be tried. */
static struct keyfield keyhead;
/* List of key field comparisons to be tried. */
static struct keyfield *keylist;
void
usage (int status)
@@ -543,10 +548,9 @@ fillbuf (struct buffer *buf, FILE *fp)
int cc;
memmove (buf->buf, buf->buf + buf->used - buf->left, buf->left);
buf->used = buf->left;
cc = buf->used = buf->left;
while (!feof (fp) && (buf->used == 0
|| !memchr (buf->buf, eolchar, buf->used)))
while (!feof (fp) && !memchr (buf->buf + buf->used - cc, eolchar, cc))
{
if (buf->used == buf->alloc)
{
@@ -744,13 +748,15 @@ static void
findlines (struct buffer *buf, struct lines *lines)
{
register char *beg = buf->buf, *lim = buf->buf + buf->used, *ptr;
struct keyfield *key = keyhead.next;
struct keyfield *key = keylist;
lines->used = 0;
while (beg < lim && (ptr = memchr (beg, eolchar, lim - beg))
&& lines->used < lines->limit)
{
struct line *line;
if (lines->used == lines->alloc)
{
lines->alloc *= 2;
@@ -759,38 +765,26 @@ findlines (struct buffer *buf, struct lines *lines)
lines->alloc * sizeof (struct line));
}
lines->lines[lines->used].text = beg;
lines->lines[lines->used].length = ptr + 1 - beg;
line = &lines->lines[lines->used];
line->text = beg;
line->length = ptr + 1 - beg;
/* Precompute the position of the first key for efficiency. */
if (key)
{
if (key->eword >= 0)
lines->lines[lines->used].keylim =
limfield (&lines->lines[lines->used], key);
else
lines->lines[lines->used].keylim = ptr;
/* Precompute the position of the first key for efficiency. */
line->keylim = 0 <= key->eword ? limfield (line, key) : ptr;
if (key->sword >= 0)
lines->lines[lines->used].keybeg =
begfield (&lines->lines[lines->used], key);
line->keybeg = begfield (line, key);
else
{
if (key->skipsblanks)
while (blanks[UCHAR (*beg)])
++beg;
lines->lines[lines->used].keybeg = beg;
line->keybeg = beg;
}
if (key->skipeblanks)
{
trim_trailing_blanks (lines->lines[lines->used].keybeg,
&lines->lines[lines->used].keylim);
}
}
else
{
lines->lines[lines->used].keybeg = 0;
lines->lines[lines->used].keylim = 0;
trim_trailing_blanks (line->keybeg, &line->keylim);
}
++lines->used;
@@ -1084,48 +1078,21 @@ getmonth (const char *s, int len)
static int
keycompare (const struct line *a, const struct line *b)
{
register char *texta, *textb, *lima, *limb;
register unsigned char *translate;
register int *ignore;
struct keyfield *key;
int diff = 0, iter = 0, lena, lenb;
struct keyfield *key = keylist;
for (key = keyhead.next; key; key = key->next, ++iter)
/* For the first iteration only, the key positions have been
precomputed for us. */
register char *texta = a->keybeg;
register char *textb = b->keybeg;
register char *lima = a->keylim;
register char *limb = b->keylim;
int diff, lena, lenb;
for (;;)
{
int comparable_lengths = 1;
ignore = key->ignore;
translate = (unsigned char *) key->translate;
/* Find the beginning and limit of each field. */
if (iter || a->keybeg == NULL || b->keybeg == NULL)
{
if (key->eword >= 0)
lima = limfield (a, key), limb = limfield (b, key);
else
lima = a->text + a->length - 1, limb = b->text + b->length - 1;
if (key->sword >= 0)
texta = begfield (a, key), textb = begfield (b, key);
else
{
texta = a->text, textb = b->text;
if (key->skipsblanks)
{
while (texta < lima && blanks[UCHAR (*texta)])
++texta;
while (textb < limb && blanks[UCHAR (*textb)])
++textb;
}
}
}
else
{
/* For the first iteration only, the key positions have
been precomputed for us. */
texta = a->keybeg, lima = a->keylim;
textb = b->keybeg, limb = b->keylim;
}
register unsigned char *translate = (unsigned char *) key->translate;
register int *ignore = key->ignore;
/* Find the lengths. */
lena = lima - texta, lenb = limb - textb;
@@ -1153,27 +1120,18 @@ keycompare (const struct line *a, const struct line *b)
diff = ((key->numeric ? numcompare : general_numcompare)
(texta, textb));
*lima = savea, *limb = saveb;
if (diff)
return key->reverse ? -diff : diff;
continue;
}
else if (key->month)
{
diff = getmonth (texta, lena) - getmonth (textb, lenb);
if (diff)
return key->reverse ? -diff : diff;
continue;
}
diff = getmonth (texta, lena) - getmonth (textb, lenb);
#ifdef ENABLE_NLS
/* Sorting like this may become slow, so in a simple locale the user
can select a faster sort that is similar to ascii sort */
else if (hard_LC_COLLATE | hard_LC_CTYPE)
else if (hard_LC_COLLATE)
{
if (ignore || translate)
{
char *copy_a = (char *) alloca (lena + 1);
char *copy_b = (char *) alloca (lenb + 1);
char *copy_a = (char *) alloca (lena + 1 + lenb + 1);
char *copy_b = copy_a + lena + 1;
int new_len_a, new_len_b, i;
/* Ignore and/or translate chars before comparing. */
@@ -1199,103 +1157,103 @@ keycompare (const struct line *a, const struct line *b)
diff = memcoll (copy_a, new_len_a, copy_b, new_len_b);
}
else if (lena == 0)
diff = -lenb;
else if (lenb == 0)
goto greater;
else
{
diff = memcoll (texta, lena, textb, lenb);
}
if (diff)
return key->reverse ? -diff : diff;
continue;
diff = memcoll (texta, lena, textb, lenb);
}
#endif
else if (ignore && translate)
else if (ignore)
{
#define CMP_WITH_IGNORE(A, B) \
do \
{ \
while (texta < lima && textb < limb) \
for (;;) \
{ \
while (texta < lima && ignore[UCHAR (*texta)]) \
++texta; \
while (textb < limb && ignore[UCHAR (*textb)]) \
++textb; \
if (texta < lima && textb < limb) \
{ \
if ((A) != (B)) \
{ \
diff = UCHAR (A) - UCHAR (B); \
break; \
} \
++texta; \
++textb; \
} \
\
if (texta == lima && textb < limb && !ignore[UCHAR (*textb)]) \
diff = -1; \
else if (texta < lima && textb == limb \
&& !ignore[UCHAR (*texta)]) \
diff = 1; \
if (! (texta < lima && textb < limb)) \
break; \
diff = UCHAR (A) - UCHAR (B); \
if (diff) \
goto not_equal; \
++texta; \
++textb; \
} \
\
if (diff == 0) \
{ \
while (texta < lima && ignore[UCHAR (*texta)]) \
++texta; \
while (textb < limb && ignore[UCHAR (*textb)]) \
++textb; \
\
if (texta == lima && textb < limb) \
diff = -1; \
else if (texta < lima && textb == limb) \
diff = 1; \
} \
/* Relative lengths are meaningless if characters were ignored. \
Handling this case here avoids what might be an invalid length \
comparison below. */ \
if (diff == 0 && texta == lima && textb == limb) \
comparable_lengths = 0; \
diff = (lima - texta) - (limb - textb); \
} \
while (0)
CMP_WITH_IGNORE (translate[UCHAR (*texta)], translate[UCHAR (*textb)]);
else if (ignore)
CMP_WITH_IGNORE (UCHAR (*texta), UCHAR (*textb));
else if (translate)
while (texta < lima && textb < limb)
{
if (translate[UCHAR (*texta++)] != translate[UCHAR (*textb++)])
{
diff = (UCHAR (translate[UCHAR (*--texta)])
- UCHAR (translate[UCHAR (*--textb)]));
break;
}
}
if (translate)
CMP_WITH_IGNORE (translate[UCHAR (*texta)],
translate[UCHAR (*textb)]);
else
CMP_WITH_IGNORE (UCHAR (*texta), UCHAR (*textb));
}
else if (lena == 0)
diff = -lenb;
else if (lenb == 0)
goto greater;
else
{
#ifdef ENABLE_NLS
if (hard_LC_COLLATE)
if (translate)
{
/* Ignore any length difference if the localized comparison
says the strings are equal. */
comparable_lengths = 0;
diff = memcoll (texta, lena, textb, lenb);
while (texta < lima && textb < limb)
{
diff = (UCHAR (translate[UCHAR (*texta++)])
- UCHAR (translate[UCHAR (*textb++)]));
if (diff)
goto not_equal;
}
}
else
#endif
{
diff = memcmp (texta, textb, min (lena, lenb));
if (diff)
goto not_equal;
}
diff = lena - lenb;
}
if (diff)
return key->reverse ? -diff : diff;
if (comparable_lengths && (diff = lena - lenb) != 0)
return key->reverse ? -diff : diff;
goto not_equal;
key = key->next;
if (! key)
break;
/* Find the beginning and limit of the next field. */
if (key->eword >= 0)
lima = limfield (a, key), limb = limfield (b, key);
else
lima = a->text + a->length - 1, limb = b->text + b->length - 1;
if (key->sword >= 0)
texta = begfield (a, key), textb = begfield (b, key);
else
{
texta = a->text, textb = b->text;
if (key->skipsblanks)
{
while (texta < lima && blanks[UCHAR (*texta)])
++texta;
while (textb < limb && blanks[UCHAR (*textb)])
++textb;
}
}
}
return 0;
greater:
diff = 1;
not_equal:
return key->reverse ? -diff : diff;
}
/* Compare two lines A and B, returning negative, zero, or positive
@@ -1304,38 +1262,32 @@ keycompare (const struct line *a, const struct line *b)
static int
compare (register const struct line *a, register const struct line *b)
{
int diff, alen, blen, minlen;
int diff, alen, blen;
/* First try to compare on the specified keys (if any).
The only two cases with no key at all are unadorned sort,
and unadorned sort -r. */
if (keyhead.next)
if (keylist)
{
diff = keycompare (a, b);
alloca (0);
if (diff != 0 || unique || stable)
{
alloca (0);
return diff;
}
return diff;
}
/* If the keys all compare equal (or no keys were specified)
fall through to the default byte-by-byte comparison. */
fall through to the default comparison. */
alen = a->length - 1, blen = b->length - 1;
if (alen == 0)
diff = - blen;
else if (blen == 0)
diff = alen;
#ifdef ENABLE_NLS
if (hard_LC_COLLATE)
{
diff = memcoll (a->text, alen, b->text, blen);
alloca (0);
return reverse ? -diff : diff;
}
else if (hard_LC_COLLATE)
diff = memcoll (a->text, alen, b->text, blen);
#endif
minlen = min (alen, blen);
if (minlen == 0
|| (! (diff = UCHAR (a->text[0]) - UCHAR (b->text[0]))
&& ! (diff = memcmp (a->text, b->text, minlen))))
else if (! (diff = memcmp (a->text, b->text, min (alen, blen))))
diff = alen - blen;
return reverse ? -diff : diff;
@@ -1357,6 +1309,7 @@ checkfp (FILE *fp, const char *file_name)
int line_number = 1;
struct line *disorder_line IF_LINT (= NULL);
int disorder_line_number = 0;
struct keyfield *key = keylist;
initbuf (&buf, mergealloc);
initlines (&lines, mergealloc / linelength + 1,
@@ -1394,18 +1347,17 @@ checkfp (FILE *fp, const char *file_name)
prev_line = lines.lines + (lines.used - 1);
if (alloc < prev_line->length)
{
do
{
alloc *= 2;
}
while (alloc < prev_line->length);
while ((alloc *= 2) < prev_line->length)
continue;
temp.text = xrealloc (temp.text, alloc);
}
assert (prev_line->length <= alloc);
memcpy (temp.text, prev_line->text, prev_line->length);
temp.length = prev_line->length;
temp.keybeg = temp.text + (prev_line->keybeg - prev_line->text);
temp.keylim = temp.text + (prev_line->keylim - prev_line->text);
if (key)
{
temp.keybeg = temp.text + (prev_line->keybeg - prev_line->text);
temp.keylim = temp.text + (prev_line->keylim - prev_line->text);
}
cc = fillbuf (&buf, fp);
if (cc == 0)
@@ -1448,8 +1400,9 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
{
struct buffer buffer[NMERGE]; /* Input buffers for each file. */
struct lines lines[NMERGE]; /* Line tables for each buffer. */
struct line saved; /* Saved line for unique check. */
int savedflag = 0; /* True if there is a saved line. */
struct line saved; /* Saved line storage for unique check. */
struct line const *savedline IF_LINT (= NULL);
/* &saved if there is a saved line. */
int savealloc IF_LINT (= 0); /* Size allocated for the saved line. */
int cur[NMERGE]; /* Current line in each line table. */
int ord[NMERGE]; /* Table representing a permutation of fps,
@@ -1457,10 +1410,12 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
is the smallest line and will be next
output. */
register int i, j, t;
struct keyfield *key = keylist;
/* Allocate space for a saved line if necessary. */
if (unique)
{
savedline = NULL;
savealloc = linelength;
saved.text = xmalloc (savealloc);
}
@@ -1501,44 +1456,39 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
/* Repeatedly output the smallest line until no input remains. */
while (nfps)
{
struct line const *smallest = &lines[ord[0]].lines[cur[ord[0]]];
/* If uniquified output is turned on, output only the first of
an identical series of lines. */
if (unique)
{
if (savedflag && compare (&saved, &lines[ord[0]].lines[cur[ord[0]]]))
if (savedline && compare (savedline, smallest))
{
savedline = 0;
write_bytes (saved.text, saved.length, ofp, output_file);
savedflag = 0;
}
if (!savedflag)
if (!savedline)
{
if (savealloc < lines[ord[0]].lines[cur[ord[0]]].length)
savedline = &saved;
if (savealloc < smallest->length)
{
while (savealloc < lines[ord[0]].lines[cur[ord[0]]].length)
savealloc *= 2;
while ((savealloc *= 2) < smallest->length)
continue;
saved.text = xrealloc (saved.text, savealloc);
}
saved.length = lines[ord[0]].lines[cur[ord[0]]].length;
memcpy (saved.text, lines[ord[0]].lines[cur[ord[0]]].text,
saved.length);
if (lines[ord[0]].lines[cur[ord[0]]].keybeg != NULL)
saved.length = smallest->length;
memcpy (saved.text, smallest->text, saved.length);
if (key)
{
saved.keybeg = saved.text +
(lines[ord[0]].lines[cur[ord[0]]].keybeg
- lines[ord[0]].lines[cur[ord[0]]].text);
saved.keybeg =
saved.text + (smallest->keybeg - smallest->text);
saved.keylim =
saved.text + (smallest->keylim - smallest->text);
}
if (lines[ord[0]].lines[cur[ord[0]]].keylim != NULL)
{
saved.keylim = saved.text +
(lines[ord[0]].lines[cur[ord[0]]].keylim
- lines[ord[0]].lines[cur[ord[0]]].text);
}
savedflag = 1;
}
}
else
write_bytes (lines[ord[0]].lines[cur[ord[0]]].text,
lines[ord[0]].lines[cur[ord[0]]].length, ofp, output_file);
write_bytes (smallest->text, smallest->length, ofp, output_file);
/* Check if we need to read more lines into core. */
if (++cur[ord[0]] == lines[ord[0]].used)
@@ -1589,7 +1539,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp, const char *output_file)
ord[i - 1] = t;
}
if (unique && savedflag)
if (unique && savedline)
{
write_bytes (saved.text, saved.length, ofp, output_file);
free (saved.text);
@@ -1729,10 +1679,10 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
while (fillbuf (&buf, fp))
{
findlines (&buf, &lines);
if (lines.used > ntmp)
if (ntmp < lines.used)
{
while (lines.used > ntmp)
ntmp *= 2;
while ((ntmp *= 2) < lines.used)
continue;
tmp = (struct line *)
xrealloc ((char *) tmp, ntmp * sizeof (struct line));
}
@@ -1773,16 +1723,16 @@ sort (char **files, int nfiles, FILE *ofp, const char *output_file)
}
}
/* Insert key KEY at the end of the list (`keyhead'). */
/* Insert key KEY at the end of the key list. */
static void
insertkey (struct keyfield *key)
{
struct keyfield *k = &keyhead;
struct keyfield **p;
while (k->next)
k = k->next;
k->next = key;
for (p = &keylist; *p; p = &(*p)->next)
continue;
*p = key;
key->next = NULL;
}
@@ -1797,16 +1747,16 @@ badfieldspec (const char *s)
static void
sighandler (int sig)
{
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
struct sigaction sigact;
sigact.sa_handler = SIG_DFL;
sigemptyset (&sigact.sa_mask);
sigact.sa_flags = 0;
sigaction (sig, &sigact, NULL);
#else /* !SA_INTERRUPT */
#else
signal (sig, SIG_DFL);
#endif /* SA_INTERRUPT */
#endif
cleanup ();
kill (getpid (), sig);
}
@@ -1875,9 +1825,9 @@ main (int argc, char **argv)
int checkonly = 0, mergeonly = 0, nfiles = 0;
char *minus = "-", *outfile = minus, **files, *tmp;
FILE *ofp;
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
struct sigaction oldact, newact;
#endif /* SA_INTERRUPT */
#endif
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -1887,7 +1837,6 @@ main (int argc, char **argv)
#ifdef ENABLE_NLS
hard_LC_COLLATE = hard_locale (LC_COLLATE);
hard_LC_CTYPE = hard_locale (LC_CTYPE);
# if HAVE_NL_LANGINFO
hard_LC_TIME = hard_locale (LC_TIME);
# endif
@@ -1925,7 +1874,7 @@ main (int argc, char **argv)
xalloc_exit_failure = SORT_FAILURE;
xalloc_fail_func = cleanup;
#ifdef SA_INTERRUPT
#ifdef SA_NOCLDSTOP
newact.sa_handler = sighandler;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
@@ -1942,7 +1891,7 @@ main (int argc, char **argv)
sigaction (SIGTERM, NULL, &oldact);
if (oldact.sa_handler != SIG_IGN)
sigaction (SIGTERM, &newact, NULL);
#else /* !SA_INTERRUPT */
#else
if (signal (SIGINT, SIG_IGN) != SIG_IGN)
signal (SIGINT, sighandler);
if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
@@ -1951,7 +1900,7 @@ main (int argc, char **argv)
signal (SIGPIPE, sighandler);
if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
signal (SIGTERM, sighandler);
#endif /* !SA_INTERRUPT */
#endif
gkey.sword = gkey.eword = -1;
gkey.ignore = NULL;
@@ -2213,7 +2162,7 @@ but lacks following character offset"));
insertkey (key);
/* Inheritance of global options to individual keys. */
for (key = keyhead.next; key; key = key->next)
for (key = keylist; key; key = key->next)
if (!key->ignore && !key->translate && !key->skipsblanks && !key->reverse
&& !key->skipeblanks && !key->month && !key->numeric
&& !key->general_numeric)
@@ -2228,9 +2177,9 @@ but lacks following character offset"));
key->reverse = gkey.reverse;
}
if (!keyhead.next && (gkey.ignore || gkey.translate || gkey.skipsblanks
|| gkey.skipeblanks || gkey.month || gkey.numeric
|| gkey.general_numeric))
if (!keylist && (gkey.ignore || gkey.translate || gkey.skipsblanks
|| gkey.skipeblanks || gkey.month || gkey.numeric
|| gkey.general_numeric))
insertkey (&gkey);
reverse = gkey.reverse;

View File

@@ -1,5 +1,5 @@
/* stty -- change and print terminal line settings
Copyright (C) 1990-1999 Free Software Foundation, Inc.
Copyright (C) 1990-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
@@ -467,12 +467,13 @@ wrapf (const char *message,...)
vsprintf (buf, message, args);
va_end (args);
buflen = strlen (buf);
if (current_col + (current_col > 0) + buflen >= max_col)
if (0 < current_col
&& max_col <= current_col + (0 < current_col) + buflen)
{
putchar ('\n');
current_col = 0;
}
if (current_col > 0)
if (0 < current_col)
{
putchar (' ');
current_col++;
@@ -1434,13 +1435,20 @@ screen_columns (void)
(but it works for ptys).
It can also fail on any system when stdout isn't a tty.
In case of any failure, just use the default. */
if (get_win_size (STDOUT_FILENO, &win) == 0 && win.ws_col > 0)
if (get_win_size (STDOUT_FILENO, &win) == 0 && 0 < win.ws_col)
return win.ws_col;
#endif
/* FIXME: use xstrtol */
if (getenv ("COLUMNS"))
return atoi (getenv ("COLUMNS"));
return 80;
{
/* Use $COLUMNS if it's in [1..INT_MAX-1]. */
char *col_string = getenv ("COLUMNS");
long n_columns;
if (!(col_string != NULL
&& xstrtol (col_string, NULL, 0, &n_columns, "") == LONGINT_OK
&& 0 < n_columns
&& n_columns < INT_MAX))
n_columns = 80;
return n_columns;
}
}
static tcflag_t *

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
@@ -165,6 +295,16 @@ char *getenv ();
off_t lseek ();
#endif
/* This is needed on some AIX systems. */
#ifndef HAVE_DECL_STRTOUL
unsigned long strtoul ();
#endif
/* This is needed on some AIX systems. */
#ifndef HAVE_DECL_STRTOULL
unsigned long long strtoull ();
#endif
#include "xalloc.h"
#if ! defined HAVE_MEMPCPY && ! defined mempcpy

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
@@ -314,9 +193,15 @@ extern int errno;
#ifndef HAVE_STRUCT_STAT_ST_BLOCKS
# define ST_BLKSIZE(statbuf) DEV_BSIZE
# if defined(_POSIX_SOURCE) || !defined(BSIZE) /* fileblocks.c uses BSIZE. */
# define ST_NBLOCKS(statbuf) ((statbuf).st_size / ST_NBLOCKSIZE + ((statbuf).st_size % ST_NBLOCKSIZE != 0))
# define ST_NBLOCKS(statbuf) \
(S_ISREG ((statbuf).st_mode) \
|| S_ISDIR ((statbuf).st_mode) \
? (statbuf).st_size / ST_NBLOCKSIZE + ((statbuf).st_size % ST_NBLOCKSIZE != 0) : 0)
# else /* !_POSIX_SOURCE && BSIZE */
# define ST_NBLOCKS(statbuf) (st_blocks ((statbuf).st_size))
# define ST_NBLOCKS(statbuf) \
(S_ISREG ((statbuf).st_mode) \
|| S_ISDIR ((statbuf).st_mode) \
? st_blocks ((statbuf).st_size) : 0)
# endif /* !_POSIX_SOURCE && BSIZE */
#else /* HAVE_STRUCT_STAT_ST_BLOCKS */
/* Some systems, like Sequents, return st_blksize of 0 on pipes. */
@@ -332,14 +217,20 @@ extern int errno;
# define ST_NBLOCKSIZE (4 * 1024)
# else /* not AIX PS/2 */
# if defined(_CRAY)
# define ST_NBLOCKS(statbuf) ((statbuf).st_blocks * ST_BLKSIZE(statbuf)/ST_NBLOCKSIZE)
# define ST_NBLOCKS(statbuf) \
(S_ISREG ((statbuf).st_mode) \
|| S_ISDIR ((statbuf).st_mode) \
? (statbuf).st_blocks * ST_BLKSIZE(statbuf)/ST_NBLOCKSIZE : 0)
# endif /* _CRAY */
# endif /* not AIX PS/2 */
# endif /* !hpux */
#endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
#ifndef ST_NBLOCKS
# define ST_NBLOCKS(statbuf) ((statbuf).st_blocks)
# define ST_NBLOCKS(statbuf) \
(S_ISREG ((statbuf).st_mode) \
|| S_ISDIR ((statbuf).st_mode) \
? (statbuf).st_blocks : 0)
#endif
#ifndef ST_NBLOCKSIZE

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 */
@@ -276,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;

144
src/tr.c
View File

@@ -1,5 +1,5 @@
/* tr -- a filter to translate characters
Copyright (C) 91, 1995-1998, 1999 Free Software Foundation, Inc.
Copyright (C) 91, 1995-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
@@ -28,6 +28,7 @@
#include "system.h"
#include "error.h"
#include "safe-read.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "tr"
@@ -36,8 +37,8 @@
#define N_CHARS (UCHAR_MAX + 1)
/* A pointer to a function that returns an int. */
typedef int (*PFI) ();
/* A pointer to a filtering function. */
typedef size_t (*Filter) (/* unsigned char *, size_t, Filter */);
/* Convert from character C to its index in the collating
sequence array. Just cast to an unsigned int to avoid
@@ -838,48 +839,6 @@ find_closing_delim (const struct E_string *es, size_t start_idx,
return 0;
}
/* Convert a string S with explicit length LEN, possibly
containing embedded zero bytes, to a long integer value.
If the string represents a negative value, a value larger
than LONG_MAX, or if all LEN characters do not represent a
valid integer, return nonzero and do not modify *VAL.
Otherwise, return zero and set *VAL to the converted value. */
static int
non_neg_strtol (const unsigned char *s, size_t len, size_t *val)
{
size_t i;
unsigned long sum = 0;
unsigned int base;
if (len <= 0)
return 1;
if (s[0] == '0')
base = 8;
else if (ISDIGIT (s[0]))
base = 10;
else
return 1;
for (i = 0; i < len; i++)
{
unsigned int c;
if (s[i] < '0')
return 1;
c = s[i] - '0';
if (c >= base)
return 1;
if (sum > (LONG_MAX - c) / base)
return 1;
sum = sum * base + c;
}
*val = sum;
return 0;
}
/* Parse the bracketed repeat-char syntax. If the P_LEN characters
beginning with P[ START_IDX ] comprise a valid [c*n] construct,
then set *CHAR_TO_REPEAT, *REPEAT_COUNT, and *CLOSING_BRACKET_IDX
@@ -905,7 +864,6 @@ find_bracketed_repeat (const struct E_string *es, size_t start_idx,
{
if (ES_MATCH (es, i, ']'))
{
const unsigned char *digit_str;
size_t digit_str_len = i - start_idx - 2;
*char_to_repeat = es->s[start_idx];
@@ -918,17 +876,34 @@ find_bracketed_repeat (const struct E_string *es, size_t start_idx,
}
/* Here, we have found [c*s] where s should be a string
of octal or decimal digits. */
digit_str = &es->s[start_idx + 2];
if (non_neg_strtol (digit_str, digit_str_len, repeat_count)
|| *repeat_count > BEGIN_STATE)
{
char *tmp = make_printable_str (digit_str, digit_str_len);
error (0, 0, _("invalid repeat count `%s' in [c*n] construct"),
tmp);
free (tmp);
return -2;
}
of octal (if it starts with `0') or decimal digits. */
{
const char *digit_str = &es->s[start_idx + 2];
unsigned long int tmp_ulong;
char *d_end;
int base = 10;
/* Select the base manually so we can be sure it's either 8 or 10.
If the spec allowed it to be interpreted as hexadecimal, we
could have used `0' and let xstrtoul decide. */
if (*digit_str == '0')
{
base = 8;
++digit_str;
--digit_str_len;
}
if (xstrtoul (digit_str, &d_end, base, &tmp_ulong, NULL) != LONGINT_OK
|| BEGIN_STATE < tmp_ulong
|| d_end - digit_str != digit_str_len)
{
char *tmp = make_printable_str (es->s + start_idx + 2,
i - start_idx - 2);
error (0, 0, _("invalid repeat count `%s' in [c*n] construct"),
tmp);
free (tmp);
return -2;
}
*repeat_count = tmp_ulong;
}
*closing_bracket_idx = i;
return 0;
}
@@ -960,7 +935,7 @@ star_digits_closebracket (const struct E_string *es, size_t idx)
return 0;
}
/* Convert string UNESACPED_STRING (which has been preprocessed to
/* Convert string UNESCAPED_STRING (which has been preprocessed to
convert backslash-escape sequences) of length LEN characters into
a linked list of the following 5 types of constructs:
- [:str:] Character class where `str' is one of the 12 valid strings.
@@ -1598,25 +1573,30 @@ when translating"));
character is in the squeeze set. */
static void
squeeze_filter (unsigned char *buf, long int size, PFI reader)
squeeze_filter (unsigned char *buf, size_t size, Filter reader)
{
unsigned int char_to_squeeze = NOT_A_CHAR;
int i = 0;
int nr = 0;
size_t i = 0;
ssize_t nr = 0;
for (;;)
{
int begin;
size_t begin;
if (i >= nr)
{
if (reader == NULL)
nr = safe_read (0, (char *) buf, size);
{
ssize_t signed_nr = safe_read (0, (char *) buf, size);
if (signed_nr < 0)
error (EXIT_FAILURE, errno, _("read error"));
nr = signed_nr;
}
else
nr = (*reader) (buf, size, NULL);
{
nr = (*reader) (buf, size, NULL);
}
if (nr < 0)
error (EXIT_FAILURE, errno, _("read error"));
if (nr == 0)
break;
i = 0;
@@ -1626,7 +1606,7 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader)
if (char_to_squeeze == NOT_A_CHAR)
{
int out_len;
size_t out_len;
/* Here, by being a little tricky, we can get a significant
performance increase in most cases when the input is
reasonably large. Since tr will modify the input only
@@ -1692,14 +1672,13 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader)
in the delete set, and return the number of characters saved
or 0 upon EOF. */
static long
read_and_delete (unsigned char *buf, long int size, PFI not_used)
static size_t
read_and_delete (unsigned char *buf, size_t size, Filter not_used)
{
long n_saved;
size_t n_saved;
static int hit_eof = 0;
assert (not_used == NULL);
assert (size > 0);
if (hit_eof)
return 0;
@@ -1709,8 +1688,8 @@ read_and_delete (unsigned char *buf, long int size, PFI not_used)
just deleted all the characters in a buffer. */
do
{
int i;
int nr = safe_read (0, (char *) buf, size);
size_t i;
ssize_t nr = safe_read (0, (char *) buf, size);
if (nr < 0)
error (EXIT_FAILURE, errno, _("read error"));
@@ -1742,15 +1721,14 @@ read_and_delete (unsigned char *buf, long int size, PFI not_used)
perform the in-place and one-to-one mapping specified by the global
array `xlate'. Return the number of characters read, or 0 upon EOF. */
static long
read_and_xlate (unsigned char *buf, long int size, PFI not_used)
static size_t
read_and_xlate (unsigned char *buf, size_t size, Filter not_used)
{
long chars_read = 0;
ssize_t chars_read = 0;
static int hit_eof = 0;
int i;
size_t i;
assert (not_used == NULL);
assert (size > 0);
if (hit_eof)
return 0;
@@ -1779,7 +1757,7 @@ static void
set_initialize (struct Spec_list *s, int complement_this_set, SET_TYPE *in_set)
{
int c;
int i;
size_t i;
memset (in_set, 0, N_CHARS * sizeof (in_set[0]));
s->state = BEGIN_STATE;
@@ -1906,7 +1884,7 @@ without squeezing repeats"));
}
else if (delete && non_option_args == 1)
{
long nr;
size_t nr;
set_initialize (s1, complement, in_delete_set);
do
@@ -1921,7 +1899,7 @@ without squeezing repeats"));
{
set_initialize (s1, complement, in_delete_set);
set_initialize (s2, 0, in_squeeze_set);
squeeze_filter (io_buf, IO_BUF_SIZE, (PFI) read_and_delete);
squeeze_filter (io_buf, IO_BUF_SIZE, read_and_delete);
}
else if (translating)
{
@@ -2010,11 +1988,11 @@ construct in string1 must be aligned with a corresponding construct\n\
if (squeeze_repeats)
{
set_initialize (s2, 0, in_squeeze_set);
squeeze_filter (io_buf, IO_BUF_SIZE, (PFI) read_and_xlate);
squeeze_filter (io_buf, IO_BUF_SIZE, read_and_xlate);
}
else
{
long chars_read;
size_t chars_read;
do
{

View File

@@ -1,5 +1,5 @@
/* tsort - topological sort.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -66,12 +66,18 @@ char *program_name;
/* Nonzero if any of the input files are the standard input. */
static int have_read_stdin;
/* The error code to return to the system. */
static int exit_status;
/* The head of the sorted list. */
static struct item *head = NULL;
/* The tail of the list of `zeros', strings that have no predecessors. */
static struct item *zeros = NULL;
/* Used for loop detection. */
static struct item *loop = NULL;
/* The number of strings to sort. */
static int n_strings = 0;
@@ -288,16 +294,18 @@ record_relation (struct item *j, struct item *k)
}
}
static void
static int
count_items (struct item *k)
{
n_strings++;
return 0;
}
static void
static int
scan_zeros (struct item *k)
{
if (k->count == 0)
/* Ignore strings that have already been printed. */
if (k->count == 0 && k->str)
{
if (head == NULL)
head = k;
@@ -306,48 +314,128 @@ scan_zeros (struct item *k)
zeros = k;
}
return 0;
}
/* If K is part of a loop, print the loop on standard error, and exit. */
/* Try to detect the loop. If we have detected that K is part of a
loop, print the loop on standard error, remove a relation to break
the loop, and return non-zero.
static void
The loop detection strategy is as follows: Realise that what we're
dealing with is essentially a directed graph. If we find an item
that is part of a graph that contains a cycle we traverse the graph
in backwards direction. In general there is no unique way to do
this, but that is no problem. If we encounter an item that we have
encountered before, we know that we've found a cycle. All we have
to do now is retrace our steps, printing out the items until we
encounter that item again. (This is not necessarily the item that
we started from originally.) Since the order in which the items
are stored in the tree is not related to the specified partial
ordering, we may need to walk the tree several times before the
loop has completely been constructed. If the loop was found, the
global variable LOOP will be NULL. */
static int
detect_loop (struct item *k)
{
if (k->count > 0 && k->top)
if (k->count > 0)
{
while (k && k->count > 0)
{
k->count = 0;
fprintf (stderr, "%s: %s\n", program_name, k->str);
k = k->top->suc;
}
/* K does not have to be part of a cycle. It is however part of
a graph that contains a cycle. */
exit (EXIT_FAILURE);
if (loop == NULL)
/* Start traversing the graph at K. */
loop = k;
else
{
struct successor **p = &k->top;
while (*p)
{
if ((*p)->suc == loop)
{
if (k->qlink)
{
/* We have found a loop. Retrace our steps. */
while (loop)
{
struct item *tmp = loop->qlink;
fprintf (stderr, "%s: %s\n", program_name,
loop->str);
/* Until we encounter K again. */
if (loop == k)
{
/* Remove relation. */
(*p)->suc->count--;
*p = (*p)->next;
break;
}
/* Tidy things up since we might have to
detect another loop. */
loop->qlink = NULL;
loop = tmp;
}
while (loop)
{
struct item *tmp = loop->qlink;
loop->qlink = NULL;
loop = tmp;
}
/* Since we have found the loop, stop walking
the tree. */
return 1;
}
else
{
k->qlink = loop;
loop = k;
break;
}
}
p = &(*p)->next;
}
}
}
return 0;
}
/* Recurse (sub)tree rooted at ROOT, calling ACTION for each node. */
/* Recurse (sub)tree rooted at ROOT, calling ACTION for each node.
Stop when ACTION returns non-zero. */
static void
recurse_tree (struct item *root, void (*action) (struct item *))
static int
recurse_tree (struct item *root, int (*action) (struct item *))
{
if (root->left == NULL && root->right == NULL)
(*action) (root);
return (*action) (root);
else
{
if (root->left != NULL)
recurse_tree (root->left, action);
(*action) (root);
if (recurse_tree (root->left, action))
return 1;
if ((*action) (root))
return 1;
if (root->right != NULL)
recurse_tree (root->right, action);
if (recurse_tree (root->right, action))
return 1;
}
return 0;
}
/* Walk the tree specified by the head ROOT, calling ACTION for
each node. */
static void
walk_tree (struct item *root, void (*action) (struct item *))
walk_tree (struct item *root, int (*action) (struct item *))
{
if (root->right)
recurse_tree (root->right, action);
@@ -406,46 +494,51 @@ tsort (const char *file)
/* T1. Initialize (N <- n). */
walk_tree (root, count_items);
/* T4. Scan for zeros. */
walk_tree (root, scan_zeros);
while (head)
while (n_strings > 0)
{
struct successor *p = head->top;
/* T4. Scan for zeros. */
walk_tree (root, scan_zeros);
/* T5. Output front of queue. */
printf ("%s\n", head->str);
n_strings--;
/* T6. Erase relations. */
while (p)
while (head)
{
p->suc->count--;
if (p->suc->count == 0)
struct successor *p = head->top;
/* T5. Output front of queue. */
printf ("%s\n", head->str);
head->str = NULL; /* Avoid printing the same string twice. */
n_strings--;
/* T6. Erase relations. */
while (p)
{
zeros->qlink = p->suc;
zeros = p->suc;
p->suc->count--;
if (p->suc->count == 0)
{
zeros->qlink = p->suc;
zeros = p->suc;
}
p = p->next;
}
p = p->next;
/* T7. Remove from queue. */
head = head->qlink;
}
/* T7. Remove from queue. */
head = head->qlink;
}
/* T8. End of process. */
assert (n_strings >= 0);
if (n_strings > 0)
{
/* The input contains a loop. */
error (0, 0, _("%s: input contains a loop:"),
(have_read_stdin ? "-" : file));
exit_status = 1;
/* T8. End of process. */
assert (n_strings >= 0);
if (n_strings > 0)
{
error (0, 0, _("%s: input contains a loop:"),
(have_read_stdin ? "-" : file));
/* Print out loop. */
walk_tree (root, detect_loop);
/* Should not happen. */
error (EXIT_FAILURE, 0, _("could not find loop"));
/* Print the loop and remove a relation to break it. */
do
walk_tree (root, detect_loop);
while (loop);
}
}
}
@@ -459,6 +552,8 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
exit_status = 0;
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
@@ -490,5 +585,5 @@ main (int argc, char **argv)
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
exit (EXIT_SUCCESS);
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@@ -1,5 +1,5 @@
/* unexpand - convert spaces to tabs
Copyright (C) 89, 91, 1995-1999 Free Software Foundation, Inc.
Copyright (C) 89, 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
@@ -57,6 +57,11 @@
allocated for the list of tabstops. */
#define TABLIST_BLOCK 256
/* A sentinel value that's placed at the end of the list of tab stops.
This value must be a large number, but not so large that adding the
length of a line to it would cause the column variable to overflow. */
#define TAB_STOP_SENTINEL INT_MAX
/* The name this program was run with. */
char *program_name;
@@ -219,10 +224,10 @@ unexpand (void)
/* Index in `tab_list' of next tabstop: */
int tab_index = 0; /* For calculating width of pending tabs. */
int print_tab_index = 0; /* For printing as many tabs as possible. */
int column = 0; /* Column on screen of next char. */
unsigned int column = 0; /* Column on screen of next char. */
int next_tab_column; /* Column the next tab stop is on. */
int convert = 1; /* If nonzero, perform translations. */
int pending = 0; /* Pending columns of blanks. */
unsigned int pending = 0; /* Pending columns of blanks. */
fp = next_file ((FILE *) NULL);
if (fp == NULL)
@@ -235,7 +240,7 @@ unexpand (void)
{
c = getc (fp);
if (c == ' ' && convert)
if (c == ' ' && convert && column < TAB_STOP_SENTINEL)
{
++pending;
++column;
@@ -276,7 +281,7 @@ unexpand (void)
pending = 0;
}
column -= pending;
while (pending != 0)
while (pending > 0)
{
if (tab_size == 0)
{
@@ -437,7 +442,7 @@ main (int argc, char **argv)
else
{
/* Append a sentinel to the list of tab stop indices. */
add_tabstop (INT_MAX);
add_tabstop (TAB_STOP_SENTINEL);
tab_size = 0;
}

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@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
@@ -82,7 +86,6 @@ INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
KMEM_GROUP = @KMEM_GROUP@
LIBOBJS = @LIBOBJS@
LIB_CRYPT = @LIB_CRYPT@
MAKEINFO = @MAKEINFO@
MAN = @MAN@
MKINSTALLDIRS = @MKINSTALLDIRS@
@@ -96,8 +99,6 @@ POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
SEQ_LIBM = @SEQ_LIBM@
SQRT_LIBM = @SQRT_LIBM@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
@@ -115,7 +116,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 +146,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 +243,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

@@ -73,6 +73,7 @@ DEPDIR = @DEPDIR@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GETCONF = @GETCONF@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNU_PACKAGE = @GNU_PACKAGE@
@@ -83,14 +84,20 @@ INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
KMEM_GROUP = @KMEM_GROUP@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MAN = @MAN@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
NEED_SETGID = @NEED_SETGID@
OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
@@ -145,7 +152,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; \

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