Compare commits

...

1541 Commits

Author SHA1 Message Date
Jim Meyering
0ecb6ace02 . 1998-03-15 20:36:02 +00:00
Jim Meyering
6d42c7e9d7 *** empty log message *** 1998-03-15 18:05:05 +00:00
Jim Meyering
6684ffa826 Use #if, not #ifdef with HAVE_ macros.
Use #if !, not #ifndef with HAVE_ macros.
1998-03-15 17:54:50 +00:00
Jim Meyering
bfbc3ce20c Use #if, not #ifdef with HAVE_ macros 1998-03-15 11:09:10 +00:00
Jim Meyering
0f5f23cb9e . 1998-03-15 09:52:09 +00:00
Jim Meyering
93494dde07 *** empty log message *** 1998-03-15 09:48:52 +00:00
Jim Meyering
be3b9520ad (EXTRA_DIST): Add prereq.m4. 1998-03-15 09:47:28 +00:00
Jim Meyering
c2c6f081c5 *** empty log message *** 1998-03-15 09:47:03 +00:00
Jim Meyering
36b10d9f21 . 1998-03-15 09:45:00 +00:00
Jim Meyering
72c0980585 *** empty log message *** 1998-03-15 09:43:27 +00:00
Jim Meyering
58647fd63d *** empty log message *** 1998-03-15 09:11:44 +00:00
Jim Meyering
6eb5e899e1 *** empty log message *** 1998-03-15 09:10:21 +00:00
Jim Meyering
a01c762a81 *** empty log message *** 1998-03-15 09:08:51 +00:00
Jim Meyering
c29025e6ed (EXTRA_DIST): Add error.m4. 1998-03-15 09:08:39 +00:00
Jim Meyering
b3582e7533 . 1998-03-15 09:07:39 +00:00
Jim Meyering
12f49aa1ae update from fsf 1998-03-15 08:11:02 +00:00
Jim Meyering
f31f7e1c75 *** empty log message *** 1998-03-14 19:53:21 +00:00
Jim Meyering
d34d42ca05 . 1998-03-14 16:39:09 +00:00
Jim Meyering
6974d67aa2 *** empty log message *** 1998-03-14 16:38:41 +00:00
Jim Meyering
85d9447441 . 1998-03-14 16:38:35 +00:00
Jim Meyering
45c381f4ba s/get-date.h/getdate.h/ 1998-03-14 16:35:24 +00:00
Jim Meyering
184c0062a4 s/get-date.h/getdate.h/ 1998-03-14 16:32:35 +00:00
Jim Meyering
7024c7d55c s/get-date.h/getdate.h/ 1998-03-14 16:31:51 +00:00
Jim Meyering
d84a21ea2d . 1998-03-14 16:30:52 +00:00
Jim Meyering
2f6fa9d160 . 1998-03-14 16:26:41 +00:00
Jim Meyering
4ac374c8e5 *** empty log message *** 1998-03-14 16:26:14 +00:00
Jim Meyering
17070ae7bf . 1998-03-14 16:25:42 +00:00
Jim Meyering
a1cc8f5961 *** empty log message *** 1998-03-14 15:56:46 +00:00
Jim Meyering
27caa20d7b *** empty log message *** 1998-03-14 15:32:55 +00:00
Jim Meyering
757555a4dc . 1998-03-14 15:31:41 +00:00
Jim Meyering
ada5e63612 . 1998-03-14 10:42:01 +00:00
Jim Meyering
a8d20df6b2 (TESTS): Add into-self. 1998-03-14 10:41:39 +00:00
Jim Meyering
4a28ea9bd6 *** empty log message *** 1998-03-14 10:41:26 +00:00
Jim Meyering
e4a1ead494 *** empty log message *** 1998-03-14 10:41:02 +00:00
Jim Meyering
ad1a2f76ce *** empty log message *** 1998-03-14 10:40:30 +00:00
Jim Meyering
a7a6111f81 . 1998-03-14 10:37:29 +00:00
Jim Meyering
7c579a0231 . 1998-03-13 23:39:48 +00:00
Jim Meyering
6630a24b7a (copy): Update prototype. 1998-03-13 23:39:39 +00:00
Jim Meyering
6429ffabbb *** empty log message *** 1998-03-13 23:39:10 +00:00
Jim Meyering
e558629ce1 (do_move): Add &copy_into_self arg in call to copy.
Don't remove source directory when copy_into_self is nonzero.
Reported by Arne Henrik Juul.
1998-03-13 23:38:50 +00:00
Jim Meyering
fefa8511b8 (do_copy): Add unused arg in calls to copy. 1998-03-13 23:38:27 +00:00
Jim Meyering
347db9ce77 (copy_dir): Add new parameter, copy_into_self, and set it.
(copy_internal): Likewise.
(copy): Likewise.
Update all callers.
1998-03-13 23:37:42 +00:00
Jim Meyering
92da57a7be Use `virtual memory exhausted' message, not
`Memory exhausted' to be consistent with the majority of other
such messages.
Say `removing all...', not `removing any...'.
1998-03-13 23:35:43 +00:00
Jim Meyering
4078ae8de8 (remove_parents): Be consistent with documentation of
--verbose option and with remove.c in saying `removing...' before
the operation is attempted.
(main): Likewise.
Suggestions from Santiago Vila.
1998-03-13 23:35:25 +00:00
Jim Meyering
3086193091 (usage): Tweak spacing 1998-03-13 15:32:28 +00:00
Jim Meyering
823425b310 *** empty log message *** 1998-03-13 15:27:10 +00:00
Jim Meyering
e03fc9bc82 protoize 1998-03-13 15:25:49 +00:00
Jim Meyering
64379c5cd8 (getugroups): Don't add a group number if it would be a duplicate.
From Ulrich Drepper.
1998-03-13 15:24:43 +00:00
Jim Meyering
d4825df6cf *** empty log message *** 1998-03-11 11:55:31 +00:00
Jim Meyering
cb3b5ed486 (save_stdin): Open temporary file exclusively, to
foil a common denial-of-service attack.
From Paul Eggert.
1998-03-11 11:54:11 +00:00
Jim Meyering
7ee8ed7e37 (xtmpfopen): Open temporary file exclusively, to
foil a common denial-of-service attack.
From Paul Eggert.
1998-03-11 11:53:29 +00:00
Jim Meyering
a991132f3e (getuidbyname) [__DJGPP__]: Make function know about
any arbitrary user name.
(getgidbyname) [__DJGPP__]: Make function know about any arbitrary
group name.
From Eli.
1998-03-10 22:55:20 +00:00
Jim Meyering
7f0867df00 (parse_user_spec) [__DJGPP__]: Make function know
about any arbitrary user and group by pretending to be the user
and to belong to the group specified in `spec_arg' argument.
1998-03-10 22:49:04 +00:00
Jim Meyering
6354d07ea0 . 1998-02-25 23:47:36 +00:00
Jim Meyering
3216105fbb . 1998-02-25 23:46:59 +00:00
Jim Meyering
8d5c4784b8 . 1998-02-25 23:46:13 +00:00
Jim Meyering
ec47f73107 . 1998-02-25 23:36:33 +00:00
Jim Meyering
94cd0c09f6 . 1998-02-25 23:35:53 +00:00
Jim Meyering
db3440d444 . 1998-02-25 22:40:24 +00:00
Jim Meyering
e8bec0725e *** empty log message *** 1998-02-25 22:39:46 +00:00
Jim Meyering
8598c54bb1 Use -include, not `include' for aclocal-files. 1998-02-25 22:39:29 +00:00
Jim Meyering
e457645eac Include new file quotearg.h.
(enum indicator_style): Rename all to classify, and not_programs
to file_type, to match option spellings.  All users changed.
(indicator_style_args): New constant.
(quote_funny_chars, quote_as_string, quote_shell): Remove;
(filename_quoting_options, dirname_quoting_options): Use these
variables instead.
(long_options): Add --indicator-style, --quoting-style,
--show-control-chars.  Remove --quote-shell.
(dired_dump_obstack): Remove style parameter and don't output style.
(main): Go back to previous method of outputting //DIRED//
and //SUBDIRED// lines, without style.  But add a new
//DIRED-OPTIONS// line that does output style.
(decode_switches, usage): Add --indicator-style, --quoting-style,
--show-control-chars.  Remove --quote-shell.
(decode_switches): Default from QUOTING_STYLE environment variable.
Set new quoting vars.
(quote_name): Renamed from quote_filename.
Take new arg specifying quoting options.
Always print; do not have a special case for null FILE * argument.
All callers changed.
Move the guts of this function to new file quotearg.c.
(length_of_file_name_and_frills): Use quotearg_buffer instead
of (old) quote_filename to find length of file name.
(decode_switches, parse_ls_color, print_dir, gobble_file,
get_link_name):	Quote output in diagnostics.
1998-02-25 22:38:12 +00:00
Jim Meyering
a14303dbc9 *** empty log message *** 1998-02-25 08:20:55 +00:00
Jim Meyering
84ad5c47c8 (TYPE_SIGNED): Define.
(TYPE_MAXIMUM): Define.
(ULONG_MAX): Use TYPE_MAXIMUM.
(LONG_MAX): Use TYPE_MAXIMUM.
1998-02-24 23:33:41 +00:00
Jim Meyering
998b3a148c (libfu_a_SOURCES): Add quotearg.c.
(noinst_HEADERS): Add quotearg.h.
1998-02-24 23:31:40 +00:00
Jim Meyering
71ee764f1e . 1998-02-24 23:31:11 +00:00
Jim Meyering
07a6f7a9e2 protoize 1998-02-24 23:19:33 +00:00
Jim Meyering
0f5ca22215 add comment 1998-02-24 23:19:13 +00:00
Jim Meyering
fc50286759 update from libit 1998-02-24 23:18:23 +00:00
Jim Meyering
0a1fd1d2ad protoize 1998-02-24 23:17:38 +00:00
Jim Meyering
7a04e95c62 capitalize macro params and protoize 1998-02-24 22:59:34 +00:00
Jim Meyering
938e7fe7ef add copyright 1998-02-24 22:58:26 +00:00
Jim Meyering
d8ab75cedc Update from libit. 1998-02-24 22:54:10 +00:00
Jim Meyering
650b182278 . 1998-02-23 10:16:53 +00:00
Jim Meyering
f31f7889fb *** empty log message *** 1998-02-22 12:36:32 +00:00
Jim Meyering
b1f2e5a7fd *** empty log message *** 1998-02-22 12:31:06 +00:00
Jim Meyering
34141257cf . 1998-02-22 12:30:47 +00:00
Jim Meyering
c96ef37ba9 *** empty log message *** 1998-02-22 09:20:33 +00:00
Jim Meyering
ccc65c4a81 *** empty log message *** 1998-02-22 09:20:17 +00:00
Jim Meyering
be5250f0ec *** empty log message *** 1998-02-22 09:19:36 +00:00
Jim Meyering
d1c1677873 . 1998-02-22 09:18:33 +00:00
Jim Meyering
6eae430477 Truncate to 1998 entries only. 1998-02-22 09:17:58 +00:00
Jim Meyering
82d361dc53 *** empty log message *** 1998-02-22 09:10:57 +00:00
Jim Meyering
6e05a13259 revert most of last delta, but leave cppi/copyright changes 1998-02-22 08:21:07 +00:00
Jim Meyering
a1413ad1cd *** empty log message *** 1998-02-22 08:19:19 +00:00
Jim Meyering
c9dd33ec3f *** empty log message *** 1998-02-22 08:18:51 +00:00
Jim Meyering
b9a394eec5 *** empty log message *** 1998-02-21 16:15:23 +00:00
Jim Meyering
f315b52ca9 . 1998-02-21 16:14:42 +00:00
Jim Meyering
26c02dd946 . 1998-02-21 16:14:15 +00:00
Jim Meyering
a03a97d7d8 *** empty log message *** 1998-02-21 16:14:05 +00:00
Jim Meyering
ead1152ef8 *** empty log message *** 1998-02-21 11:55:30 +00:00
Jim Meyering
2326be84d5 *** empty log message *** 1998-02-21 11:54:09 +00:00
Jim Meyering
7980fa3b78 *** empty log message *** 1998-02-21 11:53:27 +00:00
Jim Meyering
70a8ff09ed *** empty log message *** 1998-02-21 11:52:45 +00:00
Jim Meyering
38a63c863e . 1998-02-21 11:44:39 +00:00
Jim Meyering
a4fb33a110 . 1998-02-21 11:44:13 +00:00
Jim Meyering
bd9a38183c *** empty log message *** 1998-02-21 11:39:06 +00:00
Jim Meyering
45d85e3ba2 . 1998-02-21 11:38:47 +00:00
Jim Meyering
afa328c54e . 1998-02-21 11:33:09 +00:00
Jim Meyering
c66e967d70 . 1998-02-21 11:29:12 +00:00
Jim Meyering
ccaf565665 *** empty log message *** 1998-02-21 11:28:46 +00:00
Jim Meyering
b1a82ad6f2 . 1998-02-21 11:17:06 +00:00
Jim Meyering
c9a2ec01e5 *** empty log message *** 1998-02-21 11:15:43 +00:00
Jim Meyering
f7acc2f589 *** empty log message *** 1998-02-21 11:09:33 +00:00
Jim Meyering
5bf77e1015 . 1998-02-21 11:04:07 +00:00
Jim Meyering
3aa15eac61 *** empty log message *** 1998-02-20 21:51:48 +00:00
Jim Meyering
5799c6474d . 1998-02-20 21:50:49 +00:00
Jim Meyering
f8998dae41 Include get-date.h.
Remove get_date decl.
1998-02-20 21:50:30 +00:00
Jim Meyering
a7ba2688ca s/getdate.h/get-date.h/ 1998-02-20 21:47:10 +00:00
Jim Meyering
6810b30f39 (noinst_HEADERS): s/getdate.h/get-date.h/ 1998-02-20 21:42:29 +00:00
Jim Meyering
f8d66bde6a s/getdate.h/get-date.h/ 1998-02-20 21:42:11 +00:00
Jim Meyering
4675b67c10 . 1998-02-20 12:22:50 +00:00
Jim Meyering
ae3c7c2fb1 *** empty log message *** 1998-02-19 21:38:16 +00:00
Jim Meyering
a3ff199f12 *** empty log message *** 1998-02-19 21:37:45 +00:00
Jim Meyering
61ef81a837 (dirname): Include ctype.h.
[IN_CTYPE_DOMAIN]: Define.
[ISALPHA]: Define.
[MSDOS]: Add support for DOS-style file names with drive letters.
Based on a patch from Eli Zaretskii.
1998-02-19 21:31:06 +00:00
Jim Meyering
dcb8db3c82 [__DJGPP__]: Add missing typedef for daddr_t. 1998-02-19 21:28:38 +00:00
Jim Meyering
92b49f0da1 *** empty log message *** 1998-02-16 23:28:09 +00:00
Jim Meyering
f322649c58 (cp_option_init): Set copy_as_regular to 0, not 1.
Otherwise, mv tries to open special files.
Reported by Kjetil Torgrim Homme.
1998-02-16 23:27:50 +00:00
Jim Meyering
f49fee3e5f *** empty log message *** 1998-02-13 08:49:34 +00:00
Jim Meyering
6dbc8ff80b *** empty log message *** 1998-02-13 08:48:54 +00:00
Jim Meyering
65978b6328 Add my comment from ChangeLog entry for gkm's change. 1998-02-11 22:17:38 +00:00
Jim Meyering
5f8949c46c *** empty log message *** 1998-02-09 07:02:15 +00:00
Jim Meyering
b302e2becc *** empty log message *** 1998-02-09 07:01:02 +00:00
Jim Meyering
5921d6bc50 (cvs-dist): Update po/. 1998-02-09 07:00:34 +00:00
Jim Meyering
ec76108bb7 . 1998-02-08 22:17:10 +00:00
Jim Meyering
519365bb08 (usage): Reword to use TARGET' and LINK_NAME' in description. 1998-02-08 21:27:18 +00:00
Jim Meyering
c1fc9dbe64 . 1998-02-07 15:17:56 +00:00
Jim Meyering
06b4686f8a . 1998-02-07 15:17:31 +00:00
Jim Meyering
5a244d2598 *** empty log message *** 1998-02-07 10:19:22 +00:00
Jim Meyering
497a1e0c04 *** empty log message *** 1998-02-07 10:17:43 +00:00
Jim Meyering
32ee7fb170 *** empty log message *** 1998-02-07 10:14:29 +00:00
Jim Meyering
db7449461c . 1998-02-07 09:59:05 +00:00
Jim Meyering
9ed89c9d9c *** empty log message *** 1998-02-07 09:58:59 +00:00
Jim Meyering
6110857115 *** empty log message *** 1998-02-07 09:57:39 +00:00
Jim Meyering
36afcc383a *** empty log message *** 1998-02-07 09:54:05 +00:00
Jim Meyering
9e7ca26738 Don't set am_cv_func_working_getline before the
cache-check for the same variable -- that defeated the purpose of
the test; the test program was never run.  This was a problem only
on systems with losing getline functions -- HP-UX 10.20 is one.
Reported by Bjorn Helgaas.
1998-02-07 09:50:58 +00:00
Jim Meyering
de38f9c61f . 1998-02-07 08:13:44 +00:00
Jim Meyering
aa14b2d994 . 1998-02-07 08:13:08 +00:00
Jim Meyering
a6a3dee962 *** empty log message *** 1998-02-06 20:48:10 +00:00
Jim Meyering
0324f8d422 . 1998-02-06 20:47:23 +00:00
Jim Meyering
5a9c4223f6 . 1998-02-06 20:45:51 +00:00
Jim Meyering
eeeb6c7b23 . 1998-02-06 12:37:16 +00:00
Jim Meyering
206e3f08de *** empty log message *** 1998-02-06 12:37:07 +00:00
Jim Meyering
61a80b3a12 (EXTRA_DIST): Add perl.m4. 1998-02-06 12:36:59 +00:00
Jim Meyering
4da3feb0e9 . 1998-02-06 12:36:04 +00:00
Jim Meyering
a3d39ceb13 *** empty log message *** 1998-02-06 10:42:55 +00:00
Jim Meyering
b252cc8d6d . 1998-02-06 10:32:31 +00:00
Jim Meyering
afac7f3a78 . 1998-02-04 20:28:08 +00:00
Jim Meyering
fae6846955 *** empty log message *** 1998-02-04 20:19:14 +00:00
Jim Meyering
f79e8bdcaf . 1998-02-04 20:18:09 +00:00
Jim Meyering
ebfdc834f2 . 1998-02-04 18:15:05 +00:00
Jim Meyering
6e5ac55673 . 1998-02-04 18:06:31 +00:00
Jim Meyering
43d2406f55 . 1998-02-04 18:04:39 +00:00
Jim Meyering
29772527c8 . 1998-02-04 18:01:23 +00:00
Jim Meyering
4e72061130 . 1998-02-04 18:00:57 +00:00
Jim Meyering
470cfd9491 . 1998-02-04 12:41:35 +00:00
Jim Meyering
ff9a9a2bdf . 1998-02-03 08:56:02 +00:00
Jim Meyering
a3db75c4b3 add comments on #endif's 1998-02-03 08:28:43 +00:00
Jim Meyering
46fb234f5f (xgetgroups): Guard function defn with #if HAVE_GETGROUPS. 1998-02-03 08:27:48 +00:00
Jim Meyering
1e985af9d7 . 1998-02-03 07:38:23 +00:00
Jim Meyering
8ef38f80ec (sys/types.h): Include to get size_t on some systems.
(NULL): Define if needed.
1998-02-03 07:23:13 +00:00
Jim Meyering
047f0c2125 *** empty log message *** 1998-02-01 09:58:33 +00:00
Jim Meyering
a10c7fcd7c *** empty log message *** 1998-02-01 09:56:46 +00:00
Jim Meyering
54a0879129 *** empty log message *** 1998-01-31 07:28:56 +00:00
Jim Meyering
494d8173bd *** empty log message *** 1998-01-28 08:14:56 +00:00
Jim Meyering
e8b739e317 (print_header): Change format to align heading over
last column of `df -i' output.  From Andreas Schwab.
1998-01-28 08:09:56 +00:00
Jim Meyering
ef4765e11b . 1998-01-25 21:21:47 +00:00
Jim Meyering
ca9451a39d . 1998-01-25 21:20:53 +00:00
Jim Meyering
1349c30df2 Use $(VERSION) etc. Not @VERSION@. 1998-01-25 21:07:30 +00:00
Jim Meyering
8659ec88d4 . 1998-01-25 20:50:57 +00:00
Jim Meyering
e27d21668c (parse_obsolescent_option): -l is an obsolescent option. 1998-01-25 14:07:46 +00:00
Jim Meyering
902598d05d . 1998-01-25 12:20:58 +00:00
Jim Meyering
fc026cd548 . 1998-01-25 12:19:05 +00:00
Jim Meyering
7d4a70eaff *** empty log message *** 1998-01-25 10:51:55 +00:00
Jim Meyering
186958482f *** empty log message *** 1998-01-25 10:51:21 +00:00
Jim Meyering
da80ee04d2 . 1998-01-25 09:49:00 +00:00
Jim Meyering
dd3a865a8e . 1998-01-25 09:47:51 +00:00
Jim Meyering
aaf66a2413 *** empty log message *** 1998-01-25 09:29:46 +00:00
Jim Meyering
0eba2a8dd7 (DO_CHOWN): Don't fail for non-root when chown fails due
not only to lack of permission (EPERM), but also to lack of support
(EINVAL).  Reported by Bengt Martensson.
1998-01-25 09:28:48 +00:00
Jim Meyering
7c04ce1f09 (re_protect): Don't fail for non-root when chown fails due
not only to lack of permission (EPERM), but also to lack of support
(EINVAL).  Reported by Bengt Martensson.
1998-01-25 09:27:57 +00:00
Jim Meyering
7b4833b03c *** empty log message *** 1998-01-25 09:23:26 +00:00
Jim Meyering
3a62f8785f (cat): Convert comma-expressions to pairs of
semicolon-terminated stmts.
Add braces around compound if/else stmts.
1998-01-25 08:25:05 +00:00
Jim Meyering
85923cb2bc add missing `)' 1998-01-24 23:34:46 +00:00
Jim Meyering
bc05ba3d5a *** empty log message *** 1998-01-24 23:33:18 +00:00
Jim Meyering
ea2969da49 (parse_obsolescent_option): Do not interpret `-f -n 1 ...'
as obsolescent options.
Accept new option: --sleep-interval=SECONDS (-s).
(parse_options): Recognize it.
(usage): Describe it.
(tail_forever): Use it.
(dump_remainder): Use it.
1998-01-24 23:33:02 +00:00
Jim Meyering
0966b97bd1 (f-1): Add test for option-processing of `-f -n 1'. 1998-01-24 23:32:43 +00:00
Jim Meyering
8c3fb79a89 . 1998-01-24 16:48:52 +00:00
Jim Meyering
fc68d2786b *** empty log message *** 1998-01-24 16:27:26 +00:00
Jim Meyering
0d26afa6e0 *** empty log message *** 1998-01-24 16:22:11 +00:00
Jim Meyering
bb964b3eec (test_failure): Note that the SunOS4.1.4 failure
of the ctime test is expected.
Rename does not update ctime; link does -- so use ln, not mv.
1998-01-24 16:21:48 +00:00
Jim Meyering
638776e577 *** empty log message *** 1998-01-24 15:13:58 +00:00
Jim Meyering
0881032a16 *** empty log message *** 1998-01-24 14:50:28 +00:00
Jim Meyering
c58c644f8f *** empty log message *** 1998-01-24 14:50:16 +00:00
Jim Meyering
6e602a0232 *** empty log message *** 1998-01-24 14:49:30 +00:00
Jim Meyering
097d40b3d3 *** empty log message *** 1998-01-24 09:55:10 +00:00
Jim Meyering
57258b3446 . 1998-01-24 08:46:29 +00:00
Jim Meyering
39508b8db3 *** empty log message *** 1998-01-24 08:46:21 +00:00
Jim Meyering
cd4c2d0fdc (TYPE_MINIMUM): Add extra outer cast to work around
bug in Cray C 5.0.3.0 when T == time_t.
1998-01-24 08:45:55 +00:00
Jim Meyering
8a0550a816 Adjust expected output for changed format of `rm --verbose'. 1998-01-24 08:43:46 +00:00
Jim Meyering
663d8b143c *** empty log message *** 1998-01-23 22:09:18 +00:00
Jim Meyering
2a1a1843b7 (__mktime_internal): Work around bug in Irix4.0.5's
C compiler.  From Kaveh Ghazi.
(TYPE_MINIMUM): Define.
(TYPE_MAXIMUM): Define.
(TIME_T_MIN): Use TYPE_MINIMUM.
(TIME_T_MAX): Use TYPE_MAXIMUM.
1998-01-23 22:02:54 +00:00
Jim Meyering
9c70563ee7 add curlies 1998-01-23 18:34:12 +00:00
Jim Meyering
37ce5a5497 . 1998-01-22 23:29:35 +00:00
Jim Meyering
37a3052a36 *** empty log message *** 1998-01-22 09:03:08 +00:00
Jim Meyering
2a4842f7f3 (quit): Declare to be inline to stifle compile warning. 1998-01-22 08:58:12 +00:00
Jim Meyering
d82fadf365 Reorder functions to obviate forward dcls. 1998-01-22 08:55:13 +00:00
Jim Meyering
ef63ce007d (do_copy): Add unreachable `return 0' to stifle warning. 1998-01-22 08:36:27 +00:00
Jim Meyering
6a8e657775 . 1998-01-22 08:33:34 +00:00
Jim Meyering
309819620b (TESTS_ENVIRONMENT): Add TOUCH. 1998-01-22 08:33:26 +00:00
Jim Meyering
f7bb262cc8 minor tweaks 1998-01-22 08:33:02 +00:00
Jim Meyering
d5494d57f5 Don't use -f. Do adjust $RM if it's a relative path. 1998-01-22 08:32:22 +00:00
Jim Meyering
14a2593daf Use GNU touch to work around problems with NFS caching and/or clock skew. 1998-01-22 08:27:16 +00:00
Jim Meyering
9cdd2e05e6 (copy_internal): Use x->backup_type, not the global.
(valid_options): Use VALID_BACKUP_TYPE and VALID_SPARSE_MODE.
1998-01-22 08:22:00 +00:00
Jim Meyering
6cce6a1b7f [NDEBUG]: Comment out definition.
(do_copy): Use x->backup_type, not the global.
1998-01-22 08:19:17 +00:00
Jim Meyering
d9f0ca41bd (rm_option_init): New function.
(cp_option_init): New function.
(copy_reg): Remove now-unused function.
(do_move): Set up for and use `copy.c (copy)' in place of copy_reg.
Set up for and use `remove.c (rm)' in place of unlink.
1998-01-22 08:16:09 +00:00
Jim Meyering
df7cef21c7 Remove and minimally librarify guts for use in mv.c.
(main): Pass options (`&x') to rm.
Call remove_init and remove_fini instead of open-coding them.
1998-01-22 08:14:52 +00:00
Jim Meyering
9f2d1beded *** empty log message *** 1998-01-22 08:14:17 +00:00
Jim Meyering
ff59218d54 New file. Contains guts of old rm.c.
(remove_init): New function.
(remove_fini): New function.
1998-01-22 08:13:57 +00:00
Jim Meyering
1a18272561 Declare new global, backup_type.
(main): Initialize backup_type unconditionally.
(do_link): Call find_backup_file_name with new argument, backup_type.
1998-01-22 08:13:12 +00:00
Jim Meyering
2bdf8621d6 Declare new global, backup_type.
(main): Initialize backup_type unconditionally.
(copy_file): Call find_backup_file_name with new backup_type, argument.
1998-01-22 08:12:24 +00:00
Jim Meyering
758ab7a013 *** empty log message *** 1998-01-21 16:37:09 +00:00
Jim Meyering
734d1cccc3 (VALID_SPARSE_MODE): Define.
[struct cp_options] (backup_type): New member.
1998-01-21 16:16:00 +00:00
Jim Meyering
13de1036ac . 1998-01-21 15:59:28 +00:00
Jim Meyering
2167febcb1 Fix copyright 1998-01-21 15:57:48 +00:00
Jim Meyering
2c11b736aa Use ANSI function definitions.
Remove global declaration of backup_type.
(simple_backup_suffix): Default to `~', not `.orig'.
Use PARAMS, not __BACKUPFILE_P.
(find_backup_file_name): Add parameter, backup_type.
1998-01-21 15:57:18 +00:00
Jim Meyering
a52e0efbe2 Remove extern declaration of backup_type.
Use PARAMS, not __BACKUPFILE_P.
(VALID_BACKUP_TYPE): Define.
(find_backup_file_name): Adjust prototype.
1998-01-21 15:55:12 +00:00
Jim Meyering
4935348b67 Use ANSI function definitions. 1998-01-20 11:34:38 +00:00
Jim Meyering
e6a0306b1b [enum backup_type]: Set `none' to 1. 1998-01-20 11:34:04 +00:00
Jim Meyering
2bec121abb add `,' in comment 1998-01-19 09:29:27 +00:00
Jim Meyering
412043f1d8 . 1998-01-18 11:52:44 +00:00
Jim Meyering
4ffa362cc4 *** empty log message *** 1998-01-18 11:52:38 +00:00
Jim Meyering
35592ba64c (strncoll, strncoll_s2_readonly, look_for_fraction, numcompare):
Remove the `unsigned' from some `unsigned char*' parameter types.
Add casts via UCHAR where necessary to avoid problems with unwanted
sign extension.  Based on a patch from Kaveh Ghazi to appease Irix4's
cc compiler.
e.g.,
 > cc -DLOCALEDIR=\"/caip/u3/ghazi/foobar/share/locale\" -DHAVE_CONFIG_H
 >      -I.. -I../../src -I../../lib -I../intl -c ../../src/sort.c
 > accom: Error: ../../src/sort.c, line 500: prototype parameter 1 type
 >      must have all of the actual arguments qualifiers (except the
 >      outermost) and pointed-to types must be compatible (ANSI
 >      3.3.2.2,3.3.16.1)
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
 > accom: Error: ../../src/sort.c, line 500: Argument 1 Type Doesn't
 >      Match prototype description; prototype: pointer to const char is
 >      different from actual: pointer to unsigned char
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
 > accom: Error: ../../src/sort.c, line 500: prototype parameter 2 type
 >      must have all of the actual arguments qualifiers (except the
 >      outermost) and pointed-to types must be compatible (ANSI
 >      3.3.2.2,3.3.16.1)
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
 > accom: Error: ../../src/sort.c, line 500: Argument 2 Type Doesn't
 >      Match prototype description; prototype: pointer to const char is
 >      different from actual: pointer to unsigned char
 >              diff = strcoll (s1, s2);
 >        ----------------------------^
1998-01-18 11:51:08 +00:00
Jim Meyering
c1618a8c4c (next_file_name): Rewrite. This removes an artificial limit (albeit
already high, at INT_MAX :-) on the number of files split could create.
Reported by Ralf W. Stephan.
1998-01-18 11:18:08 +00:00
Jim Meyering
96be8bca99 Guard inclusion of langinfo.h also with HAVE_LANGINFO_H,
for Irix-4.0.5.  From Kaveh Ghazi.
1998-01-16 23:29:24 +00:00
Jim Meyering
b8a16a3f2a (mergefps): Add braces to avoid ambiguous `else' statement.
(nls_set_fraction): Likewise.
1998-01-16 23:23:04 +00:00
Jim Meyering
f1217e4976 . 1998-01-16 11:18:05 +00:00
Jim Meyering
62279c6e2d . 1998-01-16 11:17:02 +00:00
Jim Meyering
71545a6276 Make PARAMS-defining conditionals consistent. 1998-01-16 08:52:30 +00:00
Jim Meyering
53cfcbd19c Make PARAMS-defining conditionals consistent. 1998-01-16 08:51:39 +00:00
Jim Meyering
5618133eed (fail-0): Disable test. It depends on
sizeof(long) being 32 bits.  Reported by Kaveh Ghazi.
1998-01-16 08:04:19 +00:00
Jim Meyering
ade1f58e11 (print_header): Fix inode format header to line it up
with the rest of the output.
1998-01-14 08:52:56 +00:00
Jim Meyering
74cf3e8bab Set errno to ENOENT, not EINVAL. This is consistent
with most other implementations.
1998-01-13 10:08:11 +00:00
Jim Meyering
ca50e875af *** empty log message *** 1998-01-13 09:53:15 +00:00
Jim Meyering
a75ea1014e *** empty log message *** 1998-01-12 09:00:10 +00:00
Jim Meyering
98af2e9636 *** empty log message *** 1998-01-12 08:55:42 +00:00
Jim Meyering
68e5877403 *** empty log message *** 1998-01-12 08:55:01 +00:00
Jim Meyering
2b906615c2 *** empty log message *** 1998-01-12 08:53:18 +00:00
Jim Meyering
443f852f61 Include sys/param.h only #if HAVE_SYS_PARAM_H.
Move function-spanning `#if ...BSIZE' stmt to follow inclusion of
sys/param.h since BSIZE is sometimes defined in sys/param.h.
Based on a patch from Philippe De Muyter.
1998-01-12 08:13:39 +00:00
Jim Meyering
d1f4e617b5 *** empty log message *** 1998-01-11 09:24:17 +00:00
Jim Meyering
1aa070dd2e . 1998-01-11 09:14:29 +00:00
Jim Meyering
007e81132a . 1998-01-11 09:14:02 +00:00
Jim Meyering
6bcfff640e *** empty log message *** 1998-01-11 09:12:30 +00:00
Jim Meyering
aa2880362c . 1998-01-11 08:02:39 +00:00
Jim Meyering
88bd90109b *** empty log message *** 1998-01-10 22:13:49 +00:00
Jim Meyering
dba300a0d0 CHAR_BIT SCHAR_MAX UCHAR_MAX SHRT_MAX INT_MAX UINT_MAX LONG_MAX ULONG_MAX
Remove definitions of those symbols.
* src/csplit.c: Move inclusion of regex.h/rx.h to follow system.h
since it now includes limit.h which defines RE_DUP_MAX.
* src/nl.c: Likewise.
* src/tac.c: Likewise.
1998-01-10 22:12:03 +00:00
Jim Meyering
b9ed71e46e . 1998-01-10 20:53:56 +00:00
Jim Meyering
7bba3e945f initialize fail to 0 1998-01-10 16:25:46 +00:00
Jim Meyering
1bdfcabd2c . 1998-01-10 16:24:46 +00:00
Jim Meyering
c88a4c91da (EXTRA_DIST): Add const.m4. 1998-01-10 16:24:26 +00:00
Jim Meyering
136f2fd28c . 1998-01-10 15:57:57 +00:00
Jim Meyering
82739833a1 *** empty log message *** 1998-01-10 15:09:46 +00:00
Jim Meyering
1c5c2597b5 *** empty log message *** 1998-01-10 15:08:00 +00:00
Jim Meyering
eacbf12ea4 *** empty log message *** 1998-01-10 15:04:32 +00:00
Jim Meyering
0ccdf3419d (usage): Describe -D. 1998-01-10 15:03:58 +00:00
Jim Meyering
cec85a4b3a . 1998-01-10 14:25:27 +00:00
Jim Meyering
a077a7833c *** empty log message *** 1998-01-10 14:23:08 +00:00
Jim Meyering
a3094b0529 (batch_convert): Use memcpy when we don't need return value. 1998-01-10 14:21:35 +00:00
Jim Meyering
d73dd15544 . 1998-01-10 13:36:47 +00:00
Jim Meyering
27c1ad9576 *** empty log message *** 1998-01-10 13:36:09 +00:00
Jim Meyering
2eefbf7647 (usage): Correct descriptions of --sort, --time, and -t.
Suggestions from Andreas Schwab.
1998-01-10 12:53:09 +00:00
Jim Meyering
79d39ab7bf (decode_switches) [-u]: Fix bug whereby -u had no effect
without -l or -t.  Now, -u (like -c) implies --sort=time.
Suggestion from Andreas Schwab.
1998-01-10 12:07:50 +00:00
Jim Meyering
12782f54b0 *** empty log message *** 1998-01-10 11:56:26 +00:00
Jim Meyering
fff6de7b04 *** empty log message *** 1998-01-10 11:54:39 +00:00
Jim Meyering
cc76db2016 use sh-script test, not Test.pm framework 1998-01-10 11:27:24 +00:00
Jim Meyering
77c94909cf *** empty log message *** 1998-01-10 11:24:51 +00:00
Jim Meyering
3b8d19272d . 1998-01-10 11:00:46 +00:00
Jim Meyering
6099914170 *** empty log message *** 1998-01-10 10:36:41 +00:00
Jim Meyering
09d96ac539 (make_path): Reformat 3 if-stmts to test `if (newly_created_dir)' only once.
Suggestion from Andreas Schwab.
1998-01-10 10:28:37 +00:00
Jim Meyering
3edbca0e04 (make_path): Put only newly created directories on the LEADING_DIRS list. 1998-01-10 10:22:30 +00:00
Jim Meyering
c062a35803 *** empty log message *** 1998-01-08 23:17:20 +00:00
Jim Meyering
3da029a5d9 *** empty log message *** 1998-01-08 23:16:14 +00:00
Jim Meyering
de1dabf7d7 *** empty log message *** 1998-01-08 22:58:18 +00:00
Jim Meyering
03283b5000 (tac_stream): Don't perform arithmetic on now-void pointer
result of xrealloc (until recently it was char*).
1998-01-08 22:58:03 +00:00
Jim Meyering
9f5dc7e7d0 (inittables): Add && HAVE_NL_LANGINFO to the #if-test
guarding the nls month-checking code.
(nls_numeric_format): Remove unnecessary (and error-evoking w/SunOS' cc)
`unsigned' from dcls of text and lim.
(main): Cast lconvp->grouping to `unsigned char*' to appease SunOS's cc.
1998-01-08 22:56:45 +00:00
Jim Meyering
ab9cd27938 *** empty log message *** 1998-01-07 07:45:46 +00:00
Jim Meyering
c767a49741 *** empty log message *** 1998-01-06 23:53:50 +00:00
Jim Meyering
0fdd1b9130 Add %expect directive.
Move inclusion of getdate.h and dependent extern declarations down
so getdate.h's prototype follows the sometimes-enabled definition
of `const' to nothing.  Otherwise, the prototype wouldn't match
the definition because of the defined-away `const'.
(get_date): ANSI-fy definition.
From Kaveh Ghazi.
1998-01-06 23:53:33 +00:00
Jim Meyering
f19ca6fe29 *** empty log message *** 1998-01-05 17:43:31 +00:00
Jim Meyering
6cc3cf776c (df_readable): New function.
(show_dev): If a value consists entirely of 1 bits, or is derived
from some other value that consists entirely of 1 bits, report "-".
Check inode and block counts more carefully for plausibility,
to avoid arithmetic overflow when computing percentages.
1998-01-05 17:43:00 +00:00
Jim Meyering
e162abfc5b (get_fs_usage): Add parens. 1998-01-05 17:38:38 +00:00
Jim Meyering
866773c72a (PROPAGATE_ALL_ONES): New macro.
(get_fs_usage): If a value consists entirely of 1 bits,
propagate this info to the output by setting it to (uintmax_t) -1.
1998-01-05 17:33:54 +00:00
Jim Meyering
06bab849fc reindent a little 1998-01-05 10:11:08 +00:00
Jim Meyering
ed0becde29 reformat comment, dcl fail, dirname 1998-01-05 10:09:24 +00:00
Jim Meyering
8d64a37a77 remove SPECIAL_BITS #ifdefs 1998-01-05 10:06:41 +00:00
Jim Meyering
0520188821 Add support for marty's -D option 1998-01-05 10:06:07 +00:00
Jim Meyering
05d9a7233b *** empty log message *** 1998-01-04 23:28:28 +00:00
Jim Meyering
f664e44a2f *** empty log message *** 1998-01-04 23:27:12 +00:00
Jim Meyering
5705eaaee2 . 1998-01-04 22:54:19 +00:00
Jim Meyering
0e69432852 . 1998-01-04 22:46:40 +00:00
Jim Meyering
2d69426882 copyright 1998-01-04 22:46:23 +00:00
Jim Meyering
5d4f8ebdfd (main, usage): Check for write error to stdout before exiting.
Include "closeout.h".
1998-01-04 22:45:28 +00:00
Jim Meyering
b246280c27 (parse_long_options): Check for write error to stdout before exiting. 1998-01-04 22:43:44 +00:00
Jim Meyering
60e021ee4e (libfu_a_SOURCES): Add closeout.c.
(noinst_HEADERS): Add closeout.h.
1998-01-04 22:42:38 +00:00
Jim Meyering
63c0f480ad Use a single enumerated type, Verbosity, instead of
the two booleans, verbose and changes_only.  This fixes a bug whereby
--change had the same effect as --verbose.
Plus Paul's close_stdout changes.
1998-01-04 22:41:02 +00:00
Jim Meyering
e375f4e9c8 Use a single enumerated type, Verbosity, instead of
the two booleans, verbose and changes_only.  This fixes a bug whereby
--change had the same effect as --verbose.
1998-01-04 22:40:27 +00:00
Jim Meyering
109b9c5f94 . 1998-01-04 21:48:30 +00:00
Jim Meyering
126c1a40e5 . 1998-01-04 21:47:31 +00:00
Jim Meyering
2440fd8bac . 1998-01-03 22:53:52 +00:00
Jim Meyering
98b9c4bed7 . 1998-01-03 22:16:23 +00:00
Jim Meyering
40f708f534 . 1998-01-03 22:14:58 +00:00
Jim Meyering
ebc5dc0b0c *** empty log message *** 1998-01-03 22:13:53 +00:00
Jim Meyering
e0ed4e6a77 *** empty log message *** 1998-01-03 18:10:47 +00:00
Jim Meyering
c24393e0fd *** empty log message *** 1998-01-03 18:09:23 +00:00
Jim Meyering
e15db4ca81 *** empty log message *** 1998-01-03 16:47:35 +00:00
Jim Meyering
1059e96721 (show_dev): Treat `fsu.fsu_bavail == (unsigned long) -1'
just like `fsu.fsu_blocks == 0' as an indicator that usage information
is invalid.  This happens with Solaris-5.5.1 CD-ROM partitions.
1998-01-03 16:47:21 +00:00
Jim Meyering
234ea05171 *** empty log message *** 1998-01-03 14:40:33 +00:00
Jim Meyering
0fa007e352 *** empty log message *** 1998-01-03 12:03:01 +00:00
Jim Meyering
9e6b379dbf *** empty log message *** 1998-01-03 11:58:49 +00:00
Jim Meyering
d46bab3a59 Guard PARAMS-enabling definition with
`defined PROTOTYPES || (defined __STDC__ && __STDC__)' to be consistent.
1998-01-03 11:56:58 +00:00
Jim Meyering
541699c01c Guard PARAMS-enabling definition with
`defined PROTOTYPES || (defined __STDC__ && __STDC__)' to avoid
problems with Irix4's cc.  From Kaveh Ghazi.
1998-01-03 11:56:09 +00:00
Jim Meyering
23a8ea7992 *** empty log message *** 1998-01-02 23:18:08 +00:00
Jim Meyering
6b4321fd1b *** empty log message *** 1998-01-02 23:16:53 +00:00
Jim Meyering
2fb86e2eb8 (get_ids): When otherwise unspecified, set uid and gid to -1. 1998-01-02 23:16:38 +00:00
Jim Meyering
53bc7b04cb (make_path): Try to change ownership only if we've just created the
directory.  Fix latent bug (s/&&/||/ in two places -- also, note that
it could not be exercised via install or mkdir) whereby chown would
not be invoked when only one of owner/group is not -1.
1998-01-02 23:15:39 +00:00
Jim Meyering
43c2a5f62b *** empty log message *** 1998-01-01 21:33:29 +00:00
Jim Meyering
b3d19ee824 (remove_cwd_entries): Initialize the entry-name obstack
only once and never free it.
1998-01-01 21:32:46 +00:00
Jim Meyering
2c2fa642c4 (show_dev): Move check for 0-block device (and return if
not e.g., -a) back up to precede first print stmt.
1998-01-01 21:30:00 +00:00
Jim Meyering
cb5e8a14c2 *** empty log message *** 1998-01-01 19:45:43 +00:00
Jim Meyering
48221eb8bd *** empty log message *** 1998-01-01 19:44:02 +00:00
Jim Meyering
3e6934d53e *** empty log message *** 1998-01-01 19:41:47 +00:00
Jim Meyering
741e2bd94b *** empty log message *** 1998-01-01 19:36:19 +00:00
Jim Meyering
0327bae400 *** empty log message *** 1997-12-31 21:36:14 +00:00
Jim Meyering
e3d35f6789 (show_dev): Print inode counts human readably. 1997-12-31 21:34:07 +00:00
Jim Meyering
b76a453304 (decode_switches): -h and -H override output units.
(print_dir, gobble_file, print_long_format,
print_file_name_and_frills): Print disk allocations human readably.
1997-12-31 21:33:51 +00:00
Jim Meyering
069e564d89 . 1997-12-31 14:28:44 +00:00
Jim Meyering
cadfe29978 *** empty log message *** 1997-12-31 14:04:54 +00:00
Jim Meyering
da111683d5 (show_dev): Move computation of
blocks_used etc. and blocks_percent_used,
inodes_used etc. and inodes_percent_used into respective branches
of the `if (inode_format)' statement where they're actually used.
1997-12-31 14:04:20 +00:00
Jim Meyering
57da248b85 *** empty log message *** 1997-12-31 11:01:48 +00:00
Jim Meyering
b66148ba39 Define and use PARAMS, not __EXCLUDE_P. 1997-12-31 11:01:35 +00:00
Jim Meyering
86d2f9eaa8 Use PARAMS, not __EXCLUDE_P. 1997-12-31 11:01:18 +00:00
Jim Meyering
25e06fece0 (usage): s/TAB/ /g 1997-12-29 22:09:28 +00:00
Jim Meyering
d1de57abbc *** empty log message *** 1997-12-29 21:29:51 +00:00
Jim Meyering
5cc8090de2 (remove_cwd_entries): Plug a gross leak -- don't call
obstack_init inside the loop.
1997-12-29 21:04:26 +00:00
Jim Meyering
e2ed51f99e *** empty log message *** 1997-12-29 12:06:02 +00:00
Jim Meyering
134ed86e33 (usage): Replace TABs with spaces in --help message. 1997-12-29 12:05:36 +00:00
Jim Meyering
f7d4fc0e38 (invalid_arg): Use a single fprintf and whole
format statements to ease translation.
Convert from K&R to ANSI function dcls.
1997-12-29 12:02:43 +00:00
Jim Meyering
3531b69552 . 1997-12-28 21:49:54 +00:00
Jim Meyering
ce9923ab87 Use ANSI syntax, not K&R. 1997-12-28 10:41:01 +00:00
Jim Meyering
6d02c37081 *** empty log message *** 1997-12-28 10:38:30 +00:00
Jim Meyering
b2e7f8b0af (make_path) [!__STDC__]: Remove K&R-style definition. 1997-12-28 10:38:15 +00:00
Jim Meyering
08c3f260a1 define PARAMS 1997-12-28 09:48:26 +00:00
Jim Meyering
cde7e42dde Add PARAMS. 1997-12-28 08:04:08 +00:00
Jim Meyering
4656a7e55b Remove incorrect declaration of group_member.
Include group-member.h instead.
Based on suggestion from Ulrich Drepper.
1997-12-28 08:03:54 +00:00
Jim Meyering
3513f31730 *** empty log message *** 1997-12-27 23:55:40 +00:00
Jim Meyering
1bcedd2345 *** empty log message *** 1997-12-27 23:55:18 +00:00
Jim Meyering
456d579624 . 1997-12-25 23:06:12 +00:00
Jim Meyering
c02b9b75c6 new version from kb 1997-12-25 18:00:21 +00:00
Jim Meyering
012a6455ea . 1997-12-25 17:51:15 +00:00
Jim Meyering
bb48c492c6 (_GNU_SOURCE): Define only if not already defined. 1997-12-25 17:44:08 +00:00
Jim Meyering
1a952f8145 . 1997-12-25 17:43:21 +00:00
Jim Meyering
2bb1686d0c . 1997-12-25 17:05:45 +00:00
Jim Meyering
1f1ea6519b (get_ids): Don't cast GID_T_MAX to long, it might overflow. 1997-12-25 17:05:23 +00:00
Jim Meyering
f10648f6c7 (skip): Compare lseek return value with -1 to allow it
to be negative as signed value.
1997-12-25 17:04:15 +00:00
Jim Meyering
d9f1fd86d9 Declare stpcpy only if not defined as macro. 1997-12-25 17:02:25 +00:00
Jim Meyering
ea0f644cdd (S_ISLNK): Define this instead of S_ISDIR. 1997-12-25 17:01:35 +00:00
Jim Meyering
4f71c21910 Declare stpcpy only if not defined as macro. 1997-12-25 17:01:13 +00:00
Jim Meyering
9897ca0150 Declare stpcpy only if not defined as macro. 1997-12-25 16:49:08 +00:00
Jim Meyering
1a8e1f7bfd Include <string.h> if available. 1997-12-25 16:48:51 +00:00
Jim Meyering
c9f538deb9 (copy_internal): Use S_ISLNK only if defined. 1997-12-25 16:48:29 +00:00
Jim Meyering
88df9ef6f6 . 1997-12-24 13:16:54 +00:00
Jim Meyering
46e9b477a9 *** empty log message *** 1997-12-21 22:48:24 +00:00
Jim Meyering
82e77237a6 . 1997-12-21 22:48:08 +00:00
Jim Meyering
f54368ec1b s/__P/PARAMS/ 1997-12-21 22:39:53 +00:00
Jim Meyering
44dddb31c0 *** empty log message *** 1997-12-21 22:32:44 +00:00
Jim Meyering
2e308957d4 s/__P/PARAMS/ 1997-12-21 22:30:30 +00:00
Jim Meyering
2391251527 Don't include limits.h. 1997-12-21 22:22:04 +00:00
Jim Meyering
3858d01133 Don't include limits.h. 1997-12-21 22:21:26 +00:00
Jim Meyering
62fed0f3a2 Don't include limits.h or sys/param.h. 1997-12-21 22:21:10 +00:00
Jim Meyering
37998fc5bd Don't include limits.h.
These are all done in system.h now.
1997-12-21 22:20:17 +00:00
Jim Meyering
6123a88852 Don't include limits.h.
(UINT_MAX): Don't define.
(INT_MAX): Don't define.
These are all done in system.h now.
1997-12-21 22:20:01 +00:00
Jim Meyering
3d0e13a00d . 1997-12-21 12:29:32 +00:00
Jim Meyering
2f606bcf56 *** empty log message *** 1997-12-21 12:18:05 +00:00
Jim Meyering
1ed365fb82 Use PARAMS, not __P. 1997-12-21 12:17:26 +00:00
Jim Meyering
2b2fb0cf91 *** empty log message *** 1997-12-21 12:11:32 +00:00
Jim Meyering
76d9ec0ad0 increment serial number 1997-12-21 12:11:17 +00:00
Jim Meyering
32068e5812 increment serial number 1997-12-21 12:10:55 +00:00
Jim Meyering
90d217b19a increment serial number 1997-12-21 12:10:26 +00:00
Jim Meyering
726c48d02f Fix reversed types on -1 args to chown.
From Kaveh Ghazi.
1997-12-21 12:10:07 +00:00
Jim Meyering
1af374e6a4 . 1997-12-21 12:06:03 +00:00
Jim Meyering
9ef99e168b *** empty log message *** 1997-12-21 12:05:56 +00:00
Jim Meyering
bdcaa361bc Include exclude.h.
(exclude): New static var.
(long_options, usage, main): Add --exclude and --exclude-from or -X.
(count_entry): Skip excluded entries.
1997-12-21 12:05:42 +00:00
Jim Meyering
a1003f154f remove FIXME-describe comments 1997-12-21 11:57:17 +00:00
Jim Meyering
3ba71d6de1 add FIXME-describe comments 1997-12-21 11:56:34 +00:00
Jim Meyering
ac5fc8ea73 Include exclude.h.
(exclude): New static var.
(long_options, usage, main): Add --exclude and --exclude-from or -X.
(count_entry): Skip excluded entries.
1997-12-21 11:47:27 +00:00
Jim Meyering
a3e0b4392c (libfu_a_SOURCES): Add exclude.c.
(noinst_HEADERS): Add exclude.h.
1997-12-21 11:46:49 +00:00
Jim Meyering
cbd71d8eea . 1997-12-21 11:43:34 +00:00
Jim Meyering
a2c7ebd49c . 1997-12-21 11:24:53 +00:00
Jim Meyering
727298f3f5 Use PARAMS, not __P. 1997-12-21 11:22:51 +00:00
Jim Meyering
27d24b46ad (rpl_chown): Rename from chown.
Undefine chown just after including config.h.
Include sys/stat.h.
Use correct ordering of uid and gid parameters both in function
definition and in call to chown.
With patches from Kaveh Ghazi.
1997-12-21 11:17:20 +00:00
Jim Meyering
a2f0f9ac89 s/__P/PARAMS/g 1997-12-16 15:44:00 +00:00
Jim Meyering
ece81e9e4a *** empty log message *** 1997-12-16 15:43:01 +00:00
Jim Meyering
70618de21b s/__P/PARAMS/g. 1997-12-16 15:42:48 +00:00
Jim Meyering
589a3c2872 *** empty log message *** 1997-12-16 15:33:33 +00:00
Jim Meyering
03f9f3dbec s/__P/PARAMS/g 1997-12-16 15:32:32 +00:00
Jim Meyering
fc22546441 . 1997-12-16 15:16:20 +00:00
Jim Meyering
08b3d2975e *** empty log message *** 1997-12-16 15:13:06 +00:00
Jim Meyering
5d764734f7 tweak indentation 1997-12-16 15:11:23 +00:00
Jim Meyering
36665a7464 (struct bin_str): Make len int, not unsigned, to avoid
bogus comparison < 0.
(quote_filename): Add forward decl.
(decode_switches): -b, -e, -N, -Q are now mutually exclusive.
(print_dir): Quote directory name as per quoting options.
(print_long_format): Don't count color changes as part of file name.
(quote_filename): Revamp interface: now accepts stream to output to
and filename, and returns length of quoted filename.
This removes duplicated code and should make errors less likely.
Also, no longer mallocs storage.  All callers changed.
Don't quote ' ' if -Q.
(OUTCHAR): New macro.
(SAVECHAR, SAVE_2_CHARS): Remove.
(print_name_with_quoting): New stack arg.  All callers changed.
(print_color_indicator): Cast ext len to size_t to avoid warning
with GCC 2.8.
(length_of_file_name_and_frills): Rewrite to use quote_filename.
This fixes bug when computing file name length with -e.
1997-12-14  Paul Eggert  <eggert@twinsun.com>
Add shell style quoting, and make it the default.
* NEWS, doc/fileutils.texi: Describe -e, which is now the default.
Describe change to --dired output.
* src/ls.c (quote_shell): New var.
(long_options, decode_switches, usage): New option -e or --quote-shell.
(dired_dump_obstack): New arg STYLE.
(main): Pass quoting style to dired_dump_obstack.
(decode_switches): -N now clears quote_as_string.
(quote_filename): Add shell style quoting.
1997-12-16 15:09:19 +00:00
Jim Meyering
1ca40285b2 (deep): Remove `find > k' debugging remnant. 1997-12-15 11:35:22 +00:00
Jim Meyering
ce939d6f44 Make sure we get diagnostics in English. 1997-12-14 21:51:44 +00:00
Jim Meyering
f126c8d3a1 Remove lseek and memchr dcls. 1997-12-14 16:28:18 +00:00
Jim Meyering
970ffd8520 *** empty log message *** 1997-12-14 16:28:06 +00:00
Jim Meyering
7dcb361c82 *** empty log message *** 1997-12-14 16:25:06 +00:00
Jim Meyering
5867abf11e *** empty log message *** 1997-12-14 15:38:18 +00:00
Jim Meyering
9afbb6eec6 (ASSIGN_STRDUPA): Cast alloca return value to char*. 1997-12-14 15:38:04 +00:00
Jim Meyering
ef938e62d0 s/HAVE_DECLARATION_/HAVE_DECL_/. 1997-12-14 15:15:07 +00:00
Jim Meyering
e68f7b2e4b cast memcpy to char* 1997-12-14 15:12:29 +00:00
Jim Meyering
b1bd801e94 Add #serial 1. 1997-12-14 15:03:38 +00:00
Jim Meyering
56b3459d40 add memchr dcl 1997-12-14 14:00:15 +00:00
Jim Meyering
f684c873f7 s/HAVE_DECLARATION/HAVE_DECL_/g 1997-12-14 12:40:33 +00:00
Jim Meyering
7c474bb76f add lseek 1997-12-14 12:03:55 +00:00
Jim Meyering
31c36865e5 *** empty log message *** 1997-12-14 12:03:38 +00:00
Jim Meyering
a6c30b90a3 *** empty log message *** 1997-12-14 08:03:18 +00:00
Jim Meyering
386843fd25 s/DECLARATION_/DECL_/g.
Add memchr.
1997-12-14 08:03:07 +00:00
Jim Meyering
457d8d9aef *** empty log message *** 1997-12-14 07:44:38 +00:00
Jim Meyering
15f5e27eaf s/HAVE_DECLARATION_/HAVE_DECL_/g 1997-12-14 07:40:32 +00:00
Jim Meyering
1ac1f811f6 *** empty log message *** 1997-12-13 23:42:54 +00:00
Jim Meyering
b86f6c2308 (main): Add some braces.
Check return code from fclose of each input file.
Close stdout and check for errors.
1997-12-13 23:39:09 +00:00
Jim Meyering
444c6da144 (close_output_file): Check ferror before calling fclose.
(main): Close stdout and check for errors.
1997-12-13 23:38:53 +00:00
Jim Meyering
84a050b56f . 1997-12-13 22:56:50 +00:00
Jim Meyering
b5697888a0 . 1997-12-13 22:55:52 +00:00
Jim Meyering
8f38e99480 . 1997-12-13 22:54:01 +00:00
Jim Meyering
f977e4b5cf Change --help output to tell the truth: that for of=FILE,
FILE *is* truncated.  Reported by Miles Bader.
Remove incomplete, usage-like comment at top of file.
1997-12-13 22:49:33 +00:00
Jim Meyering
d75ca19d76 (usage): Mention that `notrunc' is a conv= option.
Reported by Miles Bader.
1997-12-13 17:01:54 +00:00
Jim Meyering
587a9df786 . 1997-12-13 16:23:06 +00:00
Jim Meyering
295372322d (do_move): If rename fails for any reason (not just when
errno == EXDEV), then revert to trying copy-then-unlink.  This is
necessary to allow moving files within certain types of Linux NFS
mounted filesystems.  Reported by Marty Leisner.
1997-12-13 16:22:58 +00:00
Jim Meyering
b2959537e6 *** empty log message *** 1997-12-13 16:13:34 +00:00
Jim Meyering
39546ad7d7 *** empty log message *** 1997-12-11 18:18:22 +00:00
Jim Meyering
322f7b0971 . 1997-12-11 08:40:21 +00:00
Jim Meyering
a320eee158 (do_link): Don't require --force when target exists and
using --backup.  This changes makes ln consistent with cp and mv in
this respect.  Suggestion from Eli Zaretskii.
1997-12-11 08:40:10 +00:00
Jim Meyering
603137e2ab *** empty log message *** 1997-12-10 11:17:16 +00:00
Jim Meyering
4f242b4d51 use NULL, '\0' instead of zeroes 1997-12-10 10:31:25 +00:00
Jim Meyering
3cd84da3a6 (main): Make sure pw->pw_shell is non-NULL before trying to strdup it.
Patch from Dick Streefland.
1997-12-10 10:25:46 +00:00
Jim Meyering
92f0098844 . 1997-12-06 21:18:14 +00:00
Jim Meyering
45ef6ccef8 . 1997-12-06 21:16:57 +00:00
Jim Meyering
20e1875a32 revert last change 1997-12-06 21:09:58 +00:00
Jim Meyering
b73786146f use SORT_INITIAL_LINE_LENGTH envvar for testing 1997-12-06 21:09:30 +00:00
Jim Meyering
a587b015d0 *** empty log message *** 1997-12-06 21:08:41 +00:00
Jim Meyering
a353313b22 *** empty log message *** 1997-12-06 18:23:51 +00:00
Jim Meyering
7209272d72 . 1997-12-06 13:42:21 +00:00
Jim Meyering
6ee3c1a91a (fillbuf): split longer-than-80-char line 1997-12-06 12:13:52 +00:00
Jim Meyering
9f50126a03 . 1997-12-06 09:20:26 +00:00
Jim Meyering
5d1987b3da . 1997-12-06 09:18:32 +00:00
Jim Meyering
04c29cd1db Separate struct dcl and typedef.
(String *): Rename from parameter-shadowed `string'.
(stringstruct): Remove typedef.
1997-12-06 08:57:14 +00:00
Jim Meyering
d91c95fda0 (re_compile_fastmap): Remove dcl of unused num_regs. 1997-12-06 08:27:25 +00:00
Jim Meyering
8f1aea2bc0 *** empty log message *** 1997-11-30 15:17:48 +00:00
Jim Meyering
ad7eabb3b3 . 1997-11-30 15:14:10 +00:00
Jim Meyering
468e83a183 *** empty log message *** 1997-11-30 14:22:56 +00:00
Jim Meyering
66fbc2c8f6 (savedir): Revert last change. malloc always
works when called with zero, because we use the wrapper if the
system version is lacking.
1997-11-30 14:20:17 +00:00
Jim Meyering
2807179898 *** empty log message *** 1997-11-30 13:44:02 +00:00
Jim Meyering
216037574d *** empty log message *** 1997-11-30 13:43:36 +00:00
Jim Meyering
4f670edacc *** empty log message *** 1997-11-30 13:37:44 +00:00
Jim Meyering
5c3d73a99b (EXTRA_DIST): Add inttypes_h.m4 and uintmax_t.m4. 1997-11-30 13:35:45 +00:00
Jim Meyering
d29ca45595 . 1997-11-30 13:35:35 +00:00
Jim Meyering
9e2eec1ca9 *** empty log message *** 1997-11-30 13:35:25 +00:00
Jim Meyering
e0da3d8d39 filter through cppi 1997-11-30 11:17:28 +00:00
Jim Meyering
3f7e011ab0 remove trailing blank 1997-11-30 11:16:14 +00:00
Jim Meyering
bca6f1740d remove trailing blank 1997-11-30 11:15:27 +00:00
Jim Meyering
d7d6efb0d7 remove trailing blank 1997-11-30 11:15:02 +00:00
Jim Meyering
3203b1d69c *** empty log message *** 1997-11-30 11:13:34 +00:00
Jim Meyering
fbe1ba7079 . 1997-11-30 11:13:18 +00:00
Jim Meyering
00c42a8936 (human_readable): Convert to ANSI-style definition.
[lint]: Define `power'.
1997-11-30 11:10:24 +00:00
Jim Meyering
5320bf5037 filter through cppi 1997-11-30 11:08:39 +00:00
Jim Meyering
79111711fe . 1997-11-30 11:08:23 +00:00
Jim Meyering
f7acc655f4 (print_long_format): Rename inner-scoped buf' arrays to hbuf'
to avoid shadowing local.
1997-11-30 11:07:49 +00:00
Jim Meyering
e5781fe090 (change_dir_owner): Cast st_size arg to unsigned int in savedir call. 1997-11-30 11:05:34 +00:00
Jim Meyering
a10fdc591f (change_dir_mode): Cast st_size arg to unsigned int in savedir call. 1997-11-30 11:05:10 +00:00
Jim Meyering
f7ecccf234 (full_filename): Use memcpy, not mempcpy when not using the return value. 1997-11-30 11:02:47 +00:00
Jim Meyering
5112b2973f filter through cppi 1997-11-30 11:01:54 +00:00
Jim Meyering
10aa5f6fd7 (<limits.h>): Include if HAVE_LIMITS_H.
(CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_MAX, UINT_MAX):
New macros.
(ST_NBLOCKS): Now counts actual blocks, not 512-byte blocks.
(ST_NBLOCKSIZE): New macro.
1997-11-30 10:25:21 +00:00
Jim Meyering
9c59f1dcc4 (<inttypes.h>): Include if HAVE_INTTYPES_H.
("human.h"): Include.
(<limits.h>): Don't include; system.h does it now.
(INT_MAX): Remove.
(longdiff): Remove bogus definition that uses subtraction;
it gives the wrong answer when overflows occur.
(convert_blocks): Remove.
(output_units): New variable;
replaces booleans kilobyte_blocks and megabyte_blocks.
(human_readable_base): New variable.
(long_options, usage): Add -h or --human-readable and -H or --si.
(decode_switches): Adjust to renamed option variables.
Use -H if BLOCKSIZE is SI.  Add -h, -H.
(print_dir): Count blocks using uintmax_t, not int.
(gobble_file): Now returns uintmax_t, not int.
Don't convert blocks to 512 byte units, as this might overflow;
let caller handle the problem.  Deduce what caller will print
by invoking human_readable.
(print_long_format, print_file_name_and_frills): Don't assume
inode number, block count, file size fit in unsigned long.
Use human_readable to do block count conversion and to print
file sizes.
(prep_non_filename_text): Print decimal string for time if
localtime fails due to enormous time_t.
1997-11-30 10:25:16 +00:00
Jim Meyering
d08a2b63dc (BITSPERBYTE): Remove.
(UID_T_MAX, GID_T_MAX): Define in terms of TYPE_MAXIMUM.
1997-11-30 10:25:11 +00:00
Jim Meyering
6ed8115087 (<inttypes.h>): Include if HAVE_INTTYPES_H.
("human.h"): Include.
(LONGEST_HUMAN_READABLE, enum Output_units): Remove.
(count_entry): Now returns uintmax_t, not long.
(human_readable_base): Renamed from opt_human_readable; value is now
zero or positive integer, not just zero or nonzero.
(output_units): Now an integer giving output size.
(tot_size): Now uintmax_t, not long.
(long_options, usage): Add --si or -H.
(main): Adjust to renamed option variables.
Use -H if BLOCKSIZE is SI.  Add -H.
(human_readable): Remove; rewritten and now in lib/human.c.
(print_size): Rewrite in terms of human_readable.
Accept extra arg to be printed after size; all callers changed.
1997-11-30 10:25:07 +00:00
Jim Meyering
76916942ca (<inttypes.h>): Include if HAVE_INTTYPES_H.
("human.h"): Include.
(LONGEST_HUMAN_READABLE_1K_BYTE_BLOCKS): Remove.
(human_readable_base): Renamed from human_blocks; value is now
zero or positive integer, not just zero or nonzero.
(output_units): New variable;
replaces booleans kilobyte_blocks and megabyte_blocks.
(long_options): Add --si or -H.
(print_header): Adjust to renamed option variables.
(human_readable_1k_blocks): Remove.
(show_dev): Count blocks using uintmax_t, not long.
Calculate percentages using double, not long; this still isn't
perfect as it suffers double rounding, but it's more likely to
round correctly in practice than using long did.
Adjust to renamed option variables.
Use new human_readable library function to format uintmax_t values.
(usage): Add -H, --si.
(main): Adjust to renamed option variables.
Use -H if BLOCKSIZE is SI.  Add -H.
1997-11-30 10:25:02 +00:00
Jim Meyering
72bc3b818f (<inttypes.h>): Include if HAVE_INTTYPES_H.
("human.h"): Include.
(input_blocksize, output_blocksize, conversion_blocksize):
Now size_t instead of long.  0 means unset.
(skip_records, seek_record, max_records): Now uintmax_t, not long.
(w_partial, w_full, r_partial, r_full, r_truncate):
Now uintmax_t instead of unsigned.
(print_stats): Print counts as uintmax_t, not unsigned.
(main, skip): Check for overflow when computing file offsets.
(skip): Records count arg is uintmax_t, not long; blocksize arg is
size_t, not long.  Try lseek even on non regular files, as per comment.
(oc, col): Now size_t, not int.
(copy): No need to check max_records >= 0 any more, as the
default value is now effectively infinity.
Cast lseek arg to off_t.
(copy, copy_with_block): conversion_blocksize - col can never
be negative now, since it's unsigned, so rewrite loops to
avoid problems with unsigned.
(scanargs): Parse numeric args using uintmax_t, not int.
Check for overflow when converting block size args to size_t.
Blocksize options are now unsigned, and are now 0 when not set yet.
(parse_integer): Return uintmax_t, not int; accept new int * arg
to store error indicator, since all returned values are now valid.
Check for overflow when scanning integer.
1997-11-30 10:24:58 +00:00
Jim Meyering
a5fe3a240b (<inttypes.h>): Include if HAVE_INTTYPES_H.
(hash_insert2): Cast inode number to uintmax_t; this prevents
negative remainders if the inode number is negative and ino_t
is longer than unsigned.
1997-11-30 10:24:54 +00:00
Jim Meyering
b8c474191a (copy_reg): Store file size as off_t, not long.
Do not assume st_size has been normalized to 512 byte blocks,
or that it fits in size_t after dividing by the blocksize.
1997-11-30 10:24:50 +00:00
Jim Meyering
0f411474da (<limits.h>, UINT_MAX, UINT_MAX): Remove; now
done by system.h.
1997-11-30 10:24:45 +00:00
Jim Meyering
dcd4c05dfa (savedir): Check for size zero before invoking
malloc; this can occur if st_size arg overflows on conversion to
unsigned int.  All callers now cast st_size arg to unsigned int.
1997-11-30 10:24:41 +00:00
Jim Meyering
07783bcdf0 (getuidbyname, getgidbyname): Names can now
be NULL in cache.  This change merely fixes ifdeffed-out code.
1997-11-30 10:24:38 +00:00
Jim Meyering
240cb49efe New file. The interface is inspired
by the human_readable function that was in du.c, but it's pretty
much rewritten from scratch.
1997-11-30 10:24:32 +00:00
Jim Meyering
412d0aba50 (struct fs_usage): New member fsu_blocksize.
Other members are now uintmax_t, not long.
1997-11-30 10:24:28 +00:00
Jim Meyering
25fabf3d2d Do all calculations using uintmax_t.
Include <inttypes.h> if available.
(adjust_blocks, CONVERT_BLOCKS): Remove.
(get_fs_usage): Set new member fsu_blocksize, and do not convert
numbers to 512-byte block units; this avoids overflow here.
Cast lseek arg to off_t, not long.
1997-11-30 10:24:24 +00:00
Jim Meyering
f633782aa1 (st_blocks): long -> off_t.
Avoid arithmetic overflow when size is near max.
Depend on _POSIX_SOURCE and BSIZE, not _POSIX_VERSION, for
compatibility with system.h.
(BSIZE): Remove definition, since if BSIZE is not defined
we're never invoked.
1997-11-30 10:24:20 +00:00
Jim Meyering
ce43e130bb (libfu_a_SOURCES): Add new file human.c.
(noinst_HEADERS): Add new file human.h.
1997-11-30 10:24:16 +00:00
Jim Meyering
8754a488e0 . 1997-11-30 08:32:44 +00:00
Jim Meyering
75a5b970b3 (mempcpy): remove static inline function 1997-11-30 07:34:12 +00:00
Jim Meyering
e08f95ef54 . 1997-11-29 18:05:14 +00:00
Jim Meyering
4eac40b0e5 *** empty log message *** 1997-11-24 14:25:52 +00:00
Jim Meyering
04712f52ad also test for stdlib.h
don't use STDC_HEADERS in ifdef for stdlib.h
1997-11-24 14:21:16 +00:00
Jim Meyering
c781b840f2 move big chunk of defs to sys2 1997-11-24 14:19:32 +00:00
Jim Meyering
d8415fe94f *** empty log message *** 1997-11-24 12:57:50 +00:00
Jim Meyering
9928e82eac *** empty log message *** 1997-11-24 12:53:29 +00:00
Jim Meyering
49803907f5 . 1997-11-19 18:59:48 +00:00
Jim Meyering
4c3aa5cba3 (hash_pjw): Don't use ANSI `U' suffix. Cast instead. 1997-11-19 18:59:02 +00:00
Jim Meyering
c04cb4522a add PARAMS around prototype lists 1997-11-19 18:57:40 +00:00
Jim Meyering
f62113bea3 . 1997-11-19 18:55:53 +00:00
Jim Meyering
d92a618daf revert a mempcpy to memcpy 1997-11-19 18:55:31 +00:00
Jim Meyering
1110f5f335 (AUTOMAKE_OPTIONS): Use ansi2knr so *I* don't
have to convert my hash package to use k&r C.
1997-11-19 15:04:15 +00:00
Jim Meyering
68c59ca300 *** empty log message *** 1997-11-18 03:47:06 +00:00
Jim Meyering
65eb6ca593 *** empty log message *** 1997-11-18 03:32:19 +00:00
Jim Meyering
9ed80c0140 (_REENTRANT): #define, as some hosts need this to declare localtime_r properly.
From Paul Eggert.
1997-11-18 03:32:00 +00:00
Jim Meyering
6106d5a733 . 1997-11-18 03:29:24 +00:00
Jim Meyering
59b9b24bad undef putenv 1997-11-17 15:45:19 +00:00
Jim Meyering
f1b490166e add jm_ prefix to use of am_cv_func_working_mktime
increment serial #
1997-11-17 15:13:41 +00:00
Jim Meyering
3c94a67faa . 1997-11-16 15:28:23 +00:00
Jim Meyering
434a17cc05 . 1997-11-16 15:27:52 +00:00
Jim Meyering
aa96253ae1 . 1997-11-15 19:58:19 +00:00
Jim Meyering
87cff95abc . 1997-11-15 19:54:47 +00:00
Jim Meyering
4da60d3e2c *** empty log message *** 1997-11-15 19:51:16 +00:00
Jim Meyering
fec9572013 include unistd.h 1997-11-15 19:43:06 +00:00
Jim Meyering
1076c92f8d . 1997-11-15 17:19:48 +00:00
Jim Meyering
8def3e3ec1 remove fixup_null_alloc prototype 1997-11-15 17:18:01 +00:00
Jim Meyering
83ef9b531a (EXTRA_DIST): Add mktime.m4. 1997-11-15 17:14:10 +00:00
Jim Meyering
f9d9d1cbb4 . 1997-11-15 17:13:23 +00:00
Jim Meyering
31c1d2ed3d *** empty log message *** 1997-11-15 17:13:20 +00:00
Jim Meyering
e66833e32e Require jm_AM_FUNC_MKTIME, not the one from automake. 1997-11-15 17:13:02 +00:00
Jim Meyering
e6186db39f (mempcpy): Remove definition. 1997-11-15 17:09:34 +00:00
Jim Meyering
ae2984e8ca . 1997-11-15 17:08:32 +00:00
Jim Meyering
ed5048e229 Check for %F format.
Add comments.
1997-11-15 13:17:15 +00:00
Jim Meyering
e84c69c6cf (bigtime_test): New function from Paul Eggert to detect SunOS4.1.4's
infinite looping mktime.
Portability tweaks from Paul Eggert.
1997-11-15 05:41:02 +00:00
Jim Meyering
7ee6b0046f Temporarily add a copy of this file from the automake
distribution.  Update names to have jm_ prefix.
(irix_6_4_bug): New function based on code from Ariel Faigon.
1997-11-15 05:28:04 +00:00
Jim Meyering
708a265b39 . 1997-11-15 05:24:30 +00:00
Jim Meyering
df29ef2431 . 1997-11-13 14:29:18 +00:00
Jim Meyering
3022e9b806 . 1997-11-13 14:25:41 +00:00
Jim Meyering
db984f4c6d update from GNU libc 1997-11-13 14:24:03 +00:00
Jim Meyering
e0d703658c update from GNU libc 1997-11-13 14:22:56 +00:00
Jim Meyering
f52ec0e772 partial update from FSF -- use int, not size_t; 0, not NULL 1997-11-13 14:21:02 +00:00
Jim Meyering
d29c650718 . 1997-11-13 14:16:21 +00:00
Jim Meyering
690342eae7 Update from FSF. 1997-11-13 13:23:16 +00:00
Jim Meyering
2e21152e49 Update from FSF. 1997-11-13 13:22:54 +00:00
Jim Meyering
7afa02b918 Check for POSIX.2's %f format spec. 1997-11-13 13:19:15 +00:00
Jim Meyering
7ba5fcb251 add -*-Makefile-*- 1997-11-12 17:28:34 +00:00
Jim Meyering
f1af5f9504 . 1997-11-12 17:27:41 +00:00
Jim Meyering
5b399f4fe0 [!HAVE_MEMPCPY] (mempcpy): Define here instead. 1997-11-12 17:21:54 +00:00
Jim Meyering
c0cc0c26ed [!HAVE_MEMPCPY] (mempcpy): Define. 1997-11-12 17:19:21 +00:00
Jim Meyering
b74c9a14fd (copy_dir): Use path_concat rather than open-coding it. 1997-11-12 17:18:55 +00:00
Jim Meyering
b3828d9190 *** empty log message *** 1997-11-12 16:28:53 +00:00
Jim Meyering
4842565b62 [!HAVE_MEMPCPY] (mempcpy): Define.
(batch_convert): Use mempcpy rather than stpcpy.
1997-11-12 16:28:06 +00:00
Jim Meyering
4d1e1b28f8 (path_concat): Use mempcpy, not stpcpy. 1997-11-12 16:18:23 +00:00
Jim Meyering
992fc3869f return memcpy result directly 1997-11-12 16:11:17 +00:00
Jim Meyering
e96a4f0ed1 . 1997-11-10 14:40:40 +00:00
Jim Meyering
65dd91dfc3 . 1997-11-10 14:39:14 +00:00
Jim Meyering
99910b9591 . 1997-11-10 04:11:57 +00:00
Jim Meyering
dbac29a533 *** empty log message *** 1997-11-10 03:53:45 +00:00
Jim Meyering
5e28f75496 (jm_STRFTIME_PREREQS): Check for localtime_r.
(jm_FUNC_GNU_STRFTIME): Use new macro.
(jm_FUNC_STRFTIME): New macro.  Likewise.
1997-11-10 03:52:47 +00:00
Jim Meyering
bc445a1f16 (jm_FUNC_MKTIME): Check for localtime_r. 1997-11-10 03:52:33 +00:00
Jim Meyering
572930e171 *** empty log message *** 1997-11-10 03:31:27 +00:00
Jim Meyering
9694cb0f15 add -*-Makefile-*- to first line 1997-11-09 19:06:53 +00:00
Jim Meyering
03fbbc6ee0 add -*-Makefile-*- to first line 1997-11-09 19:06:31 +00:00
Jim Meyering
ab08d64445 . 1997-11-08 21:10:39 +00:00
Jim Meyering
d9173c1c81 . 1997-11-08 21:04:13 +00:00
Jim Meyering
6d3a217c16 (EXTRA_DIST): Add lfs.m4. 1997-11-08 21:02:34 +00:00
Jim Meyering
979f238fb3 (fseeko): Define a stub if ! HAVE_FSEEKO.
(skip): Use fseeko if available.  Don't use lseek; it causes
the stdio stream to become out of sync with respect to the
underyling file descriptor.
From Paul Eggert.
1997-11-08 21:02:01 +00:00
Jim Meyering
6af4f825de . 1997-11-08 20:42:52 +00:00
Jim Meyering
9ef77c1298 *** empty log message *** 1997-11-08 20:38:23 +00:00
Jim Meyering
7417f884af (keycompare): call alloca(0) after each iteration 1997-11-08 04:47:17 +00:00
Jim Meyering
b391c8ba91 . 1997-11-08 04:46:30 +00:00
Jim Meyering
cc2fcaa6ab *** empty log message *** 1997-11-08 03:00:52 +00:00
Jim Meyering
214ed98dd8 Fix typo in comment.
Add header check for string.h.
1997-11-08 03:00:20 +00:00
Jim Meyering
36ce9a1c1c use 2 mempcpy instead of two memcpy calls 1997-11-08 02:59:16 +00:00
Jim Meyering
d87c244809 cleanup
use abort for framework errors
1997-11-08 02:56:10 +00:00
Jim Meyering
19058180fa . 1997-11-07 18:19:50 +00:00
Jim Meyering
55405358b3 *** empty log message *** 1997-11-07 17:19:00 +00:00
Jim Meyering
aaf22602f2 . 1997-11-07 17:18:15 +00:00
Jim Meyering
a313a7d147 (getmonth): Remove HAVE_ALLOCA #ifdefs.
We always have alloca.
(keycompare): Don't use variable size arrays (it's a gcc-extension).
Rewrite code that increments new lengths when not `ignoring'.
1997-11-06 14:37:34 +00:00
Jim Meyering
a8da87911c make sure autoconf tests have been run 1997-11-03 15:19:20 +00:00
Jim Meyering
cbd4a8af0f Add insurance: tell xmalloc.c we've done the test. 1997-11-03 15:18:09 +00:00
Jim Meyering
752325fc8e *** empty log message *** 1997-11-03 05:46:09 +00:00
Jim Meyering
d17ebff653 *** empty log message *** 1997-11-03 05:43:56 +00:00
Jim Meyering
0ad181ef01 *** empty log message *** 1997-11-03 05:39:43 +00:00
Jim Meyering
c9848717d6 *** empty log message *** 1997-11-03 05:38:28 +00:00
Jim Meyering
aafe49ef49 (xalloc_fail): Renamed from fixup_null_alloc.
(xcalloc): #ifdef-out unused function.
(xrealloc): Remove code to work around deficient versions of realloc.
Now we have an autoconf-enabled replacement version.
(xmalloc): Remove code to work around deficient versions of malloc.
Now we have an autoconf-enabled replacement version.
1997-11-03 05:25:44 +00:00
Jim Meyering
c417b4e790 be stricter: check for both P == 0 and N == 0. 1997-11-03 05:20:41 +00:00
Jim Meyering
1919353d75 *** empty log message *** 1997-11-03 05:20:09 +00:00
Jim Meyering
65673815ac *** empty log message *** 1997-11-03 05:19:56 +00:00
Jim Meyering
ab5ff1597f (main): New option, --max-line-length (-L).
(wc, write_counts): Implement it.
From Bruno Haible.
1997-11-03 05:08:36 +00:00
Jim Meyering
d6174d58f9 . 1997-11-03 04:52:50 +00:00
Jim Meyering
ea3c071c2d *** empty log message *** 1997-11-03 04:51:54 +00:00
Jim Meyering
3f3c12d723 don't use touch 1997-11-03 04:50:11 +00:00
Jim Meyering
f2ddecd375 revert last change 1997-11-03 04:40:37 +00:00
Jim Meyering
07e8ae7cb1 create 100 at a time 1997-11-03 04:40:07 +00:00
Jim Meyering
1b3376c9da Put cycle-detecting code inside an
#ifdef ENABLE_CYCLE_CHECK, for systems lacking d_ino.
[D_INO_IN_DIRENT]: Define ENABLE_CYCLE_CHECK.

(ASSIGN_STRDUPA): Clean up.
(right_justify): Use memcpy return value directly.
Suggestions from Ulrich Drepper.

(remove_cwd_entries) [! defined HAVE_WORKING_READDIR]: Impose overhead
of working around non-POSIX readdir implementation only on systems
that need it.
(remove_cwd_entries): Temporarily save a copy of each entry name in
an obstack rather than on the stack via alloca, then free it in the
likely event that we don't save the entry in the hash table.
1997-11-03 04:22:57 +00:00
Jim Meyering
6327a7ad45 *** empty log message *** 1997-11-02 14:38:49 +00:00
Jim Meyering
ae21be058f . 1997-11-02 14:28:13 +00:00
Jim Meyering
53424a8278 *** empty log message *** 1997-11-02 14:28:10 +00:00
Jim Meyering
267987dd44 *** empty log message *** 1997-11-02 14:25:46 +00:00
Jim Meyering
1b4242d631 . 1997-11-02 14:24:16 +00:00
Jim Meyering
c70a6df8c7 *** empty log message *** 1997-11-02 14:21:59 +00:00
Jim Meyering
0b5e948104 Guard cycle-detecting code inside #ifdef ENABLE_CYCLE_CHECK.
[D_INO_IN_DIRENT]: Define ENABLE_CYCLE_CHECK.
1997-10-28 00:55:11 +00:00
Jim Meyering
41431bbd91 *** empty log message *** 1997-10-27 05:00:47 +00:00
Jim Meyering
7da7de8f59 *** empty log message *** 1997-10-27 04:59:35 +00:00
Jim Meyering
3426a19c60 add comment 1997-10-27 04:59:25 +00:00
Jim Meyering
f831d9c32d Convert to upper case before comparing.
This makes join -i work with sort -f.
1997-10-27 04:58:22 +00:00
Jim Meyering
94c4bdd4c8 fix typo in comment 1997-10-27 03:22:01 +00:00
Jim Meyering
b67ad81f67 . 1997-10-26 15:07:47 +00:00
Jim Meyering
d9eac1e2c0 Add A, _, a tests using -f. 1997-10-26 15:07:01 +00:00
Jim Meyering
fb9673ea4a . 1997-10-26 04:51:38 +00:00
Jim Meyering
83dd3a893b . 1997-10-26 04:50:59 +00:00
Jim Meyering
ce7a44e806 . 1997-10-26 04:50:23 +00:00
Jim Meyering
91a4b3d1ed *** empty log message *** 1997-10-26 04:50:05 +00:00
Jim Meyering
910c82eff8 (NLS_STRNCMP) [!ENABLE_NLS]: s/strcmp/strncmp/ 1997-10-26 04:42:02 +00:00
Jim Meyering
eb5fa8bdd2 (xalloc_fail_func): Initialize to 0, not NULL. 1997-10-26 04:39:53 +00:00
Jim Meyering
6f82682a64 . 1997-10-26 04:26:09 +00:00
Jim Meyering
0ef0b74972 (EXTRA_DIST): Add malloc.c. 1997-10-26 03:58:27 +00:00
Jim Meyering
a091e5e93d . 1997-10-26 03:57:43 +00:00
Jim Meyering
956fa0cc78 (EXTRA_DIST): Add malloc.m4. 1997-10-26 03:53:07 +00:00
Jim Meyering
504453762c . 1997-10-26 03:52:27 +00:00
Jim Meyering
71a0d20bf5 (EXTRA_DIST): Add realloc.c. 1997-10-26 03:15:47 +00:00
Jim Meyering
9386131a43 . 1997-10-26 02:48:44 +00:00
Jim Meyering
0819395283 . 1997-10-26 02:48:15 +00:00
Jim Meyering
c5c9c39bb9 . 1997-10-26 02:47:19 +00:00
Jim Meyering
139d0623b8 . 1997-10-26 02:46:35 +00:00
Jim Meyering
bf3f82daa0 (noinst_HEADERS): Add xalloc.h. 1997-10-26 02:20:32 +00:00
Jim Meyering
f399320c40 . 1997-10-25 22:04:11 +00:00
Jim Meyering
df445b0891 Remove old-style xmalloc and xrealloc decls. 1997-10-25 22:03:55 +00:00
Jim Meyering
b3ab88e970 Remove old-style xmalloc and xrealloc decls. 1997-10-25 22:03:20 +00:00
Jim Meyering
e2609be248 Include xalloc.h.
Remove dcls of xmalloc, xcalloc and xrealloc.
1997-10-25 22:01:13 +00:00
Jim Meyering
226e5a6478 . 1997-10-25 21:52:24 +00:00
Jim Meyering
123a921fc2 s/xmalloc_exit_failure/xalloc_exit_failure 1997-10-25 21:52:09 +00:00
Jim Meyering
e6503ed629 Include xalloc.h.
Change VOID to void.
(xalloc_exit_failure): Renamed extern.
(xalloc_msg_memory_exhausted): New extern.
(xalloc_fail_func): New extern.
(fixup_null_alloc): Use new variables.
1997-10-25 21:51:21 +00:00
Jim Meyering
01b84d9480 . 1997-10-25 21:49:45 +00:00
Jim Meyering
c740c3f8ae . 1997-10-25 04:45:58 +00:00
Jim Meyering
e211bb2aff Remove old-style xmalloc and xrealloc decls. 1997-10-25 04:45:43 +00:00
Jim Meyering
cfcb7f0117 Remove old-style xmalloc and xrealloc decls.
(add_tabstop): Cast first arg of xrealloc to char*.
1997-10-25 04:44:00 +00:00
Jim Meyering
0927513b16 Include xalloc.h.
(xmalloc): Remove function.
(xrealloc): Remove function.
(main): Set xalloc_fail_func to cleanup.
Set xmalloc_exit_failure SORT_FAILURE.
1997-10-25 04:43:10 +00:00
Jim Meyering
0873056df7 Remove old-style xmalloc and xrealloc decls.
(paste_parallel): Cast first arg of xrealloc to char*.
1997-10-25 04:42:15 +00:00
Jim Meyering
b480949713 Remove old-style xmalloc and xrealloc decls.
(decode_format_string): Cast first arg of xrealloc to char*.
1997-10-25 04:41:18 +00:00
Jim Meyering
f4ae4ca4ef Remove old-style xmalloc and xrealloc decls.
(add_tabstop): Cast first arg of xrealloc to char*.
1997-10-25 04:40:28 +00:00
Jim Meyering
a0b56b516a Include xalloc.h.
(xmalloc): Remove function.
(xrealloc): Remove function.
(main): Set xalloc_fail_func to cleanup.
1997-10-25 04:38:58 +00:00
Jim Meyering
7dcae67d92 (ADD_RANGE_PAIR): Cast first arg of xrealloc to char*.
(getstr): Cast xmalloc return value to char*.
(xmalloc): Remove decl.
(xrealloc): Remove decl.
1997-10-25 04:37:57 +00:00
Jim Meyering
866a9c5e2d Use unsigned int, not just unsigned. 1997-10-24 13:17:16 +00:00
Jim Meyering
4c29214245 *** empty log message *** 1997-10-24 13:06:56 +00:00
Jim Meyering
d6b68f0fff . 1997-10-24 04:29:41 +00:00
Jim Meyering
fe4e67e1a0 *** empty log message *** 1997-10-24 02:13:01 +00:00
Jim Meyering
cd4c834ded quote AC_HEADER_STDC in AC_REQUIRE. 1997-10-24 02:06:52 +00:00
Jim Meyering
1c97532caf don't use lower and upper temporaries 1997-10-24 01:45:56 +00:00
Jim Meyering
220323bbbf . 1997-10-24 01:44:35 +00:00
Jim Meyering
5aa2bbe173 *** empty log message *** 1997-10-24 01:44:29 +00:00
Jim Meyering
ba1b5f6db1 . 1997-10-24 01:43:24 +00:00
Jim Meyering
c25ff2f7c9 *** empty log message *** 1997-10-24 01:43:12 +00:00
Jim Meyering
23fa5c1d3f . 1997-10-24 01:42:27 +00:00
Jim Meyering
bd38753847 *** empty log message *** 1997-10-24 01:42:02 +00:00
Jim Meyering
d1ea3d6f17 . 1997-10-23 16:15:31 +00:00
Jim Meyering
339afbb210 [!HAVE_DECLARATION_FREE]: Declare free.
[!HAVE_DECLARATION_MALLOC]: Declare malloc.
[!HAVE_DECLARATION_REALLOC]: Declare realloc.
[!HAVE_DECLARATION_STPCPY]: Declare stpcpy.
[!HAVE_DECLARATION_STRSTR]: Declare strstr.
1997-10-23 16:07:31 +00:00
Jim Meyering
f4d8e10147 Remove stpcpy decl.
Remove free, malloc, and realloc decls.
1997-10-23 16:06:59 +00:00
Jim Meyering
9fec99f4a6 Remove free and malloc decls. 1997-10-23 16:06:19 +00:00
Jim Meyering
3faf14fe5c Remove stpcpy decl.
Remove free and malloc decls.
1997-10-23 16:05:59 +00:00
Jim Meyering
eae64f3a4f Remove stpcpy decl. 1997-10-23 16:04:47 +00:00
Jim Meyering
2190ae8456 . 1997-10-23 16:04:22 +00:00
Jim Meyering
5d95b57e31 *** empty log message *** 1997-10-23 16:04:09 +00:00
Jim Meyering
ddac742eb8 . 1997-10-23 15:59:42 +00:00
Jim Meyering
9e51e01450 . 1997-10-23 15:58:39 +00:00
Jim Meyering
096b53e6c6 [STREQ]: Undef then redefine. 1997-10-23 15:57:54 +00:00
Jim Meyering
1f98316792 Remove strstr decl. 1997-10-23 15:57:36 +00:00
Jim Meyering
58e904c6fd Remove stpcpy decl. 1997-10-23 15:57:21 +00:00
Jim Meyering
308d4d7b56 . 1997-10-23 15:34:12 +00:00
Jim Meyering
fd9508f73e . 1997-10-23 15:32:42 +00:00
Jim Meyering
92f84dde01 . 1997-10-23 15:32:08 +00:00
Jim Meyering
c7ba7d37a5 *** empty log message *** 1997-10-23 14:30:37 +00:00
Jim Meyering
e3d7071595 Remove stpcpy dcl. 1997-10-23 14:30:27 +00:00
Jim Meyering
00bc2c29ca Remove malloc, and realloc dcls. 1997-10-23 14:30:14 +00:00
Jim Meyering
f11893c764 Remove free, malloc, and realloc dcls. 1997-10-23 14:30:03 +00:00
Jim Meyering
1aad2e1c4a Remove malloc and realloc dcls. 1997-10-23 14:29:46 +00:00
Jim Meyering
d4899bad7e Remove stpcpy dcl. 1997-10-23 14:28:31 +00:00
Jim Meyering
1323b4bc13 *** empty log message *** 1997-10-23 13:28:01 +00:00
Jim Meyering
9f1ddc8d01 (EXTRA_DIST): Add decl.m4 and do-decl.m4. 1997-10-23 13:26:45 +00:00
Jim Meyering
d0a698d984 *** empty log message *** 1997-10-23 04:53:18 +00:00
Jim Meyering
1bf2efdbf0 . 1997-10-23 04:53:06 +00:00
Jim Meyering
394f851071 update from FSF 1997-10-22 14:06:16 +00:00
Jim Meyering
b36a76ab70 *** empty log message *** 1997-10-20 18:31:29 +00:00
Jim Meyering
916300ba27 *** empty log message *** 1997-10-19 03:20:04 +00:00
Jim Meyering
22b1971cbc *** empty log message *** 1997-10-19 03:12:10 +00:00
Jim Meyering
a7e650ac12 (remove_cwd_entries): Entries in table of processed dir
entries are not malloc'd, so don't have hash cleanup free them.
Rewind dirp upon NULL readdir, required for at least SunOS.
1997-10-19 03:09:40 +00:00
Jim Meyering
53e807719a *** empty log message *** 1997-10-19 02:38:31 +00:00
Jim Meyering
b51e8b8ec4 *** empty log message *** 1997-10-19 02:37:12 +00:00
Jim Meyering
6f976ee5d4 . 1997-10-18 20:14:50 +00:00
Jim Meyering
3fa5a54f68 (LONG_MAX): Define if not defined. 1997-10-18 19:49:50 +00:00
Jim Meyering
72ab8e314c *** empty log message *** 1997-10-17 19:05:07 +00:00
Jim Meyering
d255fdbe9c *** empty log message *** 1997-10-17 18:58:04 +00:00
Jim Meyering
71c4a4524f . 1997-10-17 18:57:46 +00:00
Jim Meyering
c555721842 (remove_cwd_entries): Change the while(dp...) to a while(1) loop,
and move dcl and assignment of dp into the loop.
1997-10-17 18:06:34 +00:00
Jim Meyering
0dcc4a0d58 *** empty log message *** 1997-10-17 15:21:27 +00:00
Jim Meyering
d6cdc3e8f5 . 1997-10-17 15:20:17 +00:00
Jim Meyering
df400162fc *** empty log message *** 1997-10-17 15:20:08 +00:00
Jim Meyering
695b9df0ec indent 1997-10-16 15:34:26 +00:00
Jim Meyering
1a68cff356 Add comments. From Orn. 1997-10-16 15:29:15 +00:00
Jim Meyering
acf88c6fa8 add assertions 1997-10-16 15:03:54 +00:00
Jim Meyering
1bcc596ada . 1997-10-16 15:01:58 +00:00
Jim Meyering
f015b15dc9 (look_for_fraction): Patch from Orn Hansen.
(getmonth): Compare the two month names only to the length of the
string in the month table.  Patch from Orn Hansen.
(NLS_STRNCMP): New macro.
(strncoll_s2_readonly): New function.
(inittables): Don't use temporary `comp' to hide type of comparator function.
(nls_sort_month_comp): Declare parameters to be void* to match
comparator function type required for qsort.
(getmonth): Use NLS_STRNCMP rather than #ifdef.
Use do-while, rather than while-loop.
1997-10-16 14:54:58 +00:00
Jim Meyering
e803da432b begin merging Orn's changes 1997-10-16 13:12:13 +00:00
Jim Meyering
8f8e6f63d8 *** empty log message *** 1997-10-15 21:38:08 +00:00
Jim Meyering
bbc161b496 . 1997-10-15 05:12:00 +00:00
Jim Meyering
e3fe6a0efd *** empty log message *** 1997-10-15 05:00:41 +00:00
Jim Meyering
1ab25ef4a1 (_NL_ITEM) [!defined]: Define.
From from rn E. Hansen.
1997-10-15 05:00:33 +00:00
Jim Meyering
0fab8dca59 . 1997-10-14 22:34:00 +00:00
Jim Meyering
55707840f3 Remove ChangeLog entry from Orn. 1997-10-14 22:33:20 +00:00
Jim Meyering
8d3d73c573 Use STREQ in place of most uses of strcmp.
(zaptemp): Make parameter `const'.
1997-10-14 22:32:44 +00:00
Jim Meyering
2bb1be5ca0 (NLS_STRCMP): Define.
(getmonth): Remove ifdef and use NLS_STRCMP instead.
Use HAVE_ALLOCA, not _HAVE_ALLOCA.
1997-10-14 22:25:02 +00:00
Jim Meyering
cb3a4594b9 . 1997-10-14 22:15:31 +00:00
Jim Meyering
a1796c88cb . 1997-10-14 22:15:06 +00:00
Jim Meyering
ed63af49a2 Add tests to exercise fraccompare. 1997-10-14 22:14:48 +00:00
Jim Meyering
e1927c2248 . 1997-10-14 22:09:59 +00:00
Jim Meyering
0fa42caea6 (CHARS_IN_ABM): Remove definition
(inittables): Remove assumption that all abbreviated month names have
length 3.
(getmonth): Likewise.
(main): Add #if's for more efficient code when using the GNU C library.
From Ulrich Drepper.
1997-10-14 21:36:33 +00:00
Jim Meyering
69c54c088c tweak Orn's fraccompare. Always use it. 1997-10-14 20:41:28 +00:00
Jim Meyering
bf5606ff49 (fraccompare): Indent.
Move dcls of S and N into if block.
1997-10-14 14:12:48 +00:00
Jim Meyering
3f7506491b fix spelling errors in comments 1997-10-14 13:47:22 +00:00
Jim Meyering
8c96da80b0 (keycompare): Move assignment out of if-expression. 1997-10-14 13:40:51 +00:00
Jim Meyering
df3a123e85 (strncoll): Rename parameter to LEN.
Clean up formatting.
Add a FIXME.
1997-10-14 13:37:35 +00:00
Jim Meyering
8b924d2318 *** empty log message *** 1997-10-14 13:08:06 +00:00
Jim Meyering
7fff797d97 Declare xstrdup.
(my_setlocale): New function.
(main): Guard against failure of strdup (use xstrdup) and setlocale.
1997-10-14 13:07:12 +00:00
Jim Meyering
42a2bc2846 (STREQ): Remove definition. 1997-10-14 12:50:28 +00:00
Jim Meyering
b2ff7dd7c5 [patch from Orn]
(look_for_fraction): Eliminate arbitrary limit on
number of `groups'.  Declare as void, not int.
Patch from rn E. Hansen.
(main): When determining whether we're in the C or POSIX locale,
don't rely on the form of the string returned by setlocale.
Suggestion from Ulrich Drepper.
1997-10-14 12:19:09 +00:00
Jim Meyering
27c0b63dfc apply one more piece from KBs patch 1997-10-13 23:09:15 +00:00
Jim Meyering
588d5520d6 expr reorg from KB 1997-10-13 21:59:27 +00:00
Jim Meyering
1f96e81489 *** empty log message *** 1997-10-13 14:08:51 +00:00
Jim Meyering
a41c38cb7d Bracket inclusion of termios.h with #ifdef HAVE_TERMIOS_H.
Masami Takikawa reported that this is necessary on NeXTStep 3.0 systems.
1997-10-13 14:08:38 +00:00
Jim Meyering
c4aa5c4df7 *** empty log message *** 1997-10-13 14:07:31 +00:00
Jim Meyering
2c32c6a11a eliminate a comma expr,
fix one func return type
eliminate `* 1'
1997-10-13 04:02:42 +00:00
Jim Meyering
b01df13c39 (NLS_MAP): Remove unused definitions.
Replace with uses of UCHAR.
(nls_locale_map): Remove dcl of unused file-scope array.
1997-10-13 03:52:35 +00:00
Jim Meyering
3616231d94 (NLS_MEMCMP): Define.
(keycompare): Use it instead of open-coded #ifdefs.
(compare): Likewise.
1997-10-13 03:48:58 +00:00
Jim Meyering
b7e7317be0 indent and clean up some more 1997-10-13 03:37:16 +00:00
Jim Meyering
045d8da585 Indent some more.
#ifdef ENABLE_NLS th NLS part of insertkey.
1997-10-13 03:26:39 +00:00
Jim Meyering
0ac3a6acde indent and add FIXME comments 1997-10-13 03:12:17 +00:00
Jim Meyering
9ee502b57d filter through cppi 1997-10-13 02:08:30 +00:00
Jim Meyering
79bfec7ced Apply big patch from rn E. Hansen. 1997-10-13 02:08:01 +00:00
Jim Meyering
168acf8b9c . 1997-10-10 21:22:33 +00:00
Jim Meyering
eed785a714 . 1997-10-10 21:22:01 +00:00
Jim Meyering
a9e92e39a3 . 1997-10-10 21:21:04 +00:00
Jim Meyering
ee9b6aa2e5 *** empty log message *** 1997-10-10 21:20:45 +00:00
Jim Meyering
d7f5a724ca Add a test.
From William Lewis.
1997-10-10 21:20:27 +00:00
Jim Meyering
b9b4d6b169 *** empty log message *** 1997-10-08 14:24:32 +00:00
Jim Meyering
3d6090e6f7 *** empty log message *** 1997-10-07 23:59:21 +00:00
Jim Meyering
3ea2606e41 indent cpp directives to reflect nesting 1997-10-07 23:58:29 +00:00
Jim Meyering
3f3f566627 update bug-reporting address 1997-10-07 23:55:52 +00:00
Jim Meyering
05bbdbd786 update bug-reporting address 1997-10-07 23:53:36 +00:00
Jim Meyering
54abd85010 update bug-reporting address 1997-10-07 23:53:10 +00:00
Jim Meyering
5db3c9bdb4 update bug-reporting address 1997-10-07 23:51:39 +00:00
Jim Meyering
45e8ddd2c9 . 1997-10-07 22:08:55 +00:00
Jim Meyering
e5549867e2 change verbose messages 1997-10-06 13:30:14 +00:00
Jim Meyering
2e1d300fe5 (usage): Add a line describing --verbose. 1997-10-06 13:09:28 +00:00
Jim Meyering
4e3811ecb7 *** empty log message *** 1997-10-06 13:07:47 +00:00
Jim Meyering
40fa6cc699 (make_path): Print verbose message using fprintf, not error. 1997-10-06 13:07:14 +00:00
Jim Meyering
7a4cc2dff1 (make_path): Print message IFF the directory was
just created and the format string is non-NULL.
1997-10-06 13:03:29 +00:00
Jim Meyering
b6bc4c265e *** empty log message *** 1997-10-06 05:32:54 +00:00
Jim Meyering
f8265dd3d8 *** empty log message *** 1997-10-06 05:25:59 +00:00
Jim Meyering
48f0a08332 fix braino 1997-10-06 05:23:49 +00:00
Jim Meyering
c8eb28c84b . 1997-10-06 05:04:16 +00:00
Jim Meyering
e13ae8ea54 (noinst_HEADERS): Add savedir.h. 1997-10-06 05:04:11 +00:00
Jim Meyering
947713c68b . 1997-10-06 04:58:33 +00:00
Jim Meyering
7bff8c9b50 (struct cp_options): New field: require_preserve. 1997-10-06 04:58:26 +00:00
Jim Meyering
eb2947bbbd (cp_option_init): Initialize it.
(main): Set to 1 for -a and for -p.
1997-10-06 04:58:05 +00:00
Jim Meyering
fe12b67113 (copy_internal): Use require_preserve. 1997-10-06 04:57:40 +00:00
Jim Meyering
22a4f828db . 1997-10-04 01:57:39 +00:00
Jim Meyering
03ae2c6b97 Remove old-style savedir dcl.
Include savedir.h for prototype.
1997-10-04 01:57:12 +00:00
Jim Meyering
3445d47a10 Remove old-style savedir dcl.
Include savedir.h for prototype.
1997-10-04 01:56:23 +00:00
Jim Meyering
a3ce4b756d *** empty log message *** 1997-10-04 01:55:11 +00:00
Jim Meyering
5873623fd5 (savedir): Declare DIR parameter to be const.
Include savedir.h.
1997-10-04 01:43:58 +00:00
Jim Meyering
a1faaa73d3 . 1997-10-04 01:43:13 +00:00
Jim Meyering
792a091d75 . 1997-10-03 03:28:05 +00:00
Jim Meyering
f76c31d4cd *** empty log message *** 1997-10-03 03:26:20 +00:00
Jim Meyering
e762d8ee73 (test_vector): Remove _%Z from test `9'.
The timezone string was too system dependent.
1997-10-03 03:26:01 +00:00
Jim Meyering
a8cf858306 (fspec_init_dp): Use DTTOIF. Fix syntax error in code
that gets compiled on BSDI3.0 systems.
1997-10-03 02:44:33 +00:00
Jim Meyering
20694b3960 *** empty log message *** 1997-09-30 04:33:59 +00:00
Jim Meyering
0b26f06ded . 1997-09-30 04:32:56 +00:00
Jim Meyering
5bdecc6cc7 . 1997-09-30 04:29:50 +00:00
Jim Meyering
d24d45b2b4 . 1997-09-30 04:29:22 +00:00
Jim Meyering
65ad25c5dc . 1997-09-30 04:19:40 +00:00
Jim Meyering
a84d00ebd3 . 1997-09-30 04:19:04 +00:00
Jim Meyering
40dfaeed5c *** empty log message *** 1997-09-28 16:33:22 +00:00
Jim Meyering
de2517a1f4 (remove_dir): Update old comment. 1997-09-28 03:51:00 +00:00
Jim Meyering
4a32d010ef [enum RM_status]: Remove `= 2'. Add comment.
(dir_stack): Describe.
(remove_file): Revert s/fprintf/error/ change.  We don't want newlines at
end of prompt strings.
(remove_dir): Likewise.
1997-09-28 03:47:53 +00:00
Jim Meyering
3fca18930e . 1997-09-28 02:40:17 +00:00
Jim Meyering
02ade899f9 Integrate test to detect bug in memcmp from the
Next x86 OpenStep C library.  Test program from William Lewis.
1997-09-28 02:32:26 +00:00
Jim Meyering
3e90df41a9 tweak comment 1997-09-27 23:45:54 +00:00
Jim Meyering
a25003439a . 1997-09-27 23:24:39 +00:00
Jim Meyering
7899ec4a2b *** empty log message *** 1997-09-27 23:24:27 +00:00
Jim Meyering
dd3edcb414 . 1997-09-25 12:59:56 +00:00
Jim Meyering
b7bfc2d2a2 Make echo conform to POSIX. By default, don't
interpret backslash escape sequences.
[V9_DEFAULT]: Don't #define.
(usage): Document -e option.
(main): Recognize options iff POSIXLY_CORRECT is not set.
From Bruno Haible.
1997-09-25 12:58:50 +00:00
Jim Meyering
9177f974da *** empty log message *** 1997-09-22 12:00:10 +00:00
Jim Meyering
77e927d501 od's new z format 1997-09-22 05:00:50 +00:00
Jim Meyering
aa298d7bbe [struct tspec] (hexl_mode_trailer): Rename from `trailer.'
(dump_hexl_mode_trailer): Rename from dump_string_trailer.
Use fputs and putchar instead of trivial or %-less printfs.
(decode_one_format): Parenthesize each field_width assignment in an
argument list to make the side effect a little more apparent.
(write_block): Use fputs and putchar instead of trivial or %-less printfs.
(dump_strings): Cast string_min to off_t to avoid long-standing warning.
1997-09-22 04:59:57 +00:00
Jim Meyering
f1e4f5cf82 Patch from John Kodis. 1997-09-21 20:23:58 +00:00
Jim Meyering
3f11fc8041 . 1997-09-21 13:24:12 +00:00
Jim Meyering
535135e826 *** empty log message *** 1997-09-21 13:22:37 +00:00
Jim Meyering
89d48552da (IN_CTYPE_DOMAIN): Define.
(ISSPACE): Guard with IN_CTYPE_DOMAIN.
(ISDIGIT): Guard with IN_CTYPE_DOMAIN.
(TOUPPER): Guard with IN_CTYPE_DOMAIN.
From Bruno Haible.
1997-09-21 13:22:20 +00:00
Jim Meyering
29becc72ac (IN_CTYPE_DOMAIN): Define.
(ISSPACE): Define.
(ISDIGIT): Define.
(TOLOWER): Define.
1997-09-21 13:19:19 +00:00
Jim Meyering
99e8d1ac51 (IN_CTYPE_DOMAIN): Define.
(ISSPACE): Define.
(readname): Use ISSPACE, not isspace.
1997-09-21 13:15:48 +00:00
Jim Meyering
0ea3fb3c07 *** empty log message *** 1997-09-21 04:55:06 +00:00
Jim Meyering
7449936903 (libfu_a_SOURCES): Use hash.c, not oa-hash.c.
(noinst_HEADERS): Use hash.h, not oa-hash.h.
1997-09-21 04:54:52 +00:00
Jim Meyering
004c583882 *** empty log message *** 1997-09-21 04:53:29 +00:00
Jim Meyering
fc802521f3 Use hash.c (chaining) functions, not those of oa-hash.c
(open addressing).  The latter implementation is wonderful when
deletions are rare, but doen't support the frequent deletions
required to implement the active directory set.
1997-09-21 04:53:14 +00:00
Jim Meyering
2e1922942c (hash_free_0): Remove prototype.
Move function to precede first use.
1997-09-21 04:41:19 +00:00
Jim Meyering
2dd7796da0 (ZALLOC): Take Ht parameter instead of relying on one being in scope. 1997-09-20 19:38:29 +00:00
Jim Meyering
20539121db *** empty log message *** 1997-09-20 19:33:46 +00:00
Jim Meyering
daeaff8c14 *** empty log message *** 1997-09-20 19:33:05 +00:00
Jim Meyering
e760bf3708 *** empty log message *** 1997-09-20 18:32:40 +00:00
Jim Meyering
5f20a181aa . 1997-09-17 17:06:52 +00:00
Jim Meyering
2fef57672b use malloc, not xmalloc in obstack #define
use Uli's prime code, not near-prime
(hash_initialize): don't require prime table size as input
(hash_insert_if_absent): When rehashing, choose new size that is 2N+1, not 2N.
1997-09-17 17:06:26 +00:00
Jim Meyering
bba93bb711 use HASH_H, not _hash_h_ in #ifndef
fix comment: hash_rehash does *not* use hash_key_freer
(HASH_INSERT_NEW_ITEM): Take new arg: Failp.
1997-09-17 17:04:21 +00:00
Jim Meyering
fa1ece2973 from ti/hdlsv 1997-09-17 16:03:32 +00:00
Jim Meyering
4d09de4e63 (main): Call parse_long_options only if POSIXLY_CORRECT
is *not* set.  Reported by Frank T Lofaro.
1997-09-17 13:04:31 +00:00
Jim Meyering
95343e720d *** empty log message *** 1997-09-17 13:04:19 +00:00
Jim Meyering
96c7801048 *** empty log message *** 1997-09-17 13:03:53 +00:00
Jim Meyering
85f74e093b *** empty log message *** 1997-09-17 12:58:45 +00:00
Jim Meyering
ddc44210a4 update from FSF .../copies 1997-09-17 12:46:45 +00:00
Jim Meyering
e52535af00 *** empty log message *** 1997-09-16 20:03:02 +00:00
Jim Meyering
3a0056aa09 . 1997-09-16 19:59:02 +00:00
Jim Meyering
3e9c67e385 tweak message strings 1997-09-15 18:46:42 +00:00
Jim Meyering
821279c98b tweak message strings 1997-09-15 18:45:47 +00:00
Jim Meyering
312d78eca6 (install_handler): Rename from sig_handler. 1997-09-15 14:18:15 +00:00
Jim Meyering
6a4773b2d9 *** empty log message *** 1997-09-15 14:17:42 +00:00
Jim Meyering
c9b7235ea0 *** empty log message *** 1997-09-15 14:13:37 +00:00
Jim Meyering
942ecc6d94 *** empty log message *** 1997-09-15 14:11:35 +00:00
Jim Meyering
2c53930cbb *** empty log message *** 1997-09-15 14:11:02 +00:00
Jim Meyering
dc0e1d4cb5 . 1997-09-15 14:03:35 +00:00
Jim Meyering
5b421e3103 *** empty log message *** 1997-09-15 14:03:23 +00:00
Jim Meyering
c2bbb8e875 (do_link): Perform S_ISLNK test only if lstat succeeded. 1997-09-15 14:02:47 +00:00
Jim Meyering
1822e3bd68 declare malloc 1997-09-15 13:26:09 +00:00
Jim Meyering
b4204ff74c (remove_cwd_entries): Don't free entries -- they're alloca'd, now. 1997-09-15 13:24:43 +00:00
Jim Meyering
45853bf653 Use memcpy, not stpncpy. This fixes a UMR. 1997-09-15 12:34:25 +00:00
Jim Meyering
ee62735854 . 1997-09-15 04:11:30 +00:00
Jim Meyering
370d12c241 . 1997-09-15 03:59:24 +00:00
Jim Meyering
a3576f081b *** empty log message *** 1997-09-15 03:58:06 +00:00
Jim Meyering
425f0215f8 *** empty log message *** 1997-09-15 03:57:04 +00:00
Jim Meyering
eaa1924e36 Write implementation overview. 1997-09-15 03:56:19 +00:00
Jim Meyering
e33f73ba8d remove obsolete comment 1997-09-15 03:31:42 +00:00
Jim Meyering
e01071c1d7 tweak comment 1997-09-15 03:24:03 +00:00
Jim Meyering
6d77a9d346 (full_filename): Use realloc, not xrealloc. 1997-09-15 03:23:12 +00:00
Jim Meyering
f5be07c5c7 *** empty log message *** 1997-09-15 03:21:40 +00:00
Jim Meyering
2adf9f295e . 1997-09-15 03:21:35 +00:00
Jim Meyering
bf886f22b7 . 1997-09-15 03:20:53 +00:00
Jim Meyering
cb92ddeb53 (EXTRA_DIST): Add realloc.m4. 1997-09-15 03:20:45 +00:00
Jim Meyering
ddbf490eb4 (EXTRA_DIST): Add realloc.c. 1997-09-15 03:19:52 +00:00
Jim Meyering
8dae34819a . 1997-09-14 17:43:43 +00:00
Jim Meyering
5a74e8ae4e (equal): Use STREQ (form system.h) instead.
(siginfo_handler): New function to handle SIGINFO/SIGUSR1.
(handle_sig): New function.
(main): Use handle_sig instead of open-coding it.
Handle SIGINFO (or SIGUSR1 if that's not defined).
(print_stats): Move definition to precede first reference.
Remove prototype.
1997-09-14 17:42:33 +00:00
Jim Meyering
ac1bb837ca *** empty log message *** 1997-09-14 16:25:33 +00:00
Jim Meyering
686c105caa *** empty log message *** 1997-09-14 16:24:35 +00:00
Jim Meyering
cb628f9be3 Don't include signal.h. 1997-09-14 16:24:17 +00:00
Jim Meyering
cc76a774e3 . 1997-09-14 16:04:48 +00:00
Jim Meyering
9aef26e3d0 (main) [--traditional]: Don't give diagnostic about there
being more than three arguments if there are *no* arguments specified.
Reported by Jochen Hein.
1997-09-14 16:03:58 +00:00
Jim Meyering
c2210482ee *** empty log message *** 1997-09-14 16:03:23 +00:00
Jim Meyering
fe57800e4c . 1997-09-14 04:18:48 +00:00
Jim Meyering
d5f56f9cd7 (struct col_info) [valid_len]: Rename from `valid' which conflicted
with the macro in locale.h of SunOS4.1.4.
1997-09-14 04:16:37 +00:00
Jim Meyering
22c2c69da4 (print_horizontal): Add some non-essential curly braces. 1997-09-14 04:08:52 +00:00
Jim Meyering
d9f0902259 (print_many_per_line): Add some non-essential curly braces. 1997-09-14 04:07:28 +00:00
Jim Meyering
f61c317736 *** empty log message *** 1997-09-14 03:49:47 +00:00
Jim Meyering
aa8336c08f *** empty log message *** 1997-09-14 03:48:17 +00:00
Jim Meyering
548bd7cf11 s/__inline/inline/. 1997-09-14 03:41:26 +00:00
Jim Meyering
b208989a75 (PARAMS): Define.
(rm): Guard prototype in forward dcl with PARAMS.
1997-09-14 03:39:26 +00:00
Jim Meyering
849a724b76 (PARAMS): Define.
Guard prototype with PARAMS.
1997-09-14 03:36:38 +00:00
Jim Meyering
12c9be75c3 *** empty log message *** 1997-09-14 03:36:21 +00:00
Jim Meyering
322a087077 *** empty log message *** 1997-09-14 03:32:59 +00:00
Jim Meyering
230bf922dd [HAVE_CONFIG_H]: Include config.h. 1997-09-14 03:32:09 +00:00
Jim Meyering
1778193988 Use 1' not +1' -- some compilers (sunos' cc) can't parse it. 1997-09-14 03:22:39 +00:00
Jim Meyering
85bb9aba83 [HAVE_CONFIG_H]: Include config.h. 1997-09-14 03:20:38 +00:00
Jim Meyering
3e8068282b Include config.h. 1997-09-14 03:12:35 +00:00
Jim Meyering
f8356568bd . 1997-09-14 02:27:14 +00:00
Jim Meyering
fced145a6f . 1997-09-14 02:21:09 +00:00
Jim Meyering
75b17ba951 Add tests 19a and 19b. 1997-09-14 02:20:55 +00:00
Jim Meyering
76bf15f3f5 . 1997-09-14 02:19:38 +00:00
Jim Meyering
9610d3daa9 . 1997-09-14 02:19:15 +00:00
Jim Meyering
1b868e164e *** empty log message *** 1997-09-14 02:02:14 +00:00
Jim Meyering
561028f4ac merge from rm-fix branch 1997-09-14 02:00:48 +00:00
Jim Meyering
ea05c547f4 *** empty log message *** 1997-09-11 15:47:49 +00:00
Jim Meyering
16f5d0a11b Add new option: --verbose (-v).
From Andreas Schwab.
1997-09-11 15:45:20 +00:00
Jim Meyering
85925f6fe8 *** empty log message *** 1997-09-05 02:14:21 +00:00
Jim Meyering
a72c09608f . 1997-09-02 05:00:43 +00:00
Jim Meyering
163218e095 *** empty log message *** 1997-09-02 04:58:33 +00:00
Jim Meyering
7f519808bb (EXTRA_DIST): Remove mvdir.c and rmdir.c.
Add lstat.c and stat.c.
1997-09-02 04:58:17 +00:00
Jim Meyering
eb5eb4b184 . 1997-09-02 04:57:10 +00:00
Jim Meyering
30e5bc03f5 *** empty log message *** 1997-09-02 04:29:38 +00:00
Jim Meyering
08774a1668 *** empty log message *** 1997-09-02 02:16:28 +00:00
Jim Meyering
c08bc8f748 update from libc 1997-09-02 02:15:10 +00:00
Jim Meyering
90df7a344e *** empty log message *** 1997-09-02 02:09:01 +00:00
Jim Meyering
156f60ff68 (EXTRA_DIST): Add stat.m4. 1997-09-02 02:08:52 +00:00
Jim Meyering
b3dd93b242 . 1997-09-02 02:07:40 +00:00
Jim Meyering
2d93d34275 [!STDC_HEADERS]: Declare malloc. 1997-09-02 01:51:39 +00:00
Jim Meyering
262b5c6bb6 . 1997-09-02 01:46:30 +00:00
Jim Meyering
dbc71f8be4 *** empty log message *** 1997-09-01 20:44:46 +00:00
Jim Meyering
84de13d6fe *** empty log message *** 1997-09-01 20:43:47 +00:00
Jim Meyering
f59116179b *** empty log message *** 1997-09-01 20:32:07 +00:00
Jim Meyering
ba1852e6f1 (do_link): Form destination file name (when DEST is a directory) before
checking whether SOURCE and DEST are the same file.
1997-09-01 20:31:00 +00:00
Jim Meyering
3f27c2b654 update gettext-0.31 1997-09-01 20:27:07 +00:00
Jim Meyering
fbd9c922b4 . 1997-09-01 20:25:23 +00:00
Jim Meyering
2d87c8508a *** empty log message *** 1997-09-01 20:23:34 +00:00
Jim Meyering
9d07e1de5c . 1997-09-01 20:08:08 +00:00
Jim Meyering
8188297c46 . 1997-09-01 16:30:41 +00:00
Jim Meyering
7515c4a994 *** empty log message *** 1997-09-01 02:36:48 +00:00
Jim Meyering
da4376bb23 . 1997-09-01 02:15:13 +00:00
Jim Meyering
173606dfc6 Describe who's --lookup option. 1997-09-01 02:12:18 +00:00
Jim Meyering
3d061807bb *** empty log message *** 1997-09-01 02:09:17 +00:00
Jim Meyering
bb22f10c37 (main): New option --lookup (-l).
(print_entry): Only call canon_host if user explicitly asks for it.
(usage): Describe --lookup.
From Galen Hazelwood.
1997-09-01 02:08:58 +00:00
Jim Meyering
4aa3cfc3db *** empty log message *** 1997-08-31 22:19:30 +00:00
Jim Meyering
fe531f25e6 *** empty log message *** 1997-08-31 22:17:25 +00:00
Jim Meyering
8a788f502e . 1997-08-31 22:15:57 +00:00
Jim Meyering
a98be62643 tweak comment 1997-08-31 22:10:46 +00:00
Jim Meyering
c0270058fe *** empty log message *** 1997-08-31 22:09:54 +00:00
Jim Meyering
f5d34cdce9 (change_file_group): Call describe_change with a 3-state argument.
(describe_change): Report whether the operation was successful,
a failure, or that the request was a no-op.
Before, running `chown --verb bin /' as non-root reported
  group of / changed to bin
  chgrp: you are not a member of group `bin': Not owner
1997-08-31 22:07:53 +00:00
Jim Meyering
72bf7437cb (change_file_owner): Call describe_change with a 3-state argument.
(describe_change): Report whether the operation was successful,
a failure, or that the request was a no-op.
Before, running `chown --verb bin /' as non-root reported
  owner of / changed to bin
  chown: /: Not owner
1997-08-31 22:06:10 +00:00
Jim Meyering
7d6f2ec75d . 1997-08-31 21:25:29 +00:00
Jim Meyering
2e828fa1eb . 1997-08-31 21:24:49 +00:00
Jim Meyering
13bbc7d111 *** empty log message *** 1997-08-31 21:22:28 +00:00
Jim Meyering
0180caa0c5 . 1997-08-31 21:22:13 +00:00
Jim Meyering
5ca242d9a0 *** empty log message *** 1997-08-31 21:20:56 +00:00
Jim Meyering
e340982761 *** empty log message *** 1997-08-31 21:02:35 +00:00
Jim Meyering
c98bd4b9f3 *** empty log message *** 1997-08-31 21:02:10 +00:00
Jim Meyering
031bd9ac31 (EXTRA_DIST): Add lstat.m4. 1997-08-31 21:00:36 +00:00
Jim Meyering
7435d83352 . 1997-08-31 21:00:05 +00:00
Jim Meyering
ea4e209b2b . 1997-08-31 20:52:51 +00:00
Jim Meyering
a0ccfc52c8 *** empty log message *** 1997-08-31 20:42:52 +00:00
Jim Meyering
42c0f57881 add description 1997-08-31 20:08:26 +00:00
Jim Meyering
a14eed3cb2 Ifdef out dcl of now-unused nogroup_alist. 1997-08-31 18:13:56 +00:00
Jim Meyering
59e5cb3ea3 *** empty log message *** 1997-08-31 16:18:10 +00:00
Jim Meyering
377f2fbc55 . 1997-08-31 16:17:56 +00:00
Jim Meyering
e81e47663f . 1997-08-31 15:28:07 +00:00
Jim Meyering
e7d45e86d1 *** empty log message *** 1997-08-31 15:27:53 +00:00
Jim Meyering
9ecc0c5517 . 1997-08-31 15:21:13 +00:00
Jim Meyering
83e5d2b29b (libfu_a_SOURCES): Add oa-hash.c.
(noinst_HEADERS): Add oa-hash.h.
1997-08-31 15:20:57 +00:00
Jim Meyering
fffe6020aa *** empty log message *** 1997-08-31 13:10:35 +00:00
Jim Meyering
e7eb4ca699 . 1997-08-31 13:09:27 +00:00
Jim Meyering
e5c36df55c (EXTRA_DIST): Add d-ino.m4 and d-type.m4. 1997-08-31 13:09:01 +00:00
Jim Meyering
0f3d7f59a9 [!STDC_HEADERS]: Declare malloc. 1997-08-31 13:00:00 +00:00
Jim Meyering
c3cdbb8d3f (change_file_mode): Call describe_change with a 3-state argument.
(describe_change): Report whether the operation was successful,
a failure, or that the request was a no-op.
Before, running `chmod --verb u-r /' as non-root reported
  mode of / changed to 0355 (-wxr-xr-x)
  chmod: /: Not owner
Reported by Philippe Schnoebelen <phs@hobbes.fing.edu.uy>
1997-08-31 12:57:15 +00:00
Jim Meyering
2a1bb90a7e *** empty log message *** 1997-08-31 12:54:14 +00:00
Jim Meyering
2f1095be00 *** empty log message *** 1997-08-31 12:36:07 +00:00
Jim Meyering
72a9275f65 *** empty log message *** 1997-08-24 21:06:00 +00:00
Jim Meyering
92715a3867 . 1997-08-24 20:56:13 +00:00
Jim Meyering
4a3c8c53e3 *** empty log message *** 1997-08-24 20:55:56 +00:00
Jim Meyering
1f3b5a3dd8 *** empty log message *** 1997-08-24 20:51:07 +00:00
Jim Meyering
a1d61ec70e *** empty log message *** 1997-08-24 20:50:16 +00:00
Jim Meyering
c83761c759 . 1997-08-24 20:42:54 +00:00
Jim Meyering
88eb1da1da . 1997-08-24 20:30:06 +00:00
Jim Meyering
6b099582bd . 1997-08-24 19:18:03 +00:00
Jim Meyering
fada8884a3 update from glibc 1997-08-22 14:55:01 +00:00
Jim Meyering
2fc81ec762 . 1997-08-18 20:03:36 +00:00
Jim Meyering
b5ef7a4be7 (show_date): Don't hang if strftime produces an empty string. 1997-08-18 19:50:35 +00:00
Jim Meyering
41347fc40e *** empty log message *** 1997-08-16 17:41:45 +00:00
Jim Meyering
2bd0aa26c2 *** empty log message *** 1997-08-16 17:40:57 +00:00
Jim Meyering
962cb92146 *** empty log message *** 1997-08-16 17:39:59 +00:00
Jim Meyering
db00e4acb1 *** empty log message *** 1997-08-16 16:41:15 +00:00
Jim Meyering
754478c6f5 . 1997-08-16 16:40:55 +00:00
Jim Meyering
caa34fb806 . 1997-08-16 12:25:56 +00:00
Jim Meyering
aad3038b71 (mode_create_from_ref): Remove dcl of unused local, I. 1997-08-03 20:28:45 +00:00
Jim Meyering
a4def0664d . 1997-08-03 17:53:25 +00:00
Jim Meyering
8075bc7e8a s/\<_ (/_(/g 1997-08-03 02:49:43 +00:00
Jim Meyering
c710dafd38 . 1997-08-03 02:07:58 +00:00
Jim Meyering
dc16b600a5 *** empty log message *** 1997-08-03 02:07:26 +00:00
Jim Meyering
c091f9835b indent 1997-08-03 02:04:28 +00:00
Jim Meyering
6993b5780b . 1997-08-03 01:54:34 +00:00
Jim Meyering
6e08ff4f71 *** empty log message *** 1997-08-02 17:36:07 +00:00
Jim Meyering
6df8557d33 . 1997-08-02 17:32:04 +00:00
Jim Meyering
9608d12c39 *** empty log message *** 1997-08-02 17:31:01 +00:00
Jim Meyering
dd9b964694 *** empty log message *** 1997-08-02 17:21:18 +00:00
Jim Meyering
b8f7d0087d *** empty log message *** 1997-08-02 17:20:39 +00:00
Jim Meyering
70611589b3 . 1997-08-02 17:10:12 +00:00
Jim Meyering
94c7a45d8e *** empty log message *** 1997-08-02 16:51:37 +00:00
Jim Meyering
9a012ca907 . 1997-08-02 15:29:55 +00:00
Jim Meyering
9bb6fc54aa . 1997-08-02 15:25:25 +00:00
Jim Meyering
eb1e691d00 . 1997-08-02 15:23:59 +00:00
Jim Meyering
45764b9af2 Remove @code{} from node names. 1997-07-30 16:31:56 +00:00
Jim Meyering
fb1e26800f . 1997-07-29 03:08:13 +00:00
Jim Meyering
910502b044 Add new option: --reference=FILE. 1997-07-29 03:05:45 +00:00
Jim Meyering
2ff9982e42 Add new option: --reference=FILE. 1997-07-29 03:04:58 +00:00
Jim Meyering
f6e8b41a5f (mode_create_from_ref): Don't use umask.
Don't use MODE_X_IF_ANY_X.
1997-07-29 03:03:49 +00:00
Jim Meyering
42e5deb36c (usage): tweak -p descr 1997-07-29 02:55:45 +00:00
Jim Meyering
8bff24291a *** empty log message *** 1997-07-29 02:30:55 +00:00
Jim Meyering
16340bfef0 . 1997-07-29 02:30:34 +00:00
Jim Meyering
fa5f24c4c6 *** empty log message *** 1997-07-29 02:06:33 +00:00
Jim Meyering
b78d012e9d Declare pointer parameters const as appropriate. 1997-07-29 02:06:25 +00:00
Jim Meyering
43e8e1245e (main): New option --preserve-timestamps (-p).
(install_file_in_file): Change timestamps if requested.
(change_timestamps): New function.
(usage): Describe --preserve-timestamps.
Correct --mode description.
From Galen Hazelwood.
1997-07-29 01:57:24 +00:00
Jim Meyering
8569f8ffa9 replace with new version from libc 1997-07-26 02:55:14 +00:00
Jim Meyering
821c3f6fda use Cambridge, Mass example, not Azores one 1997-07-25 12:47:34 +00:00
Jim Meyering
e36d0b9d89 big patch from Paul Eggert 1997-07-25 12:43:58 +00:00
Jim Meyering
720e3dc89a *** empty log message *** 1997-07-22 01:37:42 +00:00
Jim Meyering
4fcb103952 *** empty log message *** 1997-07-22 01:36:06 +00:00
Jim Meyering
a267b98f43 *** empty log message *** 1997-07-22 01:27:45 +00:00
Jim Meyering
afc73d862b (parse_obsolescent_option): #ifdef-out portability warning. 1997-07-22 01:26:35 +00:00
Jim Meyering
9a1113585f *** empty log message *** 1997-07-22 01:16:55 +00:00
Jim Meyering
f1ee29eac3 (checkfp): tweak comment 1997-07-19 15:08:53 +00:00
Jim Meyering
1bc1e233ca *** empty log message *** 1997-07-19 15:05:08 +00:00
Jim Meyering
dddf0d13df (checkfp): Print the `disorder' message. Include both
the number and the contents of the first out-of-order line, in addition
to the file name.  Change meaning of return value.
(check): Don't print disorder message here.
Adjust test of checkfp's return value.
Feature suggestion from Karl Heuer.
1997-07-19 15:04:59 +00:00
Jim Meyering
b9551de86a *** empty log message *** 1997-07-19 15:02:19 +00:00
Jim Meyering
5bd6c2209a *** empty log message *** 1997-07-19 13:38:57 +00:00
Jim Meyering
08bc7404bc This means that if multiple users are given on the command line, the
error return code is that of the last, so earlier failures can't be
detected.
1997-07-16 13:46:53 +00:00
Jim Meyering
78b6253dea *** empty log message *** 1997-07-16 12:55:40 +00:00
Jim Meyering
10055f8398 *** empty log message *** 1997-07-16 12:55:05 +00:00
Jim Meyering
1a91d3ecc2 *** empty log message *** 1997-07-16 12:52:00 +00:00
Jim Meyering
74ed7c9f94 Exit with status from `id' command.
Don't print `$name : $groups' if id fails.
Reported by Austin Donnelly.
1997-07-16 12:49:36 +00:00
Jim Meyering
f46c35a744 *** empty log message *** 1997-07-15 14:12:45 +00:00
Jim Meyering
f574936f77 correct cpp-indentation 1997-07-15 14:05:07 +00:00
Jim Meyering
8abf2733e0 Merge with FSF. 1997-07-15 14:03:22 +00:00
Jim Meyering
8c6a8c7743 tweak again 1997-07-14 18:32:12 +00:00
Jim Meyering
197d78d428 new version from kb, with patch 1997-07-14 18:15:50 +00:00
Jim Meyering
64c3a36a0e . 1997-07-14 15:43:25 +00:00
Jim Meyering
bf72a762d8 . 1997-07-14 15:42:30 +00:00
Jim Meyering
78364faa8b . 1997-07-14 15:42:10 +00:00
Jim Meyering
92435ee51b . 1997-07-14 15:37:48 +00:00
Jim Meyering
589e18a1f7 Tweak new examples based on Karl B.s suggestions. 1997-07-14 14:41:16 +00:00
Jim Meyering
566451e5be remove fixme 1997-07-13 23:37:57 +00:00
Jim Meyering
8ea7459457 (EXTRA_DIST): Remove explicit mention of texinfo.texi.
Now, automake includes it automatically.
1997-07-13 23:20:39 +00:00
Jim Meyering
3a58489962 . 1997-07-13 23:03:49 +00:00
Jim Meyering
3ef794ff5f turn off losing tests 1997-07-13 23:03:31 +00:00
Jim Meyering
e30da6776c *** empty log message *** 1997-07-13 22:50:19 +00:00
Jim Meyering
a33a897f29 *** empty log message *** 1997-07-13 22:49:39 +00:00
Jim Meyering
f43d9ab8a6 *** empty log message *** 1997-07-13 22:06:36 +00:00
Jim Meyering
8acf7844dc *** empty log message *** 1997-07-13 22:04:17 +00:00
Jim Meyering
a3adba60c8 . 1997-07-13 21:59:43 +00:00
Jim Meyering
25ec733e8d Include xstrtoul.h.
Remove global variable, unit_size.
(atou): Remove now-unused function.
(parse_unit): Likewise.
(string_to_ull): New function.
(head): Take new parameter, count_lines.  Use it instead of unit_size.
Update callers.
(head_file): Likewise.
(main): Use string_to_ull, not atou/parse_unit.
1997-07-13 21:59:34 +00:00
Jim Meyering
08e6bd4da0 *** empty log message *** 1997-07-13 20:38:15 +00:00
Jim Meyering
7c97f17f9b *** empty log message *** 1997-07-13 20:27:15 +00:00
Jim Meyering
5b0298d2b5 . 1997-07-13 19:47:00 +00:00
Jim Meyering
7e73237bac . 1997-07-13 19:45:14 +00:00
Jim Meyering
8568fe543b . 1997-07-13 16:36:10 +00:00
Jim Meyering
1c9c4d7230 More tests -- add TZ-free equivalents. 1997-07-13 16:36:04 +00:00
Jim Meyering
3e129adac4 add ``First, a quote:'' 1997-07-13 15:08:31 +00:00
Jim Meyering
8f6f2a4cc1 don't include error.h. 1997-07-13 13:31:30 +00:00
Jim Meyering
4f110142bb *** empty log message *** 1997-07-13 04:28:05 +00:00
Jim Meyering
23497d87b7 (DISTFILES): Remove ChangeLog. 1997-07-13 04:27:57 +00:00
Jim Meyering
73f3647fe2 . 1997-07-13 04:25:15 +00:00
Jim Meyering
a305c4a189 . 1997-07-13 04:13:53 +00:00
Jim Meyering
b05ff2249b Rename lots of `this' locals.
Make some parameters `const'.
(who): Update read_utmp caller.
(search_entries): Take additional param: utmp_buf.
Update read_utmp caller.
(who_am_i): Update read_utmp caller.
1997-07-13 04:13:40 +00:00
Jim Meyering
7fe4db1451 (users): Update read_utmp caller. 1997-07-13 03:57:00 +00:00
Jim Meyering
393e4a8c36 (uptime): Update read_utmp caller. 1997-07-13 03:56:29 +00:00
Jim Meyering
aba02b5978 (PARAMS): Update prototype.
(utmp_contents): Remove dcl.
1997-07-13 03:55:38 +00:00
Jim Meyering
708d4a74de (read_utmp): Take new params: count and buffer.
Return boolean indicating failure.
Now, caller must give diagnostic upon.
1997-07-13 03:54:00 +00:00
Jim Meyering
6e1340462e Add FIXME.
indent
1997-07-13 03:13:09 +00:00
Jim Meyering
aeea923e99 indent 1997-07-13 03:10:15 +00:00
Jim Meyering
d461077920 indent 1997-07-13 03:08:45 +00:00
Jim Meyering
d0c515b45c indent 1997-07-13 03:07:36 +00:00
Jim Meyering
4b84ea8745 indent 1997-07-13 02:58:35 +00:00
Jim Meyering
51a0fa60c8 . 1997-07-13 02:54:48 +00:00
Jim Meyering
2d8c67c7d5 *** empty log message *** 1997-07-13 02:54:28 +00:00
Jim Meyering
ad0f8c9b71 (uptime): rename users to n_users 1997-07-13 02:52:58 +00:00
Jim Meyering
67fe78f11c declare xmalloc
(users): rename users to n_users
1997-07-13 02:52:24 +00:00
Jim Meyering
b18c5abf1c (who): rename users to n_users 1997-07-13 02:51:34 +00:00
Jim Meyering
59f66af0f4 . 1997-07-13 02:49:39 +00:00
Jim Meyering
4cf5b77561 . 1997-07-13 02:19:46 +00:00
Jim Meyering
65738c9162 . 1997-07-13 02:18:14 +00:00
Jim Meyering
6341f011d7 . 1997-07-13 02:17:51 +00:00
Jim Meyering
558f0fa3ea revert to previous version 1997-07-12 23:16:59 +00:00
Jim Meyering
7673378e0a *** empty log message *** 1997-07-12 23:01:17 +00:00
Jim Meyering
97fca9a840 *** empty log message *** 1997-07-12 22:56:55 +00:00
Jim Meyering
f124c131af *** empty log message *** 1997-07-12 22:55:13 +00:00
Jim Meyering
ee81a6190f *** empty log message *** 1997-07-12 22:53:07 +00:00
Jim Meyering
d1a07e1ad2 (MAYBE_SET_TZ_UTC0): New macro.
(set_tz): New function.
(batch_convert): If necessary, save the initial value of TZ and
for each date in the file, restore it before each call to get_date,
then set it to UTC0 before each show_date call.
(main): Don't set TZ before calling get_date.
Set TZ after get_date call and before show_date call.
Reported by Matthew Braun.
1997-07-12 22:52:57 +00:00
Jim Meyering
3dcfda7bda . 1997-07-12 22:32:21 +00:00
Jim Meyering
3f275a59a5 add a --file test 1997-07-12 22:32:12 +00:00
Jim Meyering
67132b480f Add a few more date examples. Prompted by question from Galen H. 1997-07-12 22:10:03 +00:00
Jim Meyering
d9921abba7 . 1997-07-12 21:59:08 +00:00
Jim Meyering
626e48dcca . 1997-07-12 21:57:51 +00:00
Jim Meyering
f1994a3f6e *** empty log message *** 1997-07-12 21:57:38 +00:00
Jim Meyering
b6a57ff354 add date2sec and sec2date from the manual 1997-07-12 21:56:35 +00:00
Jim Meyering
0e6b6d4c5c add utc-1 1997-07-12 21:07:26 +00:00
Jim Meyering
309b8c57fb *** empty log message *** 1997-07-12 20:34:34 +00:00
Jim Meyering
a3294a01b0 *** empty log message *** 1997-07-11 16:07:52 +00:00
Jim Meyering
204f6064e5 remove `minimally' 1997-07-11 16:07:29 +00:00
Jim Meyering
17ca5d8c74 remove `minimally' 1997-07-11 16:07:06 +00:00
Jim Meyering
4a2df8ccf5 new one from Karl 1997-07-11 15:27:19 +00:00
Jim Meyering
2d1baaeb31 *** empty log message *** 1997-07-10 18:30:08 +00:00
Jim Meyering
1a2964b988 *** empty log message *** 1997-07-10 18:29:27 +00:00
Jim Meyering
4170f6416d . 1997-07-10 18:25:12 +00:00
Jim Meyering
735847657b *** empty log message *** 1997-07-10 18:25:05 +00:00
Jim Meyering
8d6318c532 . 1997-07-10 17:32:31 +00:00
Jim Meyering
36df273199 . 1997-07-10 17:31:40 +00:00
Jim Meyering
1db47deedb . 1997-07-10 17:31:29 +00:00
Jim Meyering
d6bdaed4c0 . 1997-07-10 17:30:50 +00:00
Jim Meyering
1481657ca1 . 1997-07-10 17:29:09 +00:00
Jim Meyering
99f8939150 *** empty log message *** 1997-07-10 16:19:13 +00:00
Jim Meyering
45eb103e4c convert obsolescent tests to posix-style ones 1997-07-10 16:16:17 +00:00
Jim Meyering
990c0d0fad Include $0 in `wrong number of elements...' message. 1997-07-10 15:56:33 +00:00
Jim Meyering
9295c4fdca Remove $. from duplicate test name message 1997-07-10 15:56:09 +00:00
Jim Meyering
41c1791ddd *** empty log message *** 1997-07-10 15:38:43 +00:00
Jim Meyering
c8fbd48706 *** empty log message *** 1997-07-10 15:35:01 +00:00
Jim Meyering
ccd911b026 . 1997-07-10 15:34:31 +00:00
Jim Meyering
deb5b314a5 . 1997-07-10 15:26:51 +00:00
Jim Meyering
c23aa46af6 *** empty log message *** 1997-07-09 21:14:40 +00:00
Jim Meyering
8dfdbd327c . 1997-07-09 18:11:59 +00:00
Jim Meyering
49ec273bd5 . 1997-07-09 18:03:56 +00:00
Jim Meyering
b09226e1b4 *** empty log message *** 1997-07-09 18:03:12 +00:00
Jim Meyering
d68871bdec (make_path): Chdir to `/' before starting if necessary.
Call save_cwd before while loop rather than from first iteration inside it.
1997-07-09 18:02:07 +00:00
Jim Meyering
6b544d3d8a . 1997-07-09 17:57:48 +00:00
Jim Meyering
2624654a78 (strverscmp): Add `parenentheses around arithmetic in operand of |'
as suggested by gcc -Wall.
1997-07-09 15:55:41 +00:00
Jim Meyering
2d3d80a3f2 indent 1997-07-09 15:42:54 +00:00
Jim Meyering
f6ffa56bc6 fix typo in comment 1997-07-09 15:33:27 +00:00
Jim Meyering
8d71f2bb2d . 1997-07-09 15:32:31 +00:00
Jim Meyering
a9309ad872 . 1997-07-09 15:31:29 +00:00
Jim Meyering
bc1634bc1a *** empty log message *** 1997-07-09 15:30:22 +00:00
Jim Meyering
6da5f51d3a . 1997-07-09 15:28:14 +00:00
Jim Meyering
a8068a365d *** empty log message *** 1997-07-09 15:28:01 +00:00
Jim Meyering
29e0df8652 . 1997-07-09 15:21:03 +00:00
Jim Meyering
f9f695018a *** empty log message *** 1997-07-09 14:21:30 +00:00
Jim Meyering
64320d0470 . 1997-07-09 14:20:14 +00:00
Jim Meyering
5e0ce74b1d . 1997-07-09 14:18:57 +00:00
Jim Meyering
47489a5b27 *** empty log message *** 1997-07-09 14:16:44 +00:00
Jim Meyering
a5d528d3d7 *** empty log message *** 1997-07-09 14:12:13 +00:00
Jim Meyering
3358aeb5d3 . 1997-07-09 14:05:31 +00:00
Jim Meyering
bc16e65a8e *** empty log message *** 1997-07-09 14:05:22 +00:00
Jim Meyering
6bb8c4e904 Add comments. 1997-07-09 14:00:27 +00:00
Jim Meyering
89743fce5c *** empty log message *** 1997-07-08 23:20:50 +00:00
Jim Meyering
8f19e15873 *** empty log message *** 1997-07-08 23:06:36 +00:00
Jim Meyering
c2f3a114a8 *** empty log message *** 1997-07-08 23:05:32 +00:00
Jim Meyering
ba6af15f00 *** empty log message *** 1997-07-08 23:04:58 +00:00
Jim Meyering
0c073269a5 . 1997-07-08 23:00:29 +00:00
Jim Meyering
4e9441a1e7 . 1997-07-08 22:44:58 +00:00
Jim Meyering
c2b8fe4acf . 1997-07-08 22:43:38 +00:00
Jim Meyering
f3a329069e (mode_create_from_ref): New function. 1997-07-06 21:28:04 +00:00
Jim Meyering
244fb561f8 (mode_create_from_ref): Add prototype.
(MODE_MASK_ALL): New define.
(MODE_BAD_REFERENCE): New define.
1997-07-06 21:27:44 +00:00
Jim Meyering
2cd9474cb6 (getuidbyname): Declare parameter to be const.
(getgidbyname): Declare parameter to be const.
1997-07-06 21:27:07 +00:00
Jim Meyering
abd1bad4b6 (noinst_HEADERS): Add strverscmp.h. 1997-07-06 21:25:57 +00:00
Jim Meyering
f066a3acfe . 1997-07-06 21:25:19 +00:00
Jim Meyering
83c3f08048 declare stpcpy 1997-07-06 21:24:10 +00:00
Jim Meyering
d0caad54ae Add new option: --sort=version (-v). 1997-07-06 21:23:42 +00:00
Jim Meyering
f873ad6e6c (libfu_a_SOURCES): Add strverscmp.c.
(noinst_HEADERS): Add strverscmp.h.
1997-07-06 14:47:50 +00:00
Jim Meyering
0c5e6d93cd *** empty log message *** 1997-07-06 13:52:12 +00:00
Jim Meyering
2b0ecc7fa5 (print_long_format): Reflect changes in semantics of getuser, getgroup. 1997-07-06 13:51:16 +00:00
Jim Meyering
afe6283539 (getuser): Return NULL (rather than stringified uid) upon lookup failure.
(getgroup): Likewise.
(getuidbyname) [NOT_USED]: #ifdef-out unused function.
(getgidbyname) [NOT_USED]: #ifdef-out unused function.
1997-07-06 13:50:29 +00:00
Jim Meyering
0735c835a9 Change some #ifdef to #if.
Indent a cpp directive.
1997-07-06 11:57:38 +00:00
Jim Meyering
a1cf1abf4d *** empty log message *** 1997-07-05 22:52:33 +00:00
Jim Meyering
1fca2b262a *** empty log message *** 1997-07-05 22:50:58 +00:00
Jim Meyering
08f38fd930 (parse_obsolescent_option): If POSIXLY_CORRECT is set, give
a diagnostic and fail when there are two or more non-option arguments.
1997-07-05 22:50:32 +00:00
Jim Meyering
573588283f . 1997-07-05 13:24:11 +00:00
Jim Meyering
8e14d7accc *** empty log message *** 1997-07-05 13:23:18 +00:00
Jim Meyering
77ef7e08a7 *** empty log message *** 1997-07-05 08:26:21 +00:00
Jim Meyering
ac0ee614d6 Redefine/undef getusershell around inclusion of <unistd.h>
(via system.h) so Cray's int-returning prototype doesn't conflict
with our char*-returning one.
1997-07-05 08:25:58 +00:00
Jim Meyering
8e04be3e8d . 1997-07-04 23:05:22 +00:00
Jim Meyering
4369606f15 regenerate with updated mk-script 1997-07-04 23:04:21 +00:00
Jim Meyering
f014f4f60f *** empty log message *** 1997-07-04 19:12:34 +00:00
Jim Meyering
581b1540f5 Redirect output of cmp to /dev/null. 1997-07-04 19:12:25 +00:00
Jim Meyering
a7da25a2bb *** empty log message *** 1997-07-04 19:05:12 +00:00
Jim Meyering
14608042dd . 1997-07-04 19:01:55 +00:00
Jim Meyering
f8bedd0047 . 1997-07-04 15:02:30 +00:00
Jim Meyering
4d8f9c4929 regenerate with updated ../Makefile.am.in 1997-07-04 15:02:06 +00:00
Jim Meyering
1e80216861 regenerate with updated mk-script 1997-07-04 15:01:57 +00:00
Jim Meyering
b541bff3de . 1997-07-04 15:01:06 +00:00
Jim Meyering
bea4748f5c regenerate with updated mk-script 1997-07-04 14:43:55 +00:00
Jim Meyering
19d151cbbd regenerate with updated ../Makefile.am.in 1997-07-04 14:43:06 +00:00
Jim Meyering
d61ab3fc24 . 1997-07-04 14:42:16 +00:00
Jim Meyering
70cfca742f *** empty log message *** 1997-07-04 08:20:55 +00:00
Jim Meyering
677ddac432 (validate): Create test files in $(srcdir), not in build dir. 1997-07-04 08:09:15 +00:00
Jim Meyering
93b02c5289 *** empty log message *** 1997-07-04 07:53:28 +00:00
Jim Meyering
22ff29fe3e (apply_attributes): New function.
(copy_reg): Use apply_attributes instead of open-coding the pieces.
Now, failure to preserve file attributes does not cause mv to change
its exit status, and such failures elicit warning diagnostics.  This
behavior is required by POSIX.  Before, failure to preserve ownership
due to insufficient access was diagnosed only for root.
Prompted by a report from Bengt Martensson.
1997-07-03 12:16:41 +00:00
Jim Meyering
ab171ee6b5 *** empty log message *** 1997-07-03 12:13:31 +00:00
Jim Meyering
c86d0a7a45 *** empty log message *** 1997-07-03 10:29:48 +00:00
Jim Meyering
4396edc12e (test_vector): Remove bogus TZ=GMT environment setting. 1997-07-03 10:28:51 +00:00
Jim Meyering
442d670b3a . 1997-07-02 16:09:39 +00:00
Jim Meyering
7a280a0fda (STRTOX): Convert function header in macro definition
to K&R-style.  Otherwise, ansi2knr would fail to convert the function
definitions to K&R for old style compilers.  From Kaveh Ghazi.
1997-07-02 16:07:44 +00:00
Jim Meyering
df05506016 *** empty log message *** 1997-07-01 11:55:55 +00:00
Jim Meyering
b3580d0a75 . 1997-07-01 11:50:44 +00:00
Jim Meyering
2499628bff (make_path): Reorder stat-then-mkdir-if-missing
calls so that mkdir is called first.  Before make_path would first
`stat' a directory, then call mkdir if it didn't exist.  But if
some other process created the directory between the stat & mkdir,
the mkdir would fail with EEXIST.  Diagnosis and suggestion from
Greg McGary.
1997-07-01 11:50:39 +00:00
Jim Meyering
b5e0f033a6 *** empty log message *** 1997-07-01 11:50:08 +00:00
Jim Meyering
059ccb6ac7 [putenv]: Undefine before including system headers.
Otherwise, the declaration of *rpl_putenv* conflicts with the system
prototype on at least Irix5.3.  From Marcus Daniels.
1997-07-01 11:30:08 +00:00
Jim Meyering
5f14bb768e *** empty log message *** 1997-06-30 04:00:48 +00:00
Jim Meyering
7f490dad0e . 1997-06-30 03:53:28 +00:00
Jim Meyering
3e81211212 . 1997-06-30 01:58:23 +00:00
Jim Meyering
3f0b15ac80 *** empty log message *** 1997-06-29 22:26:54 +00:00
Jim Meyering
41faa55aed (base_name_strip_trailing_slashes): Remove. 1997-06-29 22:26:18 +00:00
Jim Meyering
04c0cd59a5 (base_name_strip_trailing_slashes): new function. 1997-06-29 22:25:54 +00:00
Jim Meyering
6ad0d51107 (copy): Add FIXME comment. 1997-06-29 22:24:26 +00:00
Jim Meyering
bc8c5033e3 *** empty log message *** 1997-06-29 22:21:51 +00:00
Jim Meyering
dc404c4107 (copy_reg): New parameter, SOURCE_STATS.
(do_move): Update caller.
(movefile): Take new boolean parameter, DEST_IS_DIR,
to save a stat per moved file when the destination is a directory.
(main): Call movefile with additional argument.
(strip_trailing_slashes_2): New function.
(movefile): Remove trailing slashes from dest.  Otherwise, stat ("b/")
fails with ENOTDIR on systems including Linux w/libc 2.0.30.
Reproduce with `rm -rf a b; mkdir a; touch b; ./mv a b/'.
(do_move): Fix misleading comment.
1997-06-29 22:21:42 +00:00
Jim Meyering
e44678aac2 *** empty log message *** 1997-06-29 21:24:26 +00:00
Jim Meyering
42a63be148 *** empty log message *** 1997-06-29 21:13:33 +00:00
Jim Meyering
1226259896 Remove _sys_putenv cruft and just rename the function itself. 1997-06-29 21:05:05 +00:00
Jim Meyering
cabc10b909 *** empty log message *** 1997-06-29 20:26:38 +00:00
Jim Meyering
90e9fd9c77 . 1997-06-29 20:24:27 +00:00
Jim Meyering
0935e2ce3f *** empty log message *** 1997-06-29 20:21:38 +00:00
Jim Meyering
611cf8e97b *** empty log message *** 1997-06-29 20:19:45 +00:00
Jim Meyering
3d9239c750 fix it right 1997-06-29 20:18:58 +00:00
Jim Meyering
551c02f7b6 Define-away putenv only if it's not already defined. 1997-06-29 20:12:52 +00:00
Jim Meyering
90c131fa21 . 1997-06-29 13:52:16 +00:00
Jim Meyering
a6b6c95b83 *** empty log message *** 1997-06-29 13:50:57 +00:00
Jim Meyering
25c1d1dccd *** empty log message *** 1997-06-29 13:49:53 +00:00
Jim Meyering
d9741142c8 . 1997-06-29 13:34:51 +00:00
Jim Meyering
a84d2bada4 Set and export LANGUAGE, LC_ALL, and LANG
so tests get english strings.  From Ulrich Drepper.
1997-06-29 12:19:43 +00:00
Jim Meyering
9654920c40 . 1997-06-29 03:27:24 +00:00
Jim Meyering
a13135d09e Move the OPENOPTS def from end to beginning of else clause so it's closer
to the one in the then clause.
1997-06-29 01:56:36 +00:00
Jim Meyering
f657d65570 update from automake-1.2 1997-06-25 17:05:56 +00:00
Jim Meyering
9bcfe15afe . 1997-06-25 17:01:22 +00:00
Jim Meyering
4378dcecdf . 1997-06-25 16:08:03 +00:00
Jim Meyering
fa4894b30c . 1997-06-25 15:38:35 +00:00
Jim Meyering
6700c89ac7 Use variable width columns when printing in multi-column mode.
(init_col_info): New function.
(print_current_files): Call init_col_info if format is
`many_per_line' or `horizontal'.
(print_many_per_line): Calculate optimum column widths.
(print_horizontal): Likewise.
From Ulrich Drepper.
1997-06-22 19:52:24 +00:00
Jim Meyering
d18dc59619 *** empty log message *** 1997-06-22 04:04:07 +00:00
Jim Meyering
973f13ccb2 . 1997-06-22 04:01:43 +00:00
Jim Meyering
e148f6d293 . 1997-06-22 03:51:36 +00:00
Jim Meyering
3841b591c1 . 1997-06-22 03:50:14 +00:00
Jim Meyering
e8b0678fed . 1997-06-22 03:49:51 +00:00
Jim Meyering
08f074fb34 *** empty log message *** 1997-06-22 03:38:08 +00:00
Jim Meyering
2f91f08a79 . 1997-06-22 03:32:37 +00:00
Jim Meyering
9bf8c1c229 . 1997-06-16 18:02:08 +00:00
Jim Meyering
504b9fe47a . 1997-06-16 18:01:32 +00:00
Jim Meyering
57f7889059 comment 1997-06-16 17:50:23 +00:00
Jim Meyering
8b4d49fc79 . 1997-06-16 17:42:33 +00:00
Jim Meyering
a6526f2171 (eval6): Accept new unary operator, quote.
From Karl Heuer.
1997-06-16 17:01:24 +00:00
Jim Meyering
bfc9115ee5 *** empty log message *** 1997-06-16 16:58:28 +00:00
Jim Meyering
5e3188fba4 . 1997-06-16 16:57:55 +00:00
Jim Meyering
57c0f5cfff (EXTRA_DIST): Add putenv.m4. 1997-06-16 16:57:02 +00:00
Jim Meyering
19342feca7 . 1997-06-16 16:45:15 +00:00
Jim Meyering
7b097c0e37 add copyright 1997-06-16 16:15:30 +00:00
Jim Meyering
952a76e506 tweak error message 1997-06-16 16:12:04 +00:00
Jim Meyering
0dcca900cc (full_write): Add comment regarding failure due to bug in
Linux Slackware 1.2.13 kernel.
1997-06-15 15:06:52 +00:00
Jim Meyering
ab029fd3e5 . 1997-06-15 13:35:02 +00:00
Jim Meyering
acdc74dbf5 Rewrite using save-cwd.c and chdir to remove quadratic component of complexity.
Before, it processed O(n^2) directory name components via stat and mkdir.
Now it's O(n).  This makes mkdir -p a lot more efficient when creating
directories with very many components.  On a Linux 2.0.30 ext2fs filesystem
this command: mkdir -p `perl -e 'print "a/" x 500'`  now runs in 0.77 seconds
(user+sys).  Contrast that with the 9.5(!) seconds it took before.
1997-06-15 13:34:47 +00:00
Jim Meyering
1830d29be9 Add test that -o 0 works. 1997-06-15 11:47:46 +00:00
Jim Meyering
3b4748d124 *** empty log message *** 1997-06-15 11:42:55 +00:00
Jim Meyering
50e65a424c (init_header) [T_BUF_FMT]: Output the 4-digit year (not the
2-digit abbreviation) in each page header.  Reported by Noah Friedman.
1997-06-15 11:40:47 +00:00
Jim Meyering
aca4091fae *** empty log message *** 1997-06-14 19:33:13 +00:00
Jim Meyering
2add756624 *** empty log message *** 1997-06-14 17:32:00 +00:00
Jim Meyering
2f1768f676 (cut_fields): Detect when the input is empty and handle
that special case.  Before `cut -f1 </dev/null' would improperly
output a single newline.  Reported by Phil Richards.
1997-06-14 17:31:40 +00:00
Jim Meyering
4f0bef5377 . 1997-06-14 16:45:00 +00:00
Jim Meyering
4dc1f7070b . 1997-06-14 16:36:22 +00:00
Jim Meyering
63ca47adfc proof reading from kb 1997-06-13 16:07:12 +00:00
Jim Meyering
c8460daf24 . 1997-06-12 16:40:53 +00:00
Jim Meyering
a6062bfb05 document expr's new quote operator 1997-06-12 16:32:08 +00:00
Jim Meyering
83461932b5 *** empty log message *** 1997-06-12 15:07:26 +00:00
Jim Meyering
23c6ab8674 *** empty log message *** 1997-06-12 15:07:05 +00:00
Jim Meyering
25f6a4a7c0 remove blank line at end and add copyright
tweak cpp indentation
1997-06-12 12:58:47 +00:00
Jim Meyering
8eebff2029 *** empty log message *** 1997-06-12 11:51:11 +00:00
Jim Meyering
6ecad0839e (eval6): Accept new unary operator, quote. From Karl Heuer. 1997-06-12 11:50:58 +00:00
Jim Meyering
9fb965dfd8 Add comment for posixly_correct. 1997-06-12 11:47:34 +00:00
Jim Meyering
bcdaf2c1a5 fix typo in expr/index doc.
from kwzh
1997-06-12 11:27:04 +00:00
Jim Meyering
e737958ebb . 1997-06-11 20:19:30 +00:00
Jim Meyering
44df08ee55 *** empty log message *** 1997-06-11 20:19:23 +00:00
Jim Meyering
8406b91aba (docolon): Test (re_buffer.re_nsub > 0) rather than
searching for `\(' to determine whether to return 0 or the empty
string.  Before it would improperly return '' if the pattern
contained a substring like this: `\\('.  From Karl Heuer.
For example, running expr c : '\\(' should print `0'.
1997-06-11 20:18:15 +00:00
Jim Meyering
2078f2391e . 1997-06-06 14:30:11 +00:00
Jim Meyering
f442eb2941 . 1997-06-03 20:01:55 +00:00
Jim Meyering
f1390de4c3 [HAVE_UNISTD_H]: Include unistd.h.
John Gatewood Ham reported that this is necessary for DJGPP/Win95.
1997-06-03 20:01:47 +00:00
Jim Meyering
93ede2c8e1 *** empty log message *** 1997-06-03 20:01:14 +00:00
Jim Meyering
ae7a2a007a . 1997-06-02 14:29:50 +00:00
Jim Meyering
1f107588fa . 1997-06-01 18:47:56 +00:00
Jim Meyering
a45a7e3819 . 1997-06-01 17:59:08 +00:00
Jim Meyering
5f0bf654a4 (mk-script): Depend on ../../config.status. 1997-06-01 17:58:27 +00:00
Jim Meyering
985bd80461 . 1997-06-01 17:20:42 +00:00
Jim Meyering
8bb2bf5d28 *** empty log message *** 1997-06-01 17:20:31 +00:00
Jim Meyering
cc167bce98 *** empty log message *** 1997-06-01 17:16:30 +00:00
Jim Meyering
f5291be83e Add tests using `next'. 1997-06-01 17:16:23 +00:00
Jim Meyering
2c0e561933 (OtherTable): Interpret `next' as 1 (not 2) units.
Patch from Richard Sharman <rsharman@magmacom.com>.
1997-06-01 17:15:51 +00:00
Jim Meyering
a488983890 fix for abs pathnames 1997-05-30 14:00:47 +00:00
Jim Meyering
94468e0921 indent cpp directives 1997-05-29 13:20:25 +00:00
Jim Meyering
4377246ee3 update from automake-1.1p 1997-05-29 13:19:34 +00:00
Jim Meyering
6edc738156 correct/normalize indentation in cpp directives 1997-05-28 12:19:28 +00:00
Jim Meyering
4f690a51e3 update from FSF 1997-05-28 12:01:33 +00:00
Jim Meyering
7eaf75e3b1 *** empty log message *** 1997-05-28 11:43:25 +00:00
Jim Meyering
4354caa2d4 (read_filesystem_list): Add `|| defined (__OpenBSD__)'
to the NetBSD #if so OpenBSD also uses the f_fstypename member.
(fstype_to_string): Add `&& !defined (__OpenBSD__)' to the NetBSD #if
expression to exclude this function definition.  OpenBSD 2.1 beta
doesn't need it.  Patch from Hugh Daniel <hugh@ecotone.xanadu.com>
1997-05-28 11:42:29 +00:00
Jim Meyering
106775512b *** empty log message *** 1997-05-28 11:40:16 +00:00
Jim Meyering
72559c0e30 *** empty log message *** 1997-05-27 14:17:08 +00:00
Jim Meyering
437b98461e Don't include backupfile.h. 1997-05-27 14:16:49 +00:00
Jim Meyering
074c7edade *** empty log message *** 1997-05-27 13:55:45 +00:00
Jim Meyering
e4f25ca7b1 Use base_name, not basename. 1997-05-27 13:55:23 +00:00
Jim Meyering
dd547a84bf . 1997-05-27 12:50:39 +00:00
Jim Meyering
bc50ceb474 clean up for -Wall 1997-05-27 11:05:40 +00:00
Jim Meyering
4c2adcbd56 Use base_name, not basename. 1997-05-27 11:04:41 +00:00
Jim Meyering
f0c27dac9e Use base_name, not basename.
Use X, not CP_OPTIONS.
1997-05-27 11:00:50 +00:00
Jim Meyering
93e9fef09f (libfu_a_SOURCES): Add addext.c.
Remove getversion.c;  get_version is now in backupfile.c.
Add basename.c since it's no longer replacible.
1997-05-27 10:45:34 +00:00
Jim Meyering
187f712b73 *** empty log message *** 1997-05-27 10:39:22 +00:00
Jim Meyering
aa8b6cf83c Change dcl of program_name so it doesn't conflict with the ubiquitous char* one. 1997-05-27 10:39:10 +00:00
Jim Meyering
46a9863033 . 1997-05-27 10:31:04 +00:00
Jim Meyering
c213bae308 Update from patch-2.2.93. 1997-05-27 10:30:45 +00:00
Jim Meyering
ca55ba3715 Update from FSF via patch-2.2.93. 1997-05-27 09:41:25 +00:00
Jim Meyering
168eb7758e Update from FSF via patch-2.2.93. 1997-05-27 09:39:25 +00:00
Jim Meyering
96c4c01019 Update from glibc via patch-2.2.93. 1997-05-27 09:38:06 +00:00
Jim Meyering
926c6c3301 *** empty log message *** 1997-05-26 04:46:57 +00:00
Jim Meyering
8805ede31b (copy_internal): When preserving symlinks (--no-dereference) and the
destination file is a symlink, use stat (not xstat) to see if it points
back to the source.  Reported by James <james@albion.glarp.com>.
1997-05-26 04:46:47 +00:00
Jim Meyering
cd29ba84ab *** empty log message *** 1997-05-26 04:43:47 +00:00
Jim Meyering
a65a081656 declare strip_trailing_slashes 1997-05-25 21:25:28 +00:00
Jim Meyering
8b36f9cbcd *** empty log message *** 1997-05-25 21:24:44 +00:00
Jim Meyering
0cc1681a5b Remove global variable opt_human_readable.
(enum Output_units): Rename from output_size.
Rename size_* to Unit_*.
Add Unit_variable to correspond to --human-readable.
(convert_blocks): Remove now-unused definition.
(human_readable): Rename paramater n_bytes to n_blocks.
Adjust conversions to reflect fact that input is now number of
512-byte blocks, not bytes.
(print_size): New function.
(du_files): Use print_size instead of open coding it.
(count_entry): Always count in units of 512-byte blocks to delay.
This lets du accumulate totals corresponding to a terabyte before
overflowing 32-bit long int.
Use print_size instead of open coding it.
1997-05-25 21:23:15 +00:00
Jim Meyering
e3e8f658c4 *** empty log message *** 1997-05-25 15:17:31 +00:00
Jim Meyering
07876bcb5d (convert_blocks): Add definition. 1997-05-25 15:10:03 +00:00
Jim Meyering
11080b7544 (convert_blocks): Remove definition.
Indent cpp directives.
1997-05-25 14:22:55 +00:00
Jim Meyering
1b71b3372e (convert_blocks): Remove now-unnecessary #undef.
(du_files): Pass output_size unchanged to convert_blocks.  No need
to test output_size for size_bytes, convert_blocks handles that
correctly.
(count_entry): Likewise.
1997-05-25 14:21:41 +00:00
Jim Meyering
1bfb2c3ec7 *** empty log message *** 1997-05-25 14:11:59 +00:00
Jim Meyering
1ba34180d7 (main): Implement new --max-depth=N option.
Based on the idea and a patch from Torbjorn Lindgren.
(du_files): Likewise.
(count_entry): Likewise.
[AIX]: Remove unused #pragma alloca.
1997-05-25 14:11:50 +00:00
Jim Meyering
54a61c3cf6 Remove FIXME.
Add spurious curlies and an empty line.
1997-05-25 13:00:01 +00:00
Jim Meyering
f735e157e9 . 1997-05-25 03:47:31 +00:00
Jim Meyering
5708e7bba8 *** empty log message *** 1997-05-25 03:47:21 +00:00
Jim Meyering
6919955eb1 New options: --ignore-fail-on-non-empty and --verbose.
(remove_parents): Implement new options.
(main): Likewise.
1997-05-25 03:46:46 +00:00
Jim Meyering
4f99d359c8 . 1997-05-25 03:15:30 +00:00
Jim Meyering
6fd92cf72b *** empty log message *** 1997-05-24 18:27:46 +00:00
Jim Meyering
2ebfd210cd . 1997-05-24 18:26:59 +00:00
Jim Meyering
d5659aa5e1 . 1997-05-24 18:12:59 +00:00
Jim Meyering
9add219c87 . 1997-05-24 18:11:33 +00:00
Jim Meyering
4d347c9e1f *** empty log message *** 1997-05-24 14:43:51 +00:00
Jim Meyering
90721ff4a4 (read_filesystem_list): Show automount-related
duplicate filesystems only when --all specified.  With suggestions
from Stuart Kemp.
1997-05-24 14:43:21 +00:00
Jim Meyering
1024238089 Indent cpp directives. 1997-05-24 14:42:40 +00:00
Jim Meyering
b0f8e63615 . 1997-05-24 14:31:23 +00:00
Jim Meyering
c8062f789d . 1997-05-24 14:13:55 +00:00
Jim Meyering
3dc7a93409 . 1997-05-24 14:11:19 +00:00
Jim Meyering
59ed92cdcf . 1997-05-23 13:23:49 +00:00
Jim Meyering
d0a506b84b . 1997-05-02 04:02:17 +00:00
Jim Meyering
ccb48f46d6 indent cpp-directives 1997-05-01 20:53:59 +00:00
Jim Meyering
9080de09fc indent cpp-directives 1997-05-01 20:51:16 +00:00
Jim Meyering
44848c0887 update from automake-1.1o 1997-04-29 15:48:14 +00:00
Jim Meyering
f6a1207cf9 . 1997-04-29 15:22:05 +00:00
Jim Meyering
6c04dfc1e1 *** empty log message *** 1997-04-27 23:46:02 +00:00
Jim Meyering
795d254715 (STRTOX): Don't fail because of extra character(s) following a
character constant.  Give the *warning* only if !POSIXLY_CORRECT.
1997-04-27 23:45:57 +00:00
Jim Meyering
e5ce0d8b3e *** empty log message *** 1997-04-27 23:33:54 +00:00
Jim Meyering
9778fd673b (cfcc_msg): File-scope constant.
(STRTOX): Use new constant as error message format string in macro.
Suggestion from Andreas Schwab.
1997-04-27 23:33:49 +00:00
Jim Meyering
3a46eb9695 . 1997-04-27 23:12:01 +00:00
Jim Meyering
3a84136d8c . 1997-04-27 20:18:07 +00:00
Jim Meyering
a77bf7510f *** empty log message *** 1997-04-27 20:13:21 +00:00
Jim Meyering
afdfd95be8 *** empty log message *** 1997-04-27 20:12:16 +00:00
Jim Meyering
3f9d8ee21b . 1997-04-27 19:41:52 +00:00
Jim Meyering
480a5db227 . 1997-04-27 19:41:16 +00:00
Jim Meyering
9874f0eedf changes suggested by kb 1997-04-24 13:00:51 +00:00
Jim Meyering
39361c9d6e patch from Andreas S. 1997-04-21 14:55:26 +00:00
Jim Meyering
7f74dcb1a6 s/;/. in comment to placate francois 1997-04-10 03:46:01 +00:00
Jim Meyering
738818ee66 . 1997-04-07 16:59:43 +00:00
Jim Meyering
90e1281e8e *** empty log message *** 1997-04-07 15:24:38 +00:00
Jim Meyering
907f15c7d6 *** empty log message *** 1997-04-07 15:21:33 +00:00
Jim Meyering
258186e1ce . 1997-04-07 15:10:57 +00:00
Jim Meyering
2e1059b400 . 1997-04-07 15:08:56 +00:00
Jim Meyering
58a9554b17 . 1997-04-07 00:44:33 +00:00
Jim Meyering
ca70b66b72 (STRTOX): New macro to eliminate code duplication.
(xstrtod, xstrtol, xstrtoul): Remove functions.
Use the STRTOX instead.
1997-04-06 20:58:16 +00:00
Jim Meyering
b3f0804efd . 1997-04-06 20:42:00 +00:00
Jim Meyering
ebce57b0e6 *** empty log message *** 1997-04-06 20:36:48 +00:00
Jim Meyering
3426e7ca7a Change most char* dcls to const char*. 1997-04-06 19:32:19 +00:00
Jim Meyering
39b444e420 Reorder functions to obviate forward decls. 1997-04-06 19:30:07 +00:00
Jim Meyering
00ea088ccd . 1997-04-04 03:29:25 +00:00
Jim Meyering
cd45cc7335 (EXTRA_DIST): Update file list. 1997-04-04 03:27:35 +00:00
Jim Meyering
7ecf5ed43b . 1997-04-04 03:18:54 +00:00
Jim Meyering
6d648c45ed Add test from Phil Richards. 1997-04-04 03:18:04 +00:00
Jim Meyering
cc093a9945 (main): Implement new --max-depth=N option.
Based on the idea and a patch from Torbjorn Lindgren.
(du_files): Likewise.
(count_entry): Likewise.
1997-03-27 05:47:56 +00:00
Jim Meyering
3416bdb6e1 *** empty log message *** 1997-03-27 05:45:12 +00:00
Jim Meyering
a37da82c38 . 1997-03-23 21:27:46 +00:00
Jim Meyering
f101a9b57f *** empty log message *** 1997-03-23 21:22:14 +00:00
Jim Meyering
c7b5fd2423 . 1997-03-23 02:56:47 +00:00
Jim Meyering
f1c111d469 *** empty log message *** 1997-03-23 02:30:09 +00:00
Jim Meyering
24ffa56fd0 . 1997-03-22 19:54:32 +00:00
Jim Meyering
e269fcdb28 *** empty log message *** 1997-03-22 06:06:02 +00:00
Jim Meyering
61ac269c6e *** empty log message *** 1997-03-22 06:05:16 +00:00
Jim Meyering
e71f8cf087 *** empty log message *** 1997-03-22 06:03:31 +00:00
Jim Meyering
b524db4e87 *** empty log message *** 1997-03-22 05:58:50 +00:00
Jim Meyering
37e05875d5 *** empty log message *** 1997-03-22 05:58:26 +00:00
Jim Meyering
fcc31060fa . 1997-03-21 03:16:03 +00:00
Jim Meyering
e328e25bd1 . 1997-03-21 03:14:53 +00:00
Jim Meyering
bf435650e1 . 1997-03-21 03:11:55 +00:00
Jim Meyering
cd0aba1c14 . 1997-03-21 03:10:21 +00:00
Jim Meyering
a1e46876c6 . 1997-03-19 02:57:20 +00:00
Jim Meyering
66c246fc17 cpp-indent
Change a few #ifdef to #if.
Remove 3 spurious #ifdef that were guarding an #undef each.
1997-03-19 02:56:54 +00:00
Jim Meyering
fbe78f2ef6 . 1997-03-19 02:12:42 +00:00
Jim Meyering
33da7dcdda (check_format): Rename local, FORMAT_STRING, to avoid shadowing global.
(print_numbers): Likewise.
1997-03-19 02:12:36 +00:00
Jim Meyering
3f2ded808d (idle_string): Rename local, IDLE, to avoid shadowing global. 1997-03-18 23:34:23 +00:00
Jim Meyering
bcdeccb6a3 (log_su): Resort to getpwuid if getlogin fails.
If no tty name is found, use `none' in the log message.
Based on a patch from Galen Hazelwood.
1997-03-18 12:49:20 +00:00
Jim Meyering
808a6a2308 . 1997-03-14 04:14:37 +00:00
Jim Meyering
29e56fa096 . 1997-03-14 04:09:13 +00:00
Jim Meyering
f02b837782 (main): Allow use of 0 (zero) as the margin offset
argument to the -o option.  Patch from Gary Anderson.
1997-03-14 04:06:12 +00:00
Jim Meyering
294ea6ffc2 . 1997-03-14 04:00:19 +00:00
Jim Meyering
c127695e96 (main): Make sure c1 is not -1 before using it as an
array index.  Patch from Greg McGary.  Although this is truly a
bug, I believe it would not cause tr to misbehave on most systems.
I could not construct a test case with which this bug causes tr
to generate invalid output.
1997-03-14 03:59:21 +00:00
Jim Meyering
d713508802 Add test that -o 0 works. 1997-03-14 03:52:10 +00:00
Jim Meyering
c42ed1e1fb . 1997-03-14 03:30:22 +00:00
Jim Meyering
e64db863dd . 1997-03-14 03:30:02 +00:00
Jim Meyering
40b667e0e9 . 1997-03-14 03:29:41 +00:00
Jim Meyering
effc683cfc (TIME_T_MIN): Work around a bug in Cray C 5.0.3.0. 1997-03-14 03:28:09 +00:00
Jim Meyering
898fd10ec0 . 1997-03-13 05:21:23 +00:00
Jim Meyering
7017b8f67f (change_file_group): Use uid of -1 to indicate
we don't want to change the file's user ID.
1997-03-13 05:19:54 +00:00
Jim Meyering
c230f7db00 Update from gettext-0.10.27. 1997-03-13 05:17:50 +00:00
Jim Meyering
5ed7bf6069 . 1997-03-13 05:17:16 +00:00
Jim Meyering
a7cbdd04cd . 1997-03-13 05:16:47 +00:00
Jim Meyering
4e81181981 (EXTRA_DIST): Add chown.c. 1997-03-13 05:13:18 +00:00
Jim Meyering
1dc27001d5 Add chown.m4. 1997-03-13 05:12:13 +00:00
Jim Meyering
9034e099da . 1997-03-13 05:10:42 +00:00
Jim Meyering
78f4331cab . 1997-03-13 03:54:05 +00:00
Jim Meyering
a9616d4982 . 1997-03-12 01:26:15 +00:00
Jim Meyering
f1fbec95d5 . 1997-03-11 05:11:09 +00:00
Jim Meyering
dd2f783492 . 1997-03-11 05:02:11 +00:00
Jim Meyering
fac7cfba06 . 1997-03-10 04:47:59 +00:00
Jim Meyering
613357b0ab (decode_switches): Ignore value of COLUMNS envionment
variable when it is the empty string.  Suggestion from Ulrich Drepper.
1997-03-10 04:47:32 +00:00
Jim Meyering
de397548a8 comm's exit status 1997-03-10 03:47:13 +00:00
Jim Meyering
8a3180c8f0 . 1997-03-09 06:33:43 +00:00
Jim Meyering
73e03453df . 1997-03-09 06:18:33 +00:00
Jim Meyering
ea805db369 (usage): Fix typo in --help output. From Andreas Schwab. 1997-03-01 04:33:59 +00:00
Jim Meyering
d358cd813b . 1997-02-28 05:02:41 +00:00
Jim Meyering
571f4f4fde . 1997-02-28 05:01:39 +00:00
Jim Meyering
8c93627ccb (tYEAR_UNIT): Increase yyRelYear by $1, not just by 1.
From Andreas Schwab.
1997-02-27 05:53:15 +00:00
Jim Meyering
80409f292d . 1997-02-27 05:52:59 +00:00
Jim Meyering
8b2b45e172 . 1997-02-27 05:49:51 +00:00
Jim Meyering
94cab36432 (re_protect): When there is any potential for ambiguity in a diagnostic,
give explanatory diagnostic in addition to file name.
1997-02-27 05:49:44 +00:00
Jim Meyering
e1b834211b (copy_internal): When there is any potential for
ambiguity in a diagnostic, give explanatory diagnostic in addition
to file name.
1997-02-27 05:49:01 +00:00
Jim Meyering
a0400ec19b . 1997-02-26 13:01:45 +00:00
Jim Meyering
27237bfb10 . 1997-02-26 04:21:01 +00:00
Jim Meyering
df86f458a2 . 1997-02-26 02:21:34 +00:00
Jim Meyering
88c3a362e9 . 1997-02-23 05:47:16 +00:00
Jim Meyering
a4ccff96f9 . 1997-02-23 02:01:27 +00:00
Jim Meyering
6df1efb30c . 1997-02-22 20:41:21 +00:00
Jim Meyering
75bc50c6fc . 1997-02-22 20:34:30 +00:00
Jim Meyering
5cb0201730 . 1997-02-22 20:19:05 +00:00
Jim Meyering
db78b4797a (tMONTH_UNIT): Increase yyRelMonth by $1, not just by 1.
(tDAY_UNIT): Likewise for yyRelDay.
(tHOUR_UNIT): Likewise for yyRelHour.
(tMINUTE_UNIT): Likewise for yyRelMinutes.
(tSEC_UNIT): Likewise for yyRelSeconds.
1997-02-22 20:13:19 +00:00
Jim Meyering
9de7f6a024 . 1997-02-21 02:19:59 +00:00
Jim Meyering
4b0e6d0a33 update from FSF 1997-02-21 02:19:48 +00:00
Jim Meyering
a6ebe05733 . 1997-02-21 02:17:18 +00:00
Jim Meyering
e16668553e update from FSF 1997-02-21 02:16:54 +00:00
Jim Meyering
3b459d46bc . 1997-02-20 05:11:19 +00:00
Jim Meyering
2e31651a02 (factor): Rewrite inner loop to be more efficient.
Patch from Torbjorn Granlund.
1997-02-20 05:11:12 +00:00
Jim Meyering
9e2c86c67a . 1997-02-20 05:06:29 +00:00
Jim Meyering
4af2c36dfa (main): Remove trailing slashes from command line arguments.
Otherwise, running `mkdir x; chmod 644 x; ls -d x/' (note the trailing
slash) makes ls fail with permission denied on at least Linux 1.2.13
and 2.0.14 systems.
1997-02-20 04:54:56 +00:00
Jim Meyering
5234813a09 . 1997-02-19 03:38:52 +00:00
Jim Meyering
3b8313838c . 1997-02-19 03:27:18 +00:00
Jim Meyering
9b47c04ac1 . 1997-02-19 03:25:30 +00:00
Jim Meyering
11332e0c26 Add tests for %U, %V, and %W and for a bug fixed on 1996-03-05.
Remove misleading `-' from leap-1 test.
1997-02-19 03:23:16 +00:00
Jim Meyering
785168be90 . 1997-02-19 03:20:35 +00:00
Jim Meyering
91eb812c61 . 1997-02-19 02:54:43 +00:00
Jim Meyering
2be08dd6d3 . 1997-02-19 00:56:22 +00:00
Jim Meyering
6d09ea7b0d . 1997-02-18 17:46:56 +00:00
Jim Meyering
7bb258353f . 1997-02-18 17:46:04 +00:00
Jim Meyering
35ec0a08b5 . 1997-02-18 15:13:51 +00:00
Jim Meyering
1b1bca8a63 . 1997-02-18 15:13:12 +00:00
Jim Meyering
11e498679b . 1997-02-18 15:12:41 +00:00
Jim Meyering
30979f06d8 . 1997-02-18 02:47:49 +00:00
Jim Meyering
c321e5b51a . 1997-02-18 02:46:29 +00:00
Jim Meyering
bf8b53e78b . 1997-02-18 02:43:59 +00:00
Jim Meyering
1ee3e32c80 . 1997-02-17 04:18:26 +00:00
Jim Meyering
668010de9e . 1997-02-17 04:18:06 +00:00
Jim Meyering
24f79bb72c . 1997-02-17 04:17:09 +00:00
Jim Meyering
1bdee95e06 . 1997-02-17 04:12:20 +00:00
Jim Meyering
90bdeb65ca . 1997-02-17 04:11:19 +00:00
Jim Meyering
522f1f2f27 . 1997-02-17 01:33:48 +00:00
Jim Meyering
0d457a8063 . 1997-02-17 01:30:05 +00:00
Jim Meyering
5db942f46c . 1997-02-17 01:26:54 +00:00
Jim Meyering
80cccededc . 1997-02-17 01:26:13 +00:00
Jim Meyering
dd77d0602a Add missing paren. 1997-02-16 23:49:11 +00:00
Jim Meyering
4722a74bcf (Tests '7.*'): Reflect file-renaming. 1997-02-16 19:14:32 +00:00
Jim Meyering
16632f72fc . 1997-02-16 19:11:10 +00:00
Jim Meyering
be855de208 renamed from T- versions to avoid name-clashes on case-indep filesystems 1997-02-16 19:08:01 +00:00
Jim Meyering
feb2f918b3 (parse_obsolescent_option): Reverse order of args in diagnostic.
Remove `' quotes in diagnostic.
(parse_options): Remove `' quotes in diagnostic.
1997-02-16 14:31:39 +00:00
Jim Meyering
6bdbdae68c fixed off-by-one error 1997-02-12 16:31:01 +00:00
Jim Meyering
59f891e8b8 FIXME: major revamp to use FILE*; passed a few more tests 1997-02-12 16:25:40 +00:00
Jim Meyering
2be25646bd change wording in message 1997-02-09 16:07:38 +00:00
Jim Meyering
4ee12115f0 update copyright 1997-02-09 04:56:33 +00:00
Jim Meyering
7eb03c4372 update copyrights for 1997 1997-02-09 04:54:16 +00:00
Jim Meyering
b7ffe8cdaf update copyrights for 1997 1997-02-09 04:52:50 +00:00
Jim Meyering
dbc538f92b update copyrights for 1997 1997-02-09 04:46:02 +00:00
Jim Meyering
562488ee9c (parse_obsolescent_option): Give warning diagnostic for
(but now accept) obsolescent usage with more than one file argument.
1997-02-09 04:44:47 +00:00
Jim Meyering
3e9c9be49e . 1997-02-08 03:25:12 +00:00
Jim Meyering
9e2ad11286 . 1997-02-07 04:17:25 +00:00
Jim Meyering
5d159ca17a . 1997-02-07 04:04:24 +00:00
Jim Meyering
b7a12bb110 (quote_filename): Allocate two more bytes (for quotes)
when using --quote-name (-Q).
Feb 2 change wasn't complete.  Patch from Mark Harris.
1997-02-06 03:58:09 +00:00
Jim Meyering
155fa29f27 . 1997-02-05 04:20:20 +00:00
Jim Meyering
8257531353 . 1997-02-05 04:07:17 +00:00
Jim Meyering
49e3c8fee2 Bracket inclusion of termios.h with #if HAVE_TERMIOS_H.
Masami Takikawa reported that NeXTStep 3.0 doesn't have termios.h.
1997-02-05 04:06:53 +00:00
Jim Meyering
7a5980964b Dennis Biringer <biringer@textron.mhpcc.af.mil> writes:
| Please note that Hawaii has no daylight savings time (HDT - Hawaii
| Daylight) as stated on page 147 of the tar manual.  We are always on Hawaii
| Standard Time (HST).
|
| Also, on page 146, the Alaska-Hawaii Standard zone (AHST) is called
| Hawaii-Aleutian Standard Time by section 263 of the United States Code.
| (http://tycho.usno.navy.mil/260.html).
|
| Thanks for the effort on the manual,
| Dennis
|
| --
| Dennis Biringer                            535 Lipoa Parkway #149
| Dennis.Biringer@textron.mhpcc.af.mil       Kihei HI 96753
| biringer@mrtc.org                          VOICE: 808-874-3206
1997-02-05 02:35:46 +00:00
Jim Meyering
c1e4806502 [__GNUC__]: Don't define alloca to __builtin_alloca. 1997-02-04 03:52:16 +00:00
Jim Meyering
84ed9c3db9 . 1997-02-04 03:48:17 +00:00
Jim Meyering
3c97cf0102 libitize 1997-02-04 03:30:49 +00:00
Jim Meyering
9e61c5f51a . 1997-02-04 03:29:06 +00:00
Jim Meyering
a0aa288531 libitize 1997-02-04 03:27:13 +00:00
Jim Meyering
1235c944d2 libitize 1997-02-04 03:26:31 +00:00
Jim Meyering
05ff9c82a6 new obstack from libc 1997-02-04 03:20:29 +00:00
Jim Meyering
e4af7abbde . 1997-02-03 05:09:12 +00:00
Jim Meyering
e8bcfd934a Move alloca-related preprocessor code into system.h. 1997-02-03 05:08:19 +00:00
Jim Meyering
1b5a74d1a7 (parse_long_options): Compare getopt_long return
value against -1, not EOF.  Use NULL, not `(int *) 0' as last parameter
in getopt_long call.
1997-02-03 05:06:27 +00:00
Jim Meyering
a2ffd5db02 [__GNUC__]: Don't define alloca to __builtin_alloca. 1997-02-03 04:20:22 +00:00
Jim Meyering
704a69781e . 1997-02-03 03:22:52 +00:00
Jim Meyering
5f24ab538f . 1997-02-03 03:21:02 +00:00
Jim Meyering
6a203a2347 (quote_filename): Don't backslash-escape double quotes.
This fixes a problem whereby columns weren't aligned when some files
contained double quote characters and ls's --escape (-b) option was
used.  Reported by Mark Harris.
1997-02-03 00:10:40 +00:00
Jim Meyering
16e150496f . 1997-02-02 23:51:20 +00:00
Jim Meyering
44a82a9eb6 . 1997-02-02 22:22:37 +00:00
Jim Meyering
a15366696c * src/cp-hash.c (struct entry): Move dcl to this file from cp.h.
(struct htab): Likewise.
No longer include cp.h.  Instead, include the things it used to include.
1997-02-02 22:21:03 +00:00
Jim Meyering
c64a391bb2 . 1997-02-02 21:23:10 +00:00
Jim Meyering
1d286acd9a (hash_insert2): Rename local HTAB to HT to avoid shadowing global. 1997-02-02 20:44:10 +00:00
Jim Meyering
b63df62ce1 [obstack_chunk_alloc]: Define to malloc, not xmalloc
to work better with new obstack functions.
1997-02-02 20:11:54 +00:00
Jim Meyering
ff323743c5 [obstack_chunk_alloc]: Define to malloc, not xmalloc
to work better with new obstack functions.
1997-02-02 20:10:11 +00:00
Jim Meyering
50d2bb5b7b (main): Rename local I to C to avoid shadowing and to
be more consistent.  Declare I in inner scopes.
1997-02-02 20:09:02 +00:00
Jim Meyering
1a375e421b Gutted code -- pieces are in copy.[ch]. 1997-02-02 18:33:19 +00:00
Jim Meyering
09e2cc2fdf use $@, instead of literal `POTFILES' 1997-02-02 16:05:43 +00:00
Jim Meyering
d262a3cc82 (POTFILES): Redirect to an intermediate file and write-protect POTFILES. 1997-02-02 15:43:54 +00:00
Jim Meyering
badb35bdb7 . 1997-02-02 00:09:46 +00:00
Jim Meyering
3cca84e543 . 1997-02-02 00:09:25 +00:00
Jim Meyering
4ea19e3b31 . 1997-02-01 23:12:18 +00:00
Jim Meyering
118cbe89db . 1997-02-01 16:56:47 +00:00
Jim Meyering
f13f9c1936 Reflect renamings. 1997-02-01 16:56:32 +00:00
Jim Meyering
0bda501d01 rename 1997-02-01 16:55:41 +00:00
Jim Meyering
8e6d4e2d3e . 1997-02-01 16:53:08 +00:00
Jim Meyering
c859133450 . 1997-02-01 16:52:02 +00:00
Jim Meyering
1b4dfdc778 . 1997-02-01 16:51:33 +00:00
Jim Meyering
620317a6bf . 1997-02-01 16:51:11 +00:00
Jim Meyering
c1c6d5fa1f (test 10md): Reflect renaming. 1997-02-01 16:48:08 +00:00
Jim Meyering
576b49f9f0 . 1997-02-01 16:47:56 +00:00
Jim Meyering
f18a2cdcd6 . 1997-02-01 16:47:17 +00:00
Jim Meyering
b6aa3e6c17 . 1997-02-01 16:46:06 +00:00
Jim Meyering
2e2fe82afe (spec_to_list): Warn about all filenames that exceed max-length before dying. 1997-02-01 16:44:15 +00:00
Jim Meyering
67c5175138 . 1997-02-01 16:41:08 +00:00
Jim Meyering
bece4592b4 update for 20.1 patch from roland 1997-02-01 16:39:27 +00:00
Jim Meyering
0081aea9e1 . 1997-02-01 13:23:39 +00:00
Jim Meyering
fec37a7211 (init_parameters): For compatibility: use default
separator `TAB' with full length lines.  From Roland Huebner.
1997-02-01 13:23:27 +00:00
Jim Meyering
5d3c42ac61 . 1997-02-01 13:20:02 +00:00
Jim Meyering
cd0b33c839 (usage): Make parenthetical note on --no-dereference a little more general. 1997-02-01 04:49:51 +00:00
Jim Meyering
a7dbd3f5e4 . 1997-02-01 04:25:59 +00:00
Jim Meyering
e077b7593b bracket bug address with <> and append a period 1997-02-01 04:24:58 +00:00
Jim Meyering
a882d55b52 bracket bug address with <> and append a period 1997-02-01 04:24:08 +00:00
Jim Meyering
899a90bfd9 bracket bug address with <> and append a period 1997-02-01 04:23:31 +00:00
Jim Meyering
09f70cf63b Rename globals buffer and buffer_size to have G_ prefix
to avoid shadowing local variables.
1997-02-01 03:29:21 +00:00
Jim Meyering
d4efcf477e (add_line_number): Rename from `number' to avoid shadowing local variables. 1997-02-01 03:25:14 +00:00
Jim Meyering
0e291b59ed . 1997-02-01 03:13:22 +00:00
Jim Meyering
b8c82a8e39 Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call. 1997-02-01 03:05:36 +00:00
Jim Meyering
4f51b86bfb Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call. 1997-02-01 03:03:44 +00:00
Jim Meyering
c2d2dec516 Compare getopt_long return value against -1, not EOF. Use NULL, not '(int *) 0' as last parameter in getopt_long call. 1997-02-01 02:00:04 +00:00
Jim Meyering
1e40423be8 (maintainer-clean): Remove GMOFILES.
From Paul Eggert.
1997-01-30 05:28:37 +00:00
Jim Meyering
0c5ab92b59 . 1997-01-30 04:16:33 +00:00
Jim Meyering
b9278db095 . 1997-01-30 04:11:17 +00:00
Jim Meyering
944b08f293 Do each test twice: get input via REDIR and PIPE. 1997-01-30 03:38:47 +00:00
Jim Meyering
307b54a273 (test_vector): Do each (non-stdin-requiring) test three times. 1997-01-30 03:38:07 +00:00
Jim Meyering
795162649b . 1997-01-30 03:36:40 +00:00
Jim Meyering
3181551ddd . 1997-01-30 03:36:06 +00:00
Jim Meyering
4cbcb32a53 correctly compute number of tests 1997-01-30 03:31:40 +00:00
Jim Meyering
13a5e426f3 Remove common_option_prefix flag.
(test_vector): Prepend the common option here instead.
1997-01-30 03:27:35 +00:00
Jim Meyering
56557d787a Remove input_via_stdin flag.
Do each test twice: get input via REDIR and PIPE.
1997-01-30 03:26:27 +00:00
Jim Meyering
6b1d2c4de1 Do each test three times. 1997-01-30 03:25:16 +00:00
Jim Meyering
bca3705ac5 . 1997-01-30 03:22:44 +00:00
Jim Meyering
9fcda065b6 . 1997-01-30 03:14:43 +00:00
Jim Meyering
188edf1546 . 1997-01-30 03:01:15 +00:00
Jim Meyering
22922b8765 Allow each test to be run any or all of three different ways. Program
input may be specified via a file or files listed on the command line,
via input redirection (if there's only one file), or via a pipe.
1997-01-29 14:19:17 +00:00
Jim Meyering
e16812dea8 . 1997-01-29 13:03:05 +00:00
Jim Meyering
20580c3f25 . 1997-01-29 02:54:21 +00:00
Jim Meyering
a6871ebbce Remove `t' prefix on all generated test file names.
Change suffixes from (.in, .exp, .out, .err) to (.I, .X, .O, .E).
Ensure that no test file (generated or maintainer-supplied) has a
longer than 14 characters.
1997-01-28 21:22:34 +00:00
Jim Meyering
0ce61713d5 (usage): Remove one space in message to make colons line up. 1997-01-28 03:44:27 +00:00
Jim Meyering
d705b6c469 . 1997-01-28 03:43:05 +00:00
Jim Meyering
771ab6e1bf (print_long_format): Fix off-by-one problem in size being passed to strftime. 1997-01-28 03:40:18 +00:00
Jim Meyering
b103723acc . 1997-01-27 03:15:14 +00:00
Jim Meyering
03ebea3ec6 . 1997-01-27 03:10:22 +00:00
Jim Meyering
5f011471a3 really make the messages identical 1997-01-27 02:28:39 +00:00
Jim Meyering
6b3f36f935 . 1997-01-27 02:18:56 +00:00
Jim Meyering
1010c1f580 . 1997-01-26 20:01:11 +00:00
Jim Meyering
7490632078 . 1997-01-26 19:04:03 +00:00
Jim Meyering
537381d409 . 1997-01-26 19:03:30 +00:00
Jim Meyering
3a01be66d4 . 1997-01-26 19:02:52 +00:00
Jim Meyering
8a87c1a169 . 1997-01-26 19:01:54 +00:00
Jim Meyering
07b07ca07c . 1997-01-26 18:57:36 +00:00
Jim Meyering
26a10a8026 (usage): Fix typo (--writeable -> --writable) in help output 1997-01-26 18:51:44 +00:00
Jim Meyering
072c1efe39 (parse_options): Add quotes to make messages identical. 1997-01-26 18:50:33 +00:00
Jim Meyering
c38939be8e . 1997-01-26 07:03:50 +00:00
385 changed files with 42211 additions and 21630 deletions

View File

@@ -134,8 +134,8 @@ Each translation team has its own mailing list, courtesy of Linux
International. You may reach your translation team at the address
`LL@li.org', replacing LL by the two-letter ISO 639 code for your
language. Language codes are *not* the same as the country codes given
in ISO 3166. The following translation teams exist, as of December
1996:
in ISO 3166. The following translation teams exist, as of February
1997:
Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl',
English `en', Esperanto `eo', Finnish `fi', French `fr', German
@@ -173,7 +173,7 @@ Available Packages
Languages are not equally supported in all GNU packages. The
following matrix shows the current state of GNU internationalization,
as of December 1996. The matrix shows, in regard of each package, for
as of February 1997. The matrix shows, in regard of each package, for
which languages PO files have been submitted to translation
coordination.
@@ -182,33 +182,33 @@ coordination.
bash | [] [] [] | 3
bison | [] [] [] | 3
clisp | [] [] [] | 3
cpio | [] [] [] [] | 4
cpio | [] [] [] [] [] | 5
diffutils | [] [] [] [] | 4
enscript | [] [] [] [] [] | 5
fileutils | [] [] [] [] [] [] [] [] | 8
findutils | [] [] [] [] [] [] | 6
flex | [] [] | 2
findutils | [] [] [] [] [] [] [] | 7
flex | [] [] [] | 3
gcal | [] [] [] | 3
gettext | [] [] [] [] [] [] [] [] [] [] | 11
grep | [] [] [] [] [] [] [] [] | 8
hello | [] [] [] [] [] [] [] [] [] [] | 10
id-utils | [] [] | 2
indent | | 0
libc | [] [] [] [] [] [] | 6
indent | [] [] | 2
libc | [] [] [] [] [] [] [] | 7
m4 | [] [] [] [] [] | 5
make | [] [] [] [] [] | 5
make | [] [] [] [] [] [] | 6
music | [] | 1
ptx | [] [] [] [] [] [] [] [] | 8
recode | [] [] [] [] [] [] [] | 7
recode | [] [] [] [] [] [] [] [] | 8
sh-utils | [] [] [] [] [] | 5
sharutils | [] [] [] [] | 4
sharutils | [] [] [] [] [] | 5
tar | [] [] [] [] [] [] [] [] [] | 9
texinfo | | 0
textutils | [] [] [] [] [] [] | 6
wdiff | [] [] [] [] [] [] [] [] | 8
`-------------------------------------------'
14 languages cs de en es fi fr ja ko nl no pl pt sl sv
27 packages 1 21 1 11 1 24 1 8 20 7 14 6 7 14 136
27 packages 1 22 1 14 1 25 1 10 20 7 14 7 7 15 145
Some counters in the preceding matrix are higher than the number of
visible blocks let us expect. This is because a few extra PO files are
@@ -221,6 +221,6 @@ distributed as such by its maintainer. There might be an observable
lag between the mere existence a PO file and its wide availability in a
GNU distribution.
If December 1996 seems to be old, you may fetch a more recent copy
If February 1997 seems to be old, you may fetch a more recent copy
of this `ABOUT-NLS' file on most GNU archive sites.

View File

@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -304,8 +304,9 @@ the "copyright" line and a pointer to where the full notice is found.
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.
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.

7
GNUmakefile Normal file
View File

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

View File

@@ -31,7 +31,7 @@ The simplest way to compile this package is:
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
@@ -167,7 +167,9 @@ operates.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
@@ -178,4 +180,3 @@ operates.
script, and exit.
`configure' also accepts some other, not widely useful, options.

62
Makefile.maint Normal file
View File

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

25
THANKS
View File

@@ -1,21 +1,42 @@
This is just a start at listing e-mail addresses of contributors.
The rest of the addresses are still in the ChangeLog.
Arne Henrik Juul arnej@imf.unit.no
Achim Blumensath: blume@corona.oche.de
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
Arne Henrik Juul: arnej@imf.unit.no
Bauke Jan Douma: bjdouma@xs4all.nl
Bengt Martensson: bengt@mathematik.uni-Bremen.de
Bjorn Helgaas: helgaas@rsn.hp.com
Charles Karney: karney@pppl.gov
Eirik Fuller: eirik@netcom.com
Eli Zaretskii: eliz@is.elta.co.il
Emile LeBlanc: leblanc@math.toronto.edu
François Pinard: pinard@iro.umontreal.ca
Galen Hazelwood: galenh@micron.net
Greg McGary: gkm@eng.ascend.com
Hugh Daniel: hugh@xanadu.com
James: james@albion.glarp.com
James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
Jesse Thilo: jgt2@eecs.lehigh.edu
Joakim Rosqvist: dvljrt@cs.umu.se
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
Marcus Daniels: marcus@sysc.pdx.edu
Mark A. Thomas: thommark@access.digex.net
Mark Harris: mark@monitor.designacc.com
Marty Leisner: leisner@sdsp.mc.xerox.com
Masami Takikawa: takikawm@CS.ORST.EDU
Matthew S. Levine: mslevine@theory.lcs.mit.edu
Miles Bader: miles@gnu.ai.mit.edu
Noel Cragg: noel@red-bean.com
Peter Eriksson: peter@ifm.liu.se
Paul Eggert: eggert@twinsun.com
Philippe De Muyter: phdm@macqel.be
Ross Ridge: rridge@calum.csclub.uwaterloo.ca
Santiago Vila Doncel: sanvila@ctv.es
Santiago Vila Doncel: sanvila@unex.es
Stuart Kemp: skemp@peter.bmc.com
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
Torbjorn Lindgren: tl@funcom.no
Tony Leneis: tony@plaza.ds.adp.com
Michael Veksler: mveksler@techunix.technion.ac.il
Wayne Stewart: wstewa@atl.com

View File

@@ -1,9 +1,7 @@
## Process this file with automake to produce Makefile.in
## Process this file with automake to produce Makefile.in -*-Makefile-*-
info_TEXINFOS = fileutils.texi
# FIXME: remove texinfo.tex when automake has been fixed to include it
# automatically
EXTRA_DIST = perm.texi getdate.texi texinfo.tex
EXTRA_DIST = perm.texi getdate.texi
# Tell makeinfo to put everything in a single info file: sh-utils.info.
# Otherwise, it would also generate files with names like sh-utils.info-[123],

View File

@@ -1,8 +1,14 @@
# Makefile.in generated automatically by automake 1.1l from Makefile.am
# Makefile.in generated automatically by automake 1.2f from Makefile.am
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
@@ -32,26 +38,57 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
YACC = @YACC@
GENCAT = @GENCAT@
PERL = @PERL@
MV = @MV@
GMSGFMT = @GMSGFMT@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
LN = @LN@
RM = @RM@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
info_TEXINFOS = fileutils.texi
# FIXME: remove texinfo.tex when automake has been fixed to include it
# automatically
EXTRA_DIST = perm.texi getdate.texi texinfo.tex
EXTRA_DIST = perm.texi getdate.texi
# Tell makeinfo to put everything in a single info file: sh-utils.info.
# Otherwise, it would also generate files with names like sh-utils.info-[123],
@@ -62,6 +99,7 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
TEXI2DVI = texi2dvi
TEXINFO_TEX = $(srcdir)/texinfo.tex
INFO_DEPS = fileutils.info
DVIS = fileutils.dvi
TEXINFOS = fileutils.texi
@@ -69,45 +107,44 @@ DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
version.texi
PACKAGE = @PACKAGE@
VERSION = @VERSION@
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
default: all
.SUFFIXES:
.SUFFIXES: .texi .texinfo .info .dvi .ps
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
cd $(top_srcdir) && automake --gnu doc/Makefile
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
version.texi: @MAINT@stamp-vti
version.texi: stamp-vti
cp $(srcdir)/stamp-vti $(srcdir)/version.texi
stamp-vti: fileutils.texi $(top_srcdir)/configure.in
echo "@set UPDATED `cd $(srcdir) \
@echo "@set UPDATED `cd $(srcdir) \
&& $(SHELL) ./mdate-sh fileutils.texi`" > vti.tmp
echo "@set EDITION $(VERSION)" >> vti.tmp
echo "@set VERSION $(VERSION)" >> vti.tmp
cmp -s vti.tmp $(srcdir)/version.texi || cp vti.tmp $(srcdir)/version.texi
rm vti.tmp
echo timestamp > $(srcdir)/stamp-vti
@echo "@set EDITION $(VERSION)" >> vti.tmp
@echo "@set VERSION $(VERSION)" >> vti.tmp
@cmp -s vti.tmp $(srcdir)/stamp-vti \
|| (echo "Updating $(srcdir)/stamp-vti"; \
cp vti.tmp $(srcdir)/stamp-vti)
-@rm -f vti.tmp
mostlyclean-vti:
rm -f vti.tmp
-rm -f vti.tmp
clean-vti:
distclean-vti:
maintainer-clean-vti:
@MAINT@rm -f stamp-vti version.texi
-rm -f stamp-vti version.texi
fileutils.info: fileutils.texi version.texi
fileutils.dvi: fileutils.texi version.texi
@@ -116,6 +153,7 @@ fileutils.dvi: fileutils.texi version.texi
DVIPS = dvips
.texi.info:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
@@ -123,41 +161,73 @@ DVIPS = dvips
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.texi:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.texinfo.info:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.texinfo:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.texinfo.dvi:
TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.txi.info:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.txi.dvi:
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.txi:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.dvi.ps:
$(DVIPS) $< -o $@
install-info-am: $(INFO_DEPS)
$(NORMAL_INSTALL)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(infodir)
@for file in $(INFO_DEPS); do \
for ifile in `cd $(srcdir) && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
if test -f $(srcdir)/$$ifile; then \
echo "$(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile"; \
$(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile; \
d=$(srcdir); \
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
if test -f $$d/$$ifile; then \
echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
$(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
else : ; fi; \
done; \
done
$(POST_INSTALL)
@if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
@$(POST_INSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
for file in $(INFO_DEPS); do \
echo "install-info --info-dir=$(infodir) $(infodir)/$$file";\
install-info --info-dir=$(infodir) $(infodir)/$$file; :;\
echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
done; \
else : ; fi
uninstall-info:
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
$(PRE_UNINSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
ii=yes; \
else ii=; fi; \
for file in $(INFO_DEPS); do \
test -z "$ii" \
|| install-info --info-dir=$(infodir) --remove $$file; \
done
@$(NORMAL_UNINSTALL)
for file in $(INFO_DEPS); do \
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \
done
dist-info: $(INFO_DEPS)
@@ -170,18 +240,24 @@ dist-info: $(INFO_DEPS)
done; \
done
mostlyclean-info:
rm -f fileutils.aux fileutils.cp fileutils.cps fileutils.dvi \
fileutils.fn fileutils.fns fileutils.ky fileutils.log \
fileutils.pg fileutils.toc fileutils.tp fileutils.vr \
fileutils.op
mostlyclean-aminfo:
-rm -f fileutils.aux fileutils.cp fileutils.cps fileutils.dvi \
fileutils.fn fileutils.fns fileutils.ky fileutils.kys \
fileutils.ps fileutils.log fileutils.pg fileutils.toc \
fileutils.tp fileutils.tps fileutils.vr fileutils.vrs \
fileutils.op fileutils.tr fileutils.cv fileutils.cn
clean-info:
clean-aminfo:
distclean-info:
distclean-aminfo:
maintainer-clean-info:
for i in $(INFO_DEPS); do rm -f `eval echo $$i*`; done
maintainer-clean-aminfo:
for i in $(INFO_DEPS); do \
rm -f $$i; \
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
rm -f $$i-[0-9]*; \
fi; \
done
tags: TAGS
TAGS:
@@ -189,68 +265,74 @@ TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = doc
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 doc/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
$(MAKE) distdir="$(distdir)" dist-info
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
info: $(INFO_DEPS)
dvi: $(DVIS)
check: all
$(MAKE)
installcheck:
install-exec:
$(NORMAL_INSTALL)
@$(NORMAL_INSTALL)
install-data: install-info-am
$(NORMAL_INSTALL)
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall: uninstall-info
all: $(INFO_DEPS) Makefile
all: Makefile $(INFO_DEPS)
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
$(mkinstalldirs) $(infodir)
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
rm -f Makefile $(DISTCLEANFILES)
rm -f config.cache config.log stamp-h
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-vti mostlyclean-info mostlyclean-generic
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic
clean: clean-vti clean-info clean-generic mostlyclean
clean: clean-vti clean-aminfo clean-generic mostlyclean
distclean: distclean-vti distclean-info distclean-generic clean
rm -f config.status
distclean: distclean-vti distclean-aminfo distclean-generic clean
-rm -f config.status
maintainer-clean: maintainer-clean-vti maintainer-clean-info \
maintainer-clean: maintainer-clean-vti maintainer-clean-aminfo \
maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: default mostlyclean-vti distclean-vti clean-vti \
maintainer-clean-vti install-info-am uninstall-info mostlyclean-info \
distclean-info clean-info maintainer-clean-info tags distdir info dvi \
installcheck install-exec install-data install uninstall all \
maintainer-clean-vti install-info-am uninstall-info mostlyclean-aminfo \
distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir info \
dvi installcheck install-exec install-data install uninstall all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean

View File

@@ -4,6 +4,8 @@
@cindex date input formats
@findex getdate
First, a quote:
@quotation
Our units of temporal measurement, from seconds on up to months, are so
complicated, asymmetrical and disjunctive so as to make coherent mental
@@ -44,7 +46,7 @@ midnight, 1 January 1970 UCT.
* General date syntax:: Common rules.
* Calendar date item:: 19 Dec 1994.
* Time of day item:: 9:20pm.
* Timezone item:: EST, DST, BST, UCT, AHST, ...
* Time zone item:: EST, DST, BST, UTC, ...
* Day of week item:: Monday and others.
* Relative item in date strings:: next tuesday, 2 years ago.
* Pure numbers in date strings:: 19931219, 1440.
@@ -203,161 +205,139 @@ indicates the first half of the day, @samp{pm} indicates the second
half of the day. In this notation, 12 is the predecessor of 1:
midnight is @samp{12am} while noon is @samp{12pm}.
@cindex timezone correction
@cindex minutes, timezone correction by
The time may alternatively be followed by a timezone correction,
@cindex time zone correction
@cindex minutes, time zone correction by
The time may alternatively be followed by a time zone correction,
expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
of zone minutes. When a timezone correction is given this way, it
forces interpretation of the time in UTC, overriding any previous
specification for the timezone or the local timezone. The @var{minute}
part of the time of the day may not be elided when a timezone correction
is used. This is the only way to specify a timezone correction by
of zone minutes. When a time zone correction is given this way, it
forces interpretation of the time relative to
Coordinated Universal Time (UTC), overriding any previous
specification for the time zone or the local time zone. The @var{minute}
part of the time of the day may not be elided when a time zone correction
is used. This is the only way to specify a time zone correction by
fractional parts of an hour.
Either @samp{am}/@samp{pm} or a timezone correction may be specified,
Either @samp{am}/@samp{pm} or a time zone correction may be specified,
but not both.
@node Timezone item
@section Timezone item
@node Time zone item
@section Time zone item
@cindex timezone item
@cindex time zone item
A @dfn{timezone item} specifies an international timezone, indicated by
a small set of letters. Any included period is ignored. Military
timezone designations use a single letter. Currently, only integral
zone hours may be represented in a timezone item. See the previous
section for a finer control over the timezone correction.
A @dfn{time zone item} specifies an international time zone, indicated by
a small set of letters. They are supported for backward compatibility reasons,
but they are not recommended because they are ambiguous in practice:
for example, the abbreviation @samp{EST} has different meanings in
Australia and the United States. Any included period is ignored. Military
time zone designations use a single letter. Currently, only integral
zone hours may be represented in a time zone item. See the previous
section for a finer control over the time zone correction.
Here are many non-daylight-savings-time timezones, indexed by the zone
Here are many non-daylight-saving-time time zones, indexed by the zone
hour value.
@table @asis
@item +000
@cindex Greenwich Mean Time
@cindex Universal Coordinated Time
@cindex Western European Time
@samp{GMT} for Greenwich Mean, @samp{UT} or @samp{UTC} for Universal
(Coordinated), @samp{WET} for Western European and @samp{Z} for
militaries.
@item +100
@cindex West African Time
@samp{WAT} for West Africa and
@samp{A} for militaries.
@item +200
@cindex Azores Time
@samp{AT} for Azores and @samp{B} for militaries.
@item +300
@samp{C} for militaries.
@item +400
@cindex Atlantic Standard Time
@samp{AST} for Atlantic Standard and @samp{D} for militaries.
@item +500
@cindex Eastern Standard Time
@samp{E} for militaries and @samp{EST} for Eastern Standard.
@item +600
@cindex Central Standard Time
@samp{CST} for Central Standard and @samp{F} for militaries.
@item +700
@cindex Mountain Standard Time
@samp{G} for militaries and @samp{MST} for Mountain Standard.
@item +800
@cindex Pacific Standard Time
@samp{H} for militaries and @samp{PST} for Pacific Standard.
@item +900
@cindex Yukon Standard Time
@samp{I} for militaries and @samp{YST} for Yukon Standard.
@item +1000
@cindex Alaska-Hawaii Time
@cindex Central Alaska Time
@cindex Hawaii Standard Time
@samp{AHST} for Alaska-Hawaii Standard, @samp{CAT} for Central Alaska,
@samp{HST} for Hawaii Standard and @samp{K} for militaries.
@item +1100
@cindex Nome Standard Time
@samp{L} for militaries and @samp{NT} for Nome.
@item +1200
@cindex International Date Line West
@samp{IDLW} for International Date Line West and @samp{M} for
militaries.
@item -100
@cindex Central European Time
@cindex Middle European Time
@cindex Middle European Winter Time
@cindex French Winter Time
@cindex Swedish Winter Time
@samp{CET} for Central European, @samp{FWT} for French Winter,
@samp{MET} for Middle European, @samp{MEWT} for Middle European
Winter, @samp{N} for militaries and @samp{SWT} for Swedish Winter.
@item -200
@cindex Eastern European Time
@cindex USSR Zone
@samp{EET} for Eastern European, USSR Zone 1 and @samp{O} for militaries.
@item -300
@cindex Baghdad Time
@samp{BT} for Baghdad, USSR Zone 2 and @samp{P} for militaries.
@item -400
@samp{Q} for militaries and @samp{ZP4} for USSR Zone 3.
@item -500
@samp{R} for militaries and @samp{ZP5} for USSR Zone 4.
@item -600
@samp{S} for militaries and @samp{ZP6} for USSR Zone 5.
@item -700
@cindex West Australian Standard Time
@samp{T} for militaries and @samp{WAST} for West Australian Standard.
@item -800
@cindex China Coast Time
@samp{CCT} for China Coast, USSR Zone 7 and @samp{U} for militaries.
@item -900
@cindex Japan Standard Time
@samp{JST} for Japan Standard, USSR Zone 8 and @samp{V} for militaries.
@item -1000
@cindex East Australian Standard Time
@cindex Guam Standard Time
@samp{EAST} for East Australian Standard, @samp{GST} for Guam
Standard, USSR Zone 9 and @samp{W} for militaries.
@item -1200
@samp{Y} for militaries.
@item -1100
@samp{X} for militaries.
@item -1200
@cindex International Date Line East
@cindex New Zealand Standard Time
@samp{IDLE} for International Date Line East, @samp{NZST} for
New Zealand Standard, @samp{NZT} for New Zealand and @samp{Y} for
militaries.
@item -1000
@samp{W} for militaries.
@item -0900
@samp{V} for militaries.
@item -0800
@samp{PST} for Pacific Standard, and
@samp{U} for militaries.
@item -0700
@samp{MST} for Mountain Standard, and
@samp{T} for militaries.
@item -0600
@samp{CST} for Central Standard, and
@samp{S} for militaries.
@item -0500
@samp{EST} for Eastern Standard, and
@samp{R} for militaries.
@item -0400
@samp{AST} for Atlantic Standard, and
@samp{Q} for militaries.
@item -0300
@samp{P} for militaries.
@item -0200
@samp{O} for militaries.
@item -0100
@samp{N} for militaries.
@item +0000
@cindex Greenwich Mean Time
@cindex Coordinated Universal Time
@cindex Universal Coordinated Time
@cindex Universal Time (Coordinated)
@samp{GMT} for Greenwich Mean,
@samp{UT} for Universal,
@samp{UTC} for Coordinated Universal,
@samp{WET} for Western European, and
@samp{Z} for ISO 8601 and militaries.
@item +0100
@samp{A} for militaries,
@samp{CET} for Central European,
@samp{MET} for Midden Europesche Tijd (Dutch), and
@samp{MEZ} for Mittel-Europ@"aische Zeit (German).
@item +0200
@samp{B} for militaries, and
@samp{EET} for Eastern European.
@item +0300
@samp{C} for militaries.
@item +0400
@samp{D} for militaries.
@item +0500
@samp{E} for militaries.
@item +0600
@samp{F} for militaries.
@item +0700
@samp{G} for militaries.
@item +0800
@samp{H} for militaries.
@item +0900
@samp{I} for militaries, and
@samp{JST} for Japan Standard.
@item +1000
@samp{GST} for Guam Standard, and
@samp{K} for militaries.
@item +1100
@samp{L} for militaries.
@item +1200
@samp{M} for militaries, and
@samp{NZST} for New Zealand Standard.
@end table
@cindex daylight savings time
Here are many DST timezones, indexed by the zone hour value. Also, by
following a non-DST timezone by the string @samp{DST} in a separate word
(that is, separated by some whitespace), the corresponding DST timezone
@cindex daylight-saving time
Here are many daylight-saving time (DST) time zones,
indexed by the zone hour value. Also, by
following a non-DST time zone by the string @samp{DST} in a separate word
(that is, separated by some whitespace), the corresponding DST time zone
may be specified.
@table @asis
@item 0
@samp{BST} for British Summer.
@item +400
@samp{ADT} for Atlantic Daylight.
@item +500
@samp{EDT} for Eastern Daylight.
@item +600
@samp{CDT} for Central Daylight.
@item +700
@samp{MDT} for Mountain Daylight.
@item +800
@item -0700
@samp{PDT} for Pacific Daylight.
@item +900
@samp{YDT} for Yukon Daylight.
@item +1000
@samp{HDT} for Hawaii Daylight.
@item -100
@samp{MEST} for Middle European Summer, @samp{MESZ} for Middle European
Summer, @samp{SST} for Swedish Summer and @samp{FST} for French Summer.
@item -700
@samp{WADT} for West Australian Daylight.
@item -1000
@samp{EADT} for Eastern Australian Daylight.
@item -1200
@item -0600
@samp{MDT} for Mountain Daylight.
@item -0500
@samp{CDT} for Central Daylight.
@item -0400
@samp{EDT} for Eastern Daylight.
@item -0300
@samp{ADT} for Atlantic Daylight.
@item +0100
@samp{BST} for British Summer, and
@samp{WEST} for Western European Summer.
@item +0200
@samp{CEST} for Central European Summer,
@samp{MEST} for Midden Europesche S. Tijd (Dutch), and
@samp{MESZ} for Mittel-Europ@"aische Sommerzeit (German).
@item +1300
@samp{NZDT} for New Zealand Daylight.
@end table

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# mdate-sh - get modification time of a file and pretty-print it.
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
# Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
# Get modification time of a file or directory and pretty-print it.
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,8 +14,8 @@
# 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.
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Prevent date giving response in another language.
LANG=C
@@ -25,14 +25,15 @@ export LC_ALL
LC_TIME=C
export LC_TIME
# Get the extended ls output of the file.
# Get the extended ls output of the file or directory.
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
if ls -L /dev/null 1>/dev/null 2>&1; then
set - `ls -L -l $1`
set - x`ls -L -l -d $1`
else
set - `ls -l $1`
set - x`ls -l -d $1`
fi
# The month is at least the fourth argument.
# (3 shifts here, the next inside the loop)
# The month is at least the fourth argument
# (3 shifts here, the next inside the loop).
shift
shift
shift

View File

@@ -120,8 +120,7 @@ by the Foundation.
@cindex shell utilities
@cindex utilities for shell programming
This manual minimally documents version @value{VERSION} of the GNU shell
utilities.
This manual documents version @value{VERSION} of the GNU shell utilities.
@menu
* Introduction:: Caveats, overview, and authors.
@@ -167,7 +166,7 @@ The GNU shell utilities are mostly compatible with the POSIX.2 standard.
@c This paragraph appears in all of fileutils.texi, textutils.texi, and
@c sh-utils.texi too -- so be sure to keep them consistent.
@cindex bugs, reporting
Please report bugs to @samp{sh-utils-bugs@@gnu.ai.mit.edu}. Remember
Please report bugs to @samp{sh-utils-bugs@@gnu.org}. Remember
to include the version number, machine architecture, input files, and
any other information needed to reproduce the bug: your input, what you
expected, what you got, and why it is wrong. Diffs are welcome, but
@@ -182,8 +181,10 @@ sometimes difficult to infer. @xref{Bugs, , , gcc, GNU CC}.
@cindex Pinard, @value{Francois}
@cindex Berry, Karl
@cindex Stallman, Richard
This manual is based on the Unix man pages in the distribution, which
were originally written by David MacKenzie and updated by Jim Meyering.
This manual was originally derived from the Unix man pages in the
distribution, which were written by David MacKenzie and updated by Jim
Meyering. What you are reading now is the authoritative documentation
for these utilities; the man pages are no longer being maintained.
@value{Francois} Pinard did the initial conversion to Texinfo format.
Karl Berry did the indexing, some reorganization, and editing of the results.
Richard Stallman contributed his usual invaluable insights to the
@@ -717,53 +718,92 @@ Exit status:
@end display
@menu
* Relations for expr:: | & < <= = == != >= >
* String expressions:: <colon> match substr index length quote
* Numeric expressions:: + - * / %
* String expressions:: <colon> match substr index length
* Relations for expr:: | & < <= = == != >= >
* Examples of expr:: Examples.
@end menu
@node Relations for expr
@subsection Relations for @code{expr}
@node String expressions
@subsection String expressions
@cindex connectives, logical
@cindex logical connectives
@cindex relations, numeric or string
@cindex string expressions
@cindex expressions, string
The usual logical connectives and relations, in order of precedence.
@code{expr} supports pattern matching and other string operators. These
have lower precedence than both the numeric and relational operators (in
the next sections).
@table @samp
@item |
@kindex |
@cindex logical or operator
@cindex or operator
Yields its first argument if it is neither null nor 0, otherwise its
second argument.
@item @var{string} : @var{regex}
@cindex pattern matching
@cindex regular expression matching
@cindex matching patterns
Perform pattern matching. The arguments are coerced to strings and the
second is considered to be a (basic, a la GNU @code{grep}) regular
expression, with a @code{^} implicitly prepended. The first argument is
then matched against this regular expression.
@item &
@kindex &
@cindex logical and operator
@cindex and operator
Yields its first argument if neither argument is null or 0, otherwise
0.
If the match succeeds and @var{regex} uses @samp{\(} and @samp{\)}, the
@code{:} expression returns the part of @var{string} that matched the
subexpression; otherwise, it returns the number of characters matched.
@item < <= = == != >= >
@kindex <
@kindex <=
@kindex =
@kindex ==
@kindex >
@kindex >=
@cindex comparison operators
Compare the arguments and return 1 if the relation is true, 0 otherwise.
@code{==} is a synonym for @code{=}. @code{expr} first tries to coerce
both arguments to numbers and do a numeric comparison; if either
coercion fails, it does a lexicographic comparison.
If the match fails, the @code{:} operator returns the null string if
@samp{\(} and @samp{\)} are used in @var{regex}, otherwise 0.
@kindex \( @r{regexp operator}
Only the first @samp{\( @dots{} \)} pair is relevant to the return
value; additional pairs are meaningful only for grouping the regular
expression operators.
@kindex \+ @r{regexp operator}
@kindex \? @r{regexp operator}
@kindex \| @r{regexp operator}
In the regular expression, @code{\+}, @code{\?}, and @code{\|} are
operators which respectively match one or more, zero or one, or separate
alternatives. SunOS and other @code{expr}'s treat these as regular
characters. (POSIX allows either behavior.)
@xref{Top, , Regular Expression Library, regex, Regex}, for details of
regular expression syntax. Some examples are in @ref{Examples of expr}.
@item match @var{string} @var{regex}
@findex match
An alternative way to do pattern matching. This is the same as
@w{@samp{@var{string} : @var{regex}}}.
@item substr @var{string} @var{position} @var{length}
@findex substr
Returns the substring of @var{string} beginning at @var{position}
with length at most @var{length}. If either @var{position} or
@var{length} is negative, zero, or non-numeric, returns the null string.
@item index @var{string} @var{charset}
@findex index
Returns the first position in @var{string} where the first character in
@var{charset} was found. If no character in @var{charset} is found in
@var{string}, return 0.
@item length @var{string}
@findex length
Returns the length of @var{string}.
@item quote @var{token}
@findex quote
Interpret @var{token} as a string, even if it is a keyword like @var{match}
or an operator like @code{/}.
This makes it possible to test @code{expr length quote "$x"} or
@code{expr quote "$x" : '.*/\(.\)'} and have it do the right thing even if
the value of @var{$x} happens to be (for example) @code{/} or @code{index}.
This operator is a GNU extension. It is disabled when
the environment variable @var{POSIXLY_CORRECT} is set.
@end table
To make @code{expr} interpret keywords as strings, you must use the
@code{quote} operator.
@node Numeric expressions
@subsection Numeric expressions
@@ -771,9 +811,9 @@ coercion fails, it does a lexicographic comparison.
@cindex numeric expressions
@cindex expressions, numeric
Numeric operators, in order of increasing precedence. The connectives
(previous section) have higher precedence, the string operators
(following section) have lower.
@code{expr} supports the usual numeric operators, in order of increasing
precedence. The string operators (previous section) have lower precedence,
the connectives (next section) have higher.
@table @samp
@@ -798,67 +838,51 @@ numbers; an error occurs if this cannot be done.
@end table
@node String expressions
@subsection String expressions
@node Relations for expr
@subsection Relations for @code{expr}
@cindex string expressions
@cindex expressions, string
@cindex connectives, logical
@cindex logical connectives
@cindex relations, numeric or string
String operators. These have lowest precedence.
@code{expr} supports the usual logical connectives and relations. These
are higher precedence than either the string or numeric operators
(previous sections). Here is the list, lowest-precedence operator first.
@table @samp
@item @var{string} : @var{regex}
@cindex pattern matching
@cindex regular expression matching
@cindex matching patterns
Perform pattern matching. The arguments are coerced to strings and the
second is considered to be a (basic, a la @code{grep}) regular
expression, with a @code{^} implicitly prepended. The first argument is
then matched against this regular expression.
@item |
@kindex |
@cindex logical or operator
@cindex or operator
Returns its first argument if that is neither null nor 0, otherwise its
second argument.
If the match succeeds and @var{regex} uses @samp{\(} and @samp{\)}, the
@code{:} expression returns the part of @var{string} that matched the
subexpression; otherwise, it returns the number of characters matched.
@item &
@kindex &
@cindex logical and operator
@cindex and operator
Return its first argument if neither argument is null or 0, otherwise
0.
If the match fails, the @code{:} operator returns the null string if
@samp{\(} and @samp{\)} are used in @var{regex}, otherwise 0.
Only the first @samp{\( @dots{} \)} pair is relevant to the return
value; additional pairs are meaningful only for grouping the regular
expression operators.
@xref{Top, , Regular Expression Library, regex, Regex}, for details of
regular expression syntax.
@item match @var{string} @var{regex}
@findex match
An alternative way to do pattern matching. This is the same as
@w{@samp{@var{string} : @var{regex}}}.
@item substr @var{string} @var{position} @var{length}
@findex substr
Returns the substring of @var{string} beginning at @var{position}
with length at most @var{length}. If either @var{position} or
@var{length} is negative or non-numeric, returns the null string.
@item index @var{string} @var{character-class}
@findex index
Returns the first position in @var{string} where the first character in
@var{charset} was found. If no character in @var{charset} is found in
@var{string}, return 0.
@item length @var{string}
@findex length
Returns the length of @var{string}.
@item < <= = == != >= >
@kindex <
@kindex <=
@kindex =
@kindex ==
@kindex >
@kindex >=
@cindex comparison operators
Compare the arguments and return 1 if the relation is true, 0 otherwise.
@code{==} is a synonym for @code{=}. @code{expr} first tries to coerce
both arguments to numbers and do a numeric comparison; if either
coercion fails, it does a lexicographic comparison.
@end table
The keywords cannot be used as strings.
@node Examples of expr
@subsection Examples of @code{expr}
@subsection Examples of using @code{expr}
@cindex examples of @code{expr}
Here are a few examples, including quoting for shell metacharacters.
@@ -874,6 +898,12 @@ To print the non-directory part of the file name stored in
expr $fname : '.*/\(^.*\)' '^|' $fname
@end example
An example showing that @code{\+} is an operator:
@example
expr aaa : 'a\+'
@result{} 3
@end example
@example
expr abc : 'a\(.\)c'
@result{} b
@@ -881,7 +911,8 @@ expr index abcdef cz
@result{} 3
expr index index a
@error{} expr: syntax error
expr index quote index a
@result{} 0
@end example
@@ -2024,6 +2055,14 @@ After the login time, print the number of hours and minutes that the
user has been idle. @samp{.} means the user was active in last minute.
@samp{old} means the user was idle for more than 24 hours.
@item -l
@itemx --lookup
@opindex -l
@opindex --lookup
Attempt to canonicalize hostnames found in utmp through a DNS lookup. This
is not the default because it can cause significant delays on systems with
automatic dial-up internet access.
@item -H
@itemx --heading
@opindex -H
@@ -2439,6 +2478,50 @@ use @samp{date --rfc}. I just did and saw this:
Mon, 25 Mar 1996 23:34:17 -0600
@end example
@item
To convert a date string to the number of seconds since the epoch
(which is 1970-01-01 00:00:00 UTC), use the @samp{--date} option with
the @samp{%s} format. That can be useful in sorting and/or graphing
and/or comparing data by date. The following command outputs the
number of the seconds since the epoch for the time one second later
than the epoch, but in time zone five hours later (Cambridge, Massachusetts),
thus a total of five hours and one second after the epoch:
@example
date --date='1970-01-01 00:00:01 UTC +5 hours' +%s
18001
@end example
Suppose you had @emph{not} specified time zone information in the example above.
Then, date would have used your computer's idea of the time zone when
interpreting the string. Here's what you would get if you were in
Greenwich, England:
@example
# local time zone used
date --date='1970-01-01 00:00:01' +%s
1
@end example
@item
If you're sorting or graphing dated data, your raw date values may be
represented as seconds since the epoch. But few people can look at
the date @samp{946684800} and casually note ``Oh, that's the first second
of the year 2000.''
@example
date --date='2000-01-01 UTC' +%s
946684800
@end example
To convert such an unwieldy number of seconds back to
a more readable form, use a command like this:
@smallexample
date -d '1970-01-01 946684800 sec' +"%Y-%m-%d %T %z"
2000-01-01 00:00:00 +0000
@end smallexample
@end itemize

File diff suppressed because it is too large Load Diff

View File

@@ -108,8 +108,7 @@ by the Foundation.
@cindex text utilities
@cindex utilities for text handling
This manual minimally documents version @value{VERSION} of the GNU text
utilities.
This manual documents version @value{VERSION} of the GNU text utilities.
@menu
* Introduction:: Caveats, overview, and authors.
@@ -143,15 +142,17 @@ The GNU text utilities are mostly compatible with the @sc{POSIX.2} standard.
@c This paragraph appears in all of fileutils.texi, textutils.texi, and
@c sh-utils.texi too -- so be sure to keep them consistent.
@cindex bugs, reporting
Please report bugs to @samp{textutils-bugs@@gnu.ai.mit.edu}. Remember
Please report bugs to @samp{textutils-bugs@@gnu.org}. Remember
to include the version number, machine architecture, input files, and
any other information needed to reproduce the bug: your input, what you
expected, what you got, and why it is wrong. Diffs are welcome, but
please include a description of the problem as well, since this is
sometimes difficult to infer. @xref{Bugs, , , gcc, GNU CC}.
This manual is based on the Unix man pages in the distribution, which
were originally written by David MacKenzie and updated by Jim Meyering.
This manual was originally derived from the Unix man pages in the
distribution, which were written by David MacKenzie and updated by Jim
Meyering. What you are reading now is the authoritative documentation
for these utilities; the man pages are no longer being maintained.
The original @code{fmt} man page was written by Ross Paterson.
Fran@,{c}ois Pinard did the initial conversion to Texinfo format.
Karl Berry did the indexing, some reorganization, and editing of the results.
@@ -571,6 +572,10 @@ string, or use this option more than once, @code{od} writes one copy
of each output line using each of the data types that you specified,
in the order that you specified.
Adding a trailing ``z'' to any type specification appends a display
of the ASCII character representation of the printable characters
to the output line generated by the type specification.
@table @samp
@item a
named character,
@@ -996,10 +1001,10 @@ opened. (The exit status will still be nonzero, however.)
@opindex -s
Separate columns by a string @var{separator}. Don't use
@samp{-s @var{separator}}, no space between flag and argument. If this
option is omitted altogether, the default is a space, same as
@samp{-s" "}. With @samp{-s} only, no separator is used, same as
@samp{-s""}. @samp{-s} does not affect line truncation or column
alignment.
option is omitted altogether, the default is @key{TAB} together with
@samp{-j} option and space otherwise (same as @samp{-s" "}). With
@samp{-s} only, no separator is used (same as @samp{-s""}). @samp{-s}
does not affect line truncation or column alignment.
@item -t
@opindex -t
@@ -1508,6 +1513,10 @@ wc --bytes --words
@noindent
prints both the byte counts and the word counts.
With the @code{--max-line-length} option, @code{wc} prints the length
of the longest line per file, and if there is more than one file it
prints the maximum (not the sum) of those lengths.
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@@ -1532,6 +1541,12 @@ Print only the word counts.
@opindex --lines
Print only the newline counts.
@item -L
@itemx --max-line-length
@opindex -L
@opindex --max-line-length
Print only the maximum line lengths.
@end table
@@ -1630,7 +1645,7 @@ options}.
If a @var{file} is specified as @samp{-} or if no files are given
@code{md5sum} computes the checksum for the standard input.
@code{md5sum} can also determine whether a file and checksum are
consistent. Synopsis:
consistent. Synopses:
@example
md5sum [@var{option}]@dots{} [@var{file}]@dots{}
@@ -1704,7 +1719,7 @@ Treat all input files as text files. This is the reverse of
@opindex -w
@opindex --warn
@cindex verifying MD5 checksums
When verifying checksums, warn about improperly formated MD5 checksum lines.
When verifying checksums, warn about improperly formatted MD5 checksum lines.
This option is useful only if all but a few lines in the checked input
are valid.
@@ -2167,6 +2182,11 @@ Columns are separated by @key{TAB}.
The options @samp{-1}, @samp{-2}, and @samp{-3} suppress printing of
the corresponding columns. Also see @ref{Common options}.
Unlike some other comparison utilities, @code{comm} has an exit
status that does not depend on the result of the comparison.
Upon normal completion @code{comm} produces an exit code of zero.
If there is an error it exits with nonzero status.
@node Operating on fields within a line
@chapter Operating on fields within a line
@@ -2453,7 +2473,7 @@ used only in @var{set1} or @var{set2}, as noted below.
@table @asis
@item Backslash escapes.
@item Backslash escapes
@cindex backslash escapes
A backslash followed by a character not listed below causes an error
@@ -2461,19 +2481,19 @@ message.
@table @samp
@item \a
Control-G,
Control-G.
@item \b
Control-H,
Control-H.
@item \f
Control-L,
Control-L.
@item \n
Control-J,
Control-J.
@item \r
Control-M,
Control-M.
@item \t
Control-I,
Control-I.
@item \v
Control-K,
Control-K.
@item \@var{ooo}
The character with the value given by @var{ooo}, which is 1 to 3
octal digits,
@@ -2481,7 +2501,7 @@ octal digits,
A backslash.
@end table
@item Ranges.
@item Ranges
@cindex ranges
The notation @samp{@var{m}-@var{n}} expands to all of the characters
@@ -2493,7 +2513,7 @@ enclose ranges, translations specified in that format will still work as
long as the brackets in @var{string1} correspond to identical brackets
in @var{string2}.
@item Repeated characters.
@item Repeated characters
@cindex repeated characters
The notation @samp{[@var{c}*@var{n}]} in @var{set2} expands to @var{n}
@@ -2503,7 +2523,7 @@ to as many copies of @var{c} as are needed to make @var{set2} as long as
@var{set1}. If @var{n} begins with @samp{0}, it is interpreted in
octal, otherwise in decimal.
@item Character classes.
@item Character classes
@cindex characters classes
The notation @samp{[:@var{class}:]} expands to all of the characters in
@@ -2558,7 +2578,7 @@ Uppercase letters.
Hexadecimal digits.
@end table
@item Equivalence classes.
@item Equivalence classes
@cindex equivalence classes
The syntax @samp{[=@var{c}=]} expands to all of the characters that are
@@ -2820,10 +2840,10 @@ Robbins.
@menu
* Toolbox introduction::
* I/O redirection::
* The @code{who} command::
* The @code{cut} command::
* The @code{sort} command::
* The @code{uniq} command::
* The who command::
* The cut command::
* The sort command::
* The uniq command::
* Putting the tools together::
@end menu
@@ -2938,7 +2958,7 @@ discussion, we will only present those command line options that interest
us. As you should always do, double check your system documentation
for the full story.
@node The @code{who} command
@node The who command
@unnumberedsec The @code{who} command
The first program is the @code{who} command. By itself, it generates a
@@ -2960,7 +2980,7 @@ Unix systems, user names are never more than eight characters long. This
little bit of trivia will be useful later. The output of @code{who} is nice,
but the data is not all that exciting.
@node The @code{cut} command
@node The cut command
@unnumberedsec The @code{cut} command
The next program we'll look at is the @code{cut} command. This program
@@ -2989,7 +3009,7 @@ With the @samp{-c} option, @code{cut} will cut out specific characters
useful for data filtering.
@node The @code{sort} command
@node The sort command
@unnumberedsec The @code{sort} command
Next we'll look at the @code{sort} command. This is one of the most
@@ -3002,7 +3022,7 @@ making it into a filter). The sort is based on the machine collating
sequence (@sc{ASCII}) or based on user-supplied ordering criteria.
@node The @code{uniq} command
@node The uniq command
@unnumberedsec The @code{uniq} command
Finally (at least for now), we'll look at the @code{uniq} program. When

View File

@@ -1,25 +1,29 @@
## Process this file with automake to produce Makefile.in
## Process this file with automake to produce Makefile.in -*-Makefile-*-
AUTOMAKE_OPTIONS = ../src/ansi2knr
noinst_LIBRARIES = libfu.a
## FIXME: Remove mvdir.c, and rmdir.c when
## automake is fixed -- probably for 1.1g
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
EXTRA_DIST = chown.c getgroups.c getline.c lstat.c malloc.c mktime.c \
realloc.c stat.c strftime.c
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
argmatch.c backupfile.c dirname.c filemode.c \
full-write.c getversion.c idcache.c \
isdir.c long-options.c makepath.c modechange.c path-concat.c \
safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.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 save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h long-options.h \
makepath.h modechange.h mountlist.h path-concat.h pathmax.h \
save-cwd.h xstrtol.h xstrtoul.h
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
quotearg.h save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c

View File

@@ -1,8 +1,14 @@
# Makefile.in generated automatically by automake 1.1l from Makefile.am
# Makefile.in generated automatically by automake 1.2f from Makefile.am
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
@@ -32,41 +38,80 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
YACC = @YACC@
GENCAT = @GENCAT@
PERL = @PERL@
MV = @MV@
GMSGFMT = @GMSGFMT@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
LN = @LN@
RM = @RM@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
AUTOMAKE_OPTIONS = ../src/ansi2knr
noinst_LIBRARIES = libfu.a
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
EXTRA_DIST = chown.c getgroups.c getline.c lstat.c malloc.c mktime.c \
realloc.c stat.c strftime.c
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
argmatch.c backupfile.c dirname.c filemode.c \
full-write.c getversion.c idcache.c \
isdir.c long-options.c makepath.c modechange.c path-concat.c \
safe-read.c save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.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 save-cwd.c savedir.c stripslash.c userspec.c xgetcwd.c \
xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h long-options.h \
makepath.h modechange.h mountlist.h path-concat.h pathmax.h \
save-cwd.h xstrtol.h xstrtoul.h
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
quotearg.h save-cwd.h savedir.h strverscmp.h xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -79,59 +124,61 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libfu_a_OBJECTS = getdate.o posixtm.o getopt.o getopt1.o argmatch.o \
backupfile.o dirname.o filemode.o full-write.o getversion.o idcache.o \
isdir.o long-options.o makepath.o modechange.o path-concat.o \
safe-read.o save-cwd.o savedir.o stripslash.o userspec.o xgetcwd.o \
xmalloc.o xstrdup.o xstrtol.o xstrtoul.o yesno.o
ANSI2KNR = ../src/ansi2knr
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 save-cwd$U.o \
savedir$U.o stripslash$U.o userspec$U.o xgetcwd$U.o xmalloc$U.o \
xstrdup$U.o xstrtol$U.o xstrtoul$U.o yesno$U.o
AR = ar
INTERLOCK = ./interlock
YLWRAP = ./ylwrap
YLWRAP = $(srcdir)/ylwrap
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(LDFLAGS) -o $@
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in alloca.c basename.c error.c \
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getgroups.c getline.c group-member.c interlock memcmp.c \
memcpy.c memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h \
posixtm.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stpcpy.c \
strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c strtoul.c \
ylwrap
DIST_COMMON = Makefile.am Makefile.in alloca.c chown.c error.c error.h \
euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c getdate.c \
getgroups.c getline.c group-member.c lstat.c malloc.c memcmp.c memcpy.c \
memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h posixtm.c \
realloc.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stat.c \
stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c \
strtoul.c strverscmp.c ylwrap
PACKAGE = @PACKAGE@
VERSION = @VERSION@
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
DEP_FILES = .deps/alloca.P .deps/argmatch.P .deps/backupfile.P \
.deps/basename.P .deps/dirname.P .deps/error.P .deps/euidaccess.P \
GZIP = --best
DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
.deps/backupfile.P .deps/basename.P .deps/chown.P .deps/closeout.P \
.deps/dirname.P .deps/error.P .deps/euidaccess.P .deps/exclude.P \
.deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P .deps/fsusage.P \
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getgroups.P \
.deps/getline.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \
.deps/group-member.P .deps/idcache.P .deps/isdir.P .deps/long-options.P \
.deps/makepath.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
.deps/ftruncate.P .deps/full-write.P .deps/getdate .deps/getdate.P \
.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \
.deps/group-member.P .deps/hash.P .deps/human.P .deps/idcache.P \
.deps/isdir.P .deps/long-options.P .deps/lstat.P .deps/makepath.P \
.deps/malloc.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \
.deps/obstack.P .deps/path-concat.P .deps/posixtm.P .deps/regex.P \
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/rx.P \
.deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stpcpy.P \
.deps/obstack.P .deps/path-concat.P .deps/posixtm .deps/posixtm.P \
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
.deps/rmdir.P .deps/rpmatch.P .deps/rx.P .deps/safe-read.P \
.deps/save-cwd.P .deps/savedir.P .deps/stat.P .deps/stpcpy.P \
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
.deps/userspec.P .deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P \
.deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
.deps/strverscmp.P .deps/userspec.P .deps/xgetcwd.P .deps/xmalloc.P \
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(libfu_a_OBJECTS)
default: all
.SUFFIXES:
.SUFFIXES: .c .o .y
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
cd $(top_srcdir) && automake --gnu lib/Makefile
.SUFFIXES: .S .c .o .s .y
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
@@ -141,60 +188,235 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
rm -f *.o core
-rm -f *.o core *.core
clean-compile:
distclean-compile:
rm -f *.tab.c
-rm -f *.tab.c
maintainer-clean-compile:
$(libfu_a_OBJECTS): ../config.h
../src/ansi2knr: ../src/ansi2knr.o
cd ../src && $(MAKE) ansi2knr
mostlyclean-kr:
-rm -f *_.c
clean-kr:
distclean-kr:
maintainer-clean-kr:
libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
rm -f libfu.a
-rm -f libfu.a
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(RANLIB) libfu.a
.y.c:
$(SHELL) $(INTERLOCK) =yacclockdir $(YLWRAP) "$(YACC)" y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS) $<
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
posixtm.h: posixtm.c
getdate.h: getdate.c
addext_.c: addext.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/addext.c; then echo $(srcdir)/addext.c; else echo addext.c; fi` addext_.c
alloca_.c: alloca.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` alloca_.c
argmatch_.c: argmatch.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/argmatch.c; then echo $(srcdir)/argmatch.c; else echo argmatch.c; fi` argmatch_.c
backupfile_.c: backupfile.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/backupfile.c; then echo $(srcdir)/backupfile.c; else echo backupfile.c; fi` backupfile_.c
basename_.c: basename.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/basename.c; then echo $(srcdir)/basename.c; else echo basename.c; fi` basename_.c
chown_.c: chown.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/chown.c; then echo $(srcdir)/chown.c; else echo chown.c; fi` chown_.c
closeout_.c: closeout.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/closeout.c; then echo $(srcdir)/closeout.c; else echo closeout.c; fi` closeout_.c
dirname_.c: dirname.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/dirname.c; then echo $(srcdir)/dirname.c; else echo dirname.c; fi` dirname_.c
error_.c: error.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` error_.c
euidaccess_.c: euidaccess.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/euidaccess.c; then echo $(srcdir)/euidaccess.c; else echo euidaccess.c; fi` euidaccess_.c
exclude_.c: exclude.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/exclude.c; then echo $(srcdir)/exclude.c; else echo exclude.c; fi` exclude_.c
fileblocks_.c: fileblocks.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/fileblocks.c; then echo $(srcdir)/fileblocks.c; else echo fileblocks.c; fi` fileblocks_.c
filemode_.c: filemode.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/filemode.c; then echo $(srcdir)/filemode.c; else echo filemode.c; fi` filemode_.c
fnmatch_.c: fnmatch.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/fnmatch.c; then echo $(srcdir)/fnmatch.c; else echo fnmatch.c; fi` fnmatch_.c
fsusage_.c: fsusage.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/fsusage.c; then echo $(srcdir)/fsusage.c; else echo fsusage.c; fi` fsusage_.c
ftruncate_.c: ftruncate.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/ftruncate.c; then echo $(srcdir)/ftruncate.c; else echo ftruncate.c; fi` ftruncate_.c
full-write_.c: full-write.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/full-write.c; then echo $(srcdir)/full-write.c; else echo full-write.c; fi` full-write_.c
getdate_.c: getdate.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getdate.c; then echo $(srcdir)/getdate.c; else echo getdate.c; fi` getdate_.c
getgroups_.c: getgroups.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getgroups.c; then echo $(srcdir)/getgroups.c; else echo getgroups.c; fi` getgroups_.c
getline_.c: getline.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getline.c; then echo $(srcdir)/getline.c; else echo getline.c; fi` getline_.c
getopt_.c: getopt.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` getopt_.c
getopt1_.c: getopt1.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` getopt1_.c
group-member_.c: group-member.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/group-member.c; then echo $(srcdir)/group-member.c; else echo group-member.c; fi` group-member_.c
hash_.c: hash.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` hash_.c
human_.c: human.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/human.c; then echo $(srcdir)/human.c; else echo human.c; fi` human_.c
idcache_.c: idcache.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/idcache.c; then echo $(srcdir)/idcache.c; else echo idcache.c; fi` idcache_.c
isdir_.c: isdir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/isdir.c; then echo $(srcdir)/isdir.c; else echo isdir.c; fi` isdir_.c
long-options_.c: long-options.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/long-options.c; then echo $(srcdir)/long-options.c; else echo long-options.c; fi` long-options_.c
lstat_.c: lstat.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/lstat.c; then echo $(srcdir)/lstat.c; else echo lstat.c; fi` lstat_.c
makepath_.c: makepath.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/makepath.c; then echo $(srcdir)/makepath.c; else echo makepath.c; fi` makepath_.c
malloc_.c: malloc.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` malloc_.c
memcmp_.c: memcmp.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/memcmp.c; then echo $(srcdir)/memcmp.c; else echo memcmp.c; fi` memcmp_.c
memcpy_.c: memcpy.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/memcpy.c; then echo $(srcdir)/memcpy.c; else echo memcpy.c; fi` memcpy_.c
memset_.c: memset.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/memset.c; then echo $(srcdir)/memset.c; else echo memset.c; fi` memset_.c
mkdir_.c: mkdir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/mkdir.c; then echo $(srcdir)/mkdir.c; else echo mkdir.c; fi` mkdir_.c
mktime_.c: mktime.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/mktime.c; then echo $(srcdir)/mktime.c; else echo mktime.c; fi` mktime_.c
modechange_.c: modechange.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/modechange.c; then echo $(srcdir)/modechange.c; else echo modechange.c; fi` modechange_.c
mountlist_.c: mountlist.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/mountlist.c; then echo $(srcdir)/mountlist.c; else echo mountlist.c; fi` mountlist_.c
obstack_.c: obstack.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` obstack_.c
path-concat_.c: path-concat.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/path-concat.c; then echo $(srcdir)/path-concat.c; else echo path-concat.c; fi` path-concat_.c
posixtm_.c: posixtm.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/posixtm.c; then echo $(srcdir)/posixtm.c; else echo posixtm.c; fi` posixtm_.c
quotearg_.c: quotearg.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` quotearg_.c
realloc_.c: realloc.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` realloc_.c
regex_.c: regex.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` regex_.c
rename_.c: rename.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rename.c; then echo $(srcdir)/rename.c; else echo rename.c; fi` rename_.c
rmdir_.c: rmdir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rmdir.c; then echo $(srcdir)/rmdir.c; else echo rmdir.c; fi` rmdir_.c
rpmatch_.c: rpmatch.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rpmatch.c; then echo $(srcdir)/rpmatch.c; else echo rpmatch.c; fi` rpmatch_.c
rx_.c: rx.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/rx.c; then echo $(srcdir)/rx.c; else echo rx.c; fi` rx_.c
safe-read_.c: safe-read.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/safe-read.c; then echo $(srcdir)/safe-read.c; else echo safe-read.c; fi` safe-read_.c
save-cwd_.c: save-cwd.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/save-cwd.c; then echo $(srcdir)/save-cwd.c; else echo save-cwd.c; fi` save-cwd_.c
savedir_.c: savedir.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/savedir.c; then echo $(srcdir)/savedir.c; else echo savedir.c; fi` savedir_.c
stat_.c: stat.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/stat.c; then echo $(srcdir)/stat.c; else echo stat.c; fi` stat_.c
stpcpy_.c: stpcpy.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` stpcpy_.c
strcasecmp_.c: strcasecmp.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strcasecmp.c; then echo $(srcdir)/strcasecmp.c; else echo strcasecmp.c; fi` strcasecmp_.c
strdup_.c: strdup.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` strdup_.c
strftime_.c: strftime.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strftime.c; then echo $(srcdir)/strftime.c; else echo strftime.c; fi` strftime_.c
stripslash_.c: stripslash.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/stripslash.c; then echo $(srcdir)/stripslash.c; else echo stripslash.c; fi` stripslash_.c
strndup_.c: strndup.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` strndup_.c
strstr_.c: strstr.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strstr.c; then echo $(srcdir)/strstr.c; else echo strstr.c; fi` strstr_.c
strtol_.c: strtol.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strtol.c; then echo $(srcdir)/strtol.c; else echo strtol.c; fi` strtol_.c
strtoul_.c: strtoul.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strtoul.c; then echo $(srcdir)/strtoul.c; else echo strtoul.c; fi` strtoul_.c
strverscmp_.c: strverscmp.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/strverscmp.c; then echo $(srcdir)/strverscmp.c; else echo strverscmp.c; fi` strverscmp_.c
userspec_.c: userspec.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/userspec.c; then echo $(srcdir)/userspec.c; else echo userspec.c; fi` userspec_.c
xgetcwd_.c: xgetcwd.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/xgetcwd.c; then echo $(srcdir)/xgetcwd.c; else echo xgetcwd.c; fi` xgetcwd_.c
xmalloc_.c: xmalloc.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` xmalloc_.c
xstrdup_.c: xstrdup.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/xstrdup.c; then echo $(srcdir)/xstrdup.c; else echo xstrdup.c; fi` xstrdup_.c
xstrtol_.c: xstrtol.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/xstrtol.c; then echo $(srcdir)/xstrtol.c; else echo xstrtol.c; fi` xstrtol_.c
xstrtoul_.c: xstrtoul.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/xstrtoul.c; then echo $(srcdir)/xstrtoul.c; else echo xstrtoul.c; fi` xstrtoul_.c
yesno_.c: yesno.c $(ANSI2KNR)
$(ANSI2KNR) `if test -f $(srcdir)/yesno.c; then echo $(srcdir)/yesno.c; else echo yesno.c; fi` yesno_.c
addext_.o alloca_.o argmatch_.o backupfile_.o basename_.o chown_.o \
closeout_.o dirname_.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 long-options_.o lstat_.o makepath_.o \
malloc_.o memcmp_.o memcpy_.o memset_.o mkdir_.o mktime_.o \
modechange_.o mountlist_.o obstack_.o path-concat_.o posixtm_.o \
quotearg_.o realloc_.o regex_.o rename_.o rmdir_.o rpmatch_.o rx_.o \
safe-read_.o save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o \
strdup_.o strftime_.o stripslash_.o strndup_.o strstr_.o strtol_.o \
strtoul_.o strverscmp_.o userspec_.o xgetcwd_.o xmalloc_.o xstrdup_.o \
xstrtol_.o xstrtoul_.o yesno_.o : $(ANSI2KNR)
tags: TAGS
ID: $(HEADERS) $(SOURCES)
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
ID: $(HEADERS) $(SOURCES) $(LISP)
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list="$(SUBDIRS)"; for subdir in $$list; do \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
done; \
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
|| cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
rm -f TAGS ID
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
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 lib/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
@@ -202,15 +424,9 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file; \
done
MKDEP = gcc -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-include .deps/.P
.deps/.P:
test -d .deps || mkdir .deps
echo > $@
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
$(DEP_FILES): .deps/.P
mostlyclean-depend:
@@ -219,76 +435,83 @@ clean-depend:
distclean-depend:
maintainer-clean-depend:
rm -rf .deps
-rm -rf .deps
.deps/%.P: $(srcdir)/%.c
@echo "Computing dependencies for $<..."
@o='o'; \
test -n "$o" && o='$$o'; \
$(MKDEP) $< | sed "s/^\(.*\)\.o:/\1.$$o \1.l$$o:/" > $@
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
< .deps/$(*F).p > .deps/$(*F).P
@-rm -f .deps/$(*F).p
info:
dvi:
check: all
$(MAKE)
installcheck:
install-exec:
$(NORMAL_INSTALL)
@$(NORMAL_INSTALL)
install-data:
$(NORMAL_INSTALL)
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
all: $(LIBRARIES) $(BUILT_SOURCES) $(HEADERS) Makefile
all: Makefile $(LIBRARIES) $(HEADERS)
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
rm -f Makefile $(DISTCLEANFILES)
rm -f config.cache config.log stamp-h
test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean-kr mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
clean-generic mostlyclean
clean: clean-noinstLIBRARIES clean-compile clean-kr clean-tags \
clean-depend clean-generic mostlyclean
distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \
distclean-depend distclean-generic clean
rm -f config.status
distclean: distclean-noinstLIBRARIES distclean-compile distclean-kr \
distclean-tags distclean-depend distclean-generic clean
-rm -f config.status
maintainer-clean: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean
maintainer-clean-compile maintainer-clean-kr \
maintainer-clean-tags maintainer-clean-depend \
maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
distclean-depend clean-depend maintainer-clean-depend info dvi \
installcheck install-exec install-data install uninstall all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \
maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
clean-depend maintainer-clean-depend info dvi installcheck install-exec \
install-data install uninstall all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.

106
lib/addext.c Normal file
View File

@@ -0,0 +1,106 @@
/* addext.c -- add an extension to a file name
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> and Paul Eggert */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef HAVE_DOS_FILE_NAMES
#define HAVE_DOS_FILE_NAMES 0
#endif
#ifndef HAVE_LONG_FILE_NAMES
#define HAVE_LONG_FILE_NAMES 0
#endif
#include <backupfile.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef _POSIX_NAME_MAX
#define _POSIX_NAME_MAX 14
#endif
#include <sys/types.h>
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
/* Append to FILENAME the extension EXT, unless the result would be too long,
in which case just append the character E. */
void
addext (filename, ext, e)
char *filename;
char const *ext;
int e;
{
char *s = base_name (filename);
size_t slen = strlen (s), extlen = strlen (ext);
long slen_max = -1;
#if HAVE_PATHCONF && defined _PC_NAME_MAX
if (slen + extlen <= _POSIX_NAME_MAX && ! HAVE_DOS_FILE_NAMES)
/* The file name is so short there's no need to call pathconf. */
slen_max = _POSIX_NAME_MAX;
else if (s == filename)
slen_max = pathconf (".", _PC_NAME_MAX);
else
{
char c = *s;
*s = 0;
slen_max = pathconf (filename, _PC_NAME_MAX);
*s = c;
}
#endif
if (slen_max < 0)
slen_max = HAVE_LONG_FILE_NAMES ? 255 : 14;
if (HAVE_DOS_FILE_NAMES && slen_max <= 12)
{
/* Live within DOS's 8.3 limit. */
char *dot = strchr (s, '.');
if (dot)
{
slen -= dot + 1 - s;
s = dot + 1;
slen_max = 3;
}
else
slen_max = 8;
extlen = 9; /* Don't use EXT. */
}
if (slen + extlen <= slen_max)
strcpy (s + slen, ext);
else
{
if (slen_max <= slen)
slen = slen_max - 1;
s[slen] = e;
s[slen + 1] = 0;
}
}

View File

@@ -1,5 +1,5 @@
/* argmatch.c -- find a match for a string in an array
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,33 +12,34 @@
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. */
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie <djm@ai.mit.edu> */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <argmatch.h>
#include <sys/types.h>
#include <stdio.h>
#ifdef STDC_HEADERS
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
extern char *program_name;
/* If ARG is an unambiguous match for an element of the
null-terminated array OPTLIST, return the index in OPTLIST
of the matched element, else -1 if it does not match any element
or -2 if it is ambiguous (is a prefix of more than one element). */
int
argmatch (arg, optlist)
const char *arg;
const char *const *optlist;
argmatch (const char *arg, const char *const *optlist)
{
int i; /* Temporary index in OPTLIST. */
size_t arglen; /* Length of ARG. */
@@ -75,15 +76,10 @@ argmatch (arg, optlist)
PROBLEM is the return value from argmatch. */
void
invalid_arg (kind, value, problem)
const char *kind;
const char *value;
int problem;
invalid_arg (const char *kind, const char *value, int problem)
{
fprintf (stderr, "%s: ", program_name);
if (problem == -1)
fprintf (stderr, "invalid");
else /* Assume -2. */
fprintf (stderr, "ambiguous");
fprintf (stderr, " %s `%s'\n", kind, value);
const char *fmt = (problem == -1
? "%s: invalid %s `%s'\n"
: "%s: ambiguous %s `%s'\n");
fprintf (stderr, fmt, program_name, kind, value);
}

View File

@@ -1,18 +1,12 @@
#ifndef ARGMATCH_H
#define ARGMATCH_H 1
/* argmatch.h -- declarations for matching arguments against option lists */
#ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
# else
# define __P(args) ()
# endif /* GCC. */
#endif /* Not __P. */
#if defined __STDC__ || __GNUC__
# define __ARGMATCH_P(args) args
#else
# define __ARGMATCH_P(args) ()
#endif
int
argmatch __P ((const char *arg, const char *const *optlist));
int argmatch __ARGMATCH_P ((const char *, const char * const *));
void invalid_arg __ARGMATCH_P ((const char *, const char *, int));
void
invalid_arg __P ((const char *kind, const char *value, int problem));
#endif /* ARGMATCH_H */
extern char *program_name;

View File

@@ -1,5 +1,5 @@
/* backupfile.c -- make Emacs style backup file names
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,100 +12,97 @@
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. */
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* David MacKenzie <djm@gnu.ai.mit.edu>.
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.
Some algorithms adapted from GNU Emacs. */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <argmatch.h>
#include <backupfile.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include "backupfile.h"
#ifdef HAVE_STRING_H
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#ifdef HAVE_DIRENT_H
#if HAVE_DIRENT_H
# include <dirent.h>
# define NLENGTH(direct) (strlen((direct)->d_name))
#else /* not HAVE_DIRENT_H */
# define NLENGTH(direct) strlen ((direct)->d_name)
#else
# define dirent direct
# define NLENGTH(direct) ((direct)->d_namlen)
# ifdef HAVE_SYS_NDIR_H
# define NLENGTH(direct) ((size_t) (direct)->d_namlen)
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif /* HAVE_SYS_NDIR_H */
# ifdef HAVE_SYS_DIR_H
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif /* HAVE_SYS_DIR_H */
# ifdef HAVE_NDIR_H
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif /* HAVE_NDIR_H */
#endif /* HAVE_DIRENT_H */
# endif
#endif
#ifdef CLOSEDIR_VOID
#if CLOSEDIR_VOID
/* Fake a return value. */
# define CLOSEDIR(d) (closedir (d), 0)
#else
# define CLOSEDIR(d) closedir (d)
#endif
#ifdef STDC_HEADERS
#if STDC_HEADERS
# include <stdlib.h>
#else
char *malloc ();
#endif
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H
# define HAVE_DIR 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
# define HAVE_DIR 0
#endif
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
/* Upper bound on the string length of an integer converted to string.
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
add 1 for integer division truncation; add 1 more for a minus sign. */
#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
/* 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_LOCALE unless
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)
#if defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif
#if defined (_POSIX_VERSION)
/* POSIX does not require that the d_ino field be present, and some
systems do not provide it. */
# define REAL_DIR_ENTRY(dp) 1
#else
#if D_INO_IN_DIRENT
# define REAL_DIR_ENTRY(dp) ((dp)->d_ino != 0)
#else
# define REAL_DIR_ENTRY(dp) 1
#endif
/* Which type of backup file names are generated. */
enum backup_type backup_type = none;
/* The extension added to file names to produce a simple (as opposed
to numbered) backup file name. */
char *simple_backup_suffix = "~";
const char *simple_backup_suffix = "~";
char *basename ();
char *dirname ();
static char *concat ();
char *find_backup_file_name ();
static char *make_version_name ();
static int max_backup_version ();
static int version_number ();
static int max_backup_version PARAMS ((const char *, const char *));
static int version_number PARAMS ((const char *, const char *, size_t));
/* Return the name of the new backup file for file FILE,
allocated with malloc. Return 0 if out of memory.
@@ -113,41 +110,56 @@ static int version_number ();
Do not call this function if backup_type == none. */
char *
find_backup_file_name (file)
const char *file;
find_backup_file_name (const char *file, enum backup_type backup_type)
{
char *dir;
char *base_versions;
int highest_backup;
size_t backup_suffix_size_max;
size_t file_len = strlen (file);
size_t numbered_suffix_size_max = INT_STRLEN_BOUND (int) + 4;
char *s;
const char *suffix = simple_backup_suffix;
if (backup_type == simple)
return concat (file, simple_backup_suffix);
base_versions = concat (basename (file), ".~");
if (base_versions == 0)
return 0;
dir = dirname (file);
if (dir == 0)
/* Allow room for simple or `.~N~' backups. */
backup_suffix_size_max = strlen (simple_backup_suffix) + 1;
if (HAVE_DIR && backup_suffix_size_max < numbered_suffix_size_max)
backup_suffix_size_max = numbered_suffix_size_max;
s = malloc (file_len + backup_suffix_size_max + numbered_suffix_size_max);
if (s)
{
free (base_versions);
return 0;
strcpy (s, file);
#if HAVE_DIR
if (backup_type != simple)
{
int highest_backup;
size_t dir_len = base_name (s) - s;
strcpy (s + dir_len, ".");
highest_backup = max_backup_version (file + dir_len, s);
if (! (backup_type == numbered_existing && highest_backup == 0))
{
char *numbered_suffix = s + (file_len + backup_suffix_size_max);
sprintf (numbered_suffix, ".~%d~", highest_backup + 1);
suffix = numbered_suffix;
}
strcpy (s, file);
}
#endif /* HAVE_DIR */
addext (s, suffix, '~');
}
highest_backup = max_backup_version (base_versions, dir);
free (base_versions);
free (dir);
if (backup_type == numbered_existing && highest_backup == 0)
return concat (file, simple_backup_suffix);
return make_version_name (file, highest_backup + 1);
return s;
}
#if HAVE_DIR
/* Return the number of the highest-numbered backup file for file
FILE in directory DIR. If there are no numbered backups
of FILE in DIR, or an error occurs reading DIR, return 0.
FILE should already have ".~" appended to it. */
*/
static int
max_backup_version (file, dir)
const char *file;
const char *dir;
max_backup_version (const char *file, const char *dir)
{
DIR *dirp;
struct dirent *dp;
@@ -164,7 +176,7 @@ max_backup_version (file, dir)
while ((dp = readdir (dirp)) != 0)
{
if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) <= file_name_length)
if (!REAL_DIR_ENTRY (dp) || NLENGTH (dp) < file_name_length + 4)
continue;
this_version = version_number (file, dp->d_name, file_name_length);
@@ -176,62 +188,55 @@ max_backup_version (file, dir)
return highest_version;
}
/* Return a string, allocated with malloc, containing
"FILE.~VERSION~". Return 0 if out of memory. */
static char *
make_version_name (file, version)
const char *file;
int version;
{
char *backup_name;
backup_name = malloc (strlen (file) + 16);
if (backup_name == 0)
return 0;
sprintf (backup_name, "%s.~%d~", file, version);
return backup_name;
}
/* If BACKUP is a numbered backup of BASE, return its version number;
otherwise return 0. BASE_LENGTH is the length of BASE.
BASE should already have ".~" appended to it. */
*/
static int
version_number (base, backup, base_length)
const char *base;
const char *backup;
int base_length;
version_number (const char *base, const char *backup, size_t base_length)
{
int version;
const char *p;
version = 0;
if (!strncmp (base, backup, base_length) && ISDIGIT (backup[base_length]))
if (strncmp (base, backup, base_length) == 0
&& backup[base_length] == '.'
&& backup[base_length + 1] == '~')
{
for (p = &backup[base_length]; ISDIGIT (*p); ++p)
for (p = &backup[base_length + 2]; ISDIGIT (*p); ++p)
version = version * 10 + *p - '0';
if (p[0] != '~' || p[1])
version = 0;
}
return version;
}
#endif /* HAVE_DIR */
/* Return the newly-allocated concatenation of STR1 and STR2.
If out of memory, return 0. */
static char *
concat (str1, str2)
const char *str1;
const char *str2;
static const char * const backup_args[] =
{
char *newstr;
int str1_length = strlen (str1);
"never", "simple", "nil", "existing", "t", "numbered", 0
};
newstr = malloc (str1_length + strlen (str2) + 1);
if (newstr == 0)
return 0;
strcpy (newstr, str1);
strcpy (newstr + str1_length, str2);
return newstr;
static const enum backup_type backup_types[] =
{
simple, simple, numbered_existing, numbered_existing, numbered, numbered
};
/* Return the type of backup indicated by VERSION.
Unique abbreviations are accepted. */
enum backup_type
get_version (const char *version)
{
int i;
if (version == 0 || *version == 0)
return numbered_existing;
i = argmatch (version, backup_args);
if (i < 0)
{
invalid_arg ("version control type", version, i);
exit (2);
}
return backup_types[i];
}

View File

@@ -1,5 +1,5 @@
/* backupfile.h -- declarations for making Emacs style backup file names
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,8 +12,9 @@
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. */
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* When to make backup files. */
enum backup_type
@@ -32,11 +33,23 @@ enum backup_type
numbered
};
extern enum backup_type backup_type;
extern char *simple_backup_suffix;
#define VALID_BACKUP_TYPE(Type) \
((Type) == none \
|| (Type) == simple \
|| (Type) == numbered_existing \
|| (Type) == numbered)
#ifdef __STDC__
char *find_backup_file_name (const char *file);
#else
char *find_backup_file_name ();
extern char const *simple_backup_suffix;
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
char *base_name PARAMS ((char const *));
char *find_backup_file_name PARAMS ((char const *, enum backup_type));
enum backup_type get_version PARAMS ((char const *));
void addext PARAMS ((char *, char const *, int));

View File

@@ -1,5 +1,5 @@
/* basename.c -- return the last element in a path
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,24 +15,30 @@
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
/* Return NAME with any leading path stripped off.
Don't use strrchr/rindex. */
#ifndef FILESYSTEM_PREFIX_LEN
# define FILESYSTEM_PREFIX_LEN(Filename) 0
#endif
#ifndef ISSLASH
# define ISSLASH(C) ((C) == '/')
#endif
/* In general, we can't use the builtin `basename' function if available,
since it has different meanings in different environments.
In some environments the builtin `basename' modifies its argument. */
char *
basename (name)
const char *name;
base_name (char const *name)
{
const char *base = name;
char const *base = name += FILESYSTEM_PREFIX_LEN (name);
for (; *name; name++)
if (ISSLASH (*name))
base = name + 1;
while (*name)
{
if (*name == '/')
base = name + 1;
++name;
}
return (char *) base;
}

58
lib/chown.c Normal file
View File

@@ -0,0 +1,58 @@
/* provide consistent interface to chown for systems that don't interpret
an ID of -1 as meaning `don't change the corresponding ID'.
Copyright (C) 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#include <config.h>
/* Disable the definition of chown to rpl_chown (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_chown on
most systems. */
#undef chown
#include <sys/types.h>
#include <sys/stat.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
/* FIXME: describe. */
int
rpl_chown (file, uid, gid)
const char *file;
uid_t uid;
gid_t gid;
{
if (gid == (gid_t) -1 || uid == (uid_t) -1)
{
struct stat file_stats;
/* Stat file to get id(s) that should remain unchanged. */
if (stat (file, &file_stats))
return 1;
if (gid == (gid_t) -1)
gid = file_stats.st_gid;
if (uid == (uid_t) -1)
uid = file_stats.st_uid;
}
return chown (file, uid, gid);
}

60
lib/closeout.c Normal file
View File

@@ -0,0 +1,60 @@
/* closeout.c - close standard output
Copyright (C) 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# define _(Text) Text
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <stdio.h>
#include "closeout.h"
#include "error.h"
/* Close standard output, exiting with status STATUS on failure. */
void
close_stdout_status (int status)
{
if (ferror (stdout))
error (status, 0, _("write error"));
if (fclose (stdout) != 0)
error (status, errno, _("write error"));
}
/* Close standard output, exiting with status EXIT_FAILURE on failure. */
void
close_stdout (void)
{
close_stdout_status (EXIT_FAILURE);
}

10
lib/closeout.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
void close_stdout PARAMS ((void));
void close_stdout_status PARAMS ((int status));

View File

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

View File

@@ -1,10 +1,14 @@
/* error.c -- error handler for noninteractive utilities
Copyright (C) 1990, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
/* Error handler for noninteractive utilities
Copyright (C) 1990,91,92,93,94,95,96,97 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.
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.
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
@@ -12,13 +16,14 @@
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. */
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 MacKenzie <djm@gnu.ai.mit.edu>. */
#if HAVE_CONFIG_H
# include <config.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
@@ -43,12 +48,11 @@
void exit ();
#endif
#ifndef _
# define _(String) String
#endif
#include "error.h"
/* Get prototypes for the functions defined here. */
#include <error.h>
#ifndef _
#define _(String) String
#endif
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
@@ -65,15 +69,21 @@ unsigned int error_message_count;
#ifdef _LIBC
/* In the GNU C library, there is a predefined variable for this. */
# define program_name program_invocation_name
# include <errno.h>
#define program_name program_invocation_name
#include <errno.h>
#else /* not _LIBC */
/* In GNU libc we want do not want to use the common name `error' directly.
Instead make it a weak alias. */
#define error __error
#define error_at_line __error_at_line
#else
/* The calling program should define program_name and set it to the
name of the executing program. */
extern char *program_name;
#ifndef HAVE_STRERROR_R
# if HAVE_STRERROR
# ifndef strerror /* On some systems, strerror is a macro */
char *strerror ();
@@ -87,12 +97,13 @@ private_strerror (errnum)
extern int sys_nerr;
if (errnum > 0 && errnum <= sys_nerr)
return sys_errlist[errnum];
return _(sys_errlist[errnum]);
return _("Unknown system error");
}
# define strerror private_strerror
# endif /* HAVE_STRERROR */
#endif /* not _LIBC */
#endif /* HAVE_STRERROR_R */
#endif /* _LIBC */
/* Print the program name and error message MESSAGE, which is a printf-style
format string with optional args.
@@ -137,7 +148,14 @@ error (status, errnum, message, va_alist)
++error_message_count;
if (errnum)
fprintf (stderr, ": %s", strerror (errnum));
{
#if defined HAVE_STRERROR_R || defined _LIBC
char errbuf[1024];
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif
}
putc ('\n', stderr);
fflush (stderr);
if (status)
@@ -205,9 +223,24 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
++error_message_count;
if (errnum)
fprintf (stderr, ": %s", strerror (errnum));
{
#if defined HAVE_STRERROR_R || defined _LIBC
char errbuf[1024];
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif
}
putc ('\n', stderr);
fflush (stderr);
if (status)
exit (status);
}
#ifdef _LIBC
/* Make the weak alias. */
#undef error
#undef error_at_line
weak_alias (__error, error)
weak_alias (__error_at_line, error_at_line)
#endif

View File

@@ -1,10 +1,14 @@
/* error.h -- declaration for error-reporting function
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
/* Declaration for error-reporting function
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
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.
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
@@ -12,26 +16,31 @@
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. */
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifndef ERROR_H_
# define ERROR_H_
#ifndef _ERROR_H
#define _ERROR_H 1
# ifndef __attribute__
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
# if defined (__STDC__) && __STDC__
#ifdef __cplusplus
extern "C" {
#endif
#if defined (__STDC__) && __STDC__
/* Print a message with `fprintf (stderr, FORMAT, ...)';
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
@@ -49,11 +58,11 @@ extern void error_at_line (int status, int errnum, const char *fname,
function without parameters instead. */
extern void (*error_print_progname) (void);
# else
#else
void error ();
void error_at_line ();
extern void (*error_print_progname) ();
# endif
#endif
/* This variable is incremented each time `error' is called. */
extern unsigned int error_message_count;
@@ -62,4 +71,8 @@ extern unsigned int error_message_count;
variable controls whether this mode is selected or not. */
extern int error_one_per_line;
#endif /* not ERROR_H_ */
#ifdef __cplusplus
}
#endif
#endif /* error.h */

View File

@@ -21,7 +21,7 @@ Suite 330, Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie and Torbjorn Granlund.
Adapted for GNU C library by Roland McGrath. */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
@@ -111,7 +111,7 @@ static gid_t egid;
/* Nonzero if UID, GID, EUID, and EGID have valid values. */
static int have_ids = 0;
# ifdef HAVE_GETGROUPS
# if HAVE_GETGROUPS
int group_member ();
# else
# define group_member(gid) 0

127
lib/exclude.c Normal file
View File

@@ -0,0 +1,127 @@
/* exclude.c -- exclude file names
Copyright 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert <eggert@twinsun.com> */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <exclude.h>
#include <fnmatch.h>
#include <stdio.h>
#include <sys/types.h>
void *xmalloc PARAMS ((size_t));
void *xrealloc PARAMS ((void *, size_t));
/* Keep track of excluded file name patterns. */
struct exclude
{
char const **exclude;
int exclude_alloc;
int exclude_count;
};
struct exclude *
new_exclude (void)
{
struct exclude *ex = (struct exclude *) xmalloc (sizeof (struct exclude));
ex->exclude_count = 0;
ex->exclude_alloc = 64;
ex->exclude = (char const **) xmalloc (ex->exclude_alloc * sizeof (char *));
return ex;
}
int
excluded_filename (struct exclude const *ex, char const *f)
{
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)
return 1;
return 0;
}
void
add_exclude (struct exclude *ex, char const *pattern)
{
if (ex->exclude_alloc <= ex->exclude_count)
ex->exclude = (char const **) xrealloc (ex->exclude,
((ex->exclude_alloc *= 2)
* sizeof (char *)));
ex->exclude[ex->exclude_count++] = pattern;
}
int
add_exclude_file (struct exclude *ex, char const *filename, char line_end)
{
int use_stdin = filename[0] == '-' && !filename[1];
FILE *in;
char *buf;
char *p;
char const *pattern;
char const *lim;
size_t buf_alloc = 1024;
size_t buf_count = 0;
int c;
int e = 0;
if (use_stdin)
in = stdin;
else if (! (in = fopen (filename, "r")))
return -1;
buf = xmalloc (buf_alloc);
while ((c = getc (in)) != EOF)
{
buf[buf_count++] = c;
if (buf_count == buf_alloc)
buf = xrealloc (buf, buf_alloc *= 2);
}
buf = xrealloc (buf, buf_count + 1);
if (ferror (in))
e = errno;
if (!use_stdin && fclose (in) != 0)
e = errno;
for (pattern = p = buf, lim = buf + buf_count; p <= lim; p++)
if (p < lim ? *p == line_end : buf < p && p[-1])
{
*p = '\0';
add_exclude (ex, pattern);
pattern = p + 1;
}
errno = e;
return e ? -1 : 0;
}

34
lib/exclude.h Normal file
View File

@@ -0,0 +1,34 @@
/* exclude.h -- declarations for excluding file names
Copyright 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert <eggert@twinsun.com> */
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
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 *));

View File

@@ -1,5 +1,5 @@
/* Convert file size to number of blocks on System V-like machines.
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,23 +17,31 @@
/* Written by Brian L. Matthews, blm@6sceng.UUCP. */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if !defined (HAVE_ST_BLOCKS) && !defined(_POSIX_VERSION)
# include <sys/types.h>
#include <sys/types.h>
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if !HAVE_ST_BLOCKS && !defined _POSIX_SOURCE && defined BSIZE
# if HAVE_UNISTD_H
# include <unistd.h>
# endif
# ifndef NINDIR
/* Some SysV's, like Irix, seem to lack these. Hope they're correct. */
/* Size of a indirect block, in bytes. */
# ifndef BSIZE
# define BSIZE 1024
# if defined (__DJGPP__)
typedef long daddr_t; /* for disk address */
# endif
/* Some SysV's, like Irix, seem to lack this. Hope it's correct. */
/* Number of inode pointers per indirect block. */
# define NINDIR (BSIZE/sizeof(daddr_t))
# define NINDIR (BSIZE / sizeof (daddr_t))
# endif /* !NINDIR */
/* Number of direct block addresses in an inode. */
@@ -41,12 +49,12 @@
/* Return the number of 512-byte blocks in a file of SIZE bytes. */
long
off_t
st_blocks (size)
long size;
off_t size;
{
long datablks = (size + 512 - 1) / 512;
long indrblks = 0;
off_t datablks = size / 512 + (size % 512 != 0);
off_t indrblks = 0;
if (datablks > NDIR)
{

View File

@@ -1,5 +1,5 @@
/* filemode.c -- make a string describing file modes
Copyright (C) 1985, 1990, 1993 Free Software Foundation, Inc.
Copyright (C) 1985, 1990, 1993, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
@@ -47,45 +47,45 @@
#endif
#ifdef STAT_MACROS_BROKEN
#undef S_ISBLK
#undef S_ISCHR
#undef S_ISDIR
#undef S_ISFIFO
#undef S_ISLNK
#undef S_ISMPB
#undef S_ISMPC
#undef S_ISNWK
#undef S_ISREG
#undef S_ISSOCK
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# 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. */
#if !defined(S_ISBLK) && defined(S_IFBLK)
#define S_ISBLK(m) (((m) & S_IFMT) == 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)
# 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)
# 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)
# 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)
# 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)
# 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)
# 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)
# 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)
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
void mode_string ();

View File

@@ -1,38 +1,32 @@
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1993, 1996, 1997 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.
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 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. */
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 HAVE_CONFIG_H
# include <config.h>
#endif
/* Enable GNU extensions in fnmatch.h. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <errno.h>
#include <fnmatch.h>
#include <ctype.h>
#if defined (STDC_HEADERS) || !defined (isascii)
# define ISASCII(c) 1
#else
# define ISASCII(c) isascii(c)
#endif
#define ISUPPER(c) (ISASCII (c) && isupper (c))
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
@@ -42,7 +36,16 @@
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#if defined _LIBC || !defined __GNU_LIBRARY__
# if defined STDC_HEADERS || !defined isascii
# define ISASCII(c) 1
# else
# define ISASCII(c) isascii(c)
# endif
# define ISUPPER(c) (ISASCII (c) && isupper (c))
# ifndef errno
@@ -60,8 +63,8 @@ fnmatch (pattern, string, flags)
register const char *p = pattern, *n = string;
register char c;
/* Note that this evalutes C many times. */
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
/* Note that this evaluates C many times. */
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
while ((c = *p++) != '\0')
{
@@ -83,6 +86,9 @@ fnmatch (pattern, string, flags)
if (!(flags & FNM_NOESCAPE))
{
c = *p++;
if (c == '\0')
/* Trailing \ loses. */
return FNM_NOMATCH;
c = FOLD (c);
}
if (FOLD (*n) != c)
@@ -94,10 +100,24 @@ fnmatch (pattern, string, flags)
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
if (((flags & FNM_FILE_NAME) && *n == '/') ||
(c == '?' && *n == '\0'))
return FNM_NOMATCH;
for (c = *p++; c == '?' || c == '*'; c = *p++)
{
if ((flags & FNM_FILE_NAME) && *n == '/')
/* A slash does not match a wildcard under FNM_FILE_NAME. */
return FNM_NOMATCH;
else if (c == '?')
{
/* A ? needs to match one character. */
if (*n == '\0')
/* There isn't another character; no match. */
return FNM_NOMATCH;
else
/* One character of the string is consumed in matching
this ? wildcard, so *??? won't match if there are
less than three characters. */
++n;
}
}
if (c == '\0')
return 0;
@@ -134,7 +154,11 @@ fnmatch (pattern, string, flags)
register char cstart = c, cend = c;
if (!(flags & FNM_NOESCAPE) && c == '\\')
cstart = cend = *p++;
{
if (*p == '\0')
return FNM_NOMATCH;
cstart = cend = *p++;
}
cstart = cend = FOLD (cstart);
@@ -181,8 +205,12 @@ fnmatch (pattern, string, flags)
c = *p++;
if (!(flags & FNM_NOESCAPE) && c == '\\')
/* XXX 1003.2d11 is unclear if this is right. */
++p;
{
if (*p == '\0')
return FNM_NOMATCH;
/* XXX 1003.2d11 is unclear if this is right. */
++p;
}
}
if (not)
return FNM_NOMATCH;

View File

@@ -1,5 +1,5 @@
/* fsusage.c -- return space usage of mounted filesystems
Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,9 @@
# include <config.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include "fsusage.h"
@@ -62,30 +65,14 @@ int statfs ();
int statvfs ();
#endif
/* Many space usage primitives use all 1 bits to denote a value that is
not applicable or unknown. Propagate this information by returning
a uintmax_t value that is all 1 bits if the argument is all 1 bits,
even if the argument is unsigned and smaller than unitmax_t. */
#define PROPAGATE_ALL_ONES(x) ((x) == -1 ? (uintmax_t) -1 : (uintmax_t) (x))
int safe_read ();
/* Return the number of TOSIZE-byte blocks used by
BLOCKS FROMSIZE-byte blocks, rounding away from zero.
TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
static long
adjust_blocks (blocks, fromsize, tosize)
long blocks;
int fromsize, tosize;
{
if (tosize <= 0)
abort ();
if (fromsize <= 0)
return -1;
if (fromsize == tosize) /* e.g., from 512 to 512 */
return blocks;
else if (fromsize > tosize) /* e.g., from 2048 to 512 */
return blocks * (fromsize / tosize);
else /* e.g., from 256 to 512 */
return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
}
/* Fill in the fields of FSP with information about space usage for
the filesystem on which PATH resides.
DISK is the device on which PATH is mounted, for space-getting
@@ -100,27 +87,29 @@ get_fs_usage (path, disk, fsp)
struct fs_usage *fsp;
{
#ifdef STAT_STATFS3_OSF1
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
struct statfs fsd;
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
return -1;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#endif /* STAT_STATFS3_OSF1 */
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
# define CONVERT_BLOCKS(B) adjust_blocks ((B), 1024, 512)
struct fs_data fsd;
if (statfs (path, &fsd) != 1)
return -1;
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.fd_req.btot);
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.fd_req.bfree);
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.fd_req.bfreen);
fsp->fsu_files = fsd.fd_req.gtot;
fsp->fsu_ffree = fsd.fd_req.gfree;
fsp->fsu_blocksize = 1024;
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.fd_req.bfreen);
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
#endif /* STAT_STATFS2_FS_DATA */
@@ -128,8 +117,6 @@ get_fs_usage (path, disk, fsp)
# ifndef SUPERBOFF
# define SUPERBOFF (SUPERB * 512)
# endif
# define CONVERT_BLOCKS(B) \
adjust_blocks ((B), (fsd.s_type == Fs2b ? 1024 : 512), 512)
struct filsys fsd;
int fd;
@@ -143,29 +130,34 @@ get_fs_usage (path, disk, fsp)
fd = open (disk, O_RDONLY);
if (fd < 0)
return -1;
lseek (fd, (long) SUPERBOFF, 0);
lseek (fd, (off_t) SUPERBOFF, 0);
if (safe_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
{
close (fd);
return -1;
}
close (fd);
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.s_fsize);
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.s_tfree);
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.s_tfree);
fsp->fsu_files = (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1);
fsp->fsu_ffree = fsd.s_tinode;
fsp->fsu_blocksize = (fsd.s_type == Fs2b ? 1024 : 512);
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.s_fsize);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.s_tfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.s_tfree);
fsp->fsu_files = (fsd.s_isize == -1
? (uintmax_t) -1
: (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1));
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.s_tinode);
#endif /* STAT_READ_FILSYS */
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
struct statfs fsd;
if (statfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
/* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
@@ -184,60 +176,59 @@ get_fs_usage (path, disk, fsp)
#endif /* STAT_STATFS2_BSIZE */
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
struct statfs fsd;
if (statfs (path, &fsd) < 0)
return -1;
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
#endif /* STAT_STATFS2_FSIZE */
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
# if _AIX || defined(_CRAY)
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
# ifdef _CRAY
# define f_bavail f_bfree
# endif
# else
# define CONVERT_BLOCKS(B) (B)
# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
# define f_bavail f_bfree
# endif
# endif
# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN
# define f_bavail f_bfree
# endif
struct statfs fsd;
if (statfs (path, &fsd, sizeof fsd, 0) < 0)
return -1;
/* Empirically, the block counts on most SVR3 and SVR3-derived
systems seem to always be in terms of 512-byte blocks,
no matter what value f_bsize has. */
# if _AIX || defined(_CRAY)
fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
# else
fsp->fsu_blocksize = 512;
# endif
#endif /* STAT_STATFS4 */
#ifdef STAT_STATVFS /* SVR4 */
# define CONVERT_BLOCKS(B) \
adjust_blocks ((B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
struct statvfs fsd;
if (statvfs (path, &fsd) < 0)
return -1;
/* f_frsize isn't guaranteed to be supported. */
fsp->fsu_blocksize =
PROPAGATE_ALL_ONES (fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize);
#endif /* STAT_STATVFS */
#if !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ_FILSYS)
/* !Ultrix && !SVR2 */
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.f_blocks);
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.f_bfree);
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.f_bavail);
fsp->fsu_files = fsd.f_files;
fsp->fsu_ffree = fsd.f_ffree;
fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.f_blocks);
fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.f_bfree);
fsp->fsu_bavail = PROPAGATE_ALL_ONES (fsd.f_bavail);
fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.f_files);
fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.f_ffree);
#endif /* not STAT_STATFS2_FS_DATA && not STAT_READ_FILSYS */

View File

@@ -1,5 +1,5 @@
/* fsusage.h -- declarations for filesystem space usage info
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,22 +16,29 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
#if !defined FSUSAGE_H_
# define FSUSAGE_H_
struct fs_usage
{
long fsu_blocks; /* Total blocks. */
long fsu_bfree; /* Free blocks available to superuser. */
long fsu_bavail; /* Free blocks available to non-superuser. */
long fsu_files; /* Total file nodes. */
long fsu_ffree; /* Free file nodes. */
int fsu_blocksize; /* Size of a block. */
uintmax_t fsu_blocks; /* Total blocks. */
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */
uintmax_t fsu_files; /* Total file nodes. */
uintmax_t fsu_ffree; /* Free file nodes. */
};
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int get_fs_usage __P ((const char *path, const char *disk,
struct fs_usage *fsp));
int get_fs_usage PARAMS ((const char *path, const char *disk,
struct fs_usage *fsp));
#endif

View File

@@ -1,8 +1,8 @@
/* ftruncate emulations that work on some System V's.
This file is in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
@@ -19,15 +19,15 @@ ftruncate (fd, length)
}
#else /* not F_CHSIZE */
#ifdef F_FREESP
# ifdef F_FREESP
/* By William Kucharski <kucharsk@netcom.com>. */
#include <sys/stat.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
# include <sys/stat.h>
# include <errno.h>
# if HAVE_UNISTD_H
# include <unistd.h>
# endif
int
ftruncate (fd, length)
@@ -71,8 +71,8 @@ ftruncate (fd, length)
return 0;
}
#else /* not F_CHSIZE nor F_FREESP */
#ifdef HAVE_CHSIZE
# else /* not F_CHSIZE nor F_FREESP */
# if HAVE_CHSIZE
int
ftruncate (fd, length)
@@ -82,12 +82,12 @@ ftruncate (fd, length)
return chsize (fd, length);
}
#else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
# else /* not F_CHSIZE nor F_FREESP nor HAVE_CHSIZE */
#include <errno.h>
#ifndef errno
# include <errno.h>
# ifndef errno
extern int errno;
#endif
# endif
int
ftruncate (fd, length)
@@ -98,6 +98,6 @@ ftruncate (fd, length)
return -1;
}
#endif /* not HAVE_CHSIZE */
#endif /* not F_FREESP */
# endif /* not HAVE_CHSIZE */
# endif /* not F_FREESP */
#endif /* not F_CHSIZE */

View File

@@ -1,5 +1,5 @@
/* full-write.c -- an interface to write that retries after interrupts
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,10 +37,7 @@ extern int errno;
Return LEN upon success, write's (negative) error code otherwise. */
int
full_write (desc, ptr, len)
int desc;
char *ptr;
size_t len;
full_write (int desc, const char *ptr, size_t len)
{
int total_written;
@@ -48,6 +45,10 @@ full_write (desc, ptr, len)
while (len > 0)
{
int written = write (desc, ptr, len);
/* FIXME: write on my slackware Linux 1.2.13 returns zero when
I try to write more data than there is room on a floppy disk.
This puts dd into an infinite loop. Reproduce with
dd if=/dev/zero of=/dev/fd0. */
if (written < 0)
{
#ifdef EINTR

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,28 +14,28 @@
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
# ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
#if defined (vms)
#ifdef vms
# include <types.h>
# include <time.h>
#else
# include <sys/types.h>
# ifdef TIME_WITH_SYS_TIME
# if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
# else
# ifdef HAVE_SYS_TIME_H
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>

View File

@@ -3,9 +3,7 @@
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
** a couple of people on Usenet. Completely overhauled by Rich $alz
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
**
** This grammar has 13 shift/reduce conflicts.
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
**
** This code is in the public domain and has no copyright.
*/
@@ -51,8 +49,6 @@
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#include "getdate.h"
#if defined (STDC_HEADERS) || defined (USG)
# include <string.h>
#endif
@@ -64,10 +60,6 @@
# define bcopy(from, to, len) memcpy ((to), (from), (len))
#endif
extern struct tm *gmtime ();
extern struct tm *localtime ();
extern time_t mktime ();
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
yacc generated parsers in the same program. Note that these are only
@@ -172,6 +164,9 @@ static int yyRelYear;
%}
/* This grammar has 13 shift/reduce conflicts. */
%expect 13
%union {
int Number;
enum _MERIDIAN Meridian;
@@ -347,7 +342,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelYear += $1 * $2;
}
| tYEAR_UNIT {
yyRelYear++;
yyRelYear += $1;
}
| tUNUMBER tMONTH_UNIT {
yyRelMonth += $1 * $2;
@@ -356,7 +351,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelMonth += $1 * $2;
}
| tMONTH_UNIT {
yyRelMonth++;
yyRelMonth += $1;
}
| tUNUMBER tDAY_UNIT {
yyRelDay += $1 * $2;
@@ -365,7 +360,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelDay += $1 * $2;
}
| tDAY_UNIT {
yyRelDay++;
yyRelDay += $1;
}
| tUNUMBER tHOUR_UNIT {
yyRelHour += $1 * $2;
@@ -374,7 +369,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelHour += $1 * $2;
}
| tHOUR_UNIT {
yyRelHour++;
yyRelHour += $1;
}
| tUNUMBER tMINUTE_UNIT {
yyRelMinutes += $1 * $2;
@@ -383,7 +378,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelMinutes += $1 * $2;
}
| tMINUTE_UNIT {
yyRelMinutes++;
yyRelMinutes += $1;
}
| tUNUMBER tSEC_UNIT {
yyRelSeconds += $1 * $2;
@@ -392,7 +387,7 @@ relunit : tUNUMBER tYEAR_UNIT {
yyRelSeconds += $1 * $2;
}
| tSEC_UNIT {
yyRelSeconds++;
yyRelSeconds += $1;
}
;
@@ -441,6 +436,15 @@ o_merid : /* NULL */
%%
/* Include this file down here because bison inserts code above which
may define-away `const'. We want the prototype for get_date to have
the same signature as the function definition does. */
#include "getdate.h"
extern struct tm *gmtime ();
extern struct tm *localtime ();
extern time_t mktime ();
/* Month and day table. */
static TABLE const MonthDayTable[] = {
{ "january", tMONTH, 1 },
@@ -493,7 +497,7 @@ static TABLE const OtherTable[] = {
{ "now", tMINUTE_UNIT, 0 },
{ "last", tUNUMBER, -1 },
{ "this", tMINUTE_UNIT, 0 },
{ "next", tUNUMBER, 2 },
{ "next", tUNUMBER, 1 },
{ "first", tUNUMBER, 1 },
/* { "second", tUNUMBER, 2 }, */
{ "third", tUNUMBER, 3 },
@@ -886,9 +890,7 @@ difftm (a, b)
}
time_t
get_date (p, now)
const char *p;
const time_t *now;
get_date (const char *p, const time_t *now)
{
struct tm tm, tm0, *tmp;
time_t Start;

View File

@@ -1,6 +1,6 @@
/* getline.c -- Replacement for GNU C library function getline
Copyright (C) 1993, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -24,7 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The `getdelim' function is only declared if the following symbol
is defined. */
#define _GNU_SOURCE 1
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <stdio.h>
#include <sys/types.h>

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# include <stdio.h>
# ifndef PARAMS
# if defined (__GNUC__) || __STDC__
# define PARAMS(args) args
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(args) ()
# define PARAMS(Args) ()
# endif
# endif

View File

@@ -1,5 +1,5 @@
/* Get the system load averages.
Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995
Copyright (C) 1985, 86, 87, 88, 89, 91, 92, 93, 1994, 1995, 1997
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -51,7 +51,7 @@
DGUX
eunice UNIX emulator under VMS.
hpux
MSDOS No-op for MSDOS.
__MSDOS__ No-op for MSDOS.
NeXT
sgi
sequent Sequent Dynix 3.x.x (BSD)
@@ -60,7 +60,7 @@
UMAX
UMAX4_3
VMS
WIN32 No-op for Windows95/NT.
WINDOWS32 No-op for Windows95/NT.
__linux__ Linux: assumes /proc filesystem mounted.
Support from Michael K. Johnson.
__NetBSD__ NetBSD: assumes /kern filesystem mounted.
@@ -167,6 +167,9 @@ extern int errno;
# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
# define OSF_ALPHA
# include <sys/mbuf.h>
# include <sys/socket.h>
# include <net/route.h>
# include <sys/table.h>
# endif
@@ -278,7 +281,7 @@ extern int errno;
/* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
above under #ifdef MIPS. But we want the sgi value. */
# undef FSCALE
# define FSCALE 1000.0
# define FSCALE 1000.0
# endif
# if defined (ardent) && defined (titan)
@@ -296,7 +299,7 @@ extern int errno;
# endif /* Not FSCALE. */
# if !defined (LDAV_CVT) && defined (FSCALE)
# define LDAV_CVT(n) (((double) (n)) / FSCALE)
# define LDAV_CVT(n) (((double) (n)) / FSCALE)
# endif
/* VAX C can't handle multi-line #ifs, or lines longer that 256 characters. */
@@ -444,6 +447,14 @@ extern int errno;
# endif /* LOAD_AVE_TYPE */
# if defined(__GNU__) && !defined (NeXT)
/* Note that NeXT Openstep defines __GNU__ even though it should not. */
/* GNU system acts much like NeXT, for load average purposes,
but not exactly. */
# define NeXT
# define host_self mach_host_self
# endif
# ifdef NeXT
# ifdef HAVE_MACH_MACH_H
# include <mach/mach.h>
@@ -543,7 +554,7 @@ getloadavg (loadavg, nelem)
elem = -1;
# endif
# if !defined (LDAV_DONE) && defined (SUNOS_5)
# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)
/* Use libkstat because we don't have to be root. */
# define LDAV_DONE
kstat_ctl_t *kc;
@@ -588,7 +599,7 @@ getloadavg (loadavg, nelem)
}
kstat_close (kc);
# endif /* SUNOS_5 */
# endif /* HAVE_LIBKSTAT */
# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
/* Use pstat_getdynamic() because we don't have to be root. */
@@ -826,7 +837,7 @@ getloadavg (loadavg, nelem)
: (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
# endif /* OSF_MIPS */
# if !defined (LDAV_DONE) && (defined (MSDOS) || defined (WIN32))
# if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
# define LDAV_DONE
/* A faithful emulation is going to have to be saved for a rainy day. */
@@ -834,7 +845,7 @@ getloadavg (loadavg, nelem)
{
loadavg[elem] = 0.0;
}
# endif /* MSDOS */
# endif /* __MSDOS__ || WINDOWS32 */
# if !defined (LDAV_DONE) && defined (OSF_ALPHA)
# define LDAV_DONE

View File

@@ -4,25 +4,27 @@
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
Free Software Foundation, Inc.
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.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
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.
The GNU C Library 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
Library General Public License for more details.
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.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
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. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
@@ -253,26 +255,41 @@ static int last_nonopt;
/* Bash 2.0 gives us an environment variable containing flags
indicating ARGV elements that should not be considered arguments. */
static const char *nonoption_flags;
/* Defined in getopt_init.c */
extern char *__getopt_nonoption_flags;
static int nonoption_flags_max_len;
static int nonoption_flags_len;
static int original_argc;
static char *const *original_argv;
extern pid_t __libc_pid;
/* Make sure the environment variable bash 2.0 puts in the environment
is valid for the getopt call we must make sure that the ARGV passed
to getopt is that one passed to the process. */
static void store_args (int argc, char *const *argv) __attribute__ ((unused));
static void
store_args (int argc, char *const *argv)
__attribute__ ((unused))
store_args_and_env (int argc, char *const *argv)
{
/* XXX This is no good solution. We should rather copy the args so
that we can compare them later. But we must not use malloc(3). */
original_argc = argc;
original_argv = argv;
}
text_set_element (__libc_subinit, store_args);
#endif
text_set_element (__libc_subinit, store_args_and_env);
# define SWAP_FLAGS(ch1, ch2) \
if (nonoption_flags_len > 0) \
{ \
char __tmp = __getopt_nonoption_flags[ch1]; \
__getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
__getopt_nonoption_flags[ch2] = __tmp; \
}
#else /* !_LIBC */
# define SWAP_FLAGS(ch1, ch2)
#endif /* _LIBC */
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
@@ -301,6 +318,28 @@ exchange (argv)
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */
#ifdef _LIBC
/* First make sure the handling of the `__getopt_nonoption_flags'
string can work normally. Our top argument must be in the range
of the string. */
if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
char *new_str = malloc (top + 1);
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len);
memset (&new_str[nonoption_flags_max_len], '\0',
top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
}
}
#endif
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
@@ -315,6 +354,7 @@ exchange (argv)
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
@@ -331,6 +371,7 @@ exchange (argv)
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
SWAP_FLAGS (bottom + i, middle + i);
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
@@ -358,7 +399,7 @@ _getopt_initialize (argc, argv, optstring)
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
first_nonopt = last_nonopt = optind = 1;
first_nonopt = last_nonopt = optind;
nextchar = NULL;
@@ -385,17 +426,30 @@ _getopt_initialize (argc, argv, optstring)
if (posixly_correct == NULL
&& argc == original_argc && argv == original_argv)
{
/* Bash 2.0 puts a special variable in the environment for each
command it runs, specifying which ARGV elements are the results of
file name wildcard expansion and therefore should not be
considered as options. */
char var[100];
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
nonoption_flags = getenv (var);
if (nonoption_flags == NULL)
nonoption_flags_len = 0;
else
nonoption_flags_len = strlen (nonoption_flags);
if (nonoption_flags_max_len == 0)
{
if (__getopt_nonoption_flags == NULL
|| __getopt_nonoption_flags[0] == '\0')
nonoption_flags_max_len = -1;
else
{
const char *orig_str = __getopt_nonoption_flags;
int len = nonoption_flags_max_len = strlen (orig_str);
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
__getopt_nonoption_flags =
(char *) malloc (nonoption_flags_max_len);
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
{
memcpy (__getopt_nonoption_flags, orig_str, len);
memset (&__getopt_nonoption_flags[len], '\0',
nonoption_flags_max_len - len);
}
}
}
nonoption_flags_len = nonoption_flags_max_len;
}
else
nonoption_flags_len = 0;
@@ -471,10 +525,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
optarg = NULL;
if (!__getopt_initialized || optind == 0)
if (optind == 0 || !__getopt_initialized)
{
if (optind == 0)
optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = _getopt_initialize (argc, argv, optstring);
optind = 1; /* Don't scan ARGV[0], the program name. */
__getopt_initialized = 1;
}
@@ -485,7 +540,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
#ifdef _LIBC
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|| (optind < nonoption_flags_len \
&& nonoption_flags[optind] == '1'))
&& __getopt_nonoption_flags[optind] == '1'))
#else
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif

View File

@@ -1,23 +1,25 @@
/* Declarations for getopt.
Copyright (C) 1989,90,91,92,93,94,96,97 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.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
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.
The GNU C Library 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
Library General Public License for more details.
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.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
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 _GETOPT_H
#define _GETOPT_H 1

View File

@@ -1,23 +1,25 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97 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.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
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.
The GNU C Library 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
Library General Public License for more details.
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.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@@ -1,5 +1,5 @@
/* getugroups.c -- return a list of the groups a user is in
Copyright (C) 1990, 1991 Free Software Foundation.
Copyright (C) 1990, 1991, 1998 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
@@ -45,10 +45,7 @@ struct group *getgrent ();
the current process. */
int
getugroups (maxcount, grouplist, username)
int maxcount;
GETGROUPS_T *grouplist;
char *username;
getugroups (int maxcount, GETGROUPS_T *grouplist, char *username)
{
struct group *grp;
register char **cp;
@@ -59,16 +56,27 @@ getugroups (maxcount, grouplist, username)
for (cp = grp->gr_mem; *cp; ++cp)
if (!strcmp (username, *cp))
{
if (maxcount != 0)
int n;
/* See if this group number is already on the list. */
for (n = 0; n < count; ++n)
if (grouplist[n] == grp->gr_gid)
break;
/* If it's a new group number, then try to add it to the list. */
if (n == count)
{
if (count >= maxcount)
if (maxcount != 0)
{
endgrent ();
return count;
if (count >= maxcount)
{
endgrent ();
return count;
}
grouplist[count] = grp->gr_gid;
}
grouplist[count] = grp->gr_gid;
count++;
}
count++;
}
endgrent ();
return count;

View File

@@ -1,5 +1,5 @@
/* getusershell.c -- Return names of valid user shells.
Copyright (C) 1991 Free Software Foundation, Inc.
Copyright (C) 1991, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,14 @@
#include <stdio.h>
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#ifdef STDC_HEADERS
# include <stdlib.h>
#else
@@ -175,10 +183,10 @@ readname (name, size, stream)
}
/* Skip blank space. */
while ((c = getc (stream)) != EOF && isspace (c))
while ((c = getc (stream)) != EOF && ISSPACE (c))
/* Do nothing. */ ;
while (c != EOF && !isspace (c))
while (c != EOF && !ISSPACE (c))
{
(*name)[name_index++] = c;
while (name_index >= *size)

View File

@@ -1,5 +1,5 @@
/* group-member.c -- determine whether group id is in calling user's group list
Copyright (C) 1994 Free Software Foundation, Inc.
Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
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
@@ -26,7 +26,7 @@
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -41,18 +41,17 @@ struct group_info
GETGROUPS_T *group;
};
#ifdef HAVE_GETGROUPS
#if HAVE_GETGROUPS
static void
free_group_info (g)
struct group_info *g;
free_group_info (struct group_info *g)
{
free (g->group);
free (g);
}
static struct group_info *
get_group_info ()
get_group_info (void)
{
int n_groups;
int n_group_slots;
@@ -96,8 +95,7 @@ get_group_info ()
either of the current or effective group IDs. */
int
group_member (gid)
gid_t gid;
group_member (gid_t gid)
{
#ifndef HAVE_GETGROUPS
return ((gid == getgid ()) || (gid == getegid ()));

View File

@@ -1,7 +1,15 @@
#ifndef GROUP_MEMBER_H_
# define GROUP_MEMBER_H_ 1
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int
group_member ();
group_member PARAMS ((gid_t));
#endif /* GROUP_MEMBER_H_ */

774
lib/hash.c Normal file
View File

@@ -0,0 +1,774 @@
/* A generic hash table package. */
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "hash.h"
#ifdef USE_OBSTACK
# define ZALLOC(Ht, N) obstack_alloc (&(ht->ht_obstack), (N))
#else
# define ZALLOC(Ht, N) malloc ((N))
#endif
#define BUCKET_HEAD(ht, idx) ((ht)->hash_table[(idx)])
static int
is_prime (candidate)
unsigned long candidate;
{
/* No even number and none less than 10 will be passed here. */
unsigned long divn = 3;
unsigned long sq = divn * divn;
while (sq < candidate && (candidate % divn))
{
divn++;
sq += 4 * divn;
divn++;
}
return (candidate % divn);
}
/* Round a given number up to the nearest prime. */
static unsigned long
next_prime (candidate)
unsigned long candidate;
{
/* Make it definitely odd. */
candidate |= 1;
while (!is_prime (candidate))
candidate += 2;
return candidate;
}
static void
hash_free_entry (HT *ht, HASH_ENT *e)
{
e->key = NULL;
e->next = ht->hash_free_entry_list;
ht->hash_free_entry_list = e;
}
static HASH_ENT *
hash_allocate_entry (HT *ht)
{
HASH_ENT *new;
if (ht->hash_free_entry_list)
{
new = ht->hash_free_entry_list;
ht->hash_free_entry_list = new->next;
}
else
{
new = (HASH_ENT *) ZALLOC (ht, sizeof (HASH_ENT));
}
return new;
}
unsigned int
hash_get_n_slots_used (const HT *ht)
{
return ht->hash_n_slots_used;
}
/* Free all storage associated with HT that functions in this package
have allocated. If a key_freer function has been supplied (when HT
was created), this function applies it to the key of each entry before
freeing that entry. */
static void
hash_free_0 (HT *ht, int free_user_data)
{
if (free_user_data && ht->hash_key_freer != NULL)
{
unsigned int i;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p;
HASH_ENT *next;
for (p = BUCKET_HEAD (ht, i); p; p = next)
{
next = p->next;
ht->hash_key_freer (p->key);
}
}
}
#ifdef USE_OBSTACK
obstack_free (&(ht->ht_obstack), NULL);
#else
{
unsigned int i;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p;
HASH_ENT *next;
for (p = BUCKET_HEAD (ht, i); p; p = next)
{
next = p->next;
free (p);
}
}
}
#endif
ht->hash_free_entry_list = NULL;
free (ht->hash_table);
}
/* FIXME-comment */
int
hash_rehash (HT *ht, unsigned int new_table_size)
{
HT *ht_new;
unsigned int i;
if (ht->hash_table_size <= 0 || new_table_size == 0)
return 1;
ht_new = hash_initialize (new_table_size, ht->hash_key_freer,
ht->hash_hash, ht->hash_key_comparator);
if (ht_new == NULL)
return 1;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p = BUCKET_HEAD (ht, i);
for ( /* empty */ ; p; p = p->next)
{
int failed;
const void *already_in_table;
already_in_table = hash_insert_if_absent (ht_new, p->key, &failed);
assert (failed == 0 && already_in_table == 0);
}
}
hash_free_0 (ht, 0);
#ifdef TESTING
assert (hash_table_ok (ht_new));
#endif
*ht = *ht_new;
free (ht_new);
/* FIXME: fill in ht_new->n_slots_used and other statistics fields. */
return 0;
}
/* FIXME-comment */
unsigned int
hash_get_max_chain_length (HT *ht)
{
unsigned int i;
unsigned int max_chain_length = 0;
if (!ht->hash_dirty_max_chain_length)
return ht->hash_max_chain_length;
for (i = 0; i < ht->hash_table_size; i++)
{
unsigned int chain_length = 0;
HASH_ENT *p = BUCKET_HEAD (ht, i);
for ( /* empty */ ; p; p = p->next)
++chain_length;
if (chain_length > max_chain_length)
max_chain_length = chain_length;
}
ht->hash_max_chain_length = max_chain_length;
ht->hash_dirty_max_chain_length = 0;
return ht->hash_max_chain_length;
}
unsigned int
hash_get_n_keys (const HT *ht)
{
return ht->hash_n_keys;
}
unsigned int
hash_get_table_size (const HT *ht)
{
return ht->hash_table_size;
}
/* CANDIDATE_TABLE_SIZE need not be prime. If WHEN_TO_REHASH (FIXME: add
this parameter) is positive, when that percentage of table entries have
been used, the table size is increased; then a new, larger table
(GROW_FACTOR (FIXME: maybe add this parameter) times larger than the previous
size) is allocated and all entries in the old table are rehashed into
the new, larger one. The old table is freed. If WHEN_TO_REHASH is zero
or negative, the table is never resized.
The function returns non-zero
- if CANDIDATE_TABLE_SIZE is zero or negative
- if KEY_COMPARATOR or HASH is null
- if it was unable to allocate sufficient storage for the hash table
- if WHEN_TO_REHASH is zero or negative
Otherwise it returns zero. */
HT *
hash_initialize (unsigned int candidate_table_size,
Hash_key_freer_type key_freer,
unsigned int (*hash) (const void *, unsigned int),
int (*key_comparator) (const void *, const void *))
{
HT *ht;
unsigned int i;
unsigned int table_size;
if (candidate_table_size <= 0)
return NULL;
if (hash == NULL || key_comparator == NULL)
return NULL;
ht = (HT *) malloc (sizeof (HT));
if (ht == NULL)
return NULL;
table_size = next_prime (candidate_table_size);
ht->hash_table = (HASH_ENT **) malloc (table_size * sizeof (HASH_ENT *));
if (ht->hash_table == NULL)
return NULL;
for (i = 0; i < table_size; i++)
{
BUCKET_HEAD (ht, i) = NULL;
}
ht->hash_free_entry_list = NULL;
ht->hash_table_size = table_size;
ht->hash_hash = hash;
ht->hash_key_comparator = key_comparator;
ht->hash_key_freer = key_freer;
ht->hash_n_slots_used = 0;
ht->hash_max_chain_length = 0;
ht->hash_n_keys = 0;
ht->hash_dirty_max_chain_length = 0;
#ifdef USE_OBSTACK
obstack_init (&(ht->ht_obstack));
#endif
return ht;
}
/* This private function is used to help with insertion and deletion.
If E does *not* compare equal to the key of any entry in the table,
return NULL.
When E matches an entry in the table, return a pointer to the matching
entry. When DELETE is non-zero and E matches an entry in the table,
unlink the matching entry. Set *CHAIN_LENGTH to the number of keys
that have hashed to the bucket E hashed to. */
static HASH_ENT *
hash_find_entry (HT *ht, const void *e, unsigned int *table_idx,
unsigned int *chain_length, int delete)
{
unsigned int idx;
int found;
HASH_ENT *p, *prev;
idx = ht->hash_hash (e, ht->hash_table_size);
assert (idx < ht->hash_table_size);
*table_idx = idx;
*chain_length = 0;
prev = ht->hash_table[idx];
if (prev == NULL)
return NULL;
*chain_length = 1;
if (ht->hash_key_comparator (e, prev->key) == 0)
{
if (delete)
ht->hash_table[idx] = prev->next;
return prev;
}
p = prev->next;
found = 0;
while (p)
{
++(*chain_length);
if (ht->hash_key_comparator (e, p->key) == 0)
{
found = 1;
break;
}
prev = p;
p = p->next;
}
if (!found)
return NULL;
assert (p != NULL);
if (delete)
prev->next = p->next;
return p;
}
/* Return non-zero if E is already in the table, zero otherwise. */
int
hash_query_in_table (const HT *ht, const void *e)
{
unsigned int idx;
HASH_ENT *p;
idx = ht->hash_hash (e, ht->hash_table_size);
assert (idx < ht->hash_table_size);
for (p = BUCKET_HEAD (ht, idx); p != NULL; p = p->next)
if (ht->hash_key_comparator (e, p->key) == 0)
return 1;
return 0;
}
void *
hash_lookup (const HT *ht, const void *e)
{
unsigned int idx;
HASH_ENT *p;
idx = ht->hash_hash (e, ht->hash_table_size);
assert (idx < ht->hash_table_size);
for (p = BUCKET_HEAD (ht, idx); p != NULL; p = p->next)
if (ht->hash_key_comparator (e, p->key) == 0)
return p->key;
return NULL;
}
/* If E matches an entry already in the hash table, don't modify the
table and return a pointer to the matched entry. If E does not
match any item in the table, insert E and return NULL.
If the storage required for insertion cannot be allocated
set *FAILED to non-zero and return NULL. */
void *
hash_insert_if_absent (HT *ht, const void *e, int *failed)
{
const HASH_ENT *ent;
HASH_ENT *new;
unsigned int idx;
unsigned int chain_length;
assert (e != NULL); /* Can't insert a NULL key. */
*failed = 0;
ent = hash_find_entry (ht, e, &idx, &chain_length, 0);
if (ent != NULL)
{
/* E matches a key from an entry already in the table. */
return ent->key;
}
new = hash_allocate_entry (ht);
if (new == NULL)
{
*failed = 1;
return NULL;
}
new->key = (void *) e;
new->next = BUCKET_HEAD (ht, idx);
BUCKET_HEAD (ht, idx) = new;
if (chain_length == 0)
++(ht->hash_n_slots_used);
/* The insertion has just increased chain_length by 1. */
++chain_length;
if (chain_length > ht->hash_max_chain_length)
ht->hash_max_chain_length = chain_length;
++(ht->hash_n_keys);
if ((double) ht->hash_n_keys / ht->hash_table_size > 0.80)
{
unsigned int new_size;
new_size = next_prime (2 * ht->hash_table_size + 1);
*failed = hash_rehash (ht, new_size);
}
#ifdef TESTING
assert (hash_table_ok (ht));
#endif
return NULL;
}
/* If E is already in the table, remove it and return a pointer to
the just-deleted key (the user may want to deallocate its storage).
If E is not in the table, don't modify the table and return NULL. */
void *
hash_delete_if_present (HT *ht, const void *e)
{
HASH_ENT *ent;
void *key;
unsigned int idx;
unsigned int chain_length;
ent = hash_find_entry (ht, e, &idx, &chain_length, 1);
if (ent == NULL)
return NULL;
if (ent->next == NULL && chain_length == 1)
--(ht->hash_n_slots_used);
key = ent->key;
--(ht->hash_n_keys);
ht->hash_dirty_max_chain_length = 1;
if (ent->next == NULL && chain_length < ht->hash_max_chain_length)
ht->hash_dirty_max_chain_length = 0;
hash_free_entry (ht, ent);
#ifdef TESTING
assert (hash_table_ok (ht));
#endif
return key;
}
void
hash_print_statistics (const HT *ht, FILE *stream)
{
unsigned int n_slots_used;
unsigned int n_keys;
unsigned int max_chain_length;
int err;
err = hash_get_statistics (ht, &n_slots_used, &n_keys, &max_chain_length);
assert (err == 0);
fprintf (stream, "table size: %d\n", ht->hash_table_size);
fprintf (stream, "# slots used: %u (%.2f%%)\n", n_slots_used,
(100.0 * n_slots_used) / ht->hash_table_size);
fprintf (stream, "# keys: %u\n", n_keys);
fprintf (stream, "max chain length: %u\n", max_chain_length);
}
/* If there is *NO* table (so, no meaningful stats) return non-zero
and don't reference the argument pointers. Otherwise compute the
performance statistics and return non-zero. */
int
hash_get_statistics (const HT *ht,
unsigned int *n_slots_used,
unsigned int *n_keys,
unsigned int *max_chain_length)
{
unsigned int i;
if (ht == NULL || ht->hash_table == NULL)
return 1;
*max_chain_length = 0;
*n_slots_used = 0;
*n_keys = 0;
for (i = 0; i < ht->hash_table_size; i++)
{
unsigned int chain_length = 0;
HASH_ENT *p;
p = BUCKET_HEAD (ht, i);
if (p != NULL)
++(*n_slots_used);
for (; p; p = p->next)
++chain_length;
*n_keys += chain_length;
if (chain_length > *max_chain_length)
*max_chain_length = chain_length;
}
return 0;
}
int
hash_table_ok (HT *ht)
{
int code;
unsigned int n_slots_used;
unsigned int n_keys;
unsigned int max_chain_length;
if (ht == NULL || ht->hash_table == NULL)
return 1;
code = hash_get_statistics (ht, &n_slots_used, &n_keys,
&max_chain_length);
if (code != 0
|| n_slots_used != ht->hash_n_slots_used
|| n_keys != ht->hash_n_keys
|| max_chain_length != hash_get_max_chain_length (ht))
return 0;
return 1;
}
/* See hash_do_for_each_2 (below) for a variant. */
void
hash_do_for_each (HT *ht, void (*f) (void *e, void *aux), void *aux)
{
unsigned int i;
#ifdef TESTING
assert (hash_table_ok (ht));
#endif
if (ht->hash_table == NULL)
return;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p;
for (p = BUCKET_HEAD (ht, i); p; p = p->next)
{
(*f) (p->key, aux);
}
}
}
/* Just like hash_do_for_each, except that function F returns an int
that can signal (when non-zero) we should return early. */
int
hash_do_for_each_2 (HT *ht, int (*f) (void *e, void *aux), void *aux)
{
unsigned int i;
#ifdef TESTING
assert (hash_table_ok (ht));
#endif
if (ht->hash_table == NULL)
return 0;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p;
for (p = BUCKET_HEAD (ht, i); p; p = p->next)
{
int return_code;
return_code = (*f) (p->key, aux);
if (return_code != 0)
return return_code;
}
}
return 0;
}
/* For each entry in the bucket addressed by BUCKET_KEY of the hash
table HT, invoke the function F. If F returns non-zero, stop
iterating and return that value. Otherwise, apply F to all entries
in the selected bucket and return zero. The AUX argument to this
function is passed as the last argument in each invocation of F.
The first argument to F is BUCKET_KEY, and the second is the key of
an entry in the selected bucket. */
int
hash_do_for_each_in_selected_bucket (HT *ht, const void *bucket_key,
int (*f) (const void *bucket_key,
void *e, void *aux),
void *aux)
{
int idx;
HASH_ENT *p;
#ifdef TESTING
assert (hash_table_ok (ht));
#endif
if (ht->hash_table == NULL)
return 0;
idx = ht->hash_hash (bucket_key, ht->hash_table_size);
for (p = BUCKET_HEAD (ht, idx); p != NULL; p = p->next)
{
int return_code;
return_code = (*f) (bucket_key, p->key, aux);
if (return_code != 0)
return return_code;
}
return 0;
}
/* Make all buckets empty, placing any chained entries on the free list.
As with hash_free, apply the user-specified function key_freer
(if it's not NULL) to the keys of any affected entries. */
void
hash_clear (HT *ht)
{
unsigned int i;
HASH_ENT *p;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *tail = NULL;
HASH_ENT *head = BUCKET_HEAD (ht, i);
/* Free any keys and get tail pointer to last entry in chain. */
for (p = head; p; p = p->next)
{
if (ht->hash_key_freer != NULL)
ht->hash_key_freer (p->key);
p->key = NULL; /* Make sure no one tries to use this key later. */
tail = p;
}
BUCKET_HEAD (ht, i) = NULL;
/* If there's a chain in this bucket, tack it onto the
beginning of the free list. */
if (head != NULL)
{
assert (tail != NULL && tail->next == NULL);
tail->next = ht->hash_free_entry_list;
ht->hash_free_entry_list = head;
}
}
ht->hash_n_slots_used = 0;
ht->hash_max_chain_length = 0;
ht->hash_n_keys = 0;
ht->hash_dirty_max_chain_length = 0;
}
void
hash_free (HT *ht)
{
hash_free_0 (ht, 1);
free (ht);
}
#ifdef TESTING
void
hash_print (const HT *ht)
{
int i;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p;
if (BUCKET_HEAD (ht, i) != NULL)
printf ("%d:\n", i);
for (p = BUCKET_HEAD (ht, i); p; p = p->next)
{
char *s = (char *) p->key;
/* FIXME */
printf (" %s\n", s);
}
}
}
#endif /* TESTING */
void
hash_get_key_list (const HT *ht, unsigned int bufsize, void **buf)
{
unsigned int i;
unsigned int c = 0;
for (i = 0; i < ht->hash_table_size; i++)
{
HASH_ENT *p;
for (p = BUCKET_HEAD (ht, i); p; p = p->next)
{
if (c >= bufsize)
return;
buf[c++] = p->key;
}
}
}
/* Return the first key in the table. If the table is empty, return NULL. */
void *
hash_get_first (const HT *ht)
{
unsigned int idx;
HASH_ENT *p;
if (ht->hash_n_keys == 0)
return NULL;
for (idx = 0; idx < ht->hash_table_size; idx++)
{
if ((p = BUCKET_HEAD (ht, idx)) != NULL)
return p->key;
}
abort ();
}
/* Return the key in the entry following the entry whose key matches E.
If there is the only one key in the table and that key matches E,
return the matching key. If E is not in the table, return NULL. */
void *
hash_get_next (const HT *ht, const void *e)
{
unsigned int idx;
HASH_ENT *p;
idx = ht->hash_hash (e, ht->hash_table_size);
assert (idx < ht->hash_table_size);
for (p = BUCKET_HEAD (ht, idx); p != NULL; p = p->next)
{
if (ht->hash_key_comparator (e, p->key) == 0)
{
if (p->next != NULL)
{
return p->next->key;
}
else
{
unsigned int bucket;
/* E is the last or only key in the bucket chain. */
if (ht->hash_n_keys == 1)
{
/* There is only one key in the table, and it matches E. */
return p->key;
}
bucket = idx;
do
{
idx = (idx + 1) % ht->hash_table_size;
if ((p = BUCKET_HEAD (ht, idx)) != NULL)
return p->key;
}
while (idx != bucket);
}
}
}
/* E is not in the table. */
return NULL;
}

193
lib/hash.h Normal file
View File

@@ -0,0 +1,193 @@
#ifndef HASH_H
# define HASH_H 1
# if HAVE_CONFIG_H
# include <config.h>
# endif
# include <stdio.h>
# include <assert.h>
# ifdef STDC_HEADERS
# include <stdlib.h>
# endif
# ifndef HAVE_DECL_FREE
void free ();
# endif
# ifndef HAVE_DECL_MALLOC
char *malloc ();
# endif
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
# define USE_OBSTACK
# ifdef USE_OBSTACK
# include "obstack.h"
# endif
# define obstack_chunk_alloc malloc
# define obstack_chunk_free free
struct hash_ent
{
void *key;
struct hash_ent *next;
};
typedef struct hash_ent HASH_ENT;
/* This is particularly useful to cast uses in hash_initialize of the
system free function. */
typedef void (*Hash_key_freer_type) PARAMS((void *key));
struct HT
{
/* User-supplied function for freeing keys. It is specified in
hash_initialize. If non-null, it is used by hash_free and
hash_clear. You should specify `free' here only if you want
these functions to free all of your `key' data. This is typically
the case when your key is simply an auxilliary struct that you
have malloc'd to aggregate several values. */
Hash_key_freer_type hash_key_freer;
/* User-supplied hash function that hashes entry E to an integer
in the range 0..TABLE_SIZE-1. */
unsigned int (*hash_hash) PARAMS((const void *e, unsigned int table_size));
/* User-supplied function that determines whether a new entry is
unique by comparing the new entry to entries that hashed to the
same bucket index. It should return zero for a pair of entries
that compare equal, non-zero otherwise. */
int (*hash_key_comparator) PARAMS((const void *, const void *));
HASH_ENT **hash_table;
unsigned int hash_table_size;
unsigned int hash_n_slots_used;
unsigned int hash_max_chain_length;
/* Gets set when an entry is deleted from a chain of length
hash_max_chain_length. Indicates that hash_max_chain_length
may no longer be valid. */
unsigned int hash_dirty_max_chain_length;
/* Sum of lengths of all chains (not counting any dummy
header entries). */
unsigned int hash_n_keys;
/* A linked list of freed HASH_ENT structs.
FIXME: Perhaps this is unnecessary and we should simply free
and reallocate such structs. */
HASH_ENT *hash_free_entry_list;
/* FIXME: comment. */
# ifdef USE_OBSTACK
struct obstack ht_obstack;
# endif
};
typedef struct HT HT;
unsigned int
hash_get_n_slots_used PARAMS((const HT *ht));
unsigned int
hash_get_max_chain_length PARAMS((HT *ht));
int
hash_rehash PARAMS((HT *ht, unsigned int new_table_size));
unsigned int
hash_get_table_size PARAMS((const HT *ht));
HT *
hash_initialize PARAMS((unsigned int table_size,
void (*key_freer) PARAMS((void *key)),
unsigned int (*hash) PARAMS((const void *,
unsigned int)),
int (*equality_tester) PARAMS((const void *,
const void *))));
unsigned int
hash_get_n_keys PARAMS((const HT *ht));
int
hash_query_in_table PARAMS((const HT *ht, const void *e));
void *
hash_lookup PARAMS((const HT *ht, const void *e));
void *
hash_insert_if_absent PARAMS((HT *ht,
const void *e,
int *failed));
void *
hash_delete_if_present PARAMS((HT *ht, const void *e));
void
hash_print_statistics PARAMS((const HT *ht, FILE *stream));
int
hash_get_statistics PARAMS((const HT *ht, unsigned int *n_slots_used,
unsigned int *n_keys,
unsigned int *max_chain_length));
int
hash_table_ok PARAMS((HT *ht));
void
hash_do_for_each PARAMS((HT *ht,
void (*f) PARAMS((void *e, void *aux)),
void *aux));
int
hash_do_for_each_2 PARAMS((HT *ht,
int (*f) PARAMS((void *e, void *aux)),
void *aux));
int
hash_do_for_each_in_selected_bucket PARAMS((HT *ht,
const void *key,
int (*f) PARAMS((const void *bucket_key,
void *e,
void *aux)),
void *aux));
void
hash_clear PARAMS((HT *ht));
void
hash_free PARAMS((HT *ht));
void
hash_get_key_list PARAMS((const HT *ht,
unsigned int bufsize,
void **buf));
void *
hash_get_first PARAMS((const HT *ht));
void *
hash_get_next PARAMS((const HT *ht, const void *e));
/* This interface to hash_insert_if_absent is used frequently enough to
merit a macro here. */
# define HASH_INSERT_NEW_ITEM(Ht, Item, Failp) \
do \
{ \
void *_already; \
_already = hash_insert_if_absent ((Ht), (Item), Failp); \
assert (_already == NULL); \
} \
while (0)
#endif /* HASH_H */

203
lib/human.c Normal file
View File

@@ -0,0 +1,203 @@
/* human.c -- print human readable file size
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Originally contributed by lm@sgi.com;
--si and large file support added by eggert@twinsun.com. */
#include <config.h>
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include <sys/types.h>
#include <stdio.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
#include "human.h"
static const char suffixes[] =
{
0, /* not used */
'k', /* kilo */
'M', /* Mega */
'G', /* Giga */
'T', /* Tera */
'P', /* Peta */
'E', /* Exa */
'Z', /* Zetta */
'Y' /* Yotta */
};
/* Convert N to a human readable format in BUF.
N is expressed in units of FROM_UNITS; use units of TO_UNITS in the
output number. FROM_UNITS and TO_UNITS must be positive, and one must
be a multiple of the other.
If BASE is nonzero, use a format like "127k" if possible,
using powers of BASE; otherwise, use ordinary decimal format.
Normally BASE is either 1000 or 1024; it must be at least 2.
Most people visually process strings of 3-4 digits effectively,
but longer strings of digits are more prone to misinterpretation.
Hence, converting to an abbreviated form usually improves readability.
Use a suffix indicating which power is being used.
For example, assuming BASE is 1024, 8500 would be converted to 8.3k,
133456345 to 127M, 56990456345 to 53G, and so on. Numbers smaller
than BASE aren't modified. */
char *
human_readable (uintmax_t n, char *buf, int from_units, int to_units, int base)
{
uintmax_t amt;
int tenths;
int power;
char *p;
/* 0 means adjusted N == AMT.TENTHS;
1 means AMT.TENTHS < adjusted N < AMT.TENTHS + 0.05;
2 means adjusted N == AMT.TENTHS + 0.05;
3 means AMT.TENTHS + 0.05 < adjusted N < AMT.TENTHS + 0.1. */
int rounding;
p = buf + LONGEST_HUMAN_READABLE;
*p = '\0';
#ifdef lint
/* Suppress `used before initialized' warning. */
power = 0;
#endif
/* Adjust AMT out of FROM_UNITS units and into TO_UNITS units. */
if (to_units <= from_units)
{
int multiplier = from_units / to_units;
amt = n * multiplier;
tenths = rounding = 0;
if (amt / multiplier != n)
{
/* Overflow occurred during multiplication. 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 damt = n * (double) multiplier;
if (! base)
sprintf (buf, "%.0f", damt);
else
{
double e = 1;
power = 0;
do
{
e *= base;
power++;
}
while (e * base <= amt && power < sizeof suffixes - 1);
damt /= e;
sprintf (buf, "%.1f%c", damt, suffixes[power]);
if (4 < strlen (buf))
sprintf (buf, "%.0f%c", damt, suffixes[power]);
}
return buf;
}
}
else
{
int divisor = to_units / from_units;
int r10 = (n % divisor) * 10;
int r2 = (r10 % divisor) * 2;
amt = n / divisor;
tenths = r10 / divisor;
rounding = r2 < divisor ? 0 < r2 : 2 + (divisor < r2);
}
/* Use power of BASE notation if adjusted AMT is large enough. */
if (base && base <= amt)
{
power = 0;
do
{
int r10 = (amt % base) * 10 + tenths;
int r2 = (r10 % base) * 2 + (rounding >> 1);
amt /= base;
tenths = r10 / base;
rounding = (r2 < base
? 0 < r2 + rounding
: 2 + (base < r2 + rounding));
power++;
}
while (base <= amt && power < sizeof suffixes - 1);
*--p = suffixes[power];
if (amt < 10)
{
tenths += 2 < rounding + (tenths & 1);
if (tenths == 10)
{
amt++;
tenths = 0;
}
if (amt < 10)
{
*--p = '0' + tenths;
*--p = '.';
tenths = 0;
}
}
}
if (5 < tenths + (2 < rounding + (amt & 1)))
{
amt++;
if (amt == base && power < sizeof suffixes - 1)
{
*p = suffixes[power + 1];
*--p = '0';
*--p = '.';
amt = 1;
}
}
do
*--p = '0' + (int) (amt % 10);
while ((amt /= 10) != 0);
return p;
}

20
lib/human.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef HUMAN_H_
# define HUMAN_H_ 1
/* A conservative bound on the maximum length of a human-readable string.
The output can be the product of the largest uintmax_t and the largest int,
so add their sizes before converting to a bound on digits. */
# define LONGEST_HUMAN_READABLE ((sizeof (uintmax_t) + sizeof (int)) \
* CHAR_BIT / 3)
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
char *human_readable PARAMS ((uintmax_t, char *, int, int, int));
#endif /* HUMAN_H_ */

View File

@@ -1,5 +1,5 @@
/* idcache.c -- map user and group IDs, cached for speed
Copyright (C) 1985, 1988, 1989, 1990 Free Software Foundation, Inc.
Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
@@ -24,15 +24,16 @@
#include <pwd.h>
#include <grp.h>
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
#include <string.h>
#if STDC_HEADERS || HAVE_STRING_H
# include <string.h>
#else
#include <strings.h>
# include <strings.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef _POSIX_VERSION
struct passwd *getpwuid ();
struct passwd *getpwnam ();
@@ -43,6 +44,10 @@ struct group *getgrnam ();
char *xmalloc ();
char *xstrdup ();
#ifdef __DJGPP__
static char digits[] = "0123456789";
#endif
struct userid
{
union
@@ -59,16 +64,13 @@ static struct userid *user_alist;
/* The members of this list have names not in the local passwd file. */
static struct userid *nouser_alist;
/* Translate UID to a login name or a stringified number,
with cache. */
/* Translate UID to a login name, with cache, or NULL if unresolved. */
char *
getuser (uid)
uid_t uid;
getuser (uid_t uid)
{
register struct userid *tail;
struct passwd *pwent;
char usernum_string[20];
for (tail = user_alist; tail; tail = tail->next)
if (tail->id.u == uid)
@@ -77,13 +79,7 @@ getuser (uid)
pwent = getpwuid (uid);
tail = (struct userid *) xmalloc (sizeof (struct userid));
tail->id.u = uid;
if (pwent == 0)
{
sprintf (usernum_string, "%u", (unsigned) uid);
tail->name = xstrdup (usernum_string);
}
else
tail->name = xstrdup (pwent->pw_name);
tail->name = pwent ? xstrdup (pwent->pw_name) : NULL;
/* Add to the head of the list, so most recently used is first. */
tail->next = user_alist;
@@ -97,8 +93,7 @@ getuser (uid)
so we don't keep looking them up.) */
uid_t *
getuidbyname (user)
char *user;
getuidbyname (const char *user)
{
register struct userid *tail;
struct passwd *pwent;
@@ -114,6 +109,15 @@ getuidbyname (user)
return 0;
pwent = getpwnam (user);
#ifdef __DJGPP__
/* We need to pretend to be the user USER, to make
pwd functions know about an arbitrary user name. */
if (!pwent && strspn (user, digits) < strlen (user))
{
setenv ("USER", user, 1);
pwent = getpwnam (user); /* now it will succeed */
}
#endif
tail = (struct userid *) xmalloc (sizeof (struct userid));
tail->name = xstrdup (user);
@@ -136,16 +140,13 @@ getuidbyname (user)
static struct userid *group_alist;
static struct userid *nogroup_alist;
/* Translate GID to a group name or a stringified number,
with cache. */
/* Translate GID to a group name, with cache, or NULL if unresolved. */
char *
getgroup (gid)
gid_t gid;
getgroup (gid_t gid)
{
register struct userid *tail;
struct group *grent;
char groupnum_string[20];
for (tail = group_alist; tail; tail = tail->next)
if (tail->id.g == gid)
@@ -154,13 +155,7 @@ getgroup (gid)
grent = getgrgid (gid);
tail = (struct userid *) xmalloc (sizeof (struct userid));
tail->id.g = gid;
if (grent == 0)
{
sprintf (groupnum_string, "%u", (unsigned int) gid);
tail->name = xstrdup (groupnum_string);
}
else
tail->name = xstrdup (grent->gr_name);
tail->name = grent ? xstrdup (grent->gr_name) : NULL;
/* Add to the head of the list, so most recently used is first. */
tail->next = group_alist;
@@ -168,14 +163,13 @@ getgroup (gid)
return tail->name;
}
/* Translate GROUP to a UID, with cache.
/* Translate GROUP to a GID, with cache.
Return NULL if there is no such group.
(We also cache which group names have no group entry,
so we don't keep looking them up.) */
gid_t *
getgidbyname (group)
char *group;
getgidbyname (const char *group)
{
register struct userid *tail;
struct group *grent;
@@ -191,6 +185,15 @@ getgidbyname (group)
return 0;
grent = getgrnam (group);
#ifdef __DJGPP__
/* We need to pretend to belong to group GROUP, to make
grp functions know about any arbitrary group name. */
if (!grent && strspn (group, digits) < strlen (group))
{
setenv ("GROUP", group, 1);
grent = getgrnam (group); /* now it will succeed */
}
#endif
tail = (struct userid *) xmalloc (sizeof (struct userid));
tail->name = xstrdup (group);

View File

@@ -1,5 +1,5 @@
/* isdir.c -- determine whether a directory exists
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,19 +15,19 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef STAT_MACROS_BROKEN
#undef S_ISDIR
# undef S_ISDIR
#endif /* STAT_MACROS_BROKEN. */
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
/* If PATH is an existing directory or symbolic link to a directory,

View File

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

View File

@@ -1,5 +1,5 @@
/* Utility to accept --help and --version options as unobtrusively as possible.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,12 +17,13 @@
/* Written by Jim Meyering. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <getopt.h>
#include "closeout.h"
#include "long-options.h"
static struct option const long_options[] =
@@ -53,7 +54,7 @@ parse_long_options (argc, argv, command_name, package, version, usage)
opterr = 0;
if (argc == 2
&& (c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF)
&& (c = getopt_long (argc, argv, "+", long_options, NULL)) != -1)
{
switch (c)
{
@@ -62,6 +63,8 @@ parse_long_options (argc, argv, command_name, package, version, usage)
case 'v':
printf ("%s (%s) %s\n", command_name, package, version);
close_stdout (); /* FIXME: output failure exit status
should be settable via an arg. */
exit (0);
default:

View File

@@ -1,5 +1,5 @@
/* long-options.h -- declaration for --help- and --version-handling function.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,11 +17,12 @@
/* Written by Jim Meyering. */
#undef PARAMS
#if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
#else
# define PARAMS(Args) ()
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
void

50
lib/lstat.c Normal file
View File

@@ -0,0 +1,50 @@
/* Work around the bug in some systems whereby lstat succeeds when
given the zero-length file name argument. The lstat from SunOS4.1.4
has this bug.
Copyright (C) 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#include <config.h>
/* Disable the definition of lstat to rpl_lstat (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_lstat on
most systems. */
#undef lstat
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
/* FIXME: describe. */
int
rpl_lstat (file, sbuf)
const char *file;
struct stat *sbuf;
{
if (file && *file == 0)
{
errno = EINVAL;
return -1;
}
return lstat (file, sbuf);
}

View File

@@ -1,5 +1,5 @@
/* makepath.c -- Ensure that a directory path exists.
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# pragma alloca
# else
char *alloca ();
# endif
@@ -71,14 +71,49 @@ extern int errno;
# endif
#endif
#ifndef S_IWUSR
# define S_IWUSR 0200
#endif
#ifndef S_IXUSR
# define S_IXUSR 0100
#endif
#define WX_USR (S_IWUSR | S_IXUSR)
#ifdef __MSDOS__
typedef int uid_t;
typedef int gid_t;
#endif
#include "save-cwd.h"
#include "makepath.h"
#include "error.h"
void error ();
void strip_trailing_slashes ();
#define CLEANUP_CWD \
do \
{ \
/* We're done operating on basename_dir. \
Restore working directory. */ \
if (do_chdir) \
{ \
int fail = restore_cwd (&cwd, NULL, NULL); \
free_cwd (&cwd); \
if (fail) \
return 1; \
} \
} \
while (0)
#define CLEANUP \
do \
{ \
umask (oldmask); \
CLEANUP_CWD; \
} \
while (0)
/* Ensure that the directory ARGPATH exists.
Remove any trailing slashes from ARGPATH before calling this function.
@@ -98,7 +133,6 @@ void error ();
Return 0 if ARGPATH exists as a directory with the proper
ownership and permissions when done, otherwise 1. */
#if __STDC__
int
make_path (const char *argpath,
int mode,
@@ -107,30 +141,11 @@ make_path (const char *argpath,
gid_t group,
int preserve_existing,
const char *verbose_fmt_string)
#else
int
make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
verbose_fmt_string)
const char *argpath;
int mode;
int parent_mode;
uid_t owner;
gid_t group;
int preserve_existing;
const char *verbose_fmt_string;
#endif
{
char *dirpath; /* A copy we can scribble NULs on. */
struct stat stats;
int retval = 0;
int oldmask = umask (0);
/* FIXME: move this alloca and strcpy into the if-block.
Set dirpath to argpath in the else-block. */
dirpath = (char *) alloca (strlen (argpath) + 1);
strcpy (dirpath, argpath);
if (stat (dirpath, &stats))
if (stat (argpath, &stats))
{
char *slash;
int tmp_mode; /* Initial perms for leading dirs. */
@@ -141,12 +156,24 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
struct ptr_list *next;
};
struct ptr_list *p, *leading_dirs = NULL;
int do_chdir; /* Whether to chdir before each mkdir. */
struct saved_cwd cwd;
char *basename_dir;
char *dirpath;
/* Temporarily relax umask in case it's overly restrictive. */
int oldmask = umask (0);
/* Make a copy of ARGPATH that we can scribble NULs on. */
dirpath = (char *) alloca (strlen (argpath) + 1);
strcpy (dirpath, argpath);
strip_trailing_slashes (dirpath);
/* If leading directories shouldn't be writable or executable,
or should have set[ug]id or sticky bits set and we are setting
their owners, we need to fix their permissions after making them. */
if (((parent_mode & 0300) != 0300)
|| (owner != (uid_t) -1 && group != (gid_t) -1
if (((parent_mode & WX_USR) != WX_USR)
|| ((owner != (uid_t) -1 || group != (gid_t) -1)
&& (parent_mode & 07000) != 0))
{
tmp_mode = 0700;
@@ -158,49 +185,103 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
re_protect = 0;
}
/* If we can record the current working directory, we may be able
to do the chdir optimization. */
do_chdir = !save_cwd (&cwd);
/* If we've saved the cwd and DIRPATH is an absolute pathname,
we must chdir to `/' in order to enable the chdir optimization.
So if chdir ("/") fails, turn off the optimization. */
if (do_chdir && *dirpath == '/' && chdir ("/") < 0)
do_chdir = 0;
slash = dirpath;
/* Skip over leading slashes. */
while (*slash == '/')
slash++;
while ((slash = strchr (slash, '/')))
while (1)
{
int newly_created_dir = 1;
/* slash points to the leftmost unprocessed component of dirpath. */
basename_dir = slash;
slash = strchr (slash, '/');
if (slash == NULL)
break;
/* If we're *not* doing chdir before each mkdir, then we have to refer
to the target using the full (multi-component) directory name. */
if (!do_chdir)
basename_dir = dirpath;
/* The mkdir and stat calls below appear to be reversed.
They are not. It is important to call mkdir first and then to
call stat (to distinguish the three cases) only if mkdir fails.
The alternative to this approach is to `stat' each directory,
then to call mkdir if it doesn't exist. But if some other process
were to create the directory between the stat & mkdir, the mkdir
would fail with EEXIST. */
*slash = '\0';
if (stat (dirpath, &stats))
if (mkdir (basename_dir, tmp_mode))
{
if (mkdir (dirpath, tmp_mode))
if (stat (basename_dir, &stats))
{
error (0, errno, "cannot create directory `%s'", dirpath);
umask (oldmask);
CLEANUP;
return 1;
}
else if (!S_ISDIR (stats.st_mode))
{
error (0, 0, "`%s' exists but is not a directory", dirpath);
CLEANUP;
return 1;
}
else
{
if (verbose_fmt_string != NULL)
error (0, 0, verbose_fmt_string, dirpath);
if (owner != (uid_t) -1 && group != (gid_t) -1
&& chown (dirpath, owner, group)
#if defined(AFS) && defined (EPERM)
&& errno != EPERM
#endif
)
{
error (0, errno, "%s", dirpath);
retval = 1;
}
if (re_protect)
{
struct ptr_list *new = (struct ptr_list *)
alloca (sizeof (struct ptr_list));
new->dirname_end = slash;
new->next = leading_dirs;
leading_dirs = new;
}
/* DIRPATH already exists and is a directory. */
newly_created_dir = 0;
}
}
else if (!S_ISDIR (stats.st_mode))
if (newly_created_dir)
{
error (0, 0, "`%s' exists but is not a directory", dirpath);
umask (oldmask);
if (verbose_fmt_string)
fprintf (stderr, verbose_fmt_string, dirpath);
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (basename_dir, owner, group)
#if defined(AFS) && defined (EPERM)
&& errno != EPERM
#endif
)
{
error (0, errno, "%s", dirpath);
CLEANUP;
return 1;
}
if (re_protect)
{
struct ptr_list *new = (struct ptr_list *)
alloca (sizeof (struct ptr_list));
new->dirname_end = slash;
new->next = leading_dirs;
leading_dirs = new;
}
}
/* If we were able to save the initial working directory,
then we can use chdir to change into each directory before
creating an entry in that directory. This avoids making
stat and mkdir process O(n^2) file name components. */
if (do_chdir && chdir (basename_dir) < 0)
{
error (0, errno, "cannot chdir to directory, %s", dirpath);
CLEANUP;
return 1;
}
@@ -212,40 +293,49 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
slash++;
}
if (!do_chdir)
basename_dir = dirpath;
/* We're done making leading directories.
Create the final component of the path. */
/* The path could end in "/." or contain "/..", so test
if we really have to create the directory. */
if (stat (dirpath, &stats) && mkdir (dirpath, mode))
if (stat (basename_dir, &stats) && mkdir (basename_dir, mode))
{
error (0, errno, "cannot create directory `%s'", dirpath);
umask (oldmask);
CLEANUP;
return 1;
}
/* Done creating directories. Restore original umask. */
umask (oldmask);
if (verbose_fmt_string != NULL)
error (0, 0, verbose_fmt_string, dirpath);
if (owner != (uid_t) -1 && group != (gid_t) -1)
{
if (chown (dirpath, owner, group)
if (chown (basename_dir, owner, group)
#ifdef AFS
&& errno != EPERM
#endif
)
{
error (0, errno, "%s", dirpath);
error (0, errno, "cannot chown %s", dirpath);
retval = 1;
}
/* chown may have turned off some permission bits we wanted. */
if ((mode & 07000) != 0 && chmod (dirpath, mode))
if ((mode & 07000) != 0 && chmod (basename_dir, mode))
{
error (0, errno, "%s", dirpath);
error (0, errno, "cannot chmod %s", dirpath);
retval = 1;
}
}
CLEANUP_CWD;
/* If the mode for leading directories didn't include owner "wx"
privileges, we have to reset their protections to the correct
value. */
@@ -263,10 +353,11 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
{
/* We get here if the entire path already exists. */
const char *dirpath = argpath;
if (!S_ISDIR (stats.st_mode))
{
error (0, 0, "`%s' exists but is not a directory", dirpath);
umask (oldmask);
return 1;
}
@@ -278,7 +369,7 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
On System V, users can give away files with chown and then not
be able to chmod them. So don't give files away. */
if (owner != (uid_t) -1 && group != (gid_t) -1
if ((owner != (uid_t) -1 || group != (gid_t) -1)
&& chown (dirpath, owner, group)
#ifdef AFS
&& errno != EPERM
@@ -296,6 +387,5 @@ make_path (argpath, mode, parent_mode, owner, group, preserve_existing,
}
}
umask (oldmask);
return retval;
}

View File

@@ -1,15 +1,16 @@
# undef __P
#if __STDC__
# define __P(Args) Args
#else
# define __P(Args) ()
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
int
make_path __P ((const char *_argpath,
int _mode,
int _parent_mode,
uid_t _owner,
gid_t _group,
int _preserve_existing,
const char *_verbose_fmt_string));
make_path PARAMS ((const char *_argpath,
int _mode,
int _parent_mode,
uid_t _owner,
gid_t _group,
int _preserve_existing,
const char *_verbose_fmt_string));

39
lib/malloc.c Normal file
View File

@@ -0,0 +1,39 @@
/* Work around bug on some systems where malloc (0) fails.
Copyright (C) 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef malloc
#include <sys/types.h>
char *malloc ();
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
char *
rpl_malloc (n)
size_t n;
{
if (n == 0)
n = 1;
return malloc (n);
}

View File

@@ -1,5 +1,5 @@
/* Case-insensitive buffer comparator.
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,21 +25,23 @@
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
#define IN_CTYPE_DOMAIN(c) 1
# define IN_CTYPE_DOMAIN(c) 1
#else
#define IN_CTYPE_DOMAIN(c) isascii(c)
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
#if _LIBC || STDC_HEADERS
# define TOLOWER(c) tolower (c)
# define TOUPPER(c) toupper (c)
#else
# define TOLOWER(c) (ISUPPER (c) ? tolower (c) : (c))
# define TOUPPER(c) (ISLOWER (c) ? toupper (c) : (c))
#endif
#include "memcasecmp.h"
/* Like memcmp, but ignore differences in case. */
/* Like memcmp, but ignore differences in case.
Convert to upper case (not lower) before comparing so that
join -i works with sort -f. */
int
memcasecmp (vs1, vs2, n)
@@ -54,8 +56,8 @@ memcasecmp (vs1, vs2, n)
{
unsigned char u1 = *s1++;
unsigned char u2 = *s2++;
if (TOLOWER (u1) != TOLOWER (u2))
return TOLOWER (u1) - TOLOWER (u2);
if (TOUPPER (u1) != TOUPPER (u2))
return TOUPPER (u1) - TOUPPER (u2);
}
return 0;
}

View File

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

View File

@@ -1,5 +1,5 @@
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
Based on strlen implemention by Torbjorn Granlund (tege@sics.se),
/* Copyright (C) 1991, 1993, 1997 Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and
commentary by Jim Blandy (jimb@ai.mit.edu);
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),

View File

@@ -1,72 +1,83 @@
/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1993, 1995, 1997 Free Software Foundation, Inc.
Contributed by Torbjorn Granlund (tege@sics.se).
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.
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.
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 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.
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. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
# include "config.h"
#endif
#undef __ptr_t
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#define __ptr_t void *
#if defined __cplusplus || (defined __STDC__ && __STDC__)
# define __ptr_t void *
#else /* Not C++ or ANSI C. */
#undef const
#define const
#define __ptr_t char *
# undef const
# define const
# define __ptr_t char *
#endif /* C++ or ANSI C. */
#if defined (HAVE_STRING_H) || defined (_LIBC)
#include <string.h>
#ifndef __P
# if defined __GNUC__ || (defined __STDC__ && __STDC__)
# define __P(args) args
# else
# define __P(args) ()
# endif /* GCC. */
#endif /* Not __P. */
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#endif
#undef memcmp
#ifdef _LIBC
#include <memcopy.h>
# include <memcopy.h>
#else /* Not in the GNU C library. */
#include <sys/types.h>
# include <sys/types.h>
/* Type to use for aligned memory operations.
This should normally be the biggest type supported by a single load
and store. Must be an unsigned type. */
#define op_t unsigned long int
#define OPSIZ (sizeof(op_t))
# define op_t unsigned long int
# define OPSIZ (sizeof(op_t))
/* Threshold value for when to enter the unrolled loops. */
#define OP_T_THRES 16
# define OP_T_THRES 16
/* Type to use for unaligned operations. */
typedef unsigned char byte;
#ifndef WORDS_BIGENDIAN
#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
#else
#define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
#endif
# ifndef WORDS_BIGENDIAN
# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
# else
# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
# endif
#endif /* In the GNU C library. */
#ifdef WORDS_BIGENDIAN
#define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
#else
#define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
#endif
/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
@@ -86,9 +97,12 @@ typedef unsigned char byte;
/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
A and B are known to be different.
This is needed only on little-endian machines. */
#ifdef __GNUC__
static int memcmp_bytes __P((op_t, op_t));
# ifdef __GNUC__
__inline
#endif
# endif
static int
memcmp_bytes (a, b)
op_t a, b;
@@ -109,6 +123,8 @@ memcmp_bytes (a, b)
}
#endif
static int memcmp_common_alignment __P((long, long, size_t));
/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
memory operations on `op_t's. */
@@ -126,6 +142,7 @@ memcmp_common_alignment (srcp1, srcp2, len)
switch (len % 4)
{
default: /* Avoid warning about uninitialized local variables. */
case 2:
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
@@ -196,6 +213,8 @@ memcmp_common_alignment (srcp1, srcp2, len)
return 0;
}
static int memcmp_not_common_alignment __P((long, long, size_t));
/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
`op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
operations on `op_t', but SRCP1 *should be unaligned*. */
@@ -225,6 +244,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
switch (len % 4)
{
default: /* Avoid warning about uninitialized local variables. */
case 2:
a1 = ((op_t *) srcp1)[0];
a2 = ((op_t *) srcp1)[1];
@@ -366,8 +386,6 @@ memcmp (s1, s2, len)
}
#ifdef weak_alias
#undef bcmp
# undef bcmp
weak_alias (memcmp, bcmp)
#endif

View File

@@ -1,11 +1,29 @@
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
if the source overlaps with the destination.
Return DESTADDR. */
/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Jim Meyering <meyering@na-net.ornl.gov>. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Copy LEN bytes starting at SRCADDR to DESTADDR. Result undefined
if the source overlaps with the destination.
Return DESTADDR. */
char *
memcpy (destaddr, srcaddr, len)
char *destaddr;

View File

@@ -1,8 +1,9 @@
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
/* mktime: convert a `struct tm' to a time_t value
Copyright (C) 1993-1997, 1998 Free Software Foundation, Inc.
Contributed by Paul Eggert (eggert@twinsun.com).
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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.
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
@@ -15,65 +16,84 @@
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. */
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
/* Define this to have a standalone program to test this implementation of
mktime. */
/* #define DEBUG 1 */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
/* Some systems need this in order to declare localtime_r properly. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_LOCALTIME_R 1
# define STDC_HEADERS 1
#endif
/* Assume that leap seconds are possible, unless told otherwise.
If the host has a `zic' command with a `-L leapsecondfilename' option,
then it supports leap seconds; otherwise it probably doesn't. */
#ifndef LEAP_SECONDS_POSSIBLE
#define LEAP_SECONDS_POSSIBLE 1
# define LEAP_SECONDS_POSSIBLE 1
#endif
#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
#include <limits.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#if DEBUG
#include <stdio.h>
#if __STDC__ || __GNU_LIBRARY__ || STDC_HEADERS
#include <stdlib.h>
#endif
# include <stdio.h>
# if STDC_HEADERS
# include <stdlib.h>
# endif
/* Make it work even if the system's libc has its own mktime routine. */
#define mktime my_mktime
# define mktime my_mktime
#endif /* DEBUG */
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
# else
# define __P(args) ()
# endif /* GCC. */
#endif /* Not __P. */
#ifndef CHAR_BIT
#define CHAR_BIT 8
# define CHAR_BIT 8
#endif
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
It is necessary at least when t == time_t. */
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define TYPE_MAXIMUM(t) (~ (t) 0 - TYPE_MINIMUM (t))
#ifndef INT_MIN
#define INT_MIN (~0 << (sizeof (int) * CHAR_BIT - 1))
# define INT_MIN TYPE_MINIMUM (int)
#endif
#ifndef INT_MAX
#define INT_MAX (~0 - INT_MIN)
# define INT_MAX TYPE_MAXIMUM (int)
#endif
#ifndef TIME_T_MIN
#define TIME_T_MIN (0 < (time_t) -1 ? (time_t) 0 \
: ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
# define TIME_T_MIN TYPE_MINIMUM (time_t)
#endif
#ifndef TIME_T_MAX
#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
# define TIME_T_MAX TYPE_MAXIMUM (time_t)
#endif
#define TM_YEAR_BASE 1900
@@ -82,7 +102,7 @@
#ifndef __isleap
/* Nonzero if YEAR is a leap year (every 4 years,
except every 100th isn't, and every 400th is). */
#define __isleap(year) \
# define __isleap(year) \
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
#endif
@@ -95,18 +115,21 @@ const unsigned short int __mon_yday[2][13] =
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
static struct tm *ranged_convert __P ((struct tm *(*) __P ((const time_t *,
struct tm *)),
time_t *, struct tm *));
static time_t ydhms_tm_diff __P ((int, int, int, int, int, const struct tm *));
time_t __mktime_internal __P ((struct tm *,
struct tm *(*) (const time_t *, struct tm *),
time_t *));
#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
#ifdef _LIBC
#define localtime_r __localtime_r
# define localtime_r __localtime_r
#else
# if ! HAVE_LOCALTIME_R && ! defined localtime_r
/* Approximate localtime_r as best we can in its absence. */
#define localtime_r my_localtime_r
# define localtime_r my_mktime_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
@@ -119,42 +142,112 @@ localtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
#endif /* ! _LIBC */
#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
/* Yield the difference between (YEAR-YDAY HOUR:MIN:SEC) and (*TP),
measured in seconds, ignoring leap seconds.
YEAR uses the same numbering as TM->tm_year.
All values are in range, except possibly YEAR.
If TP is null, return a nonzero value.
If overflow occurs, yield the low order bits of the correct answer. */
static time_t
ydhms_tm_diff (year, yday, hour, min, sec, tp)
int year, yday, hour, min, sec;
const struct tm *tp;
{
time_t ay = year + (time_t) (TM_YEAR_BASE - 1);
time_t by = tp->tm_year + (time_t) (TM_YEAR_BASE - 1);
time_t intervening_leap_days =
(ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
time_t years = ay - by;
time_t days = (365 * years + intervening_leap_days
+ (yday - tp->tm_yday));
return (60 * (60 * (24 * days + (hour - tp->tm_hour))
+ (min - tp->tm_min))
+ (sec - tp->tm_sec));
if (!tp)
return 1;
else
{
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid int overflow. time_t overflow is OK, since
only the low order bits of the correct time_t answer are needed.
Don't convert to time_t until after all divisions are done, since
time_t might be unsigned. */
int a4 = (year >> 2) + (TM_YEAR_BASE >> 2) - ! (year & 3);
int b4 = (tp->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (tp->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);
time_t years = year - (time_t) tp->tm_year;
time_t days = (365 * years + intervening_leap_days
+ (yday - tp->tm_yday));
return (60 * (60 * (24 * days + (hour - tp->tm_hour))
+ (min - tp->tm_min))
+ (sec - tp->tm_sec));
}
}
static time_t localtime_offset;
/* Convert *TP to a time_t value. */
time_t
mktime (tp)
struct tm *tp;
{
static time_t localtime_offset;
#ifdef _LIBC
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
__tzset ();
#endif
return __mktime_internal (tp, localtime_r, &localtime_offset);
}
/* Use CONVERT to convert *T to a broken down time in *TP.
If *T is out of range for conversion, adjust it so that
it is the nearest in-range value and then convert that. */
static struct tm *
ranged_convert (convert, t, tp)
struct tm *(*convert) __P ((const time_t *, struct tm *));
time_t *t;
struct tm *tp;
{
struct tm *r;
if (! (r = (*convert) (t, tp)) && *t)
{
time_t bad = *t;
time_t ok = 0;
struct tm tm;
/* BAD is a known unconvertible time_t, and OK is a known good one.
Use binary search to narrow the range between BAD and OK until
they differ by 1. */
while (bad != ok + (bad < 0 ? -1 : 1))
{
time_t mid = *t = (bad < 0
? bad + ((ok - bad) >> 1)
: ok + ((bad - ok) >> 1));
if ((r = (*convert) (t, tp)))
{
tm = *r;
ok = mid;
}
else
bad = mid;
}
if (!r && ok)
{
/* The last conversion attempt failed;
revert to the most recent successful attempt. */
*t = ok;
*tp = tm;
r = tp;
}
}
return r;
}
/* Convert *TP to a time_t value, inverting
the monotonic and mostly-unit-linear conversion function CONVERT.
Use *OFFSET to keep track of a guess at the offset of the result,
@@ -171,7 +264,7 @@ __mktime_internal (tp, convert, offset)
/* The maximum number of probes (calls to CONVERT) should be enough
to handle any combinations of time zone rule changes, solar time,
and leap seconds. Posix.1 prohibits leap seconds, but some hosts
and leap seconds. POSIX.1 prohibits leap seconds, but some hosts
have them anyway. */
int remaining_probes = 4;
@@ -202,10 +295,10 @@ __mktime_internal (tp, convert, offset)
[mon_remainder + 12 * negative_mon_remainder])
+ mday - 1);
int sec_requested = sec;
#if LEAP_SECONDS_POSSIBLE
/* Handle out-of-range seconds specially,
since ydhms_tm_diff assumes every minute has 60 seconds. */
int sec_requested = sec;
if (sec < 0)
sec = 0;
if (59 < sec)
@@ -220,7 +313,8 @@ __mktime_internal (tp, convert, offset)
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
for (t = t0 + *offset;
(dt = ydhms_tm_diff (year, yday, hour, min, sec, (*convert) (&t, &tm)));
(dt = ydhms_tm_diff (year, yday, hour, min, sec,
ranged_convert (convert, &t, &tm)));
t += dt)
if (--remaining_probes == 0)
return -1;
@@ -240,7 +334,7 @@ __mktime_internal (tp, convert, offset)
{
struct tm otm;
if (! (dt = ydhms_tm_diff (year, yday, hour, min, sec,
(*convert) (&ot, &otm))))
ranged_convert (convert, &ot, &otm))))
{
t = ot;
tm = otm;
@@ -260,7 +354,8 @@ __mktime_internal (tp, convert, offset)
/* Adjust time to reflect the tm_sec requested, not the normalized value.
Also, repair any damage from a false match due to a leap second. */
t += sec_requested - sec + (sec == 0 && tm.tm_sec == 60);
(*convert) (&t, &tm);
if (! (*convert) (&t, &tm))
return -1;
}
#endif
@@ -276,7 +371,15 @@ __mktime_internal (tp, convert, offset)
double dday = 366 * dyear + mday;
double dsec = 60 * (60 * (24 * dday + hour) + min) + sec_requested;
if (TIME_T_MAX / 3 - TIME_T_MIN / 3 < (dsec < 0 ? - dsec : dsec))
/* On Irix4.0.5 cc, dividing TIME_T_MIN by 3 does not produce
correct results, ie., it erroneously gives a positive value
of 715827882. Setting a variable first then doing math on it
seems to work. (ghazi@caip.rutgers.edu) */
const time_t time_t_max = TIME_T_MAX;
const time_t time_t_min = TIME_T_MIN;
if (time_t_max / 3 - time_t_min / 3 < (dsec < 0 ? - dsec : dsec))
return -1;
}
@@ -310,25 +413,28 @@ static void
print_tm (tp)
struct tm *tp;
{
printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec,
tp->tm_yday, tp->tm_wday, tp->tm_isdst);
if (tp)
printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec,
tp->tm_yday, tp->tm_wday, tp->tm_isdst);
else
printf ("0");
}
static int
check_result (tk, tmk, tl, tml)
check_result (tk, tmk, tl, lt)
time_t tk;
struct tm tmk;
time_t tl;
struct tm tml;
struct tm *lt;
{
if (tk != tl || not_equal_tm (&tmk, &tml))
if (tk != tl || !lt || not_equal_tm (&tmk, lt))
{
printf ("mktime (");
print_tm (&tmk);
printf (")\nyields (");
print_tm (&tml);
print_tm (lt);
printf (") == %ld, should be %ld\n", (long) tl, (long) tk);
return 1;
}
@@ -343,6 +449,7 @@ main (argc, argv)
{
int status = 0;
struct tm tm, tmk, tml;
struct tm *lt;
time_t tk, tl;
char trailer;
@@ -359,11 +466,16 @@ main (argc, argv)
tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
tmk = tm;
tl = mktime (&tmk);
tml = *localtime (&tl);
lt = localtime (&tl);
if (lt)
{
tml = *lt;
lt = &tml;
}
printf ("mktime returns %ld == ", (long) tl);
print_tm (&tmk);
printf ("\n");
status = check_result (tl, tmk, tl, tml);
status = check_result (tl, tmk, tl, lt);
}
else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
{
@@ -374,19 +486,35 @@ main (argc, argv)
if (argc == 4)
for (tl = from; tl <= to; tl += by)
{
tml = *localtime (&tl);
tmk = tml;
tk = mktime (&tmk);
status |= check_result (tk, tmk, tl, tml);
lt = localtime (&tl);
if (lt)
{
tmk = tml = *lt;
tk = mktime (&tmk);
status |= check_result (tk, tmk, tl, tml);
}
else
{
printf ("localtime (%ld) yields 0\n", (long) tl);
status = 1;
}
}
else
for (tl = from; tl <= to; tl += by)
{
/* Null benchmark. */
tml = *localtime (&tl);
tmk = tml;
tk = tl;
status |= check_result (tk, tmk, tl, tml);
lt = localtime (&tl);
if (lt)
{
tmk = tml = *lt;
tk = tl;
status |= check_result (tk, tmk, tl, tml);
}
else
{
printf ("localtime (%ld) yields 0\n", (long) tl);
status = 1;
}
}
}
else
@@ -403,6 +531,6 @@ main (argc, argv)
/*
Local Variables:
compile-command: "gcc -DDEBUG=1 -Wall -O -g mktime.c -o mktime"
compile-command: "gcc -DDEBUG -D__EXTENSIONS__ -DHAVE_LIMITS_H -DHAVE_LOCALTIME_R -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
End:
*/

View File

@@ -1,5 +1,5 @@
/* modechange.c -- file mode manipulation
Copyright (C) 1989, 1990 Free Software Foundation, Inc.
Copyright (C) 1989, 1990, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -236,6 +236,33 @@ invalid:
return MODE_INVALID;
}
/* Return a file mode change operation that sets permissions to match those
of REF_FILE. Return MODE_BAD_REFERENCE if REF_FILE can't be accessed. */
struct mode_change *
mode_create_from_ref (ref_file)
const char *ref_file;
{
struct mode_change *change; /* the only change element */
struct stat ref_stats;
if (stat (ref_file, &ref_stats))
return MODE_BAD_REFERENCE;
change = talloc (struct mode_change);
if (change == NULL)
return MODE_MEMORY_EXHAUSTED;
change->op = '=';
change->flags = 0;
change->affected = 07777;
change->value = ref_stats.st_mode;
change->next = NULL;
return change;
}
/* Return file mode OLDMODE, adjusted as indicated by the list of change
operations CHANGES. If OLDMODE is a directory, the type `X'
change affects it even if no execute bits were set in OLDMODE.

View File

@@ -1,5 +1,5 @@
/* modechange.h -- definitions for file mode manipulation
Copyright (C) 1989, 1990 Free Software Foundation, Inc.
Copyright (C) 1989, 1990, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,14 +17,17 @@
/* Masks for the `flags' field in a `struct mode_change'. */
#if ! defined MODECHANGE_H_
# define MODECHANGE_H_
/* Affect the execute bits only if at least one execute bit is set already,
or if the file is a directory. */
#define MODE_X_IF_ANY_X 01
# define MODE_X_IF_ANY_X 01
/* If set, copy some existing permissions for u, g, or o onto the other two.
Which of u, g, or o is copied is determined by which bits are set in the
`value' field. */
#define MODE_COPY_EXISTING 02
# define MODE_COPY_EXISTING 02
struct mode_change
{
@@ -36,22 +39,27 @@ struct mode_change
};
/* Masks for mode_compile argument. */
#define MODE_MASK_EQUALS 1
#define MODE_MASK_PLUS 2
#define MODE_MASK_MINUS 4
# define MODE_MASK_EQUALS 1
# define MODE_MASK_PLUS 2
# define MODE_MASK_MINUS 4
# define MODE_MASK_ALL (MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS)
/* Error return values for mode_compile. */
#define MODE_INVALID (struct mode_change *) 0
#define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
# define MODE_INVALID (struct mode_change *) 0
# define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
# define MODE_BAD_REFERENCE (struct mode_change *) 2
#ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(Args) Args
# else
# define __P(Args) ()
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
#endif
struct mode_change *mode_compile __P ((const char *, unsigned));
unsigned short mode_adjust __P ((unsigned, const struct mode_change *));
void mode_free __P ((struct mode_change *));
struct mode_change *mode_compile PARAMS ((const char *, unsigned));
struct mode_change *mode_create_from_ref PARAMS ((const char *));
unsigned short mode_adjust PARAMS ((unsigned, const struct mode_change *));
void mode_free PARAMS ((struct mode_change *));
#endif

View File

@@ -1,5 +1,5 @@
/* mountlist.c -- return a list of mounted filesystems
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
@@ -24,79 +24,92 @@
#include "mountlist.h"
#ifdef STDC_HEADERS
#include <stdlib.h>
# include <stdlib.h>
#else
void free ();
#endif
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
#include <string.h>
# include <string.h>
#else
#include <strings.h>
# include <strings.h>
#endif
#ifndef strstr
char *strstr ();
#endif
char *xmalloc ();
char *xrealloc ();
char *xstrdup ();
void error ();
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if defined (MOUNTED_GETFSSTAT) /* __alpha running OSF_1 */
# include <sys/mount.h>
# include <sys/fs_types.h>
# include <sys/mount.h>
# include <sys/fs_types.h>
#endif /* MOUNTED_GETFSSTAT */
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
#include <mntent.h>
#if !defined(MOUNTED)
# include <mntent.h>
# if !defined(MOUNTED)
# if defined(MNT_MNTTAB) /* HP-UX. */
# define MOUNTED MNT_MNTTAB
# define MOUNTED MNT_MNTTAB
# endif
# if defined(MNTTABNAME) /* Dynix. */
# define MOUNTED MNTTABNAME
# define MOUNTED MNTTABNAME
# endif
#endif
# endif
#endif
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
#include <sys/mount.h>
# include <sys/mount.h>
#endif
#ifdef MOUNTED_GETMNT /* Ultrix. */
#include <sys/mount.h>
#include <sys/fs_types.h>
# include <sys/mount.h>
# include <sys/fs_types.h>
#endif
#ifdef MOUNTED_FREAD /* SVR2. */
#include <mnttab.h>
# include <mnttab.h>
#endif
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
#include <mnttab.h>
#include <sys/fstyp.h>
#include <sys/statfs.h>
# include <mnttab.h>
# include <sys/fstyp.h>
# include <sys/statfs.h>
#endif
#ifdef MOUNTED_LISTMNTENT
#include <mntent.h>
# include <mntent.h>
#endif
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
#include <sys/mnttab.h>
# include <sys/mnttab.h>
#endif
#ifdef MOUNTED_VMOUNT /* AIX. */
#include <fshelp.h>
#include <sys/vfs.h>
# include <fshelp.h>
# include <sys/vfs.h>
#endif
#ifdef DOLPHIN
/* So special that it's not worth putting this in autoconf. */
#undef MOUNTED_FREAD_FSTYP
#define MOUNTED_GETMNTTBL
# undef MOUNTED_FREAD_FSTYP
# define MOUNTED_GETMNTTBL
#endif
#if HAVE_SYS_MNTENT_H
/* This is to get MNTOPT_IGNORE on e.g. SVR4. */
# include <sys/mntent.h>
#endif
#if defined (MNTOPT_IGNORE) && defined (HAVE_HASMNTOPT)
# define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE)
#else
# define MNT_IGNORE(M) 0
#endif
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
@@ -127,97 +140,97 @@ xatoi (cp)
}
#endif /* MOUNTED_GETMNTENT1. */
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__)
#if defined (MOUNTED_GETMNTINFO) && !defined (__NetBSD__) && !defined (__OpenBSD__)
static char *
fstype_to_string (t)
short t;
{
switch (t)
{
#ifdef MOUNT_PC
# ifdef MOUNT_PC
case MOUNT_PC:
return "pc";
#endif
#ifdef MOUNT_MFS
# endif
# ifdef MOUNT_MFS
case MOUNT_MFS:
return "mfs";
#endif
#ifdef MOUNT_LO
# endif
# ifdef MOUNT_LO
case MOUNT_LO:
return "lo";
#endif
#ifdef MOUNT_TFS
# endif
# ifdef MOUNT_TFS
case MOUNT_TFS:
return "tfs";
#endif
#ifdef MOUNT_TMP
# endif
# ifdef MOUNT_TMP
case MOUNT_TMP:
return "tmp";
#endif
#ifdef MOUNT_UFS
# endif
# ifdef MOUNT_UFS
case MOUNT_UFS:
return "ufs" ;
#endif
#ifdef MOUNT_NFS
# endif
# ifdef MOUNT_NFS
case MOUNT_NFS:
return "nfs" ;
#endif
#ifdef MOUNT_MSDOS
# endif
# ifdef MOUNT_MSDOS
case MOUNT_MSDOS:
return "msdos" ;
#endif
#ifdef MOUNT_LFS
# endif
# ifdef MOUNT_LFS
case MOUNT_LFS:
return "lfs" ;
#endif
#ifdef MOUNT_LOFS
# endif
# ifdef MOUNT_LOFS
case MOUNT_LOFS:
return "lofs" ;
#endif
#ifdef MOUNT_FDESC
# endif
# ifdef MOUNT_FDESC
case MOUNT_FDESC:
return "fdesc" ;
#endif
#ifdef MOUNT_PORTAL
# endif
# ifdef MOUNT_PORTAL
case MOUNT_PORTAL:
return "portal" ;
#endif
#ifdef MOUNT_NULL
# endif
# ifdef MOUNT_NULL
case MOUNT_NULL:
return "null" ;
#endif
#ifdef MOUNT_UMAP
# endif
# ifdef MOUNT_UMAP
case MOUNT_UMAP:
return "umap" ;
#endif
#ifdef MOUNT_KERNFS
# endif
# ifdef MOUNT_KERNFS
case MOUNT_KERNFS:
return "kernfs" ;
#endif
#ifdef MOUNT_PROCFS
# endif
# ifdef MOUNT_PROCFS
case MOUNT_PROCFS:
return "procfs" ;
#endif
#ifdef MOUNT_AFS
# endif
# ifdef MOUNT_AFS
case MOUNT_AFS:
return "afs" ;
#endif
#ifdef MOUNT_CD9660
# endif
# ifdef MOUNT_CD9660
case MOUNT_CD9660:
return "cd9660" ;
#endif
#ifdef MOUNT_UNION
# endif
# ifdef MOUNT_UNION
case MOUNT_UNION:
return "union" ;
#endif
#ifdef MOUNT_DEVFS
# endif
# ifdef MOUNT_DEVFS
case MOUNT_DEVFS:
return "devfs" ;
#endif
#ifdef MOUNT_EXT2FS
# endif
# ifdef MOUNT_EXT2FS
case MOUNT_EXT2FS:
return "ext2fs" ;
#endif
# endif
default:
return "?";
}
@@ -345,11 +358,11 @@ read_filesystem_list (need_fs_type, all_fs)
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
me->me_devname = xstrdup (fsp->f_mntfromname);
me->me_mountdir = xstrdup (fsp->f_mntonname);
#ifdef __NetBSD__
# if defined (__NetBSD__) || defined (__OpenBSD__)
me->me_type = xstrdup (fsp->f_fstypename);
#else
# else
me->me_type = fstype_to_string (fsp->f_type);
#endif
# endif
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_next = NULL;
@@ -436,17 +449,17 @@ read_filesystem_list (need_fs_type, all_fs)
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
{
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
#ifdef GETFSTYP /* SVR3. */
# ifdef GETFSTYP /* SVR3. */
me->me_devname = xstrdup (mnt.mt_dev);
#else
# else
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
strcpy (me->me_devname, "/dev/");
strcpy (me->me_devname + 5, mnt.mt_dev);
#endif
# endif
me->me_mountdir = xstrdup (mnt.mt_filsys);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_type = "";
#ifdef GETFSTYP /* SVR3. */
# ifdef GETFSTYP /* SVR3. */
if (need_fs_type)
{
struct statfs fsd;
@@ -456,7 +469,7 @@ read_filesystem_list (need_fs_type, all_fs)
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
me->me_type = xstrdup (typebuf);
}
#endif
# endif
me->me_next = NULL;
/* Add to the linked list. */
@@ -502,6 +515,10 @@ read_filesystem_list (need_fs_type, all_fs)
while ((ret = getmntent (fp, &mnt)) == 0)
{
/* Don't show automounted filesystems twice on e.g., Solaris. */
if (!all_fs && MNT_IGNORE (&mnt))
continue;
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
me->me_devname = xstrdup (mnt.mnt_special);
me->me_mountdir = xstrdup (mnt.mnt_mountp);

View File

@@ -1,19 +1,23 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988,89,90,91,92,93,94,96 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 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.
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 GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
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. */
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "obstack.h"
@@ -52,7 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Determine default alignment. */
struct fooalign {char x; double d;};
#define DEFAULT_ALIGNMENT \
((PTR_INT_TYPE) ((char *)&((struct fooalign *) 0)->d - (char *)0))
((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
But in fact it might be less smart and round addresses to as much as
DEFAULT_ROUNDING. So we prepare for it to do that. */
@@ -67,6 +71,28 @@ union fooround {long x; double d;};
#define COPYING_UNIT int
#endif
/* The functions allocating more room by calling `obstack_chunk_alloc'
jump to the handler pointed to by `obstack_alloc_failed_handler'.
This variable by default points to the internal function
`print_and_abort'. */
#if defined (__STDC__) && __STDC__
static void print_and_abort (void);
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
#else
static void print_and_abort ();
void (*obstack_alloc_failed_handler) () = print_and_abort;
#endif
/* Exit value used when `print_and_abort' is used. */
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
int obstack_exit_failure = EXIT_FAILURE;
/* The non-GNU-C macros copy the obstack into this global variable
to avoid multiple evaluation. */
@@ -78,6 +104,20 @@ struct obstack *_obstack;
For free, do not use ?:, since some compilers, like the MIPS compilers,
do not allow (expr) ? void : void. */
#if defined (__STDC__) && __STDC__
#define CALL_CHUNKFUN(h, size) \
(((h) -> use_extra_arg) \
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
: (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
#define CALL_FREEFUN(h, old_chunk) \
do { \
if ((h) -> use_extra_arg) \
(*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
else \
(*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
} while (0)
#else
#define CALL_CHUNKFUN(h, size) \
(((h) -> use_extra_arg) \
? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
@@ -90,6 +130,7 @@ struct obstack *_obstack;
else \
(*(void (*) ()) (h)->freefun) ((old_chunk)); \
} while (0)
#endif
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
@@ -106,10 +147,15 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
struct obstack *h;
int size;
int alignment;
#if defined (__STDC__) && __STDC__
POINTER (*chunkfun) (long);
void (*freefun) (void *);
#else
POINTER (*chunkfun) ();
void (*freefun) ();
#endif
{
register struct _obstack_chunk* chunk; /* points to new chunk */
register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
@@ -130,25 +176,27 @@ _obstack_begin (h, size, alignment, chunkfun, freefun)
size = 4096 - extra;
}
#if defined (__STDC__) && __STDC__
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
#else
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
h->freefun = freefun;
#endif
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->use_extra_arg = 0;
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
{
h->alloc_failed = 1;
return 0;
}
h->alloc_failed = 0;
(*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = chunk->contents;
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
h->alloc_failed = 0;
return 1;
}
@@ -157,11 +205,16 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
struct obstack *h;
int size;
int alignment;
#if defined (__STDC__) && __STDC__
POINTER (*chunkfun) (POINTER, long);
void (*freefun) (POINTER, POINTER);
#else
POINTER (*chunkfun) ();
void (*freefun) ();
#endif
POINTER arg;
{
register struct _obstack_chunk* chunk; /* points to new chunk */
register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
@@ -182,8 +235,13 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
size = 4096 - extra;
}
#if defined(__STDC__) && __STDC__
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
#else
h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
h->freefun = freefun;
#endif
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->extra_arg = arg;
@@ -191,17 +249,14 @@ _obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
if (!chunk)
{
h->alloc_failed = 1;
return 0;
}
h->alloc_failed = 0;
(*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = chunk->contents;
h->chunk_limit = chunk->limit
= (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
h->alloc_failed = 0;
return 1;
}
@@ -216,8 +271,8 @@ _obstack_newchunk (h, length)
struct obstack *h;
int length;
{
register struct _obstack_chunk* old_chunk = h->chunk;
register struct _obstack_chunk* new_chunk;
register struct _obstack_chunk *old_chunk = h->chunk;
register struct _obstack_chunk *new_chunk;
register long new_size;
register int obj_size = h->next_free - h->object_base;
register int i;
@@ -231,11 +286,7 @@ _obstack_newchunk (h, length)
/* Allocate and initialize the new chunk. */
new_chunk = CALL_CHUNKFUN (h, new_size);
if (!new_chunk)
{
h->alloc_failed = 1;
return;
}
h->alloc_failed = 0;
(*obstack_alloc_failed_handler) ();
h->chunk = new_chunk;
new_chunk->prev = old_chunk;
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
@@ -290,14 +341,14 @@ _obstack_allocated_p (h, obj)
struct obstack *h;
POINTER obj;
{
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk* plp; /* point to previous chunk if any */
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = (h)->chunk;
/* We use >= rather than > since the object cannot be exactly at
the beginning of the chunk but might be an empty object exactly
at the end of an adjacent chunk. */
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
at the end of an adjacent chunk. */
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
{
plp = lp->prev;
lp = plp;
@@ -318,14 +369,14 @@ _obstack_free (h, obj)
struct obstack *h;
POINTER obj;
{
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk* plp; /* point to previous chunk if any */
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = h->chunk;
/* We use >= because there cannot be an object at the beginning of a chunk.
But there can be an empty object at that address
at the end of another chunk. */
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
{
plp = lp->prev;
CALL_FREEFUN (h, lp);
@@ -336,7 +387,7 @@ _obstack_free (h, obj)
}
if (lp)
{
h->object_base = h->next_free = (char *)(obj);
h->object_base = h->next_free = (char *) (obj);
h->chunk_limit = lp->limit;
h->chunk = lp;
}
@@ -352,14 +403,14 @@ obstack_free (h, obj)
struct obstack *h;
POINTER obj;
{
register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk* plp; /* point to previous chunk if any */
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = h->chunk;
/* We use >= because there cannot be an object at the beginning of a chunk.
But there can be an empty object at that address
at the end of another chunk. */
while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj))
while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj))
{
plp = lp->prev;
CALL_FREEFUN (h, lp);
@@ -370,7 +421,7 @@ obstack_free (h, obj)
}
if (lp)
{
h->object_base = h->next_free = (char *)(obj);
h->object_base = h->next_free = (char *) (obj);
h->chunk_limit = lp->limit;
h->chunk = lp;
}
@@ -379,6 +430,39 @@ obstack_free (h, obj)
abort ();
}
int
_obstack_memory_used (h)
struct obstack *h;
{
register struct _obstack_chunk* lp;
register int nbytes = 0;
for (lp = h->chunk; lp != 0; lp = lp->prev)
{
nbytes += lp->limit - (char *) lp;
}
return nbytes;
}
/* Define the error handler. */
#ifndef _
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# ifndef _
# define _(Str) gettext (Str)
# endif
# else
# define _(Str) (Str)
# endif
#endif
static void
print_and_abort ()
{
fputs (_("memory exhausted\n"), stderr);
exit (obstack_exit_failure);
}
#if 0
/* These are now turned off because the applications do not use it
and it uses bcopy via obstack_grow, which causes trouble on sysV. */
@@ -417,6 +501,13 @@ int (obstack_room) (obstack)
return obstack_room (obstack);
}
int (obstack_make_room) (obstack, length)
struct obstack *obstack;
int length;
{
return obstack_make_room (obstack, length);
}
void (obstack_grow) (obstack, pointer, length)
struct obstack *obstack;
POINTER pointer;

View File

@@ -1,19 +1,25 @@
/* obstack.h - object stack macros
Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc.
Copyright (C) 1988,89,90,91,92,93,94,96,97 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.
the C library, however. The master source lives in /gd/gnu/lib.
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.
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.
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. */
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. */
/* Summary:
@@ -100,28 +106,23 @@ Summary:
/* Don't do the contents of this file more than once. */
#ifndef __OBSTACK_H__
#define __OBSTACK_H__
#ifndef _OBSTACK_H
#define _OBSTACK_H 1
#ifdef HAVE_CONFIG_H
# include <config.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
# define bcopy(from, to, len) memcpy ((to), (from), (len))
#endif
/* We use subtraction of (char *)0 instead of casting to int
/* We use subtraction of (char *) 0 instead of casting to int
because on word-addressable machines a simple cast to int
may ignore the byte-within-word field of the pointer. */
#ifndef __PTR_TO_INT
#define __PTR_TO_INT(P) ((P) - (char *)0)
#define __PTR_TO_INT(P) ((P) - (char *) 0)
#endif
#ifndef __INT_TO_PTR
#define __INT_TO_PTR(P) ((P) + (char *)0)
#define __INT_TO_PTR(P) ((P) + (char *) 0)
#endif
/* We need the type of the resulting object. In ANSI C it is ptrdiff_t
@@ -141,18 +142,23 @@ Summary:
#include <stddef.h>
#endif
#include <sys/types.h>
#ifndef HAVE_PTRDIFF_T
# define ptrdiff_t off_t
#endif
#if defined (__STDC__) && __STDC__
#define PTR_INT_TYPE ptrdiff_t
#else
#define PTR_INT_TYPE long
#endif
#if defined (_LIBC) || defined (HAVE_STRING_H)
#include <string.h>
#define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
#else
#ifdef memcpy
#define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
#else
#define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N))
#endif
#endif
struct _obstack_chunk /* Lives at front of each chunk. */
{
char *limit; /* 1 past end of this chunk */
@@ -163,7 +169,7 @@ struct _obstack_chunk /* Lives at front of each chunk. */
struct obstack /* control current object in current chunk */
{
long chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
@@ -175,7 +181,7 @@ struct obstack /* control current object in current chunk */
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#else
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
@@ -186,7 +192,9 @@ struct obstack /* control current object in current chunk */
chunk contains a zero-length object. This
prevents freeing the chunk if we allocate
a bigger chunk to replace it. */
unsigned alloc_failed:1; /* chunk alloc func returned 0 */
unsigned alloc_failed:1; /* No longer used, as we now call the failed
handler on error, but retained for binary
compatibility. */
};
/* Declare the external functions we use; they are in obstack.c. */
@@ -199,11 +207,13 @@ extern int _obstack_begin (struct obstack *, int, int,
extern int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *);
#else
extern void _obstack_newchunk ();
extern void _obstack_free ();
extern int _obstack_begin ();
extern int _obstack_begin_1 ();
extern int _obstack_memory_used ();
#endif
#if defined (__STDC__) && __STDC__
@@ -234,6 +244,7 @@ void * obstack_finish (struct obstack *obstack);
int obstack_object_size (struct obstack *obstack);
int obstack_room (struct obstack *obstack);
void obstack_make_room (struct obstack *obstack, int size);
void obstack_1grow_fast (struct obstack *obstack, int data_char);
void obstack_ptr_grow_fast (struct obstack *obstack, void *data);
void obstack_int_grow_fast (struct obstack *obstack, int data);
@@ -243,17 +254,30 @@ void * obstack_base (struct obstack *obstack);
void * obstack_next_free (struct obstack *obstack);
int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack);
int obstack_memory_used (struct obstack *obstack);
#endif /* __STDC__ */
/* Non-ANSI C cannot really support alternative functions for these macros,
so we do not declare them. */
/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The
default action is to print a message and abort. */
#if defined (__STDC__) && __STDC__
extern void (*obstack_alloc_failed_handler) (void);
#else
extern void (*obstack_alloc_failed_handler) ();
#endif
/* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure;
/* Pointer to beginning of object being allocated or to be allocated next.
Note that this might not be the final address of the object
because a new chunk might be needed to hold the final size. */
#define obstack_base(h) ((h)->alloc_failed ? 0 : (h)->object_base)
#define obstack_base(h) ((h)->object_base)
/* Size for allocating ordinary chunks. */
@@ -261,7 +285,7 @@ int obstack_chunk_size (struct obstack *obstack);
/* Pointer to next byte not yet allocated in current chunk. */
#define obstack_next_free(h) ((h)->alloc_failed ? 0 : (h)->next_free)
#define obstack_next_free(h) ((h)->next_free)
/* Mask specifying low bits that should be clear in address of an object. */
@@ -273,25 +297,26 @@ int obstack_chunk_size (struct obstack *obstack);
#define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
#define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun))
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg))
(void *(*) (void *, long)) (chunkfun), \
(void (*) (void *, void *)) (freefun), (arg))
#define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun))
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
#define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *)) (newfreefun))
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
#else
@@ -322,6 +347,8 @@ int obstack_chunk_size (struct obstack *obstack);
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
#define obstack_memory_used(h) _obstack_memory_used (h)
#if defined (__GNUC__) && defined (__STDC__) && __STDC__
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
@@ -339,7 +366,6 @@ int obstack_chunk_size (struct obstack *obstack);
#define obstack_object_size(OBSTACK) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
__o->alloc_failed ? 0 : \
(unsigned) (__o->next_free - __o->object_base); })
#define obstack_room(OBSTACK) \
@@ -347,17 +373,27 @@ int obstack_chunk_size (struct obstack *obstack);
({ struct obstack *__o = (OBSTACK); \
(unsigned) (__o->chunk_limit - __o->next_free); })
#define obstack_make_room(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
(void) 0; })
#define obstack_empty_p(OBSTACK) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
(__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
#define obstack_grow(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
int __len = (length); \
if (__o->next_free + __len > __o->chunk_limit) \
_obstack_newchunk (__o, __len); \
if (!__o->alloc_failed) \
{ \
bcopy ((char *) (where), __o->next_free, __len); \
__o->next_free += __len; \
} \
_obstack_memcpy (__o->next_free, (char *) (where), __len); \
__o->next_free += __len; \
(void) 0; })
#define obstack_grow0(OBSTACK,where,length) \
@@ -366,12 +402,9 @@ __extension__ \
int __len = (length); \
if (__o->next_free + __len + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, __len + 1); \
if (!__o->alloc_failed) \
{ \
bcopy ((char *) (where), __o->next_free, __len); \
__o->next_free += __len; \
*(__o->next_free)++ = 0; \
} \
_obstack_memcpy (__o->next_free, (char *) (where), __len); \
__o->next_free += __len; \
*(__o->next_free)++ = 0; \
(void) 0; })
#define obstack_1grow(OBSTACK,datum) \
@@ -379,8 +412,7 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, 1); \
if (!__o->alloc_failed) \
*(__o->next_free)++ = (datum); \
*(__o->next_free)++ = (datum); \
(void) 0; })
/* These assume that the obstack alignment is good enough for pointers or ints,
@@ -392,8 +424,7 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
if (!__o->alloc_failed) \
*((void **)__o->next_free)++ = ((void *)datum); \
*((void **)__o->next_free)++ = ((void *)datum); \
(void) 0; })
#define obstack_int_grow(OBSTACK,datum) \
@@ -401,12 +432,11 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (int)); \
if (!__o->alloc_failed) \
*((int *)__o->next_free)++ = ((int)datum); \
*((int *)__o->next_free)++ = ((int)datum); \
(void) 0; })
#define obstack_ptr_grow_fast(h,aptr) (*((void **)(h)->next_free)++ = (void *)aptr)
#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint)
#define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr)
#define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
#define obstack_blank(OBSTACK,length) \
__extension__ \
@@ -414,8 +444,7 @@ __extension__ \
int __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
if (!__o->alloc_failed) \
__o->next_free += __len; \
__o->next_free += __len; \
(void) 0; })
#define obstack_alloc(OBSTACK,length) \
@@ -442,21 +471,16 @@ __extension__ \
__extension__ \
({ struct obstack *__o1 = (OBSTACK); \
void *value; \
if (__o1->alloc_failed) \
value = 0; \
else \
{ \
value = (void *) __o1->object_base; \
if (__o1->next_free == value) \
__o1->maybe_empty_object = 1; \
__o1->next_free \
= __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
& ~ (__o1->alignment_mask)); \
if (__o1->next_free - (char *)__o1->chunk \
> __o1->chunk_limit - (char *)__o1->chunk) \
__o1->next_free = __o1->chunk_limit; \
__o1->object_base = __o1->next_free; \
} \
value = (void *) __o1->object_base; \
if (__o1->next_free == value) \
__o1->maybe_empty_object = 1; \
__o1->next_free \
= __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
& ~ (__o1->alignment_mask)); \
if (__o1->next_free - (char *)__o1->chunk \
> __o1->chunk_limit - (char *)__o1->chunk) \
__o1->next_free = __o1->chunk_limit; \
__o1->object_base = __o1->next_free; \
value; })
#define obstack_free(OBSTACK, OBJ) \
@@ -470,61 +494,63 @@ __extension__ \
#else /* not __GNUC__ or not __STDC__ */
#define obstack_object_size(h) \
(unsigned) ((h)->alloc_failed ? 0 : (h)->next_free - (h)->object_base)
(unsigned) ((h)->next_free - (h)->object_base)
#define obstack_room(h) \
(unsigned) ((h)->chunk_limit - (h)->next_free)
#define obstack_empty_p(h) \
((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
in the arms of the conditional expression.
Casting the third operand to void was tried before,
but some compilers won't accept it. */
#define obstack_make_room(h,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
#define obstack_grow(h,where,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
((h)->alloc_failed ? 0 : \
(bcopy ((char *) (where), (h)->next_free, (h)->temp), \
(h)->next_free += (h)->temp)))
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \
(h)->next_free += (h)->temp)
#define obstack_grow0(h,where,length) \
( (h)->temp = (length), \
(((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
((h)->alloc_failed ? 0 : \
(bcopy ((char *) (where), (h)->next_free, (h)->temp), \
_obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \
(h)->next_free += (h)->temp, \
*((h)->next_free)++ = 0)))
*((h)->next_free)++ = 0)
#define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), 1), 0) : 0), \
((h)->alloc_failed ? 0 : \
(*((h)->next_free)++ = (datum))))
(*((h)->next_free)++ = (datum)))
#define obstack_ptr_grow(h,datum) \
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
((h)->alloc_failed ? 0 : \
(*((char **)(((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *)datum))))
(*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum)))
#define obstack_int_grow(h,datum) \
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
((h)->alloc_failed ? 0 : \
(*((int *)(((h)->next_free+=sizeof(int))-sizeof(int))) = ((int)datum))))
(*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum)))
#define obstack_ptr_grow_fast(h,aptr) (*((char **)(h)->next_free)++ = (char *)aptr)
#define obstack_int_grow_fast(h,aint) (*((int *)(h)->next_free)++ = (int)aint)
#define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr)
#define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
#define obstack_blank(h,length) \
( (h)->temp = (length), \
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
((h)->alloc_failed ? 0 : \
((h)->next_free += (h)->temp)))
((h)->next_free += (h)->temp))
#define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
@@ -536,30 +562,29 @@ __extension__ \
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
#define obstack_finish(h) \
( (h)->alloc_failed ? 0 : \
(((h)->next_free == (h)->object_base \
( ((h)->next_free == (h)->object_base \
? (((h)->maybe_empty_object = 1), 0) \
: 0), \
(h)->temp = __PTR_TO_INT ((h)->object_base), \
(h)->next_free \
= __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
& ~ ((h)->alignment_mask)), \
(((h)->next_free - (char *)(h)->chunk \
> (h)->chunk_limit - (char *)(h)->chunk) \
(((h)->next_free - (char *) (h)->chunk \
> (h)->chunk_limit - (char *) (h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp)))
__INT_TO_PTR ((h)->temp))
#if defined (__STDC__) && __STDC__
#define obstack_free(h,obj) \
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
#else
#define obstack_free(h,obj) \
( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
@@ -568,4 +593,8 @@ __extension__ \
#endif /* not __GNUC__ or not __STDC__ */
#endif /* not __OBSTACK_H__ */
#ifdef __cplusplus
} /* C++ */
#endif
#endif /* obstack.h */

View File

@@ -1,5 +1,5 @@
/* path-concat.c -- concatenate two arbitrary pathnames
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,12 +17,21 @@
/* Written by Jim Meyering. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef HAVE_MEMPCPY
# define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
#endif
#include <stdio.h>
#if HAVE_STRING_H
# include <string.h>
#endif
#include <sys/types.h>
char *malloc ();
char *stpcpy ();
/* Concatenate two pathname components, DIR and BASE, in newly-allocated
storage and return the result. Return 0 if out of memory. Add a slash
@@ -40,22 +49,24 @@ path_concat (dir, base, base_in_result)
{
char *p;
char *p_concat;
size_t base_len = strlen (base);
size_t dir_len = strlen (dir);
p_concat = malloc (strlen (dir) + strlen (base) + 2);
p_concat = malloc (dir_len + base_len + 2);
if (!p_concat)
return 0;
p = stpcpy (p_concat, dir);
p = mempcpy (p_concat, dir, dir_len);
if (*(p - 1) == '/' && *base == '/')
--p;
else if (*(p - 1) != '/' && *base != '/')
p = stpcpy (p, "/");
*p++ = '/';
if (base_in_result)
*base_in_result = p;
stpcpy (p, base);
memcpy (p, base, base_len + 1);
return p_concat;
}

View File

@@ -1,9 +1,15 @@
#if __STDC__
# undef __P
# define __P(args) args
#else
# define __P(args) ()
#endif
#if ! defined PATH_CONCAT_H_
# define PATH_CONCAT_H_
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
char *
path_concat __P ((const char *dir, const char *base, char **base_in_result));
path_concat PARAMS ((const char *dir, const char *base, char **base_in_result));
#endif

View File

@@ -1,32 +1,34 @@
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 1997, 1998 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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.
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 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.
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. */
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. */
#include <errno.h>
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Define-away any (possibly conflicting) prototype of putenv.
Many systems omit the `const' attribute on the argument. */
#define putenv _sys_putenv
/* Disable the definition of putenv to rpl_putenv (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_putenv on
systems like Irix 5.3. */
#undef putenv
#include <sys/types.h>
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
# include <stdlib.h>
@@ -38,8 +40,6 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# include <unistd.h>
#endif
#undef putenv
#if !defined (__GNU_LIBRARY__) && !defined (HAVE_STRCHR)
# define strchr index
#endif
@@ -53,10 +53,14 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern char **environ;
#endif
#ifndef NULL
# define NULL 0
#endif
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int
putenv (string)
rpl_putenv (string)
const char *string;
{
const char *const name_end = strchr (string, '=');

346
lib/quotearg.c Normal file
View File

@@ -0,0 +1,346 @@
/* quotearg.c - quote arguments for output
Copyright (C) 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert <eggert@twinsun.com> */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <quotearg.h>
#include <xalloc.h>
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define ISASCII(c) 1
#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
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
#ifndef UCHAR_MAX
# define UCHAR_MAX ((unsigned char) -1)
#endif
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#endif
#define INT_BITS (sizeof (int) * CHAR_BIT)
struct quoting_options
{
/* Basic quoting style. */
enum quoting_style style;
/* Quote the chararacters 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))];
};
/* Names of quoting styles. */
char const *const quoting_style_args[] =
{
"literal", "shell", "shell-always", "c", "escape", 0
};
/* Allocate a new set of quoting options, with contents initially identical
to O if O is not null, or to a default value if O is null.
It is the caller's responsibility to free the result. */
struct quoting_options *
clone_quoting_options (struct quoting_options *o)
{
struct quoting_options *p
= (struct quoting_options *) xmalloc (sizeof (struct quoting_options));
if (o)
*p = *o;
else
memset (p, 0, sizeof *p);
return p;
}
/* Get the value of O's quoting style. */
enum quoting_style
get_quoting_style (struct quoting_options *o)
{
return o->style;
}
/* In O, set the value of the quoting style to S. */
void
set_quoting_style (struct quoting_options *o, enum quoting_style s)
{
o->style = s;
}
/* In O, set the value of the quoting options for character C to I.
Return the old value. Currently, the only values defined for I are
0 (the default) and 1 (which means to quote the character even if
it would not otherwise be quoted). */
int
set_char_quoting (struct quoting_options *o, char c, int i)
{
unsigned char uc = c;
int *p = o->quote_these_too + uc / INT_BITS;
int shift = uc % INT_BITS;
int r = (*p >> shift) & 1;
*p ^= ((i & 1) ^ r) << shift;
return r;
}
/* Place into buffer BUF (of size BUFSIZE) a quoted version of
argument ARG (of size ARGSIZE), using 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 BUFSIZE is too small to store the output string, return the
value that would have been returned had BUFSIZE been large enough.
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
size_t
quotearg_buffer (char *buf, size_t bufsize,
char const *arg, size_t argsize,
struct quoting_options const *o)
{
unsigned char c;
size_t i;
size_t len;
int quote_mark;
enum quoting_style quoting_style = o->style;
#define STORE(c) do { if (len < bufsize) buf[len] = (c); len++; } while (0)
switch (quoting_style)
{
case shell_quoting_style:
if (! (argsize == -1 ? arg[0] == '\0' : argsize == 0))
{
switch (arg[0])
{
case '#': case '~':
break;
default:
len = 0;
for (i = 0; ; i++)
{
if (argsize == -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 (o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
goto needs_quoting;
STORE (c);
}
needs_quoting:;
break;
}
}
/* Fall through. */
case shell_always_quoting_style:
quote_mark = '\'';
break;
case c_quoting_style:
quote_mark = '"';
break;
default:
quote_mark = 0;
break;
}
len = 0;
if (quote_mark)
STORE (quote_mark);
for (i = 0; ! (argsize == -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:
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 ' ':
if (quoting_style == escape_quoting_style)
goto store_escape;
break;
case '"':
if (quoting_style == c_quoting_style)
goto store_escape;
break;
default:
if (!ISGRAPH (c))
{
STORE ('\\');
STORE ('0' + (c >> 6));
STORE ('0' + ((c >> 3) & 3));
c = '0' + (c & 3);
goto store_c;
}
break;
}
if (! (o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
goto store_c;
store_escape:
STORE ('\\');
}
store_c:
STORE (c);
}
if (quote_mark)
STORE (quote_mark);
done:
if (len < bufsize)
buf[len] = '\0';
return len;
}
/* Use storage slot N to return a quoted version of the string ARG.
OPTIONS specifies the quoting options.
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
N must be nonnegative. */
static char *
quotearg_n_options (int n, char const *arg, struct quoting_options *options)
{
static unsigned nslots;
static struct slotvec
{
size_t size;
char *val;
} *slotvec;
if (nslots <= n)
{
int n1 = n + 1;
size_t s = n1 * sizeof (struct slotvec);
if (! (0 < n1 && n1 == s / sizeof (struct slotvec)))
abort ();
slotvec = (struct slotvec *) xrealloc (slotvec, s);
memset (slotvec + nslots, 0, (n1 - nslots) * sizeof (struct slotvec));
nslots = n;
}
{
size_t size = slotvec[n].size;
char *val = slotvec[n].val;
size_t qsize = quotearg_buffer (val, size, arg, (size_t) -1, options);
if (size <= qsize)
{
slotvec[n].size = size = qsize + 1;
slotvec[n].val = val = xrealloc (val, size);
quotearg_buffer (val, size, arg, (size_t) -1, options);
}
return val;
}
}
struct quoting_options quotearg_quoting_options;
char *
quotearg_n (int n, char const *arg)
{
return quotearg_n_options (n, arg, &quotearg_quoting_options);
}
char *
quotearg (char const *arg)
{
return quotearg_n (0, arg);
}
char *
quotearg_char (char const *arg, char ch)
{
struct quoting_options options;
options = quotearg_quoting_options;
set_char_quoting (&options, ch, 1);
return quotearg_n_options (0, arg, &options);
}
char *
quotearg_colon (char const *arg)
{
return quotearg_char (arg, ':');
}

97
lib/quotearg.h Normal file
View File

@@ -0,0 +1,97 @@
/* quotearg.h - quote arguments for output
Copyright (C) 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert <eggert@twinsun.com> */
/* Basic quoting styles. */
enum quoting_style
{
literal_quoting_style, /* --quoting-style=literal */
shell_quoting_style, /* --quoting-style=shell */
shell_always_quoting_style, /* --quoting-style=shell-always */
c_quoting_style, /* --quoting-style=c */
escape_quoting_style /* --quoting-style=escape */
};
/* For now, --quoting-style=literal is the default, but
this is planned to change to --quoting-style=shell in the future. */
#ifndef DEFAULT_QUOTING_STYLE
# define DEFAULT_QUOTING_STYLE literal_quoting_style
#endif
/* Names of quoting styles. */
extern char const *const quoting_style_args[];
struct quoting_options;
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
/* Allocate a new set of quoting options, with contents initially identical
to O if O is not null, or to a default value if O is null.
It is the caller's responsibility to free the result. */
struct quoting_options *clone_quoting_options
PARAMS ((struct quoting_options *o));
/* Get the value of O's quoting style. */
enum quoting_style get_quoting_style PARAMS ((struct quoting_options *o));
/* In O, set the value of the quoting style to S. */
void set_quoting_style PARAMS ((struct quoting_options *o,
enum quoting_style s));
/* In O, set the value of the quoting options for character C to I.
Return the old value. Currently, the only values defined for I are
0 (the default) and 1 (which means to quote the character even if
it would not otherwise be quoted). */
int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
/* Place into buffer BUF (of size BUFSIZE) a quoted version of
argument ARG (of size ARGSIZE), using 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 BUFSIZE is too small to store the output string, return the
value that would have been returned had BUFSIZE been large enough.
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
size_t quotearg_buffer PARAMS ((char *buf, size_t bufsize,
char const *arg, size_t argsize,
struct quoting_options const *o));
/* The quoting options used by the convenience functions listed below. */
extern struct quoting_options quotearg_quoting_options;
/* Use storage slot N to return a quoted version of the string ARG.
The variable quotearg_quoting_options specifies the quoting options.
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
N must be nonnegative. */
char *quotearg_n PARAMS ((int n, char const *arg));
/* Equivalent to quotearg_n (ARG, 0). */
char *quotearg PARAMS ((char const *arg));
/* Like quotearg (ARG), except also quote any instances of CH. */
char *quotearg_char PARAMS ((char const *arg, char ch));
/* Equivalent to quotearg_char (ARG, ':'). */
char *quotearg_colon PARAMS ((char const *arg));

93
lib/readutmp.c Normal file
View File

@@ -0,0 +1,93 @@
/* GNU's read utmp module.
Copyright (C) 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by jla; revised by djm */
#include <config.h>
#include <sys/stat.h>
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
# include <string.h>
#else
# include <strings.h>
#endif /* STDC_HEADERS || HAVE_STRING_H */
#include "readutmp.h"
char *xmalloc ();
/* Copy UT->ut_name into storage obtained from malloc. Then remove any
trailing spaces from the copy, NUL terminate it, and return the copy. */
char *
extract_trimmed_name (ut)
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));
/* 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)] = ' ';
p = strchr (trimmed_name, ' ');
if (p != NULL)
*p = '\0';
return trimmed_name;
}
/* Read the utmp file FILENAME into *UTMP_BUF, set *N_ENTRIES to the
number of entries read, and return zero. If there is any error,
return non-zero and don't modify the parameters. */
int
read_utmp (filename, n_entries, utmp_buf)
const char *filename;
int *n_entries;
STRUCT_UTMP **utmp_buf;
{
FILE *utmp;
struct stat file_stats;
size_t n_read;
size_t size;
STRUCT_UTMP *buf;
utmp = fopen (filename, "r");
if (utmp == NULL)
return 1;
fstat (fileno (utmp), &file_stats);
size = file_stats.st_size;
if (size > 0)
buf = (STRUCT_UTMP *) xmalloc (size);
else
{
fclose (utmp);
return 1;
}
/* Use < instead of != in case the utmp just grew. */
n_read = fread (buf, 1, size, utmp);
if (ferror (utmp) || fclose (utmp) == EOF
|| n_read < size)
return 1;
*n_entries = size / sizeof (STRUCT_UTMP);
*utmp_buf = buf;
return 0;
}

85
lib/readutmp.h Normal file
View File

@@ -0,0 +1,85 @@
/* Declarations for GNU's read utmp module.
Copyright (C) 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by jla; revised by djm */
#ifndef __READUTMP_H__
# define __READUTMP_H__
# include <stdio.h>
# include <sys/types.h>
# ifdef HAVE_UTMPX_H
# include <utmpx.h>
# define UTMP_STRUCT_NAME utmpx
# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_tv.tv_sec)
# else
# include <utmp.h>
# define UTMP_STRUCT_NAME utmp
# define UT_TIME_MEMBER(UT_PTR) ((UT_PTR)->ut_time)
# endif
typedef struct UTMP_STRUCT_NAME STRUCT_UTMP;
# include <time.h>
# ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
# include <errno.h>
# ifndef errno
extern int errno;
# endif
# if !defined (UTMP_FILE) && defined (_PATH_UTMP)
# define UTMP_FILE _PATH_UTMP
# endif
# if !defined (WTMP_FILE) && defined (_PATH_WTMP)
# define WTMP_FILE _PATH_WTMP
# endif
# ifdef UTMPX_FILE /* Solaris, SysVr4 */
# undef UTMP_FILE
# define UTMP_FILE UTMPX_FILE
# endif
# ifdef WTMPX_FILE /* Solaris, SysVr4 */
# undef WTMP_FILE
# define WTMP_FILE WTMPX_FILE
# endif
# ifndef UTMP_FILE
# define UTMP_FILE "/etc/utmp"
# endif
# ifndef WTMP_FILE
# define WTMP_FILE "/etc/wtmp"
# endif
# undef PARAMS
# if defined (__STDC__) && __STDC__
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
extern char *extract_trimmed_name PARAMS ((const STRUCT_UTMP *ut));
extern int read_utmp PARAMS ((const char *filename,
int *n_entries, STRUCT_UTMP **utmp_buf));
#endif /* __READUTMP_H__ */

44
lib/realloc.c Normal file
View File

@@ -0,0 +1,44 @@
/* Work around bug on some systems where realloc (NULL, 0) fails.
Copyright (C) 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef realloc
#include <sys/types.h>
char *malloc ();
char *realloc ();
/* Change the size of an allocated block of memory P to N bytes,
with error checking. If N is zero, change it to 1. If P is NULL,
use malloc. */
char *
rpl_realloc (p, n)
char *p;
size_t n;
{
if (n == 0)
n = 1;
if (p == 0)
return malloc (n);
return realloc (p, n);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +1,33 @@
/* Definitions for data structures and routines for the regular
expression library, version 0.12.
Copyright (C) 1985,89,90,91,92,93,95,96,97 Free Software Foundation, Inc.
Copyright (C) 1985, 89, 90, 91, 92, 93, 95 Free Software Foundation, Inc.
the C library, however. The master source lives in /gd/gnu/lib.
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.
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.
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.
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.
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. */
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.
#ifndef __REGEXP_LIBRARY_H__
#define __REGEXP_LIBRARY_H__
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 _REGEX_H
#define _REGEX_H 1
/* Allow the use in C++ code. */
#ifdef __cplusplus
extern "C" {
#endif
/* POSIX says that <sys/types.h> must be included (by the caller) before
<regex.h>. */
@@ -29,17 +38,23 @@
#include <stddef.h>
#endif
/* The following two types have to be signed and unsigned integer type
wide enough to hold a value of a pointer. For most ANSI compilers
ptrdiff_t and size_t should be likely OK. Still size of these two
types is 2 for Microsoft C. Ugh... */
typedef long int s_reg_t;
typedef unsigned long int active_reg_t;
/* The following bits are used to determine the regexp syntax we
recognize. The set/not-set meanings are chosen so that Emacs syntax
remains the value 0. The bits are given in alphabetical order, and
the definitions shifted by one from the previous bit; thus, when we
add or remove a bit, only one other definition need change. */
typedef unsigned reg_syntax_t;
typedef unsigned long int reg_syntax_t;
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
/* If this bit is not set, then + and ? are operators, and \+ and \? are
literals.
@@ -134,6 +149,18 @@ typedef unsigned reg_syntax_t;
without further backtracking. */
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
/* If this bit is set, do not process the GNU regex operators.
If not set, then the GNU regex operators are recognized. */
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
/* If this bit is set, turn on internal regex debugging.
If not set, and debugging was on, turn it off.
This only works if regex.c is compiled -DDEBUG.
We define this bit always, so that all that's needed to turn on
debugging is to recompile regex.c; the calling code can always have
this bit set, and it won't affect anything in the normal case. */
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
@@ -147,13 +174,19 @@ extern reg_syntax_t re_syntax_options;
#define RE_SYNTAX_EMACS 0
#define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_UNMATCHED_RIGHT_PAREN_ORD)
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
#define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
| RE_INTERVALS | RE_NO_GNU_OPS)
#define RE_SYNTAX_GREP \
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
@@ -209,7 +242,8 @@ extern reg_syntax_t re_syntax_options;
#ifdef RE_DUP_MAX
#undef RE_DUP_MAX
#endif
#define RE_DUP_MAX ((1 << 15) - 1)
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
#define RE_DUP_MAX (0x7fff)
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
@@ -292,10 +326,10 @@ struct re_pattern_buffer
unsigned char *buffer;
/* Number of bytes to which `buffer' points. */
unsigned long allocated;
unsigned long int allocated;
/* Number of bytes actually used in `buffer'. */
unsigned long used;
unsigned long int used;
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax;
@@ -410,7 +444,7 @@ extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
and syntax given by the global `re_syntax_options', into the buffer
BUFFER. Return NULL if successful, and an error string if not. */
extern const char *re_compile_pattern
_RE_ARGS ((const char *pattern, int length,
_RE_ARGS ((const char *pattern, size_t length,
struct re_pattern_buffer *buffer));
@@ -469,10 +503,12 @@ extern void re_set_registers
unsigned num_regs, regoff_t *starts, regoff_t *ends));
#ifdef _REGEX_RE_COMP
#ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp _RE_ARGS ((const char *));
extern int re_exec _RE_ARGS ((const char *));
#endif
#endif
/* POSIX compatibility. */
extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
@@ -484,7 +520,12 @@ extern size_t regerror
size_t errbuf_size));
extern void regfree _RE_ARGS ((regex_t *preg));
#endif /* not __REGEXP_LIBRARY_H__ */
#ifdef __cplusplus
}
#endif /* C++ */
#endif /* regex.h */
/*
Local variables:

View File

@@ -1,22 +1,22 @@
/* rpmatch - determine whether string value is affirmation or negative
response according to current locale's data
Copyright (C) 1996 Free Software Foundation, Inc.
/* Determine whether string value is affirmation or negative response
according to current locale's data.
Copyright (C) 1996 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 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.
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. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include <config.h>
#endif
@@ -30,7 +30,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#include <sys/types.h>
#ifdef WITH_REGEX
#if WITH_REGEX
# include <regex.h>
#else
# include <rx.h>

View File

@@ -14,8 +14,8 @@ for more details.
You should have received a copy of the GNU Library General Public
License along with this software; see the file COPYING.LIB. If not,
write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA
02139, USA. */
write to the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* NOTE!!! AIX is so losing it requires this to be the first thing in the
* file.

View File

@@ -17,8 +17,8 @@ for more details.
You should have received a copy of the GNU Library General Public
License along with this software; see the file COPYING.LIB. If not,
write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA
02139, USA. */
write to the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* t. lord Wed Sep 23 18:20:57 1992 */

View File

@@ -1,5 +1,5 @@
/* save-cwd.c -- Save and restore current working directory.
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
/* Written by Jim Meyering <meyering@na-net.ornl.gov>. */
#ifdef HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include "config.h"
#endif
@@ -27,25 +27,25 @@
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#if HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/file.h>
#endif
#include <errno.h>
# ifndef errno
#ifndef errno
extern int errno;
#endif
#include "save-cwd.h"
#include "error.h"
char *xgetcwd __P((void));
char *xgetcwd PARAMS ((void));
/* Record the location of the current working directory in CWD so that
the program may change to other directories and later use restore_cwd
@@ -67,7 +67,7 @@ save_cwd (cwd)
if (have_working_fchdir)
{
#ifdef HAVE_FCHDIR
#if HAVE_FCHDIR
cwd->desc = open (".", O_RDONLY);
if (cwd->desc < 0)
{
@@ -96,7 +96,7 @@ save_cwd (cwd)
}
# endif /* __sun__ || sun */
#else
#define fchdir(x) (abort (), 0)
# define fchdir(x) (abort (), 0)
have_working_fchdir = 0;
#endif
}
@@ -152,4 +152,3 @@ free_cwd (cwd)
if (cwd->name)
free (cwd->name);
}

View File

@@ -1,5 +1,5 @@
#ifndef SAVE_CWD_H
#define SAVE_CWD_H 1
# define SAVE_CWD_H 1
struct saved_cwd
{
@@ -7,17 +7,17 @@ struct saved_cwd
char *name;
};
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int save_cwd __P((struct saved_cwd *cwd));
int restore_cwd __P((const struct saved_cwd *cwd, const char *dest,
const char *from));
void free_cwd __P((struct saved_cwd *cwd));
int save_cwd PARAMS ((struct saved_cwd *cwd));
int restore_cwd PARAMS ((const struct saved_cwd *cwd, const char *dest,
const char *from));
void free_cwd PARAMS ((struct saved_cwd *cwd));
#endif /* SAVE_CWD_H */

View File

@@ -1,5 +1,5 @@
/* savedir.c -- save the list of files in a directory in a string
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,14 +17,14 @@
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_DIRENT_H
@@ -46,23 +46,27 @@
#ifdef CLOSEDIR_VOID
/* Fake a return value. */
#define CLOSEDIR(d) (closedir (d), 0)
# define CLOSEDIR(d) (closedir (d), 0)
#else
#define CLOSEDIR(d) closedir (d)
# define CLOSEDIR(d) closedir (d)
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#include <string.h>
# include <stdlib.h>
# include <string.h>
#else
char *malloc ();
char *realloc ();
#endif
#ifndef NULL
#define NULL 0
# define NULL 0
#endif
#ifndef stpcpy
char *stpcpy ();
#endif
#include "savedir.h"
/* Return a freshly allocated string containing the filenames
in directory DIR, separated by '\0' characters;
@@ -73,8 +77,8 @@ char *stpcpy ();
char *
savedir (dir, name_size)
char *dir;
unsigned name_size;
const char *dir;
unsigned int name_size;
{
DIR *dirp;
struct dirent *dp;

15
lib/savedir.h Normal file
View File

@@ -0,0 +1,15 @@
#if !defined SAVEDIR_H_
# define SAVEDIR_H_
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
char *
savedir PARAMS ((const char *dir, unsigned int name_size));
#endif

56
lib/stat.c Normal file
View File

@@ -0,0 +1,56 @@
/* Work around the bug in some systems whereby stat succeeds when
given the zero-length file name argument. The stat from SunOS4.1.4
has this bug.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#include <config.h>
/* Disable the definition of stat to rpl_stat (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_stat on
most systems. */
#undef stat
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
/* This is a wrapper for stat(2).
If FILE is the empty string, fail with errno == ENOENT.
Otherwise, return the result of calling the real stat.
This works around the bug in some systems whereby stat succeeds when
given the zero-length file name argument. The stat from SunOS4.1.4
has this bug. */
int
rpl_stat (file, sbuf)
const char *file;
struct stat *sbuf;
{
if (file && *file == 0)
{
errno = ENOENT;
return -1;
}
return stat (file, sbuf);
}

View File

@@ -1,32 +1,51 @@
/* stpcpy.c -- copy a string and return pointer to end of new string
Copyright (C) 1989, 1990 Free Software Foundation.
/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
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.
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.
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.
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. */
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.
#if HAVE_CONFIG_H
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
#include <string.h>
#undef __stpcpy
#undef stpcpy
#ifndef weak_alias
# define __stpcpy stpcpy
#endif
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
char *
stpcpy (dest, src)
__stpcpy (dest, src)
char *dest;
const char *src;
{
while ((*dest++ = *src++) != '\0')
/* Do nothing. */ ;
return dest - 1;
register char *d = dest;
register const char *s = src;
do
*d++ = *s;
while (*s++ != '\0');
return d - 1;
}
#ifdef weak_alias
weak_alias (__stpcpy, stpcpy)
#endif

View File

@@ -1,9 +1,12 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 1996, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
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.
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
@@ -11,14 +14,15 @@
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. */
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
#ifdef HAVE_STRING_H
#if defined _LIBC || HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
@@ -27,14 +31,16 @@
# endif
#endif
/* Return the length of the maximum inital segment of S
#undef strcspn
/* Return the length of the maximum initial segment of S
which contains no characters from REJECT. */
int
strcspn (s, reject)
register char *s;
register char *reject;
const char *s;
const char *reject;
{
register int count = 0;
int count = 0;
while (*s != '\0')
if (strchr (reject, *s++) == 0)

View File

@@ -1,5 +1,5 @@
/* strdup.c -- return a newly allocated copy of a string
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,13 +15,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
#include <config.h>
#if HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef STDC_HEADERS
#include <string.h>
#include <stdlib.h>
# include <string.h>
# include <stdlib.h>
#else
char *malloc ();
char *strcpy ();

View File

@@ -1,7 +1,7 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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.
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.
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
@@ -14,13 +14,19 @@
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. */
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* Some systems need this in order to declare localtime_r properly. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_MBLEN 1
@@ -32,10 +38,13 @@
# define HAVE_TZSET 1
# define MULTIBYTE_IS_FORMAT_SAFE 1
# define STDC_HEADERS 1
# include <ansidecl.h>
# include "../locale/localeinfo.h"
#endif
#if defined emacs && !defined HAVE_BCOPY
# define HAVE_MEMCPY 1
#endif
#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
@@ -82,7 +91,17 @@ extern char *tzname[];
# include <stdlib.h>
# include <string.h>
#else
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# endif
#endif
#ifdef _LIBC
# define MEMPCPY(d, s, n) __mempcpy (d, s, n)
#else
# ifndef HAVE_MEMPCPY
# define MEMPCPY(d, s, n) ((void *) ((char *) memcpy (d, s, n) + (n)))
# endif
#endif
#ifndef __P
@@ -132,14 +151,14 @@ extern char *tzname[];
#ifdef _LIBC
# define gmtime_r __gmtime_r
# define localtime_r __localtime_r
extern int __tz_compute __P ((time_t timer, const struct tm *tm));
# define tzname __tzname
# define tzset __tzset
#else
# if ! HAVE_LOCALTIME_R
# if ! HAVE_TM_GMTOFF
/* Approximate gmtime_r as best we can in its absence. */
# define gmtime_r my_gmtime_r
# undef gmtime_r
# define gmtime_r my_gmtime_r
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
static struct tm *
gmtime_r (t, tp)
@@ -155,7 +174,8 @@ gmtime_r (t, tp)
# endif /* ! HAVE_TM_GMTOFF */
/* Approximate localtime_r as best we can in its absence. */
# define localtime_r my_localtime_r
# undef localtime_r
# define localtime_r my_ftime_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
@@ -169,32 +189,50 @@ localtime_r (t, tp)
return tp;
}
# endif /* ! HAVE_LOCALTIME_R */
#endif /* ! defined (_LIBC) */
#endif /* ! defined _LIBC */
#if !defined (memset) && !defined (HAVE_MEMSET) && !defined (_LIBC)
#if !defined memset && !defined HAVE_MEMSET && !defined _LIBC
/* Some systems lack the `memset' function and we don't want to
introduce additional dependencies. */
static const char spaces[16] = " ";
/* The SGI compiler reportedly barfs on the trailing null
if we use a string constant as the initializer. 28 June 1997, rms. */
static const char spaces[16] = /* " " */
{ ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
static const char zeroes[16] = /* "0000000000000000" */
{ '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0' };
# define memset_space(P, Len) \
do { \
int _len = (Len); \
\
\
do \
{ \
int _this = _len > 16 ? 16 : _len; \
memcpy ((P), spaces, _this); \
(P) += _this; \
(P) = MEMPCPY ((P), spaces, _this); \
_len -= _this; \
} \
while (_len > 0); \
} while (0)
# define memset_zero(P, Len) \
do { \
int _len = (Len); \
\
do \
{ \
int _this = _len > 16 ? 16 : _len; \
(P) = MEMPCPY ((P), zeroes, _this); \
_len -= _this; \
} \
while (_len > 0); \
} while (0)
#else
# define memset_space(P, Len) memset ((P), ' ', (Len))
# define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len))
# define memset_zero(P, Len) (memset ((P), '0', (Len)), (P) += (Len))
#endif
#define add(n, f) \
#define add(n, f) \
do \
{ \
int _n = (n); \
@@ -205,14 +243,19 @@ static const char spaces[16] = " ";
if (p) \
{ \
if (_delta > 0) \
memset_space (p, _delta); \
{ \
if (pad == '0') \
memset_zero (p, _delta); \
else \
memset_space (p, _delta); \
} \
f; \
p += _n; \
} \
i += _incr; \
} while (0)
#define cpy(n, s) \
#define cpy(n, s) \
add ((n), \
if (to_lowcase) \
memcpy_lowcase (p, (s), _n); \
@@ -245,7 +288,7 @@ memcpy_lowcase (dest, src, len)
size_t len;
{
while (len-- > 0)
dest[len] = TOLOWER (src[len]);
dest[len] = TOLOWER ((unsigned char) src[len]);
return dest;
}
@@ -258,13 +301,15 @@ memcpy_uppcase (dest, src, len)
size_t len;
{
while (len-- > 0)
dest[len] = TOUPPER (src[len]);
dest[len] = TOUPPER ((unsigned char) src[len]);
return dest;
}
#if ! HAVE_TM_GMTOFF
/* Yield the difference between *A and *B,
measured in seconds, ignoring leap seconds. */
# define tm_diff ftime_tm_diff
static int tm_diff __P ((const struct tm *, const struct tm *));
static int
tm_diff (a, b)
@@ -301,7 +346,7 @@ tm_diff (a, b)
#define YDAY_MINIMUM (-366)
static int iso_week_days __P ((int, int));
#ifdef __GNUC__
inline
__inline__
#endif
static int
iso_week_days (yday, wday)
@@ -316,7 +361,7 @@ iso_week_days (yday, wday)
}
#ifndef _NL_CURRENT
#if !(defined _NL_CURRENT || HAVE_STRFTIME)
static char const weekday_name[][10] =
{
"Sunday", "Monday", "Tuesday", "Wednesday",
@@ -330,13 +375,27 @@ static char const month_name[][10] =
#endif
#ifdef emacs
# define my_strftime emacs_strftime
/* Emacs 20.2 uses `-Dstrftime=emacs_strftime' when compiling,
because that's how strftime used to be configured.
Undo this, since it gets in the way of accessing the underlying strftime,
which is needed for things like %Ec in Solaris.
The following two lines can be removed once Emacs stops compiling with
`-Dstrftime=emacs_strftime'. */
# undef strftime
size_t strftime __P ((char *, size_t, const char *, const struct tm *));
#else
# define my_strftime strftime
#endif
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
Work around this bug by copying *tp before it might be munged. */
size_t _strftime_copytm __P ((char *, size_t, const char *,
const struct tm *));
size_t
strftime (s, maxsize, format, tp)
my_strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
@@ -346,14 +405,12 @@ static char const month_name[][10] =
tmcopy = *tp;
return _strftime_copytm (s, maxsize, format, &tmcopy);
}
# ifdef strftime
# undef strftime
# endif
# define strftime _strftime_copytm
# undef my_strftime
# define my_strftime(S, Maxsize, Format, Tp) \
_strftime_copytm (S, Maxsize, Format, Tp)
#endif
/* Write information from TP into S according to the format
string FORMAT, writing no more that MAXSIZE characters
(including the terminating '\0') and returning number of
@@ -361,7 +418,7 @@ static char const month_name[][10] =
anywhere, so to determine how many characters would be
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
size_t
strftime (s, maxsize, format, tp)
my_strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
@@ -379,6 +436,7 @@ strftime (s, maxsize, format, tp)
size_t am_len = strlen (a_month);
size_t ap_len = strlen (ampm);
#else
# if !HAVE_STRFTIME
const char *const f_wkday = weekday_name[tp->tm_wday];
const char *const f_month = month_name[tp->tm_mon];
const char *const a_wkday = f_wkday;
@@ -387,9 +445,12 @@ strftime (s, maxsize, format, tp)
size_t aw_len = 3;
size_t am_len = 3;
size_t ap_len = 2;
# endif
#endif
#if defined _NL_CURRENT || !HAVE_STRFTIME
size_t wkday_len = strlen (f_wkday);
size_t month_len = strlen (f_month);
#endif
const char *zone;
size_t zonelen;
size_t i = 0;
@@ -397,15 +458,13 @@ strftime (s, maxsize, format, tp)
const char *f;
zone = NULL;
#if !defined _LIBC && HAVE_TM_ZONE
/* XXX We have some problems here. First, the string pointed to by
tm_zone is dynamically allocated while loading the zone data. But
when another zone is loaded since the information in TP were
computed this would be a stale pointer.
The second problem is the POSIX test suite which assumes setting
#if HAVE_TM_ZONE
/* The POSIX test suite assumes that setting
the environment variable TZ to a new value before calling strftime()
will influence the result (the %Z format) even if the information in
TP is computed with a totally different time zone. --drepper@gnu */
TP is computed with a totally different time zone.
This is bogus: though POSIX allows bad behavior like this,
POSIX does not require it. Do the right thing instead. */
zone = (const char *) tp->tm_zone;
#endif
#if HAVE_TZNAME
@@ -444,6 +503,8 @@ strftime (s, maxsize, format, tp)
int width = -1;
int to_lowcase = 0;
int to_uppcase = 0;
int change_case = 0;
int format_char;
#if DO_MULTIBYTE
@@ -535,6 +596,9 @@ strftime (s, maxsize, format, tp)
case '^':
to_uppcase = 1;
continue;
case '#':
change_case = 1;
continue;
default:
break;
@@ -569,12 +633,15 @@ strftime (s, maxsize, format, tp)
}
/* Now do the specified format. */
switch (*f)
format_char = *f;
switch (format_char)
{
#define DO_NUMBER(d, v) \
digits = d; number_value = v; goto do_number
digits = width == -1 ? d : width; \
number_value = v; goto do_number
#define DO_NUMBER_SPACEPAD(d, v) \
digits = d; number_value = v; goto do_number_spacepad
digits = width == -1 ? d : width; \
number_value = v; goto do_number_spacepad
case '%':
if (modifier != 0)
@@ -585,27 +652,58 @@ strftime (s, maxsize, format, tp)
case 'a':
if (modifier != 0)
goto bad_format;
if (change_case)
{
to_uppcase = 1;
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (aw_len, a_wkday);
break;
#else
goto underlying_strftime;
#endif
case 'A':
if (modifier != 0)
goto bad_format;
if (change_case)
{
to_uppcase = 1;
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (wkday_len, f_wkday);
break;
#else
goto underlying_strftime;
#endif
case 'b':
case 'h': /* POSIX.2 extension. */
if (modifier != 0)
goto bad_format;
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (am_len, a_month);
break;
#else
goto underlying_strftime;
#endif
case 'B':
if (modifier != 0)
goto bad_format;
if (change_case)
{
to_uppcase = 1;
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (month_len, f_month);
break;
#else
goto underlying_strftime;
#endif
case 'c':
if (modifier == 'O')
@@ -615,32 +713,58 @@ strftime (s, maxsize, format, tp)
&& *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT)) != '\0'))
subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# else
subfmt = "%a %b %e %H:%M:%S %Y";
# endif
#endif
subformat:
{
char *old_start = p;
size_t len = strftime (NULL, maxsize - i, subfmt, tp);
size_t len = my_strftime (NULL, maxsize - i, subfmt, tp);
if (len == 0 && *subfmt)
return 0;
add (len, strftime (p, maxsize - i, subfmt, tp));
add (len, my_strftime (p, maxsize - i, subfmt, tp));
if (to_uppcase)
while (old_start < p)
{
*old_start = TOUPPER (*old_start);
*old_start = TOUPPER ((unsigned char) *old_start);
++old_start;
}
}
break;
#if HAVE_STRFTIME && ! (defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)
underlying_strftime:
{
/* The relevant information is available only via the
underlying strftime implementation, so use that. */
char ufmt[4];
char *u = ufmt;
char ubuf[1024]; /* enough for any single format in practice */
size_t len;
*u++ = '%';
if (modifier != 0)
*u++ = modifier;
*u++ = format_char;
*u = '\0';
len = strftime (ubuf, sizeof ubuf, ufmt, tp);
if (len == 0)
return 0;
cpy (len, ubuf);
}
break;
#endif
case 'C': /* POSIX.2 extension. */
if (modifier == 'O')
goto bad_format;
#if HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
#if HAVE_STRUCT_ERA_ENTRY
struct era_entry *era = _nl_get_era_entry (tp);
if (era)
{
@@ -648,8 +772,13 @@ strftime (s, maxsize, format, tp)
cpy (len, era->name_fmt);
break;
}
}
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# endif
#endif
}
{
int year = tp->tm_year + TM_YEAR_BASE;
DO_NUMBER (1, year / 100 - (year % 100 < 0));
@@ -663,8 +792,13 @@ strftime (s, maxsize, format, tp)
&& *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_FMT)) != '\0'))
subfmt = _NL_CURRENT (LC_TIME, D_FMT);
goto subformat;
#endif
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# else
/* Fall through. */
# endif
#endif
case 'D': /* POSIX.2 extension. */
if (modifier != 0)
goto bad_format;
@@ -694,9 +828,9 @@ strftime (s, maxsize, format, tp)
do_number:
/* Format the number according to the MODIFIER flag. */
#ifdef _NL_CURRENT
if (modifier == 'O' && 0 <= number_value)
{
#ifdef _NL_CURRENT
/* Get the locale specific alternate representation of
the number NUMBER_VALUE. If none exist NULL is returned. */
const char *cp = _nl_get_alt_digit (number_value);
@@ -710,8 +844,12 @@ strftime (s, maxsize, format, tp)
break;
}
}
}
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# endif
#endif
}
{
unsigned int u = number_value;
@@ -752,6 +890,11 @@ strftime (s, maxsize, format, tp)
cpy (buf + sizeof (buf) - bufp, bufp);
break;
case 'F':
if (modifier != 0)
goto bad_format;
subfmt = "%Y-%m-%d";
goto subformat;
case 'H':
if (modifier == 'E')
@@ -801,11 +944,23 @@ strftime (s, maxsize, format, tp)
case 'P':
to_lowcase = 1;
#if !defined _NL_CURRENT && HAVE_STRFTIME
format_char = 'p';
#endif
/* FALLTHROUGH */
case 'p':
if (change_case)
{
to_uppcase = 0;
to_lowcase = 1;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (ap_len, ampm);
break;
#else
goto underlying_strftime;
#endif
case 'R': /* GNU extension. */
subfmt = "%H:%M";
@@ -871,8 +1026,13 @@ strftime (s, maxsize, format, tp)
&& *(subfmt = _NL_CURRENT (LC_TIME, ERA_T_FMT)) != '\0'))
subfmt = _NL_CURRENT (LC_TIME, T_FMT);
goto subformat;
#endif
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# else
/* Fall through. */
# endif
#endif
case 'T': /* POSIX.2 extension. */
subfmt = "%H:%M:%S";
goto subformat;
@@ -881,6 +1041,7 @@ strftime (s, maxsize, format, tp)
add (1, *p = '\t');
break;
case 'f':
case 'u': /* POSIX.2 extension. */
DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
@@ -944,26 +1105,30 @@ strftime (s, maxsize, format, tp)
DO_NUMBER (1, tp->tm_wday);
case 'Y':
#if HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
#if HAVE_STRUCT_ERA_ENTRY
struct era_entry *era = _nl_get_era_entry (tp);
if (era)
{
subfmt = strchr (era->name_fmt, '\0') + 1;
goto subformat;
}
}
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# endif
#endif
}
if (modifier == 'O')
goto bad_format;
else
DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
case 'y':
#if HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
#if HAVE_STRUCT_ERA_ENTRY
struct era_entry *era = _nl_get_era_entry (tp);
if (era)
{
@@ -971,11 +1136,20 @@ strftime (s, maxsize, format, tp)
DO_NUMBER (1, (era->offset
+ (era->direction == '-' ? -delta : delta)));
}
}
#else
# if HAVE_STRFTIME
goto underlying_strftime;
# endif
#endif
}
DO_NUMBER (2, (tp->tm_year % 100 + 100) % 100);
case 'Z':
if (change_case)
{
to_uppcase = 0;
to_lowcase = 1;
}
cpy (zonelen, zone);
break;

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1996 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997 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.
@@ -42,8 +42,6 @@ strndup (s, n)
if (new == NULL)
return NULL;
memcpy (new, s, n);
new[n] = '\0';
return new;
return (char *) memcpy (new, s, n);
}

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,17 @@ extern int errno;
#endif
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
#define TOLOWER(c) (IN_CTYPE_DOMAIN (c) ? tolower(c) : (c))
#include <math.h>
#if HAVE_FLOAT_H
@@ -71,7 +82,7 @@ strtod (nptr, endptr)
s = nptr;
/* Eat whitespace. */
while (isspace (*s))
while (ISSPACE (*s))
++s;
/* Get the sign. */
@@ -85,7 +96,7 @@ strtod (nptr, endptr)
exponent = 0;
for (;; ++s)
{
if (isdigit (*s))
if (ISDIGIT (*s))
{
got_digit = 1;
@@ -118,7 +129,7 @@ strtod (nptr, endptr)
if (!got_digit)
goto noconv;
if (tolower (*s) == 'e')
if (TOLOWER (*s) == 'e')
{
/* Get the exponent specified after the `e' or `E'. */
int save = errno;

View File

@@ -1,5 +1,5 @@
/* strtol - Convert string representation of a number into an integer value.
Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
Copyright (C) 1991, 92, 94, 95, 96, 97 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.
@@ -129,12 +129,17 @@ extern int errno;
# define ISALPHA(Ch) iswalpha (Ch)
# define TOUPPER(Ch) towupper (Ch)
#else
# if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
# else
# define IN_CTYPE_DOMAIN(c) isascii(c)
# endif
# define L_(Ch) Ch
# define UCHAR_TYPE unsigned char
# define STRING_TYPE char
# define ISSPACE(Ch) isspace (Ch)
# define ISALPHA(Ch) isalpha (Ch)
# define TOUPPER(Ch) toupper (Ch)
# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch))
# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch))
# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch))
#endif
#ifdef __STDC__
@@ -201,7 +206,10 @@ INTERNAL (strtol) (nptr, endptr, base, group)
#endif
if (base < 0 || base == 1 || base > 36)
base = 10;
{
__set_errno (EINVAL);
return 0;
}
save = s = nptr;
@@ -309,6 +317,8 @@ INTERNAL (strtol) (nptr, endptr, base, group)
? -((unsigned LONG int) (LONG_MIN + 1)) + 1
: (unsigned LONG int) LONG_MAX))
overflow = 1;
#else
overflow |= negative;
#endif
if (overflow)

115
lib/strverscmp.c Normal file
View File

@@ -0,0 +1,115 @@
/* Compare strings while treating digits characters numerically.
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-Francois Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#include <ctype.h>
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
Fractional parts, S_Z: idem but with leading Zeroes only */
#define S_N 0x0
#define S_I 0x4
#define S_F 0x8
#define S_Z 0xC
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
#define CMP 2
#define LEN 3
/* Compare S1 and S2 as strings holding indices/version numbers,
returning less than, equal to or greater than zero if S1 is less than,
equal to or greater than S2 (for more info, see the texinfo doc).
*/
int
strverscmp (s1, s2)
const char *s1;
const char *s2;
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
int state;
int diff;
/* Symbol(s) 0 [1-9] others (padding)
Transition (10) 0 (01) d (00) x (11) - */
static const unsigned int next_state[] =
{
/* state x d 0 - */
/* S_N */ S_N, S_I, S_Z, S_N,
/* S_I */ S_N, S_I, S_I, S_I,
/* S_F */ S_N, S_F, S_F, S_F,
/* S_Z */ S_N, S_F, S_Z, S_Z
};
static const int result_type[] =
{
/* state x/x x/d x/0 x/- d/x d/d d/0 d/-
0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
/* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
/* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
-1, CMP, CMP, CMP
};
if (p1 == p2)
return 0;
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
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 = result_type[state << 2 | ((c2 == '0') + (isdigit (c2) != 0))];
switch (state)
{
case CMP:
return diff;
case LEN:
while (isdigit (*p1++))
if (!isdigit (*p2++))
return 1;
return isdigit (*p2) ? -1 : diff;
default:
return state;
}
}

20
lib/strverscmp.h Normal file
View File

@@ -0,0 +1,20 @@
/* strverscmp.h -- compare strings holding indices/version numbers */
#ifndef STRVERSCMP_H_
# define STRVERSCMP_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
int strverscmp PARAMS ((const char*, const char*));
#endif /* not STRVERSCMP_H_ */

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