Compare commits

...

280 Commits

Author SHA1 Message Date
Jim Meyering
4bd1ffa49a . 1996-07-03 04:05:07 +00:00
Jim Meyering
38762b8f78 (usage): Add omitted \n\ at the end of a line in the usage message. 1996-07-03 04:04:06 +00:00
Jim Meyering
7b2cea5ab2 [!EXIT_SUCCESS]: Define it.
[!EXIT_FAILURE]: Define it.
1996-07-03 04:00:36 +00:00
Jim Meyering
b0d3bfa316 . 1996-07-03 04:00:29 +00:00
Jim Meyering
1672bf6d27 (strndup): Include stdio.h and sys/types.h to
get definition of NULL and size_t on SunOS4.1.3.
1996-07-03 03:59:02 +00:00
Jim Meyering
8736952b0b . 1996-07-03 02:52:20 +00:00
Jim Meyering
bd1fc1c256 . 1996-07-02 04:55:06 +00:00
Jim Meyering
bb4d193ac7 [NEWLINE_REPLACEMENT_STRING]: Define.
(split_3): Translate NL bytes not to NUL, but to
NEWLINE_REPLACEMENT_STRING.
Suggested by Ulrich Drepper.
(main): Translate back to NL-containing filename.
1996-07-02 04:54:51 +00:00
Jim Meyering
7379bd7274 . 1996-07-02 04:48:57 +00:00
Jim Meyering
1372968ab0 (do_link): Update messages to ease translation.
Suggestion from Santiago Vila.
1996-07-02 04:48:32 +00:00
Jim Meyering
d2b4bca42e (main): Remove now-unnecessary diagnostic about filename containing NEWLINE. 1996-07-01 03:48:10 +00:00
Jim Meyering
6dceaa1d9d (split_3): Take an additional parameter, S_LEN.
Adapt caller.
Map translated NEWLINE-containing filename back into the original
NEWLINE-containing name.
(md5_check): Translate NEWLINE bytes to NUL bytes in filename.
1996-07-01 03:47:16 +00:00
Jim Meyering
b288652bbd . 1996-06-30 21:42:53 +00:00
Jim Meyering
2b37242292 (usage): Fix typo, 3nd->3rd, in usage message.
From Santiago Vila <sanvila@unex.es>.
1996-06-30 21:42:49 +00:00
Jim Meyering
afd2d8e4cf . 1996-06-30 14:30:00 +00:00
Jim Meyering
c18996947c . 1996-06-30 14:29:29 +00:00
Jim Meyering
23b80c8e30 . 1996-06-30 04:24:26 +00:00
Jim Meyering
3b92bd0090 . 1996-06-30 00:01:20 +00:00
Jim Meyering
14bc2891a8 . 1996-06-29 23:59:14 +00:00
Jim Meyering
1ebe204c2f . 1996-06-29 23:58:48 +00:00
Jim Meyering
27725d0745 . 1996-06-29 16:45:17 +00:00
Jim Meyering
8977920253 . 1996-06-29 05:33:00 +00:00
Jim Meyering
41b9ee8834 . 1996-06-29 05:29:08 +00:00
Jim Meyering
c4d50b0133 . 1996-06-29 05:28:48 +00:00
Jim Meyering
bb389bead8 Remove u from Colour. 1996-06-29 05:28:32 +00:00
Jim Meyering
326cc336af . 1996-06-29 04:12:05 +00:00
Jim Meyering
cd53ea93c5 (dc_parse_stream): Move enum states dcl into this function.
(dc_parse_stream): Remove parameter RESULT.
Adapt callers.
1996-06-29 04:11:43 +00:00
Jim Meyering
aec69ce220 . 1996-06-29 04:08:10 +00:00
Jim Meyering
b2d08f91db . 1996-06-29 04:07:18 +00:00
Jim Meyering
50cdbb37c8 . 1996-06-29 03:58:52 +00:00
Jim Meyering
e81d02baf1 (do_link): Allow `ln -sf --backup k k' to succeed in creating the
self-referential symlink, doing so doesn't remove the source but merely
renames it.
1996-06-29 03:58:48 +00:00
Jim Meyering
b73817cc6e . 1996-06-28 04:15:56 +00:00
Jim Meyering
0fefdeb526 . 1996-06-28 03:04:11 +00:00
Jim Meyering
8dfac9573a . 1996-06-27 04:27:10 +00:00
Jim Meyering
369361ae70 . 1996-06-27 02:37:51 +00:00
Jim Meyering
1afd3473fb (install-data): Add `else true;' to avoid
letting failing if-condition cause make to fail.
From Fred Fish (fnf@ninemoons.com).
1996-06-27 02:37:40 +00:00
Jim Meyering
117fb47f99 Elaborate on how sort -n works. 1996-06-27 02:34:30 +00:00
Jim Meyering
1bff89846b . 1996-06-26 12:39:19 +00:00
Jim Meyering
ba87d08c0e (do_link): Remove `!symlink &&' conjunct. 1996-06-26 12:31:13 +00:00
Jim Meyering
d9c0413f79 (same_name): Declare parameters to be const. 1996-06-26 12:05:35 +00:00
Jim Meyering
216777ea17 (same_name): New function.
(do_link): Use it to test reliably whether A and B (from
ln --force A B) are hard links to the same file.
From Andreas Schwab.
1996-06-26 12:02:02 +00:00
Jim Meyering
325411e109 . 1996-06-26 02:57:01 +00:00
Jim Meyering
e5aecd47c4 . 1996-06-25 05:16:30 +00:00
Jim Meyering
c84a7a232e . 1996-06-25 05:09:55 +00:00
Jim Meyering
16c5d19ce5 (strndup): Deansify.
[!STDC_HEADERS]: Include string.h and stdlib.h.
1996-06-25 05:06:53 +00:00
Jim Meyering
ac96f15bf3 (EXTRA_DIST): Add strndup.c.
(fu_SOURCES): Add getline.c.
(noinst_HEADERS): Add getline.h.
1996-06-25 05:05:43 +00:00
Jim Meyering
0c0537fdce . 1996-06-25 04:58:18 +00:00
Jim Meyering
f58702e8f9 (decode_switches): Allow 0 as argument to --tabsize (-T) option.
Interpret as a directive to use no TAB characters to separate columns.
(indent): Handle TABSIZE == 0.
1996-06-25 04:56:22 +00:00
Jim Meyering
80c03e37ba . 1996-06-25 04:26:12 +00:00
Jim Meyering
71e65bb036 (dc_parse_stream): Give `unrecognized keyword' for misspelled
`TERM' keyword as well as for others.
1996-06-25 04:26:01 +00:00
Jim Meyering
522141076e . 1996-06-25 03:41:41 +00:00
Jim Meyering
408a47499e (dc_parse_stream): Remove spurious newline in error message.
(dc_parse_file): Remove erroneous test of ERR.
1996-06-25 03:41:29 +00:00
Jim Meyering
30a65b1aa3 Use an obstack to accumulate value of LS_COLORS. 1996-06-24 03:06:52 +00:00
Jim Meyering
0a3fdd250a . 1996-06-24 03:01:46 +00:00
Jim Meyering
b617aa5f3f Add comma after e.g. in comment.
From Karl B.
1996-06-23 19:15:15 +00:00
Jim Meyering
8b0cf1dde4 . 1996-06-23 19:03:56 +00:00
Jim Meyering
d392de74de * (parse_line): Rewrite to avoid modifying LINE.
Put LINE first in parameter list.
Adjust caller.
(dc_parse_stream): Free KEYWD and ARG.
(main): Give diagnostic for unreasonable combinations of
options/arguments.
1996-06-23 19:03:31 +00:00
Jim Meyering
e5b4feb70a copied from id-utils-3.0k 1996-06-23 17:58:15 +00:00
Jim Meyering
af41baeb91 (main): New option --print (-p).
Detect write failure.
Add --bourne-shell and --c-shell aliases for --sh and --csh resp.
1996-06-22 22:27:32 +00:00
Jim Meyering
5540d977f4 . 1996-06-22 22:27:14 +00:00
Jim Meyering
98b663a29b Major overhaul. No longer read from /etc/DIR_COLORS or from ~/.dircolors.
Defaults are now compiled in.  If you specify a file on the command line,
it is used instead of the compiled-in defaults.
1996-06-22 22:02:37 +00:00
Jim Meyering
e3c3d0b385 (parse_ls_color): Use STREQ here instead of strcmp(...) == 0. 1996-06-19 04:22:28 +00:00
Jim Meyering
cfda609a21 (selected_fstype, excluded_fstype, show_disk, main):
Use STREQ here instead of strcmp(...) == 0.
1996-06-19 04:21:49 +00:00
Jim Meyering
229598b807 . 1996-06-19 04:17:36 +00:00
Jim Meyering
4c6221ee37 . 1996-06-19 04:14:29 +00:00
Jim Meyering
d76f7a7ce4 . 1996-06-19 04:11:32 +00:00
Jim Meyering
fc05e28803 (copy_reg): Cast both sides of comparison to size_t to avoid warning
about `comparison between signed and unsigned' from gcc -Wall.
1996-06-19 04:10:17 +00:00
Jim Meyering
0bbec4b26e . 1996-06-19 03:39:00 +00:00
Jim Meyering
93cff2fae1 . 1996-06-19 03:32:08 +00:00
Jim Meyering
ec0f2c34d3 (decode_switches): Correct typo in error message:
enironment -> environment.  From Santiago Vila Doncel
<sanvila@unex.es>.
1996-06-19 03:31:59 +00:00
Jim Meyering
e26d180b8c (decode_switches): Correct typo in error message: enironment -> environment.
From Santiago Vila Doncel <sanvila@unex.es>.
1996-06-19 03:25:44 +00:00
Jim Meyering
cb0cd6afdb . 1996-06-19 03:21:05 +00:00
Jim Meyering
b95e3d2f47 (do_copy): Use STREQ here instead of strcmp(...) == 0.
Declare pointer parameters const as appropriate.
1996-06-19 03:19:51 +00:00
Jim Meyering
b5eadff384 . 1996-06-19 03:15:58 +00:00
Jim Meyering
a0321a68c0 (do_copy): Change message from `missing file argument' to
more precise `missing destination file'.  From Karl Berry.
1996-06-19 02:56:06 +00:00
Jim Meyering
9ed0e96ba7 . 1996-06-19 02:53:14 +00:00
Jim Meyering
087f809fe7 . 1996-06-19 02:52:02 +00:00
Jim Meyering
dd6c617d24 . 1996-06-19 02:51:09 +00:00
Jim Meyering
b4e8fc709e (STREQ): New macro. 1996-06-19 02:00:24 +00:00
Jim Meyering
487366d091 . 1996-06-19 02:00:16 +00:00
Jim Meyering
6099222717 (do_copy): When the force and backup options have been
specified and the source and destination are the same name for an
existing, regular file, convert the user's command, e.g.
`cp --force --backup foo foo' to `cp --force foo fooSUFFIX'
where SUFFIX is determined by any version control options used.
At urging of (most recently) Karl Berry.
1996-06-19 01:59:12 +00:00
Jim Meyering
608e780536 . 1996-06-19 01:48:25 +00:00
Jim Meyering
0f73666749 . 1996-06-19 01:41:35 +00:00
Jim Meyering
e72e877181 . 1996-06-16 18:52:46 +00:00
Jim Meyering
4063f0aea3 . 1996-06-16 18:49:50 +00:00
Jim Meyering
0c8d33de03 . 1996-06-16 18:49:08 +00:00
Jim Meyering
e94070eb22 . 1996-06-16 18:48:30 +00:00
Jim Meyering
8aef0cde12 . 1996-06-16 18:47:38 +00:00
Jim Meyering
d355dcec62 (EXTRA_DIST): Add texinfo.tex. But it will
be removed once automake is fixed to add it automatically.
1996-06-16 18:47:30 +00:00
Jim Meyering
c0a9e11235 . 1996-06-16 18:41:48 +00:00
Jim Meyering
8469bec1cc . 1996-06-16 03:23:53 +00:00
Jim Meyering
28a71c3409 . 1996-06-16 03:23:06 +00:00
Jim Meyering
85c407a740 (EXTRA_DIST): Add basename.c.
(fu_SOURCES): Remove basename.c.
1996-06-16 03:21:47 +00:00
Jim Meyering
2a01f209a6 . 1996-06-16 03:18:07 +00:00
Jim Meyering
1137a26bcf Update from time-1.7. 1996-06-14 04:42:33 +00:00
Jim Meyering
8157b18b8a . 1996-06-14 03:52:05 +00:00
Jim Meyering
c8c25a4610 ($(PACKAGE).pot): Reapply change of May 30.
Depend on POTFILES only when using maintainer mode.
1996-06-14 03:51:57 +00:00
Jim Meyering
031e782bb9 . 1996-06-14 03:33:18 +00:00
Jim Meyering
289ee58ce3 . 1996-06-12 04:32:54 +00:00
Jim Meyering
53af79cfe4 . 1996-06-12 04:30:58 +00:00
Jim Meyering
57beda9b45 . 1996-06-11 17:26:10 +00:00
Jim Meyering
0f3ff1725d . 1996-06-11 00:13:09 +00:00
Jim Meyering
7188179fc0 . 1996-06-11 00:12:53 +00:00
Jim Meyering
6544a589ed . 1996-06-11 00:12:08 +00:00
Jim Meyering
79ae2a4af9 . 1996-06-10 23:23:53 +00:00
Jim Meyering
b952290dc3 . 1996-06-10 23:20:06 +00:00
Jim Meyering
737f1f03a5 . 1996-06-08 04:29:59 +00:00
Jim Meyering
cf83dc5456 . 1996-06-08 03:16:21 +00:00
Jim Meyering
652ad8aaa3 . 1996-06-07 05:14:55 +00:00
Jim Meyering
5e969c1033 . 1996-06-07 03:16:35 +00:00
Jim Meyering
e42cc5be8a Update from gettext-0.10.16. 1996-06-07 02:59:01 +00:00
Jim Meyering
8cb05a6bfa . 1996-06-06 03:54:38 +00:00
Jim Meyering
4fb75ded4c . 1996-06-02 04:49:35 +00:00
Jim Meyering
1c883e2882 Rename MO_ to SHELLTYPE_. 1996-06-02 02:58:05 +00:00
Jim Meyering
d6bf80ccc7 Declare pointer parameters const as appropriate. 1996-06-02 02:52:37 +00:00
Jim Meyering
cd536776a0 . 1996-06-01 23:08:53 +00:00
Jim Meyering
f51eb4a5cc (decode_switches): Set print_with_color in one statement. 1996-06-01 23:08:35 +00:00
Jim Meyering
de40301f0a Rename options and internal variables to reflect change to
--color=WHEN where WHEN is never, always, or auto (for consistency
with e.g. cp --sparse=WHEN.  For at least a while, the original
slackware-supported arguments `none', `force', `yes', etc will be
supported but deprecated by lack of documentation.
(decode_switches): Use STDOUT_FILENO instead of `1' in is_tty test.
(usage): Update/add description of the --color option.
1996-06-01 18:36:19 +00:00
Jim Meyering
aa41cdbb65 . 1996-06-01 03:21:53 +00:00
Jim Meyering
4d02bdd9b0 . 1996-06-01 03:19:25 +00:00
Jim Meyering
41e8b21fb7 . 1996-06-01 03:06:06 +00:00
Jim Meyering
fe9da7ee9b . 1996-05-31 03:45:49 +00:00
Jim Meyering
bd8218fbe9 . 1996-05-31 03:45:31 +00:00
Jim Meyering
d52bc68220 . 1996-05-31 03:45:16 +00:00
Jim Meyering
090cd9f443 . 1996-05-31 03:44:15 +00:00
Jim Meyering
b6c83bbaa0 . 1996-05-31 03:42:11 +00:00
Jim Meyering
5946c46972 . 1996-05-31 03:36:22 +00:00
Jim Meyering
20522f2f5d (main): Interpret the old-style +VALUE and -VALUE
options like -c VALUE and -c +VALUE (resp) when VALUE has one of
the [bkm] suffix multipliers.  This makes the code consistent
with --help output.
1996-05-31 03:35:32 +00:00
Jim Meyering
7b297f76c4 . 1996-05-31 03:08:07 +00:00
Jim Meyering
3c467c0d22 (limfield): #ifdef-out a block of code that makes
GNU sort incompatible with Unix sort when a key-end spec refers
to the N'th character in a field that has fewer than N characters.
The POSIX spec doesn't appear to specify behavior for this case.
From Karl Heuer.
1996-05-31 03:07:45 +00:00
Jim Meyering
b2ae052c6d . 1996-05-31 02:36:34 +00:00
Jim Meyering
8ee7e2c0c8 (.po.mo): Reenable dependency and rule.
It is required when using native NLS, e.g. on Solaris.
From Marcus Daniels.
1996-05-31 02:35:59 +00:00
Jim Meyering
3270b340e8 ($(PACKAGE).pot): Depend on POTFILES only when using maintainer mode.
Reported by Karl Heuer.
1996-05-31 02:26:23 +00:00
Jim Meyering
22978078f7 (stamp-cat-id): Avoid using temp filename longer than 14 characters.
(mostlyclean): Likewise.
From Karl Heuer.
1996-05-31 00:58:51 +00:00
Jim Meyering
53e41464fd (decode_one_format): Use %lu (not %d) printf formats
corresponding to unsigned long, SIZE.
1996-05-31 00:51:48 +00:00
Jim Meyering
86f7daf592 . 1996-05-31 00:51:23 +00:00
Jim Meyering
91e12f541f . 1996-05-30 06:34:25 +00:00
Jim Meyering
176a02c5d9 (installcheck): New target. 1996-05-30 06:34:16 +00:00
Jim Meyering
c6836cfdda . 1996-05-30 05:23:02 +00:00
Jim Meyering
090a56eb9c (decode_one_format): Take another parameter.
Give a specific diagnostic for invalid format spec here rather
than an overly general one from caller's caller.
(decode_format_string): Update caller.
(main): Don't give diagnostic here when decode_format_string fails.
Remove assertions that could fail on some Crays because they don't
have a two-byte type.
Johan Danielsson (joda@pdc.kth.se) reported the failed assertions.
1996-05-30 05:09:56 +00:00
Jim Meyering
8c0d3621b3 . 1996-05-30 05:09:31 +00:00
Jim Meyering
86d6d4c47c . 1996-05-30 02:32:19 +00:00
Jim Meyering
f1d4b41340 (docolon): Give a warning when the first character
of the basic regular expression is `^'.
1996-05-30 02:32:03 +00:00
Jim Meyering
ab8cec12c9 . 1996-05-30 02:31:45 +00:00
Jim Meyering
3bd31fac90 (main): Use STDIN_FILENO instead of less portable fileno (stdin). 1996-05-30 00:59:50 +00:00
Jim Meyering
31f9f9f24c . 1996-05-29 04:46:00 +00:00
Jim Meyering
e7b4a0bced . 1996-05-28 23:42:01 +00:00
Jim Meyering
a3b44d2fd5 . 1996-05-28 23:41:11 +00:00
Jim Meyering
55dcae1c8d (main): Don't mark "%s" as a translatable string.
From Gran Uddeborg.
1996-05-28 23:40:11 +00:00
Jim Meyering
a01eaef0fd (print_stats): Don't mark "%u %s" as a translatable string.
From Gran Uddeborg (gvran@uddeborg.pp.se).
1996-05-28 23:39:12 +00:00
Jim Meyering
9da759a317 (main): Use STDIN_FILENO and STDOUT_FILENO instead of less portable fileno(*). 1996-05-28 01:42:07 +00:00
Jim Meyering
d2d2d043ff Hack out broken WEAK junk. 1996-05-24 03:06:01 +00:00
Jim Meyering
afd4dcf3b2 Define __P. 1996-05-24 02:45:38 +00:00
Jim Meyering
9b7bbe7b0b . 1996-05-23 13:14:11 +00:00
Jim Meyering
d84462d473 FIXME: fill this in 1996-05-23 13:13:35 +00:00
Jim Meyering
e3579cb231 . 1996-05-23 13:05:04 +00:00
Jim Meyering
1a34934e94 (read_filesystem_list) [MOUNTED_LISTMNTENT]: New function.
From Johan Danielsson (joda@pdc.kth.se).
1996-05-23 13:04:41 +00:00
Jim Meyering
c2705c1e62 [_CRAY]: Don't include sys/filsys.h because although
Unicos-9 has it, it's not needed and would cause other problems
because it requires inclusion of other, non-standard headers.
1996-05-23 13:04:03 +00:00
Jim Meyering
63d49273c4 (usage): Make --literal (-N) description clearer. 1996-05-23 12:52:54 +00:00
Jim Meyering
2df44bba5b Add copyright header. 1996-05-22 12:37:29 +00:00
Jim Meyering
4b17c0b9ac Update from GNU libc-copies. 1996-05-22 12:37:11 +00:00
Jim Meyering
71d6f09173 . 1996-05-22 12:07:38 +00:00
Jim Meyering
5faf3cd5fb . 1996-05-22 12:03:18 +00:00
Jim Meyering
b4a30ded4c . 1996-05-21 12:15:50 +00:00
Jim Meyering
e1dc14d3a1 (euidaccess) [!S_IROTH]: Define.
[!S_IWOTH]: Define.
[!S_IXOTH]: Define.
Marcus Daniels <marcus@sysc.pdx.edu> reported that m68k NEXTSTEP 3.2
doesn't define S_IROTH or S_IWOTH unless some posix compile option
is used and associated symbols defined.
1996-05-21 12:15:27 +00:00
Jim Meyering
4c8f853735 (xgetgroups): New function, factored out of
print_group_list and print_full_info.
(print_group_list): Call it.
(print_full_info): Call it.

From Andreas Schwab:
(print_group_list): When USERNAME is specified use
getugroups to get the number of groups.
(print_full_info): Likewise.
1996-05-21 04:19:02 +00:00
Jim Meyering
6225a43223 . 1996-05-21 04:13:19 +00:00
Jim Meyering
abda80a05a . 1996-05-21 04:12:36 +00:00
Jim Meyering
6ab8d020db . 1996-05-21 04:11:45 +00:00
Jim Meyering
5daa998b30 . 1996-05-21 03:58:12 +00:00
Jim Meyering
5840eaec8d . 1996-05-21 03:57:51 +00:00
Jim Meyering
4a6d0824c9 . 1996-05-21 03:57:21 +00:00
Jim Meyering
166523ca2b . 1996-05-21 03:52:57 +00:00
Jim Meyering
04a5f54547 . 1996-05-21 03:40:45 +00:00
Jim Meyering
8f47502291 . 1996-05-21 02:56:29 +00:00
Jim Meyering
fb71b69665 . 1996-05-20 04:31:49 +00:00
Jim Meyering
f8a5744b34 . 1996-05-20 02:46:30 +00:00
Jim Meyering
e3fa3463d6 (usage): Make it a little clearer. 1996-05-20 02:46:22 +00:00
Jim Meyering
a712177a4b Tweak indentation. 1996-05-19 20:25:28 +00:00
Jim Meyering
b9ad7b9a9c . 1996-05-19 19:46:25 +00:00
Jim Meyering
47e20014b0 . 1996-05-19 18:15:59 +00:00
Jim Meyering
2f4e768ff4 . 1996-05-19 18:10:22 +00:00
Jim Meyering
f1aea23023 . 1996-05-19 17:14:19 +00:00
Jim Meyering
4734b96d4e . 1996-05-19 17:13:58 +00:00
Jim Meyering
faf0038376 New option: --no-dereference (-h).
[!MAXUID]: Define to INT_MAX.
(change_file_group): Use lchown if --no-dereference (-h) was given.
(usage): Update.
(main): Fail if user requests --no-dereference on a system that
doesn't have support for it.
1996-05-19 17:13:36 +00:00
Jim Meyering
dd7aea80f7 New option: --no-dereference (-h).
(change_file_owner): Use lchown if --no-dereference (-h) was given.
(usage): Update.
(main): Fail if user requests --no-dereference on a system that
doesn't have support for it.
1996-05-19 14:36:09 +00:00
Jim Meyering
4ff1b892d0 . 1996-05-18 19:35:36 +00:00
Jim Meyering
22125a047d . 1996-05-18 19:29:22 +00:00
Jim Meyering
b2191ea8e1 (main): Don't recognize --help, --h, --he, --version, --v, etc.
if the POSIXLY_CORRECT environment variable is set.
1996-05-18 18:37:11 +00:00
Jim Meyering
971c5b1379 (main): Don't recognize --help, --h, --he, --version, --v, etc.
if the POSIXLY_CORRECT environment variable is set.
1996-05-18 18:36:36 +00:00
Jim Meyering
2d8de9b8ab (main): Don't recognize --help, --h, --he, --version, --v, etc.
if the POSIXLY_CORRECT environment variable is set.
(docolon) [RE_SYNTAX_POSIX_BASIC]: Revert my misguided change of Mar 1.
1996-05-18 18:36:10 +00:00
Jim Meyering
271a7e6bb3 . 1996-05-17 03:19:01 +00:00
Jim Meyering
573c16a666 Update prototype to match. 1996-05-17 03:16:54 +00:00
Jim Meyering
bae16cb45b (get_fs_usage): Declare parameter PATH to be const. 1996-05-17 03:16:34 +00:00
Jim Meyering
b80225264a . 1996-05-17 03:16:21 +00:00
Jim Meyering
dcc145f13a Rearrange function definitions to precede respective uses to obviate
all forward dcls. Remove forward dcls.
Declare parameters const as appropriate.
1996-05-16 05:00:12 +00:00
Jim Meyering
51958e82aa . 1996-05-16 04:59:49 +00:00
Jim Meyering
ca0a087f3d . 1996-05-16 04:44:39 +00:00
Jim Meyering
22dc22c127 . 1996-05-16 04:31:54 +00:00
Jim Meyering
a56783bbb4 (selected_fstype): Move definition to precede use.
Remove prototype.  Declare parameter FSTYPE to be const.
(excluded_fstype): Likewise.
(main): Fail with a diagnostic if both --human-readable and
--portability are used.
Likewise if --megabytes and --portability are used.
1996-05-16 04:31:45 +00:00
Jim Meyering
699808bcad (do_link): Declare pointer parameters to be const. 1996-05-16 04:13:52 +00:00
Jim Meyering
7176037aa2 . 1996-05-16 04:02:10 +00:00
Jim Meyering
55447abbdf (getdate.c): Disable dependencies that can
require rerunning YACC when not in maintainer mode.
(posixtm.c): Likewise.
1996-05-16 04:01:39 +00:00
Jim Meyering
2c226bf49d Update prototypes. 1996-05-16 03:58:44 +00:00
Jim Meyering
8a623ebc61 (mode_compile): Declare parameter MODE_STRING const.
Remove register attribute.
(mode_adjust): Likewise for CHANGES.
1996-05-16 03:57:49 +00:00
Jim Meyering
fce70ef38b (describe_change): Declare pointer parameters to be const.
(change_file_mode): Likewise.
(change_dir_mode): Likewise.
1996-05-16 03:55:44 +00:00
Jim Meyering
9622bd6207 (md5_t_stats): Restructure pluralization of error message so it's easier
to translate.
1996-05-15 04:45:12 +00:00
Jim Meyering
f177941b93 (print_stats): Restructure pluralization of error message so it's easier
to translate.
1996-05-15 04:37:50 +00:00
Jim Meyering
a2c6905133 (main): Restructure pluralization of error message so it's easier to translate. 1996-05-15 04:37:08 +00:00
Jim Meyering
3df9acbfc9 . 1996-05-15 02:03:39 +00:00
Jim Meyering
9f58b3b3d5 . 1996-05-13 05:33:36 +00:00
Jim Meyering
e6b5a4d682 *** empty log message *** 1996-05-13 05:31:33 +00:00
Jim Meyering
1fb27efd70 . 1996-05-12 03:25:59 +00:00
Jim Meyering
d4a3e63ec8 Sat May 11 13:30:53 1996 enami tsugutomo <enami@ba2.so-net.or.jp>
* regex.c (re_match_2_internal): Fix off-by-one error; don't use
       length of exactn as character, and don't use length of bitmap of
       charset as bitmap.
1996-05-12 02:57:30 +00:00
Jim Meyering
f64964aa1d . 1996-05-11 01:59:25 +00:00
Jim Meyering
97775c5655 (all-yes): Always depend on CATALOGS. From Ulrich Drepper.
(.po.mo): Disable dependency and rule when not in maintainer mode.
1996-05-11 01:49:04 +00:00
Jim Meyering
483e2421c9 . 1996-05-10 05:10:34 +00:00
Jim Meyering
ac4a274dcf . 1996-05-10 03:31:07 +00:00
Jim Meyering
8b3d87d197 . 1996-05-10 03:30:32 +00:00
Jim Meyering
bee873f407 . 1996-05-10 03:27:51 +00:00
Jim Meyering
7b33a9910c . 1996-05-10 03:26:38 +00:00
Jim Meyering
d60264342d . 1996-05-10 03:20:30 +00:00
Jim Meyering
3cd2c9e1c8 , 1996-05-10 03:06:48 +00:00
Jim Meyering
c94ffee869 (all-yes): Also dependend on GMOFILES.
Depend on CATALOGS and GMOFILES files only in maintainer mode.
1996-05-10 03:05:51 +00:00
Jim Meyering
7da69e79df . 1996-05-08 05:01:01 +00:00
Jim Meyering
a79461545e . 1996-05-08 03:11:42 +00:00
Jim Meyering
32e36bd888 Update from GNU libc. 1996-05-07 03:41:17 +00:00
Jim Meyering
15e49fdbfb . 1996-05-06 04:20:07 +00:00
Jim Meyering
1b0419e8fd . 1996-05-06 01:28:23 +00:00
Jim Meyering
bd395b3bfc (main): Use fputs, not puts. Avoids spurious newline. 1996-05-06 01:26:25 +00:00
Jim Meyering
b7c1e2526a . 1996-05-06 01:25:32 +00:00
Jim Meyering
9300fb41f8 . 1996-05-05 18:48:42 +00:00
Jim Meyering
c434fa5195 Look for SYSTEM_FILE, not USER_FILE in SHAREDIR. 1996-05-05 02:41:29 +00:00
Jim Meyering
7f504f2317 . 1996-05-05 02:15:53 +00:00
Jim Meyering
cafa5c1c2d Make enumerated constants upper case.
(main): Don't rely on ANSI-style string concatenation.
Add `static' and/or `const' to some file scope variables.
1996-05-05 02:15:23 +00:00
Jim Meyering
73a90d1006 . 1996-05-05 02:04:32 +00:00
Jim Meyering
d4e2205ea9 Remove useless void casts of *printf return values. 1996-05-05 02:04:04 +00:00
Jim Meyering
8e9d1adf75 . 1996-05-05 01:56:17 +00:00
Jim Meyering
2f6c94da4c [IN_CTYPE_DOMAIN]: Rename from ISASCII. 1996-05-05 01:55:52 +00:00
Jim Meyering
68898bb9a7 . 1996-05-05 01:55:26 +00:00
Jim Meyering
812fdadfca [IN_CTYPE_DOMAIN]: Rename from ISASCII. 1996-05-05 01:55:16 +00:00
Jim Meyering
0e307a526c . 1996-05-05 01:55:04 +00:00
Jim Meyering
c1997cb5c3 . 1996-05-05 01:53:15 +00:00
Jim Meyering
74445dae42 [IN_CTYPE_DOMAIN]: Rename from ISASCII. 1996-05-05 01:51:50 +00:00
Jim Meyering
fcf3192814 [IN_CTYPE_DOMAIN]: Rename from ISASCII. 1996-05-05 01:51:26 +00:00
Jim Meyering
916861c0e8 . 1996-05-05 01:40:46 +00:00
Jim Meyering
437e9a0bc4 . 1996-05-02 02:47:10 +00:00
Jim Meyering
389c4049b3 (parse_ls_color, usage): Remove support for alternate spellings:
--colours and LS_COLOURS.
(parse_ls_color): Reverse sense of test for LS_COLORS environment
variable and return -- save a level of indentation on a 100+-line block.
1996-05-02 02:45:43 +00:00
Jim Meyering
a9ec4db8f2 . 1996-05-02 02:37:09 +00:00
Jim Meyering
9cda4e6527 . 1996-05-02 02:35:53 +00:00
Jim Meyering
cf1bd0e401 (EXTRA_DIST): Add strcasecmp.c. 1996-05-01 05:24:54 +00:00
Jim Meyering
419daeb511 . 1996-05-01 05:20:22 +00:00
Jim Meyering
5555b3c9db . 1996-05-01 05:19:38 +00:00
Jim Meyering
482d5be531 (parse_ls_color, usage): Remove support for alternate spellings:
--colours and LS_COLOURS.
1996-05-01 05:19:34 +00:00
Jim Meyering
87afdbeb7d . 1996-04-30 03:51:11 +00:00
Jim Meyering
a84f4f6087 . 1996-04-30 03:49:12 +00:00
Jim Meyering
12da649245 (usage): Change TAB in message to spaces. Doing that seems
to have worked around a problem with something in gettext that was
producing a truncated usage message for date's usage.
Franois Pinard.
1996-04-30 03:30:51 +00:00
Jim Meyering
22aec49d4c (main): Separate messages about too few' and too many'
arguments to ease translation.
From Franc,ois.
1996-04-30 03:29:01 +00:00
Jim Meyering
6580f24783 Mark translatable strings.
(main): Separate messages about `too few' and `too many'
arguments to ease translation.
From Franc,ois.
1996-04-30 03:26:34 +00:00
Jim Meyering
a3c143bd82 Mark translatable strings. 1996-04-30 03:20:38 +00:00
Jim Meyering
07e148c8e7 (print_name_with_quoting): Add braces around inner if-else stmt. 1996-04-29 04:53:53 +00:00
Jim Meyering
8455ea2e13 (LEN_STR_PAIR): New macro.
(color_indicator): Use it in this declaration.
(parse_ls_color): Use error, not fprintf.
(decode_switches): Add a comment.
1996-04-29 04:52:16 +00:00
Jim Meyering
95439d0f33 (parse_ls_color): Use strcpy to initialize 3-character array.
Automatic aggregate initialization isn't portable.
1996-04-29 04:31:24 +00:00
Jim Meyering
aa7d0d8c85 Remove all ^L's.
(get_funky_string): Declare static and move to precede single
caller: parse_ls_color.
1996-04-29 04:29:06 +00:00
Jim Meyering
3ce3cb772d (get_funky_string): Upper-case anon. union `state'. 1996-04-29 04:26:47 +00:00
Jim Meyering
e08a28e045 Apply color ls changes from Drepper. 1996-04-29 04:24:07 +00:00
Jim Meyering
6ea9602009 . 1996-04-29 04:04:59 +00:00
Jim Meyering
ea11fd8868 FIXME 1996-04-29 01:44:33 +00:00
Jim Meyering
346b0368cf . 1996-04-29 01:43:52 +00:00
Jim Meyering
175585876f . 1996-04-29 01:36:49 +00:00
Jim Meyering
1ecd1b9c52 . 1996-04-29 01:35:24 +00:00
Jim Meyering
30f76e827e (main): Give a better diagnostic for `sort -0'. Reported by Karl Berry. 1996-04-29 01:35:18 +00:00
Jim Meyering
8b9e784e1e . 1996-04-29 01:29:16 +00:00
Jim Meyering
5a5938db82 (copy_rest): Don't copy past end of prefix. Output
trailing spaces if the prefix had any.  Before, the command
perl -e 'print "| S";' |fmt -p' |  '|tr '\0' @ output `|@S'.
Reported by Franois Pinard.
1996-04-29 01:28:06 +00:00
Jim Meyering
3c57cea2ce . 1996-04-28 22:12:33 +00:00
Jim Meyering
0143b2901f . 1996-04-28 21:41:28 +00:00
Jim Meyering
527b07a1ad Indent CPP conditionals. 1996-04-28 21:41:20 +00:00
Jim Meyering
347c2d6d30 [HAVE_ST_BLOCKS || _POSIX_VERSION]: Add extern dcl
of unused variable so that after preprocessing, the file will never
be empty.  Otherwise, some compilers in ANSI mode (among them, the
Dec Alpha OSF 2.0 C compiler) reject empty files.  From Kaveh Ghazi.
1996-04-28 21:34:00 +00:00
Jim Meyering
9af8f15624 . 1996-04-27 04:11:35 +00:00
Jim Meyering
c17caa0c0f Fri Apr 26 05:52:03 1996 Karl Eichwalder <ke@ke.Central.DE>
* ls.c (usage): Add newline at end of printf format string.
1996-04-27 04:10:54 +00:00
62 changed files with 4479 additions and 1772 deletions

152
ABOUT-NLS
View File

@@ -2,9 +2,9 @@ Notes on the GNU Translation Project
************************************
GNU is going international! The GNU Translation Project is a way to
get maintainers, translators and users all together, so GNU will
gradually become able to speak many native languages. A few packages
already provide native language translation for their messages.
get maintainers, translators, and users all together, so that GNU will
gradually become able to speak many languages. A few packages already
provide translations for their messages.
If you found this `ABOUT-NLS' file inside a GNU distribution, you
may assume that the distributed package does use GNU `gettext'
@@ -28,7 +28,7 @@ One advise in advance
If you want to exploit the full power of internationalization, you
should configure it using
./configure --with-gnu-gettext
./configure --with-included-gettext
to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in
@@ -58,7 +58,7 @@ the GNU `gettext' package is *not* required. Installers may use
special options at configuration time for changing the default
behaviour. The commands:
./configure --with-gnu-gettext
./configure --with-included-gettext
./configure --with-catgets
./configure --disable-nls
@@ -75,7 +75,7 @@ should use the more recent version of the GNU `gettext' library. I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use
./configure --with-gnu-gettext
./configure --with-included-gettext
to prevent auto-detection.
@@ -90,7 +90,7 @@ want to use the `catgets' functions use
to enable the test for `catgets' (this causes no harm if `catgets' is
not available on your system). If you really select this option we
would like to hear about the reasons because we cannot think of any
good ones outself.
good one ourself.
Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language. Unless
@@ -127,109 +127,95 @@ leaving `LANG' to `sv'.
Translating Teams
=================
The GNU `gettext' tool set contains *everything* maintainers need
for internationalizing their packages for messages. It also contains
quite useful tools for helping translators at localizing messages to
their native language, once a package has already been
internationalized.
To achieve the GNU Translation Project, we need many interested
For the GNU Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translating team has its own mailing list, courtesy of Linux
International. You may reach your translating team at the address
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 country codes given in
ISO 3166. The following translating teams exist, as of January 1996:
language. Language codes are *not* the same as the country codes given
in ISO 3166. The following translation teams exist, as of May 1996:
Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
Esperanto `eo', Finnish `fi', French `fr', Irish `ga', German
`de', Greek `el', Italian `it', Japanese `ja', Indonesian `in',
Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl',
English `en', Esperanto `eo', Finnish `fi', French `fr', German
`de', Greek `el', Hebrew `he', Hungarian `hu', Irish `ga', Italian
`it', Indonesian `id', Japanese `ja', Korean `ko', Latin `la',
Norwegian `no', Persian `fa', Polish `pl', Portuguese `pt',
Russian `ru', Spanish `es', Swedish `sv', Telugu `te' and Turkish
`tr'.
Russian `ru', Slovenian `sl', Spanish `es', Swedish `sv', Telugu
`te', Turkish `tr' and Ukrainian `uk'.
For example, you may reach the Chinese translating team by writing to
For example, you may reach the Chinese translation team by writing to
`zh@li.org'.
If you'd like to volunteer to *work* at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is *not* the same as the list itself, it has
`-request' appended. For example, Swedish people can send a message to
`sv-request@li.org', having this message body:
`-request' appended. For example, speakers of Swedish can send a
message to `sv-request@li.org', having this message body:
subscribe
Keep in mind that team members should be interested in *working* at
translations, or at solving translational difficulties, rather than
merely lurking around. If your team does not exist yet and you want to
start one, please write to `gnu-translation@gnu.ai.mit.edu'; you will
then reach the GNU coordinator for all translator teams.
Keep in mind that team members are expected to participate
*actively* in translations, or at solving translational difficulties,
rather than merely lurking around. If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `gnu-translation@gnu.ai.mit.edu' to reach
the GNU coordinator for all translator teams.
The English team is special. It works at improving and uniformizing
the terminology used in GNU. Proven linguistic skill are praised more
than programming skill, here. For the time being, please avoid
subscribing to the English team unless explicitely invited to do so.
subscribing to the English team unless explicitly invited to do so.
Available Packages
==================
Languages are not equally supported in all GNU packages. The
following matrix shows the current state of GNU internationalization,
as of January 1996. Listed are: internationalized packages, and
languages for which work is in progress, or about to start.
as of May 1996. The matrix shows, in regard of each package, for which
languages PO files have been submitted to translation coordination.
See note cs de en fr it ja ko nl no pl pt sv
\ .-------------------------------------.
chess (1) | X / X |
clisp | X X X |
diffutils (2) | / . |
fileutils | . / |
flex (3) | / . |
m4 | - / - - . - |
gettext | X / X - X - X |
ptx | - / - - |
recode | - / - - - |
sh-utils | . / . |
sharutils | X / X X X X X |
tar | X / X - X X |
textutils | . / . |
wdiff | - - / - - |
`-------------------------------------'
cs de en fr it ja ko nl no pl pt sv
cs de en es fi fr ja ko no pl pt sl sv
.----------------------------------------.
bash | [] | 1
bison | | 0
clisp | [] [] [] | 3
cpio | [] | 1
diffutils | [] [] | 2
enscript | [] [] [] [] | 4
fileutils | [] [] [] [] | 4
findutils | [] [] | 2
flex | [] | 1
gettext | [] [] [] [] [] [] [] | 8
glibc | [] [] [] | 3
grep | [] [] [] [] | 4
hello | [] [] [] [] [] | 5
m4 | [] [] [] [] | 4
make | | 0
mkid | [] [] | 2
music | [] | 1
ptx | [] [] [] | 3
recode | [] [] [] [] [] | 5
sh-utils | [] [] | 2
sharutils | [] [] [] | 3
tar | [] [] [] [] [] [] [] | 7
textutils | [] [] [] | 3
wdiff | [] [] [] [] | 4
`----------------------------------------'
cs de en es fi fr ja ko no pl pt sl sv
1 16 1 3 1 21 1 6 3 1 3 6 9
The interpretation legend and notes are:
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
used for implementing regional variants of languages, or language
dialects.
`/'
There is no PO file, this package merely defaults to this language.
For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
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.
`.'
The effort of localizing this package has been undertaken by
someone, or by a translating team, and work is, or should be in
progress.
`-'
A PO file for this package and this language is completed and is
currently available in a pretest release, or is all ready for
inclusion in the next release of this package.
`X'
The localization of this package to this particular language is
fully completed, and now distributed through an official release.
(1)
This package is translated to specific languages by methods
predating GNU `gettext'. Translations are all kept on disk files,
and sources contain numbers where one normally expects strings.
(2)
This package is planned to switch to GNU `gettext'. For the time
being, it uses temporary means for internationalization.
(3)
This package has its translatable strings marked, but does not use
GNU `gettext'. A convenience patch may be available separately.
If January 1996 seems to be old, you may fetch a more recent copy of
If May 1996 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites.

View File

@@ -1,3 +1,6 @@
## Process this file with automake to produce Makefile.in
info_TEXINFOS = fileutils.texi
EXTRA_DIST = perm.texi getdate.texi
# FIXME: remove texinfo.tex when automake has been fixed to include it
# automatically
EXTRA_DIST = perm.texi getdate.texi texinfo.tex

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 0.31 from Makefile.am
# Makefile.in generated automatically by automake 1.0 from Makefile.am
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -39,7 +39,11 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
info_TEXINFOS = fileutils.texi
EXTRA_DIST = perm.texi getdate.texi
# FIXME: remove texinfo.tex when automake has been fixed to include it
# automatically
EXTRA_DIST = perm.texi getdate.texi texinfo.tex
mkinstalldirs = $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
MAKEINFO = makeinfo
@@ -49,8 +53,7 @@ INFO_DEPS = fileutils.info
DVIS = fileutils.dvi
TEXINFOS = fileutils.texi
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
version.texi
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti version.texi
PACKAGE = @PACKAGE@
@@ -60,20 +63,22 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) $(DATA)
DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA)
TAR = tar
default: all
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in
$(srcdir)/Makefile.in: @MAINT@Makefile.am $(top_srcdir)/configure.in
cd $(top_srcdir) && automake $(subdir)/Makefile
Makefile: $(top_builddir)/config.status Makefile.in
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
version.texi: stamp-vti
version.texi: @MAINT@stamp-vti
stamp-vti: fileutils.texi $(top_srcdir)/configure.in
echo "@set UPDATED `cd $(srcdir) && $(SHELL) mdate-sh fileutils.texi`" \
> vti.tmp
echo "@set UPDATED `cd $(srcdir) \
&& $(SHELL) ./mdate-sh fileutils.texi`" > vti.tmp
echo "@set EDITION $(VERSION)" >> vti.tmp
echo "@set VERSION $(VERSION)" >> vti.tmp
if cmp -s vti.tmp $(srcdir)/version.texi; then \
@@ -91,19 +96,19 @@ clean-vti:
distclean-vti:
maintainer-clean-vti:
rm -f stamp-vti version.texi
@MAINT@rm -f stamp-vti version.texi
fileutils.info: fileutils.texi version.texi
.texi.info:
$(MAKEINFO) -I$(srcdir) $<
$(MAKEINFO) -I$(srcdir) $< -o $(srcdir)/$@
.texi.dvi:
TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $<
install-info: $(INFO_DEPS)
$(top_srcdir)/mkinstalldirs $(infodir)
$(mkinstalldirs) $(infodir)
for file in $(INFO_DEPS); do \
for ifile in `cd $(srcdir) && echo $$file*`; do \
$(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile; \
@@ -133,7 +138,7 @@ TAGS:
subdir = doc
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist: $(DEP_DISTFILES)
distdir: $(DEP_DISTFILES)
@for file in `cd $(srcdir) && echo $(DISTFILES)`; do \
test -f $(distdir)/$$file \
|| ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
@@ -151,7 +156,7 @@ install-exec:
install-data: install-info
install: install-exec install-data
install: install-exec install-data all
@:
uninstall: uninstall-info
@@ -161,7 +166,7 @@ all: $(INFO_DEPS) Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
installdirs:
$(top_srcdir)/mkinstalldirs $(infodir)
$(mkinstalldirs) $(infodir)
mostlyclean-generic:
@@ -191,7 +196,7 @@ maintainer-clean: maintainer-clean-vti maintainer-clean-info \
.PHONY: default mostlyclean-vti distclean-vti clean-vti \
maintainer-clean-vti install-info uninstall-info mostlyclean-info \
distclean-info clean-info maintainer-clean-info tags dist info dvi \
distclean-info clean-info maintainer-clean-info tags distdir info dvi \
check 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

@@ -94,7 +94,7 @@ specified differently, depending on whether the month is specified
numerically or literally. All these strings specify the same calendar date:
@example
1970-9-17 # ISO 8601.
1970-09-17 # ISO 8601.
70-9-17 # This century assumed by default.
70-09-17 # Leading zeros are ignored.
9/17/72 # Common U.S. writing.
@@ -120,9 +120,10 @@ Here are the rules.
@cindex date format, ISO 8601
For numeric months, the ISO 8601 format
@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
any positive number, @var{month} is a number between 1 and 12, and
@var{day} is a number between 1 and 31. If @var{year} is less than 100,
then 1900 is added to it to force a date in this century. The construct
any positive number, @var{month} is a number between 01 and 12, and
@var{day} is a number between 01 and 31. A leading zero must be present
if a number is less than ten. If @var{year} is less than 100, then 1900
is added to it to force a date in this century. The construct
@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
is accepted. Also @samp{@var{month}/@var{day}}, omitting the year.

View File

@@ -217,17 +217,14 @@ og-rxw
@cindex copying existing permissions
@cindex permissions, copying existing
You can base part of a file's permissions on part of its existing
permissions. To do this, instead of using @samp{r}, @samp{w}, or
@samp{x} after the operator, you use the letter @samp{u}, @samp{g}, or
@samp{o}. For example, the mode
You can base a file's permissions on its existing permissions. To do
this, instead of using @samp{r}, @samp{w}, or @samp{x} after the
operator, you use the letter @samp{u}, @samp{g}, or @samp{o}. For
example, the mode
@example
o+g
@end example
@noindent
@c FIXME describe the ls -l notation for showing permissions.
adds the permissions for users who are in a file's group to the
permissions that other users have for the file. Thus, if the file
started out as mode 664 (@samp{rw-rw-r--}), the above mode would change

View File

@@ -28,36 +28,39 @@
@ifinfo
@format
START-INFO-DIR-ENTRY
* Shell utilities: (sh-utils). GNU shell utilities.
* basename: (sh-utils)basename invocation. Strip directory and suffix.
* date: (sh-utils)date invocation. Print/set system date and time.
* dirname: (sh-utils)dirname invocation. Strip non-directory suffix.
* echo: (sh-utils)echo invocation. Print a line of text.
* env: (sh-utils)env invocation. Modify the environment.
* expr: (sh-utils)expr invocation. Evaluate expressions.
* false: (sh-utils)false invocation. Do nothing, unsuccessfully.
* groups: (sh-utils)groups invocation. Print group names a user is in.
* hostname: (sh-utils)hostname invocation. Print or set system name.
* id: (sh-utils)id invocation. Print real/effective uid/gid.
* logname: (sh-utils)logname invocation. Print current login name.
* nice: (sh-utils)nice invocation. Modify scheduling priority.
* nohup: (sh-utils)nohup invocation. Immunize to hangups.
* pathchk: (sh-utils)pathchk invocation. Check file name portability.
* printenv: (sh-utils)printenv invocation. Print environment variables.
* printf: (sh-utils)printf invocation. Format and print data.
* pwd: (sh-utils)pwd invocation. Print working directory.
* sleep: (sh-utils)sleep invocation. Delay for a specified time.
* stty: (sh-utils)stty invocation. Print/change terminal settings.
* su: (sh-utils)su invocation. Modify user and group id.
* tee: (sh-utils)tee invocation. Redirect to multiple files.
* test: (sh-utils)test invocation. File/string tests.
* true: (sh-utils)true invocation. Do nothing, successfully.
* tty: (sh-utils)tty invocation. Print terminal name.
* uname: (sh-utils)uname invocation. Print system information.
* users: (sh-utils)users invocation. Print current user names.
* who: (sh-utils)who invocation. Print who is logged in.
* whoami: (sh-utils)whoami invocation. Print effective user id.
* yes: (sh-utils)yes invocation. Print a string indefinitely.
* Shell utilities: (sh-utils). GNU shell utilities.
* basename: (sh-utils)basename invocation. Strip directory and suffix.
* chroot: (sh-utils)chroot invocation. Specify the root directory.
* date: (sh-utils)date invocation. Print/set system date and time.
* dirname: (sh-utils)dirname invocation. Strip non-directory suffix.
* echo: (sh-utils)echo invocation. Print a line of text.
* env: (sh-utils)env invocation. Modify the environment.
* expr: (sh-utils)expr invocation. Evaluate expressions.
* factor: (sh-utils)factor invocation. Print prime factors
* false: (sh-utils)false invocation. Do nothing, unsuccessfully.
* groups: (sh-utils)groups invocation. Print group names a user is in.
* hostname: (sh-utils)hostname invocation. Print or set system name.
* id: (sh-utils)id invocation. Print real/effective uid/gid.
* logname: (sh-utils)logname invocation. Print current login name.
* nice: (sh-utils)nice invocation. Modify scheduling priority.
* nohup: (sh-utils)nohup invocation. Immunize to hangups.
* pathchk: (sh-utils)pathchk invocation. Check file name portability.
* printenv: (sh-utils)printenv invocation. Print environment variables.
* printf: (sh-utils)printf invocation. Format and print data.
* pwd: (sh-utils)pwd invocation. Print working directory.
* seq: (sh-utils)seq invocation. Print numeric sequences
* sleep: (sh-utils)sleep invocation. Delay for a specified time.
* stty: (sh-utils)stty invocation. Print/change terminal settings.
* su: (sh-utils)su invocation. Modify user and group id.
* tee: (sh-utils)tee invocation. Redirect to multiple files.
* test: (sh-utils)test invocation. File/string tests.
* true: (sh-utils)true invocation. Do nothing, successfully.
* tty: (sh-utils)tty invocation. Print terminal name.
* uname: (sh-utils)uname invocation. Print system information.
* users: (sh-utils)users invocation. Print current user names.
* who: (sh-utils)who invocation. Print who is logged in.
* whoami: (sh-utils)whoami invocation. Print effective user id.
* yes: (sh-utils)yes invocation. Print a string indefinitely.
END-INFO-DIR-ENTRY
@end format
@end ifinfo
@@ -65,7 +68,7 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the GNU shell utilities.
Copyright (C) 1994 Free Software Foundation, Inc.
Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -92,12 +95,12 @@ by the Foundation.
@titlepage
@title GNU @code{sh-utils}
@subtitle A set of shell utilities
@subtitle for version @value{VERSION}, @value{RELEASEDATE}
@subtitle for version @value{VERSION}, @value{UPDATED}
@author David MacKenzie et al.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1994 Free Software Foundation, Inc.
Copyright @copyright{} 1994, 95, 96 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -126,18 +129,21 @@ This manual minimally documents version @value{VERSION} of the GNU shell
utilities.
@menu
* Introduction:: Caveats, overview, and authors.
* Introduction:: Caveats, overview, and authors.
* Common options:: Common options.
* Date input formats:: Specifying date strings.
* Date input formats:: Specifying date strings.
* Printing text:: echo printf yes
* Conditions:: false true test expr
* Redirection:: tee
* File name manipulation:: dirname basename pathchk
* Working context:: pwd stty printenv tty
* Working context:: pwd stty printenv tty
* User information:: id logname whoami groups users who
* System context:: date uname hostname
* Modified command invocation:: env nice nohup su
* Delaying:: sleep
* Numeric operations:: factor seq
* Index:: General index.
@end menu
@end ifinfo
@@ -245,15 +251,13 @@ This section describes commands that display text strings.
@cindex text, displaying
@cindex arbitrary text, displaying
Synopsis:
@code{echo} writes each given @var{string} to standard output, with a
space between each and a newline after the last one. Synopsis:
@example
echo [@var{option}]@dots{} [@var{string}]@dots{}
@end example
@code{echo} writes each given @var{string} to standard output, with a
space between each and a newline after the last one.
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@@ -298,7 +302,7 @@ a valid octal number, it is printed literally.
@section @code{printf}: Format and print data
@pindex printf
Synopsis:
@code{printf} does formatted printing of text. Synopsis:
@example
printf @var{format} [@var{argument}]@dots{}
@@ -699,9 +703,9 @@ Operands are either numbers or strings. @code{expr} coerces
anything appearing in an operand position to an integer or a string
depending on the operation being applied to it.
Strings are not quoted for @code{expr}, though you may need to quote
them to protect characters with special meaning to the shell, e.g.,
spaces.
Strings are not quoted for @code{expr} itself, though you may need to
quote them to protect characters with special meaning to the shell,
e.g., spaces.
@cindex parentheses for grouping
Operators may given as infix symbols or prefix keywords. Parentheses
@@ -897,11 +901,11 @@ to change the input source or output destination of a command. But one
useful redirection is performed by a separate command, not by the shell;
it's described here.
@menu
* tee invocation:: Redirect output to multiple files.
@end menu
@node tee invocation
@section @code{tee}: Redirect output to multiple files
@@ -912,9 +916,7 @@ it's described here.
The @code{tee} command copies standard input to standard output and also
to any files given as arguments. This is useful when you want not only
to send some data down a pipe, but also to save a copy.
Synopsis:
to send some data down a pipe, but also to save a copy. Synopsis:
@example
tee [@var{option}]@dots{} [@var{file}]@dots{}
@@ -969,16 +971,16 @@ This section describes commands that manipulate file names.
@cindex file names, stripping directory and suffix
@cindex leading directory components, stripping
Synopsis:
@code{basename} removes any leading directory components from
@var{name}. Synopsis:
@example
basename @var{name} [@var{suffix}]
@end example
The @code{basename} command removes any leading directory components
from @var{name}. If @var{suffix} is specified and is identical
to the end of @var{name}, it is removed from @var{name} as well.
@code{basename} prints the result on standard output.
If @var{suffix} is specified and is identical to the end of @var{name},
it is removed from @var{name} as well. @code{basename} prints the
result on standard output.
The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.
@@ -992,15 +994,15 @@ options}.
@cindex stripping non-directory suffix
@cindex non-directory suffix, stripping
Synopsis:
@code{dirname} prints all but the final slash-delimited component of
a string (presumably a filename). Synopsis:
@example
dirname @var{name}
@end example
@code{dirname} prints all but the final slash-delimited component
of @var{name}. If @var{name} is a single component,
@code{dirname} prints @samp{.} (meaning the current directory).
If @var{name} is a single component, @code{dirname} prints @samp{.}
(meaning the current directory).
The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.
@@ -1014,7 +1016,7 @@ options}.
@cindex valid file names, checking for
@cindex portable file names, checking for
Synopsis:
@code{pathchk} checks portability of filenames. Synopsis:
@example
pathchk [@var{option}]@dots{} @var{name}@dots{}
@@ -1108,6 +1110,14 @@ The only options are a lone @samp{--help} or
@cindex terminal settings
@cindex line settings of terminal
@code{stty} prints or changes terminal characteristics, such as baud rate.
Synopses:
@example
stty [@var{setting}]@dots{}
stty [@var{option}]
@end example
If given no arguments, @code{stty} prints the baud rate, line
discipline number (on systems that support it), and line settings
that have been changed from the values set by @samp{stty sane}.
@@ -1117,13 +1127,6 @@ standard input.
@code{stty} accepts many non-option arguments that change aspects of
the terminal line operation, as described below.
Synopses:
@example
stty [@var{setting}]@dots{}
stty [@var{option}]
@end example
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@@ -1735,7 +1738,7 @@ of: 0 50 75 110 134 134.5 150 200 300 600 1200 1800 2400 4800 9600
@cindex printing all or some environment variables
@cindex environment variables, printing
Synopsis:
@code{printenv} prints environment variable values. Synopsis:
@example
printenv [@var{option}] [@var{variable}]@dots{}
@@ -1767,7 +1770,6 @@ Exit status:
@code{tty} prints the file name of the tty connected to its standard
input. It prints @samp{not a tty} if standard input is not a tty.
Synopsis:
@example
@@ -1826,10 +1828,8 @@ logins, groups, and so forth.
@cindex effective uid and gid, printing
@cindex printing real and effective uid and gid
@noindent @code{id} prints information about the given user, or the process
running it if no user is specified.
Synopsis:
@code{id} prints information about the given user, or the process
running it if no user is specified. Synopsis:
@example
id [@var{option}]@dots{} [@var{username}]
@@ -1923,11 +1923,9 @@ options}.
@cindex supplementary groups, printing
@code{groups} prints the names of the primary and any supplementary
groups that each given @var{username}, or the current process if none
are given, is in. If user names are given, the name of each user is
printed before the list of that user's groups.
Synopsis:
groups for each given @var{username}, or the current process if no names
are given. If names are given, the name of each user is printed before
the list of that user's groups. Synopsis:
@example
groups [@var{username}]@dots{}
@@ -1951,9 +1949,7 @@ options}.
names of users currently logged in to the current host. Each user name
corresponds to a login session, so if a user has more than one login
session, that user's name will appear the same number of times in the
output.
Synopsis:
output. Synopsis:
@example
users [@var{file}]
@@ -1976,6 +1972,7 @@ options}.
@cindex printing current user information
@cindex information, about current users
@code{who} prints information about users who are currently logged on.
Synopsis:
@example
@@ -2085,10 +2082,8 @@ information.
@cindex time, printing or setting
@cindex printing the current time
@code{date} with no arguments prints the current time and date, in
the format of the @samp{%c} directive (described below).
Synopses:
@code{date} with no arguments prints the current time and date, in the
format of the @samp{%c} directive (described below). Synopses:
@example
date [@var{option}]@dots{} [+@var{format}]
@@ -2107,10 +2102,10 @@ directives, which start with @samp{%}, characters in the format string
are printed unchanged. The directives are described below.
@menu
* Time directives:: %[HIklMprsSTXZ]
* Time directives:: %[HIklMprsSTXzZ]
* Date directives:: %[aAbBcdDhjmUwWxyY]
* Literal directives:: %[%nt]
* Padding:: Pad with zeroes, spaces (%_), or nothing (%-).
* Padding:: Pad with zeroes, spaces (%_), or nothing (%-).
* Setting the time:: Changing the system clock.
* Options for date:: Instead of the current time.
* Examples of date:: Examples.
@@ -2155,10 +2150,9 @@ time, 24-hour (hh:mm:ss)
@item %X
locale's time representation (%H:%M:%S)
@item %z
RFC-822 style numeric time zone (e.g., -0600 or +0100), or nothing
if no time zone is determinable.
Note that this value reflects the @emph{current} time zone.
It isn't changed by the @samp{--date} option.
RFC-822 style numeric time zone (e.g., -0600 or +0100), or nothing if no
time zone is determinable. This value reflects the @emph{current} time
zone. It isn't changed by the @samp{--date} option.
@item %Z
time zone (e.g., EDT), or nothing if no timezone is
determinable.
@@ -2197,11 +2191,19 @@ day of year (001@dots{}366)
@item %m
month (01@dots{}12)
@item %U
week number of year with Sunday as first day of week (00@dots{}53)
week number of year with Sunday as first day of week (00@dots{}53).
Days in a new year preceding the first Sunday are in week zero.
@item %V
week number of year with Monday as first day of the week as a decimal
(01@dots{}53). If the week containing January 1 has four or more days in
the new year, then it is considered week 1; otherwise, it is week 53 of
the previous year, and the next week is week 1. (See the ISO 8601: 1988
standard.)
@item %w
day of week (0@dots{}6) with 0 corresponding to Sunday
@item %W
week number of year with Monday as first day of week (00@dots{}53)
week number of year with Monday as first day of week (00@dots{}53).
Days in a new year preceding the first Sunday are in week zero.
@item %x
locale's date representation (mm/dd/yy)
@item %y
@@ -2351,10 +2353,8 @@ If @samp{--utc} is also specified, use @samp{GMT} in place of @samp{%z}.
@itemx --reference=@var{file}
@opindex -r
@opindex --reference
Display the time and date as obtained from a reference @var{file},
instead of the current time and date. Each file has a few timestamps
associated with it. In this context, the time and date of the last
modification are used.
Display the time and date reference according to the last modification
time of @var{file}, instead of the current time and date.
@item -s @var{datestr}
@itemx --set=@var{datestr}
@@ -2456,9 +2456,7 @@ Mon, 25 Mar 1996 23:34:17 -0600
@code{uname} prints information about the machine and operating system
it is run on. If no options are given, @code{uname} acts as if the
@code{-s} option were given.
Synopsis:
@code{-s} option were given. Synopsis:
@example
uname [@var{option}]@dots{}
@@ -2543,9 +2541,7 @@ Print the operating system version.
With no arguments, @code{hostname} prints the name of the current host
system. With one argument, it sets the current host name to the
specified string. You must have appropriate privileges to set the host
name.
Synopsis:
name. Synopsis:
@example
hostname [@var{name}]
@@ -2567,6 +2563,7 @@ different than the current one: a modified environment, as a different
user, etc.
@menu
* chroot invocation:: Modify the root directory.
* env invocation:: Modify environment variables.
* nice invocation:: Modify scheduling priority.
* nohup invocation:: Immunize to hangups.
@@ -2574,17 +2571,42 @@ user, etc.
@end menu
@node chroot invocation
@section @code{chroot}: Run a command with a different root directory
@pindex chroot
@cindex running a program in a specified root directory
@cindex root directory, running a program in a specified
@code{chroot} runs a command with a specified root directory.
On many systems, only the super-user can do this.
Synopses:
@example
chroot @var{newroot} [@var{command} [@var{args}]@dots{}]
chroot @var{option}
@end example
Ordinarily, filenames are looked up starting at the root of the
directory structure, i.e., @file{/}. @code{chroot} changes the root to
the directory @var{newroot} (which must exist) and then runs
@var{command} with optional @var{args}. If @var{command} is not
specified, the default is the value of the @code{SHELL} environment
variable or @code{/bin/sh} if not set, invoked with the @samp{-i} option.
The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.
@node env invocation
@section @code{env}: Run a command in a modified environment
@pindex env
@cindex environment, running a program in a modified
@cindex modified environment, running a program in
@cindex modified environment, running a program in a
@cindex running a program in a modified environment
@code{env} runs a command with an environment modified as specified
by the command line arguments.
Synopses:
@code{env} runs a command with a modified environment. Synopses:
@example
env [@var{option}]@dots{} [@var{name}=@var{value}]@dots{} @c
@@ -2639,6 +2661,13 @@ Start with an empty environment, ignoring the inherited environment.
@cindex priority, modifying
@cindex appropriate privileges
@code{nice} prints or modifies the scheduling priority of a job.
Synopsis:
@example
nice [@var{option}]@dots{} [@var{command} [@var{arg}]@dots{}]
@end example
If no arguments are given, @code{nice} prints the current scheduling
priority, which it inherited. Otherwise, @code{nice} runs the given
@var{command} with its scheduling priority adjusted. If no
@@ -2647,12 +2676,6 @@ priority, which it inherited. Otherwise, @code{nice} runs the given
adjustment. The priority can be adjusted by @code{nice} over the range
of -20 (the highest priority) to 19 (the lowest).
Synopsis:
@example
nice [@var{option}]@dots{} [@var{command} [@var{arg}]@dots{}]
@end example
@cindex conflicts with shell built-ins
@cindex built-in shell commands, conflicts with
Because most shells have a built-in command by the same name, using the
@@ -2678,24 +2701,24 @@ Add @var{adjustment} instead of 10 to the command's priority.
@pindex nohup
@cindex hangups, immunity to
@cindex immunity to hangups
@cindex logging out and continuing to run
@flindex nohup.out
@code{nohup} runs the given @var{command} with hangup signals ignored,
so that the command can continue running in the background after you log
out.
Synopsis:
out. Synopsis:
@example
nohup @var{command} [@var{arg}]@dots{}
@end example
@flindex nohup.out
Also, the scheduling priority is increased by 5. If standard output is a
tty, it and standard error are redirected so that they are appended to
the file @file{nohup.out}; if that cannot be written to, they are
appended to the file @file{$HOME/nohup.out}. If that cannot be written
to, the command is not run.
@code{nohup} increases the scheduling priority of @var{command} by 5, so
it has a slightly smaller change to run. If standard output is a tty,
it and standard error are redirected so that they are appended to the
file @file{nohup.out}; if that cannot be written to, they are appended
to the file @file{$HOME/nohup.out}. If that cannot be written to, the
command is not run.
If @code{nohup} creates either @file{nohup.out} or
@file{$HOME/nohup.out}, it creates it with no ``group'' or ``other''
@@ -2721,9 +2744,7 @@ options}.
@code{su} allows one user to temporarily become another user. It runs a
command (often an interactive shell) with the real and effective user
id, group id, and supplemental groups of a given @var{user}.
Synopsis:
id, group id, and supplemental groups of a given @var{user}. Synopsis:
@example
su [@var{option}]@dots{} [@var{user} [@var{arg}]@dots{}]
@@ -2865,7 +2886,7 @@ might find this idea strange at first.
@cindex delaying commands
@cindex commands for delaying
Perhaps @code{wait} or other commands should be described here also?
@c Perhaps @code{wait} or other commands should be described here also?
@menu
* sleep invocation:: Delay for a specified time.
@@ -2880,7 +2901,6 @@ Perhaps @code{wait} or other commands should be described here also?
@code{sleep} pauses for an amount of time specified by the sum of
the values of the command line arguments.
Synopsis:
@example
@@ -2906,6 +2926,82 @@ The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.
@node Numeric operations
@chapter Numeric operations
@cindex numeric operations
These programs do numerically-related operations.
@menu
* factor invocation:: Show factors of numbers.
* seq invocation:: Print sequences of numbers.
@end menu
@node factor invocation
@section @code{factor}: Print prime factors
@pindex factor
@cindex prime factors
@code{factor} prints prime factors. Synopses:
@example
factor [@var{number}]@dots{}
factor @var{option}
@end example
If no @var{number} is specified on the command line, @code{factor} reads
numbers from standard input, delimited by newlines, tabs, or spaces.
The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.
@node seq invocation
@section @code{seq}: Print numeric sequences
@pindex seq
@cindex numeric sequences
@cindex sequence of numbers
@code{seq} prints a sequence of numbers to standard output. Synopses:
@example
seq [@var{option}]@dots{} [@var{first} [@var{step}]] @var{last}@dots{}
@end example
@code{seq} prints the numbers from @var{first} to @var{last} by
@var{step}. By default, @var{first} and @var{step} are both 1, and each
number is printed on its own line. All numbers can be reals, not just
integers.
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@item -f @var{format}
@itemx --format=@var{format}
@opindex -f @var{format}
@opindex --format=@var{format}
@cindex formatting of numbers in @code{seq}
Print all numbers using @var{format}; default @samp{%g}.
@var{format} must contain exactly one of the standarding float output
formats @samp{%e}, @samp{%f}, or @samp{%g}.
@item -s @var{string}
@itemx --separator=@var{string}
@cindex separator for numbers in @code{seq}
Separate numbers with @var{string}; default is a newline.
The output always terminates with a newline.
@item -w
@itemx --equal-width
Print all numbers with the same width, by padding with leading zeroes.
(To have other kinds of padding, use @samp{--format}).
@end table
@node Index
@unnumbered Index

View File

@@ -1,6 +1,7 @@
%% TeX macros to handle texinfo files
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
% 94, 95, 1996 Free Software Foundation, Inc.
%This texinfo.tex file is free software; you can redistribute it and/or
%modify it under the terms of the GNU General Public License as
@@ -14,8 +15,8 @@
%You should have received a copy of the GNU General Public License
%along with this texinfo.tex file; see the file COPYING. If not, write
%to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
%USA.
%to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
%Boston, MA 02111-1307, USA.
%In other words, you are welcome to use, share and improve this program.
@@ -34,7 +35,7 @@
% This automatically updates the version number based on RCS.
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
\deftexinfoversion$Revision: 1.9 $
\deftexinfoversion$Revision: 1.10 $
\message{Loading texinfo package [Version \texinfoversion]:}
% If in a .fmt file, print the version number
@@ -69,7 +70,7 @@
% Avoid using \@M directly, because that causes trouble
% if the definition is written into an index file.
\global\let\tiepenalty = \@M
\gdef\tie{\lvvmode\penalty\tiepenalty\ }
\gdef\tie{\leavevmode\penalty\tiepenalty\ }
}
\let\~ = \tie % And make it available as @~.
@@ -536,17 +537,34 @@ where each line of input produces a line of output.}
\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
\leftline{\hskip\leftskip{\rm#1}}}}
% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
\def\inmargin#1{%
\strut\vadjust{\nobreak\kern-\strutdepth
\vtop to \strutdepth{\baselineskip\strutdepth\vss
\llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
\newskip\inmarginspacing \inmarginspacing=1cm
\def\strutdepth{\dp\strutbox}
%\hbox{{\rm#1}}\hfil\break}}
% @include file insert text of that file as input.
\def\include{\parsearg\includezzz}
%Use \input\thisfile to avoid blank after \input, which may be an active
%char (in which case the blank would become the \input argument).
%The grouping keeps the value of \thisfile correct even when @include
%is nested.
\def\includezzz #1{\begingroup
\def\thisfile{#1}\input\thisfile
% Allow normal characters that we make active in the argument (a file name).
\def\include{\begingroup
\catcode`\\=12
\catcode`~=12
\catcode`^=12
\catcode`_=12
\catcode`|=12
\catcode`<=12
\catcode`>=12
\catcode`+=12
\parsearg\includezzz}
% Restore active chars for included file.
\def\includezzz#1{\endgroup\begingroup
% Read the included file in a group so nested @include's work.
\def\thisfile{#1}%
\input\thisfile
\endgroup}
\def\thisfile{}
@@ -631,6 +649,15 @@ where each line of input produces a line of output.}
\let\printindex = \relax
\let\pxref = \relax
\let\settitle = \relax
\let\setchapternewpage = \relax
\let\setchapterstyle = \relax
\let\everyheading = \relax
\let\evenheading = \relax
\let\oddheading = \relax
\let\everyfooting = \relax
\let\evenfooting = \relax
\let\oddfooting = \relax
\let\headings = \relax
\let\include = \relax
\let\lowersections = \relax
\let\down = \relax
@@ -654,6 +681,11 @@ where each line of input produces a line of output.}
\def\menu{\doignore{menu}}
\def\direntry{\doignore{direntry}}
% @dircategory CATEGORY -- specify a category of the dir file
% which this file should belong to. Ignore this in TeX.
\def\dircategory{\comment}
% Ignore text until a line `@end #1'.
%
\def\doignore#1{\begingroup
@@ -689,7 +721,7 @@ where each line of input produces a line of output.}
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
\immediate\write16{ to use a workaround.}
\immediate\write16{}
\warnedobstrue
\global\warnedobstrue
\fi
}
@@ -765,15 +797,17 @@ where each line of input produces a line of output.}
% Since we want to separate VAR from REST-OF-LINE (which might be
% empty), we can't just use \parsearg; we have to insert a space of our
% own to delimit the rest of the line, and then take it out again if we
% didn't need it.
% didn't need it. Make sure the catcode of space is correct to avoid
% losing inside @example, for instance.
%
\def\set{\parsearg\setxxx}
\def\set{\begingroup\catcode` =10 \parsearg\setxxx}
\def\setxxx#1{\setyyy#1 \endsetyyy}
\def\setyyy#1 #2\endsetyyy{%
\def\temp{#2}%
\ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
\else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
\fi
\endgroup
}
% Can't use \xdef to pre-expand #2 and save some time, since \temp or
% \next or other control sequences that we've defined might get us into
@@ -910,6 +944,21 @@ where each line of input produces a line of output.}
\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
node \samp{\ignorespaces#1{}}}
\def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
\def\macroxxx#1#2 \end macro{%
\expandafter\gdef\macrotemp#1{#2}%
\endgroup}
%\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
%\def\linemacroxxx#1#2 \end linemacro{%
%\let\parsearg=\relax
%\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
%\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
%\expandafter\gdef\macrotempx#1{#2}%
%\endgroup}
%\def\butfirst#1{}
\message{fonts,}
% Font-change commands.
@@ -920,12 +969,16 @@ where each line of input produces a line of output.}
\def\sf{\fam=\sffam \tensf}
\let\li = \sf % Sometimes we call it \li, not \sf.
% We don't need math for this one.
\def\ttsl{\tenttsl}
%% Try out Computer Modern fonts at \magstephalf
\let\mainmagstep=\magstephalf
% Set the font macro #1 to the font named #2, adding on the
% specified font prefix (normally `cm').
\def\setfont#1#2{\font#1=\fontprefix#2}
% #3 is the font's design size, #4 is a scale factor
\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
% Use cm as the default font prefix.
% To specify the font prefix, you must define \fontprefix
@@ -933,29 +986,46 @@ where each line of input produces a line of output.}
\ifx\fontprefix\undefined
\def\fontprefix{cm}
\fi
% Support font families that don't use the same naming scheme as CM.
\def\rmshape{r}
\def\rmbshape{bx} %where the normal face is bold
\def\bfshape{b}
\def\bxshape{bx}
\def\ttshape{tt}
\def\ttbshape{tt}
\def\ttslshape{sltt}
\def\itshape{ti}
\def\itbshape{bxti}
\def\slshape{sl}
\def\slbshape{bxsl}
\def\sfshape{ss}
\def\sfbshape{ss}
\def\scshape{csc}
\def\scbshape{csc}
\ifx\bigger\relax
\let\mainmagstep=\magstep1
\setfont\textrm{r12}
\setfont\texttt{tt12}
\setfont\textrm\rmshape{12}{1000}
\setfont\texttt\ttshape{12}{1000}
\else
\setfont\textrm{r10 scaled \mainmagstep}
\setfont\texttt{tt10 scaled \mainmagstep}
\setfont\textrm\rmshape{10}{\mainmagstep}
\setfont\texttt\ttshape{10}{\mainmagstep}
\fi
% Instead of cmb10, you many want to use cmbx10.
% cmbx10 is a prettier font on its own, but cmb10
% looks better when embedded in a line with cmr10.
\setfont\textbf{b10 scaled \mainmagstep}
\setfont\textit{ti10 scaled \mainmagstep}
\setfont\textsl{sl10 scaled \mainmagstep}
\setfont\textsf{ss10 scaled \mainmagstep}
\setfont\textsc{csc10 scaled \mainmagstep}
\setfont\textbf\bfshape{10}{\mainmagstep}
\setfont\textit\itshape{10}{\mainmagstep}
\setfont\textsl\slshape{10}{\mainmagstep}
\setfont\textsf\sfshape{10}{\mainmagstep}
\setfont\textsc\scshape{10}{\mainmagstep}
\setfont\textttsl\ttslshape{10}{\mainmagstep}
\font\texti=cmmi10 scaled \mainmagstep
\font\textsy=cmsy10 scaled \mainmagstep
% A few fonts for @defun, etc.
\setfont\defbf{bx10 scaled \magstep1} %was 1314
\setfont\deftt{tt10 scaled \magstep1}
\setfont\defbf\bxshape{10}{\magstep1} %was 1314
\setfont\deftt\ttshape{10}{\magstep1}
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
% Fonts for indices and small examples.
@@ -963,66 +1033,70 @@ where each line of input produces a line of output.}
% because texinfo normally uses the slanted fonts for that.
% Do not make many font distinctions in general in the index, since they
% aren't very useful.
\setfont\ninett{tt9}
\setfont\indrm{r9}
\setfont\indit{sl9}
\setfont\ninett\ttshape{9}{1000}
\setfont\indrm\rmshape{9}{1000}
\setfont\indit\slshape{9}{1000}
\let\indsl=\indit
\let\indtt=\ninett
\let\indttsl=\ninett
\let\indsf=\indrm
\let\indbf=\indrm
\setfont\indsc{csc10 at 9pt}
\setfont\indsc\scshape{10}{900}
\font\indi=cmmi9
\font\indsy=cmsy9
% Fonts for headings
\setfont\chaprm{bx12 scaled \magstep2}
\setfont\chapit{ti12 scaled \magstep2}
\setfont\chapsl{sl12 scaled \magstep2}
\setfont\chaptt{tt12 scaled \magstep2}
\setfont\chapsf{ss12 scaled \magstep2}
\setfont\chaprm\rmbshape{12}{\magstep2}
\setfont\chapit\itbshape{10}{\magstep3}
\setfont\chapsl\slbshape{10}{\magstep3}
\setfont\chaptt\ttbshape{12}{\magstep2}
\setfont\chapttsl\ttslshape{10}{\magstep3}
\setfont\chapsf\sfbshape{12}{\magstep2}
\let\chapbf=\chaprm
\setfont\chapsc{csc10 scaled\magstep3}
\setfont\chapsc\scbshape{10}{\magstep3}
\font\chapi=cmmi12 scaled \magstep2
\font\chapsy=cmsy10 scaled \magstep3
\setfont\secrm{bx12 scaled \magstep1}
\setfont\secit{ti12 scaled \magstep1}
\setfont\secsl{sl12 scaled \magstep1}
\setfont\sectt{tt12 scaled \magstep1}
\setfont\secsf{ss12 scaled \magstep1}
\setfont\secbf{bx12 scaled \magstep1}
\setfont\secsc{csc10 scaled\magstep2}
\setfont\secrm\rmbshape{12}{\magstep1}
\setfont\secit\itbshape{10}{\magstep2}
\setfont\secsl\slbshape{10}{\magstep2}
\setfont\sectt\ttbshape{12}{\magstep1}
\setfont\secttsl\ttslshape{10}{\magstep2}
\setfont\secsf\sfbshape{12}{\magstep1}
\let\secbf\secrm
\setfont\secsc\scbshape{10}{\magstep2}
\font\seci=cmmi12 scaled \magstep1
\font\secsy=cmsy10 scaled \magstep2
% \setfont\ssecrm{bx10 scaled \magstep1} % This size an font looked bad.
% \setfont\ssecit{cmti10 scaled \magstep1} % The letters were too crowded.
% \setfont\ssecsl{sl10 scaled \magstep1}
% \setfont\ssectt{tt10 scaled \magstep1}
% \setfont\ssecsf{ss10 scaled \magstep1}
% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
% \setfont\ssecsl\slshape{10}{\magstep1}
% \setfont\ssectt\ttshape{10}{\magstep1}
% \setfont\ssecsf\sfshape{10}{\magstep1}
%\setfont\ssecrm{b10 scaled 1315} % Note the use of cmb rather than cmbx.
%\setfont\ssecit{ti10 scaled 1315} % Also, the size is a little larger than
%\setfont\ssecsl{sl10 scaled 1315} % being scaled magstep1.
%\setfont\ssectt{tt10 scaled 1315}
%\setfont\ssecsf{ss10 scaled 1315}
%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
%\setfont\ssectt\ttshape{10}{1315}
%\setfont\ssecsf\sfshape{10}{1315}
%\let\ssecbf=\ssecrm
\setfont\ssecrm{bx12 scaled \magstephalf}
\setfont\ssecit{ti12 scaled \magstephalf}
\setfont\ssecsl{sl12 scaled \magstephalf}
\setfont\ssectt{tt12 scaled \magstephalf}
\setfont\ssecsf{ss12 scaled \magstephalf}
\setfont\ssecbf{bx12 scaled \magstephalf}
\setfont\ssecsc{csc10 scaled \magstep1}
\setfont\ssecrm\rmbshape{12}{\magstephalf}
\setfont\ssecit\itbshape{10}{1315}
\setfont\ssecsl\slbshape{10}{1315}
\setfont\ssectt\ttbshape{12}{\magstephalf}
\setfont\ssecttsl\ttslshape{10}{\magstep1}
\setfont\ssecsf\sfbshape{12}{\magstephalf}
\let\ssecbf\ssecrm
\setfont\ssecsc\scbshape{10}{\magstep1}
\font\sseci=cmmi12 scaled \magstephalf
\font\ssecsy=cmsy10 scaled \magstep1
% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
% but that is not a standard magnification.
% Fonts for title page:
\setfont\titlerm{bx12 scaled \magstep3}
\setfont\titlerm\rmbshape{12}{\magstep3}
\let\authorrm = \secrm
% In order for the font changes to affect most math symbols and letters,
@@ -1041,33 +1115,33 @@ where each line of input produces a line of output.}
% The font-changing commands redefine the meanings of \tenSTYLE, instead
% of just \STYLE. We do this so that font changes will continue to work
% in math mode, where it is the current \fam that is relevant in most
% cases, not the current. Plain TeX does, for example,
% \def\bf{\fam=\bffam \tenbf} By redefining \tenbf, we obviate the need
% to redefine \bf itself.
% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
% \tenbf}, for example. By redefining \tenbf, we obviate the need to
% redefine \bf itself.
\def\textfonts{%
\let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
\let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
\let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
\let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
\resetmathfonts}
\def\chapfonts{%
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
\let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
\let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
\resetmathfonts}
\def\secfonts{%
\let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
\let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
\let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
\let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
\resetmathfonts}
\def\subsecfonts{%
\let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
\let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
\let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
\let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
\resetmathfonts}
\def\indexfonts{%
\let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
\let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
\let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
\let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
\resetmathfonts}
% Set up the default fonts, so we can use them for creating boxes.
@@ -1078,9 +1152,9 @@ where each line of input produces a line of output.}
\newcount\fontdepth \fontdepth=0
% Fonts for short table of contents.
\setfont\shortcontrm{r12}
\setfont\shortcontbf{bx12}
\setfont\shortcontsl{sl12}
\setfont\shortcontrm\rmshape{12}{1000}
\setfont\shortcontbf\bxshape{12}{1000}
\setfont\shortcontsl\slshape{12}{1000}
%% Add scribe-like font environments, plus @l for inline lisp (usually sans
%% serif) and @ii for TeX italic
@@ -1112,10 +1186,11 @@ where each line of input produces a line of output.}
}
\let\ttfont=\t
\def\samp #1{`\tclose{#1}'\null}
\def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
\let\file=\samp
\let\url=\samp % perhaps include a hypertex \special eventually
% @code is a modification of @t,
% which makes spaces the same size as normal in the surrounding text.
@@ -1141,7 +1216,7 @@ where each line of input produces a line of output.}
}
% We *must* turn on hyphenation at `-' and `_' in \code.
% Otherwise, it is too hard to avoid overful hboxes
% Otherwise, it is too hard to avoid overfull hboxes
% in the Emacs manual, the Library manual, etc.
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
@@ -1170,12 +1245,19 @@ where each line of input produces a line of output.}
% @kbd is like @code, except that if the argument is just one @key command,
% then @kbd has no effect.
%
\def\xkey{\key}
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
\ifx\one\xkey\ifx\threex\three \key{#2}%
\else\tclose{\look}\fi
\else\tclose{\look}\fi}
\else{\tclose{\ttsl\look}}\fi
\else{\tclose{\ttsl\look}}\fi}
% Check if we are currently using a typewriter font. Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
% this property, we can check that font parameter.
%
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
% argument is to make the input look right: @dmn{pt} instead of
@@ -1440,7 +1522,7 @@ July\or August\or September\or October\or November\or December\fi
\newif\ifitemxneedsnegativevskip
\def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi}
\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
\def\internalBitem{\smallbreak \parsearg\itemzzz}
\def\internalBitemx{\itemxpar \parsearg\itemzzz}
@@ -1711,10 +1793,10 @@ July\or August\or September\or October\or November\or December\fi
\flushcr}
% @multitable macros
% Amy Hendrickson, 8/18/94
% Amy Hendrickson, 8/18/94, 3/6/96
%
% @multitable ... @endmultitable will make as many columns as desired.
% Contents of each column will wrap at width given in preamble. Width
% @multitable ... @end multitable will make as many columns as desired.
% Contents of each column will wrap at width given in preamble. Width
% can be specified either with sample text given in a template line,
% or in percent of \hsize, the current width of text on page.
@@ -1723,10 +1805,10 @@ July\or August\or September\or October\or November\or December\fi
% To make preamble:
%
% Either define widths of columns in terms of percent of \hsize:
% @multitable @percentofhsize .2 .3 .5
% @multitable @columnfractions .25 .3 .45
% @item ...
%
% Numbers following @percentofhsize are the percent of the total
% Numbers following @columnfractions are the percent of the total
% current hsize to be used for each column. You may use as many
% columns as desired.
@@ -1734,7 +1816,16 @@ July\or August\or September\or October\or November\or December\fi
% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
% @item ...
% using the widest term desired in each column.
%
% For those who want to use more than one line's worth of words in
% the preamble, break the line within one argument and it
% will parse correctly, i.e.,
%
% @multitable {Column 1 template} {Column 2 template} {Column 3
% template}
% Not:
% @multitable {Column 1 template} {Column 2 template}
% {Column 3 template}
% Each new table line starts with @item, each subsequent new column
% starts with @tab. Empty columns may be produced by supplying @tab's
@@ -1759,71 +1850,84 @@ July\or August\or September\or October\or November\or December\fi
%
% They will wrap at the width determined by the template.
% @item@tab@tab This will be in third column.
% @endmultitable
% @end multitable
% Default dimensions may be reset by user.
% @intableparskip will set vertical space between paragraphs in table.
% @intableparindent will set paragraph indent in table.
% @spacebetweencols will set horizontal space to be left between columns.
% @spacebetweenlines will set vertical space to be left between lines.
% @multitableparskip is vertical space between paragraphs in table.
% @multitableparindent is paragraph indent in table.
% @multitablecolmargin is horizontal space to be left between columns.
% @multitablelinespace is space to leave between table items;
% 0 means it depends on current normal line spacing.
%%%%
% Dimensions
\newdimen\intableparskip
\newdimen\intableparindent
\newdimen\spacebetweencols
\newdimen\spacebetweenlines
\intableparskip=0pt
\intableparindent=6pt
\spacebetweencols=12pt
\spacebetweenlines=12pt
\newskip\multitableparskip
\newskip\multitableparindent
\newdimen\multitablecolspace
\newskip\multitablelinespace
\multitableparskip=0pt
\multitableparindent=6pt
\multitablecolspace=12pt
\multitablelinespace=0pt
%%%%
% Macros used to set up halign preamble:
\let\endsetuptable\relax
\def\xendsetuptable{\endsetuptable}
\let\percentofhsize\relax
\def\xpercentofhsize{\percentofhsize}
\let\columnfractions\relax
\def\xcolumnfractions{\columnfractions}
\newif\ifsetpercent
%% 2/1/96, to allow fractions to be given with more than one digit.
\def\pickupwholefraction#1 {\global\advance\colcount by1 %
\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
\setuptable}
\newcount\colcount
\def\setuptable#1{\def\firstarg{#1}%
\ifx\firstarg\xendsetuptable\let\go\relax%
\else
\ifx\firstarg\xpercentofhsize\global\setpercenttrue%
\ifx\firstarg\xcolumnfractions\global\setpercenttrue%
\else
\ifsetpercent
\if#1.\else%
\global\advance\colcount by1 %
\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
\fi
\let\go\pickupwholefraction % In this case arg of setuptable
% is the decimal point before the
% number given in percent of hsize.
% We don't need this so we don't use it.
\else
\global\advance\colcount by1
\setbox0=\hbox{#1}%
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
\fi%
\fi%
\let\go\setuptable%
\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
\fi\go}
%%%%
% multitable syntax
\def\tab{&}
\def\tab{&\hskip1sp\relax} % 2/2/96
% tiny skip here makes sure this column space is
% maintained, even if it is never used.
%%%%
% @multitable ... @endmultitable definitions:
% @multitable ... @end multitable definitions:
\def\multitable#1\item{\bgroup
\def\multitable{\parsearg\dotable}
\def\dotable#1{\bgroup
\let\item\cr
\tolerance=9500
\hbadness=9500
\parskip=\intableparskip
\parindent=\intableparindent
\setmultitablespacing
\parskip=\multitableparskip
\parindent=\multitableparindent
\overfullrule=0pt
\global\colcount=0\relax%
\def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
% To parse everything between @multitable and @item :
\def\one{#1}\expandafter\setuptable\one\endsetuptable
\setuptable#1 \endsetuptable
% Need to reset this to 0 after \setuptable.
\global\colcount=0\relax%
%
@@ -1834,9 +1938,9 @@ July\or August\or September\or October\or November\or December\fi
\halign\bgroup&\global\advance\colcount by 1\relax%
\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
% In order to keep entries from bumping into each other
% we will add a \leftskip of \spacebetweencols to all columns after
% we will add a \leftskip of \multitablecolspace to all columns after
% the first one.
% If a template has been used, we will add \spacebetweencols
% If a template has been used, we will add \multitablecolspace
% to the width of each template entry.
% If user has set preamble in terms of percent of \hsize
% we will use that dimension as the width of the column, and
@@ -1848,21 +1952,42 @@ July\or August\or September\or October\or November\or December\fi
\ifsetpercent
\else
% If user has <not> set preamble in terms of percent of \hsize
% we will advance \hsize by \spacebetweencols
\advance\hsize by \spacebetweencols
% we will advance \hsize by \multitablecolspace
\advance\hsize by \multitablecolspace
\fi
% In either case we will make \leftskip=\spacebetweencols:
\leftskip=\spacebetweencols
% In either case we will make \leftskip=\multitablecolspace:
\leftskip=\multitablecolspace
\fi
\noindent##}\cr%
\noindent##%\par
%\vskip\multitablelinespace
}\cr%
% \everycr will reset column counter, \colcount, at the end of
% each line. Every column entry will cause \colcount to advance by one.
% The table preamble
% looks at the current \colcount to find the correct column width.
\global\everycr{\noalign{\nointerlineskip\vskip\spacebetweenlines
\global\everycr{\noalign{\nointerlineskip\vskip\multitablelinespace
\filbreak%% keeps underfull box messages off when table breaks over pages.
\global\colcount=0\relax}}}
\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
% If so, do nothing. If not, give it an appropriate dimension based on
% current baselineskip.
\ifdim\multitablelinespace=0pt
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
\global\advance\multitablelinespace by-\ht0\fi
%% Test to see if parskip is larger than space between lines of
%% table. If not, do nothing.
%% If so, set to same dimension as multitablelinespace.
\ifdim\multitableparskip>\multitablelinespace
\global\multitableparskip=\multitablelinespace
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
%% than skip between lines in the table.
\fi%
\ifdim\multitableparskip=0pt
\global\multitableparskip=\multitablelinespace
\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
%% than skip between lines in the table.
\fi}
\message{indexing,}
% Index generation facilities
@@ -3847,7 +3972,7 @@ July\or August\or September\or October\or November\or December\fi
\setbox0=\hbox{\printednodename}%
\ifdim \wd0 = 0pt
% No printed node name was explicitly given.
\ifx\SETxref-automatic-section-title\thisisundefined
\expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
% Use the node name inside the square brackets.
\def\printednodename{\ignorespaces #1}%
\else
@@ -4250,11 +4375,13 @@ July\or August\or September\or October\or November\or December\fi
}
% Allow control of the text dimensions. Parameters in order: textheight;
% textwidth; \voffset; \hoffset (!); binding offset. All require a dimension;
% textwidth; voffset; hoffset; binding offset; topskip.
% All require a dimension;
% header is additional; added length extends the bottom of the page.
\def\changepagesizes#1#2#3#4#5{
\def\changepagesizes#1#2#3#4#5#6{
\global\vsize= #1
\global\topskip= #6
\advance\vsize by \topskip
\global\voffset= #3
\global\hsize= #2
@@ -4267,13 +4394,20 @@ July\or August\or September\or October\or November\or December\fi
\global\normaloffset= #4
\global\bindingoffset= #5}
% This layout is compatible with Latex on A4 paper.
\def\afourlatex{\changepagesizes{22cm}{15cm}{7mm}{4.6mm}{5mm}}
% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
\def\afourlatex
{\global\tolerance=700
\global\hfuzz=1pt
\setleading{12pt}
\global\parskip 15pt plus 1pt
\advance\baselineskip by 1.6pt
\changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
}
% Use @afourwide to print on European A4 paper in wide format.
\def\afourwide{\afourpaper
\changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}}
\changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
% Define macros to output various characters with catcode for normal text.
\catcode`\"=\other
@@ -4322,14 +4456,7 @@ July\or August\or September\or October\or November\or December\fi
\catcode`\_=\active
\def_{\ifusingtt\normalunderscore\_}
% Subroutine for the previous macro.
\def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
% \lvvmode is equivalent in function to \leavevmode.
% Using \leavevmode runs into trouble when written out to
% an index file due to the expansion of \leavevmode into ``\unhbox
% \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
% magic tricks with @.
\def\lvvmode{\vbox to 0pt{}}
\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
\catcode`\|=\active
\def|{{\tt \char '174}}

View File

@@ -26,31 +26,31 @@
@ifinfo
@format
START-INFO-DIR-ENTRY
* Text utilities: (textutils). GNU text utilities.
* cat: (textutils)cat invocation. Concatenate and write files.
* cksum: (textutils)cksum invocation. Print @sc{POSIX} CRC checksum.
* comm: (textutils)comm invocation. Compare sorted files by line.
* csplit: (textutils)csplit invocation. Split by context.
* cut: (textutils)cut invocation. Print selected parts of lines.
* expand: (textutils)expand invocation. Convert tabs to spaces.
* fmt: (textutils)fmt invocation. Reformat paragraph text.
* fold: (textutils)fold invocation. Wrap long input lines.
* head: (textutils)head invocation. Output the first part of files.
* join: (textutils)join invocation. Join lines on a common field.
* md5sum: (textutils)md5sum invocation. Print or check message-digests.
* nl: (textutils)nl invocation. Number lines and write files.
* od: (textutils)od invocation. Dump files in octal, etc.
* paste: (textutils)paste invocation. Merge lines of files.
* pr: (textutils)pr invocation. Paginate or columnate files.
* sort: (textutils)sort invocation. Sort text files.
* split: (textutils)split invocation. Split into fixed-size pieces.
* sum: (textutils)sum invocation. Print traditional checksum.
* tac: (textutils)tac invocation. Reverse files.
* tail: (textutils)tail invocation. Output the last part of files.
* tr: (textutils)tr invocation. Translate characters.
* unexpand: (textutils)unexpand invocation. Convert spaces to tabs.
* uniq: (textutils)uniq invocation. Uniqify files.
* wc: (textutils)wc invocation. Byte, word, and line counts.
* Text utilities: (textutils). GNU text utilities.
* cat: (textutils)cat invocation. Concatenate and write files.
* cksum: (textutils)cksum invocation. Print @sc{POSIX} CRC checksum.
* comm: (textutils)comm invocation. Compare sorted files by line.
* csplit: (textutils)csplit invocation. Split by context.
* cut: (textutils)cut invocation. Print selected parts of lines.
* expand: (textutils)expand invocation. Convert tabs to spaces.
* fmt: (textutils)fmt invocation. Reformat paragraph text.
* fold: (textutils)fold invocation. Wrap long input lines.
* head: (textutils)head invocation. Output the first part of files.
* join: (textutils)join invocation. Join lines on a common field.
* md5sum: (textutils)md5sum invocation. Print or check message-digests.
* nl: (textutils)nl invocation. Number lines and write files.
* od: (textutils)od invocation. Dump files in octal, etc.
* paste: (textutils)paste invocation. Merge lines of files.
* pr: (textutils)pr invocation. Paginate or columnate files.
* sort: (textutils)sort invocation. Sort text files.
* split: (textutils)split invocation. Split into fixed-size pieces.
* sum: (textutils)sum invocation. Print traditional checksum.
* tac: (textutils)tac invocation. Reverse files.
* tail: (textutils)tail invocation. Output the last part of files.
* tr: (textutils)tr invocation. Translate characters.
* unexpand: (textutils)unexpand invocation. Convert spaces to tabs.
* uniq: (textutils)uniq invocation. Uniqify files.
* wc: (textutils)wc invocation. Byte, word, and line counts.
END-INFO-DIR-ENTRY
@end format
@end ifinfo
@@ -58,7 +58,7 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the GNU text utilities.
Copyright (C) 1994, 95 Free Software Foundation, Inc.
Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -85,12 +85,12 @@ by the Foundation.
@titlepage
@title GNU @code{textutils}
@subtitle A set of text utilities
@subtitle for version @value{VERSION}, @value{RELEASEDATE}
@subtitle for version @value{VERSION}, @value{UPDATED}
@author David MacKenzie et al.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1994, 95 Free Software Foundation, Inc.
Copyright @copyright{} 1994, 95, 96 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -733,7 +733,7 @@ address.
These commands reformat the contents of files.
@menu
* fmt invocation:: Reformat paragraph text.
* fmt invocation:: Reformat paragraph text.
* pr invocation:: Paginate or columnate files for printing.
* fold invocation:: Wrap input lines to fit in specified width.
@end menu
@@ -827,7 +827,7 @@ room to balance line lengths.
@item -p @var{prefix}
@itemx --prefix=@var{prefix}
Only lines beginning with @var{prefix} (possibly preceded by whitespace)
are subject to formatting. The prefix and any preceding whitespace is
are subject to formatting. The prefix and any preceding whitespace are
stripped for the formatting and then re-attached to each formatted output
line. One use is to format certain kinds of program comments, while
leaving the code unchanged.
@@ -1407,7 +1407,7 @@ contents of files.
* wc invocation:: Print byte, word, and line counts.
* sum invocation:: Print checksum and block counts.
* cksum invocation:: Print CRC checksum and byte counts.
* md5sum invocation:: Print or check message-digests.
* md5sum invocation:: Print or check message-digests.
@end menu
@@ -1772,8 +1772,8 @@ like @code{1.0e-34} and @code{10e100}. Use this option only if there
is no alternative; it is much slower than @samp{-n} and numbers with
too many significant digits will be compared as if they had been
truncated. In addition, numbers outside the range of representable
double precision floating point numbers are treated as if they were zeroes.
@c FIXME: Someday there will be an option to warn about underflow and overflow.
double precision floating point numbers are treated as if they were
zeroes; overflow and underflow are not reported.
@item -i
@opindex -i
@@ -1796,6 +1796,21 @@ Sort numerically: the number begins each line; specifically, it consists
of optional whitespace, an optional @samp{-} sign, and zero or more
digits, optionally followed by a decimal point and zero or more digits.
@code{sort -n} uses what might be considered an unconventional method
to compare strings representing floating point numbers. Rather than
first converting each string to the C @code{double} type and then
comparing those values, sort aligns the decimal points in the two
strings and compares the strings a character at a time. One benefit
of using this approach is its speed. In practice this is much more
efficient than performing the two corresponding string-to-double (or even
string-to-integer) conversions and then comparing doubles. In addition,
there is no corresponding loss of precision. Converting each string to
@code{double} before comparison would limit precision to about 16 digits
on most systems.
Neither a leading @samp{+} nor exponential notation is recognized.
To compare such strings numerically, use the @samp{-g} option.
@item -r
@opindex -r
@cindex reverse sorting
@@ -2739,8 +2754,8 @@ ones, to tabs.
@end table
@c What's GNU?
@c Arnold Robbins
@c What's GNU?
@c Arnold Robbins
@node Opening the software toolbox
@chapter Opening the software toolbox

View File

@@ -1,14 +1,14 @@
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = fu
EXTRA_DIST = alloca.c euidaccess.c fnmatch.c fsusage.c ftruncate.c \
getdate.y getopt.c getopt1.c memcmp.c memcpy.c memset.c \
mkdir.c mktime.c mountlist.c \
posixtm.y rename.c rmdir.c stpcpy.c strdup.c strstr.c strtol.c strtoul.c
EXTRA_DIST = alloca.c basename.c euidaccess.c fnmatch.c fsusage.c \
ftruncate.c getdate.y getopt.c getopt1.c memcmp.c memcpy.c memset.c \
mkdir.c mktime.c mountlist.c posixtm.y rename.c rmdir.c \
stpcpy.c strcasecmp.c strdup.c strndup.c strstr.c strtol.c strtoul.c
INCLUDES = -I.. -I$(srcdir)
fu_SOURCES = getdate.c posixtm.c argmatch.c backupfile.c basename.c \
fu_SOURCES = getdate.c getline.c posixtm.c argmatch.c backupfile.c \
dirname.c error.c fileblocks.c filemode.c \
full-write.c getversion.c group-member.c idcache.c \
isdir.c long-options.c makepath.c modechange.c obstack.c \
@@ -18,14 +18,14 @@ xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
fu_LIBADD = @LIBOBJS@ @ALLOCA@
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
getopt.h group-member.h long-options.h makepath.h modechange.h mountlist.h \
obstack.h pathmax.h save-cwd.h xstrtol.h xstrtoul.h
getline.h getopt.h group-member.h long-options.h makepath.h modechange.h \
mountlist.h obstack.h pathmax.h save-cwd.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
# Since this directory contains two parsers, we have to be careful to avoid
# running two $(YACC)s during parallel makes. See below.
getdate.c: getdate.y
getdate.c: @MAINT@getdate.y
@echo expect 10 shift/reduce conflicts
$(YACC) $(srcdir)/getdate.y
mv y.tab.c getdate.c
@@ -34,7 +34,7 @@ getdate.c: getdate.y
# The artificial dependency on getdate.c keeps the two parsers from being
# built in parallel. Enforcing this little bit of sequentiality lets
# everyone (even those without bison) still run mostly parallel builds.
posixtm.c: posixtm.y getdate.c
posixtm.c: @MAINT@posixtm.y getdate.c
$(YACC) $(srcdir)/posixtm.y
mv y.tab.c posixtm.tab.c
sed -e 's/yy/zz/g' posixtm.tab.c > tposixtm.c

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 0.31 from Makefile.am
# Makefile.in generated automatically by automake 1.0 from Makefile.am
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -40,14 +40,14 @@ transform = @program_transform_name@
noinst_LIBRARIES = fu
EXTRA_DIST = alloca.c euidaccess.c fnmatch.c fsusage.c ftruncate.c \
getdate.y getopt.c getopt1.c memcmp.c memcpy.c memset.c \
mkdir.c mktime.c mountlist.c \
posixtm.y rename.c rmdir.c stpcpy.c strdup.c strstr.c strtol.c strtoul.c
EXTRA_DIST = alloca.c basename.c euidaccess.c fnmatch.c fsusage.c \
ftruncate.c getdate.y getopt.c getopt1.c memcmp.c memcpy.c memset.c \
mkdir.c mktime.c mountlist.c posixtm.y rename.c rmdir.c \
stpcpy.c strcasecmp.c strdup.c strndup.c strstr.c strtol.c strtoul.c
INCLUDES = -I.. -I$(srcdir)
fu_SOURCES = getdate.c posixtm.c argmatch.c backupfile.c basename.c \
fu_SOURCES = getdate.c getline.c posixtm.c argmatch.c backupfile.c \
dirname.c error.c fileblocks.c filemode.c \
full-write.c getversion.c group-member.c idcache.c \
isdir.c long-options.c makepath.c modechange.c obstack.c \
@@ -57,10 +57,11 @@ xmalloc.c xstrdup.c xstrtol.c xstrtoul.c yesno.c
fu_LIBADD = @LIBOBJS@ @ALLOCA@
noinst_HEADERS = argmatch.h backupfile.h error.h fnmatch.h fsusage.h \
getopt.h group-member.h long-options.h makepath.h modechange.h mountlist.h \
obstack.h pathmax.h save-cwd.h xstrtol.h xstrtoul.h
getline.h getopt.h group-member.h long-options.h makepath.h modechange.h \
mountlist.h obstack.h pathmax.h save-cwd.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
mkinstalldirs = $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
LIBRARIES = $(noinst_LIBRARIES)
@@ -78,19 +79,18 @@ LIBS = @LIBS@
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(LDFLAGS) -o $@
fu_OBJECTS = getdate.o posixtm.o argmatch.o backupfile.o basename.o \
fu_OBJECTS = getdate.o getline.o posixtm.o argmatch.o backupfile.o \
dirname.o error.o fileblocks.o filemode.o full-write.o getversion.o \
group-member.o idcache.o isdir.o long-options.o makepath.o modechange.o \
obstack.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
EXTRA_fu_SOURCES =
LIBFILES = libfu.a
AR = ar
RANLIB = @RANLIB@
HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in alloca.c fileblocks.c fnmatch.c \
fsusage.c ftruncate.c mountlist.c
DIST_COMMON = Makefile.am Makefile.in
PACKAGE = @PACKAGE@
@@ -100,13 +100,33 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) $(DATA)
DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA)
TAR = tar
DEP_FILES = $(srcdir)/.deps/alloca.P $(srcdir)/.deps/argmatch.P \
$(srcdir)/.deps/backupfile.P $(srcdir)/.deps/dirname.P \
$(srcdir)/.deps/error.P $(srcdir)/.deps/fileblocks.P \
$(srcdir)/.deps/filemode.P $(srcdir)/.deps/fnmatch.P \
$(srcdir)/.deps/fsusage.P $(srcdir)/.deps/ftruncate.P \
$(srcdir)/.deps/full-write.P $(srcdir)/.deps/getdate.P \
$(srcdir)/.deps/getline.P $(srcdir)/.deps/getopt.P \
$(srcdir)/.deps/getopt1.P $(srcdir)/.deps/getversion.P \
$(srcdir)/.deps/group-member.P $(srcdir)/.deps/idcache.P \
$(srcdir)/.deps/isdir.P $(srcdir)/.deps/long-options.P \
$(srcdir)/.deps/makepath.P $(srcdir)/.deps/modechange.P \
$(srcdir)/.deps/mountlist.P $(srcdir)/.deps/obstack.P \
$(srcdir)/.deps/posixtm.P $(srcdir)/.deps/safe-read.P \
$(srcdir)/.deps/save-cwd.P $(srcdir)/.deps/savedir.P \
$(srcdir)/.deps/stripslash.P $(srcdir)/.deps/userspec.P \
$(srcdir)/.deps/xgetcwd.P $(srcdir)/.deps/xmalloc.P \
$(srcdir)/.deps/xstrdup.P $(srcdir)/.deps/xstrtol.P \
$(srcdir)/.deps/xstrtoul.P $(srcdir)/.deps/yesno.P
SOURCES = $(fu_SOURCES)
OBJECTS = $(fu_OBJECTS)
default: all
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in
$(srcdir)/Makefile.in: @MAINT@Makefile.am $(top_srcdir)/configure.in
cd $(top_srcdir) && automake $(subdir)/Makefile
Makefile: $(top_builddir)/config.status Makefile.in
@@ -141,11 +161,11 @@ libfu.a: $(fu_OBJECTS) $(fu_LIBADD)
$(RANLIB) libfu.a
ID: $(HEADERS) $(SOURCES)
here=`pwd` && cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS)
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
tags: TAGS
TAGS:
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
here=`pwd` && cd $(srcdir) && etags $(ETAGS_ARGS) $(SOURCES) $(HEADERS) -o $$here/TAGS
mostlyclean-tags:
@@ -159,49 +179,39 @@ maintainer-clean-tags:
subdir = lib
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist: $(DEP_DISTFILES)
distdir: $(DEP_DISTFILES)
@for file in `cd $(srcdir) && echo $(DISTFILES)`; do \
test -f $(distdir)/$$file \
|| ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir)/$$file; \
done
alloca.o: alloca.c
argmatch.o: argmatch.c
backupfile.o: backupfile.c backupfile.h
basename.o: basename.c
dirname.o: dirname.c
error.o: error.c
fileblocks.o: fileblocks.c
filemode.o: filemode.c
fnmatch.o: fnmatch.c
fsusage.o: fsusage.c fsusage.h
ftruncate.o: ftruncate.c
full-write.o: full-write.c
getdate.o: getdate.c
getopt.o: getopt.c
getopt1.o: getopt1.c getopt.h
getversion.o: getversion.c backupfile.h
group-member.o: group-member.c group-member.h
idcache.o: idcache.c
isdir.o: isdir.c
long-options.o: long-options.c long-options.h
makepath.o: makepath.c makepath.h
modechange.o: modechange.c modechange.h
mountlist.o: mountlist.c mountlist.h
obstack.o: obstack.c obstack.h
posixtm.o: posixtm.c
safe-read.o: safe-read.c
save-cwd.o: save-cwd.c ../config.h save-cwd.h error.h
savedir.o: savedir.c
stripslash.o: stripslash.c
userspec.o: userspec.c
xgetcwd.o: xgetcwd.c pathmax.h
xmalloc.o: xmalloc.c
xstrdup.o: xstrdup.c
xstrtol.o: xstrtol.c xstrtol.h
xstrtoul.o: xstrtoul.c xstrtol.c xstrtol.h
yesno.o: yesno.c
# This fragment is probably only useful for maintainers. It relies on
# GNU make and gcc. It is only included in the generated Makefile.in
# if `automake' is not passed the `--include-deps' flag.
MKDEP = gcc -MM $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-include $(srcdir)/.deps/.P
$(srcdir)/.deps/.P: $(BUILT_SOURCES)
cd $(srcdir) && test -d .deps || mkdir .deps
echo > $@
-include $(DEP_FILES)
$(DEP_FILES): $(srcdir)/.deps/.P
$(srcdir)/.deps/%.P: $(srcdir)/%.c
@echo "mkdeps $< > $@"
@re=`echo 's,^$(srcdir)//*,,g;s, $(srcdir)//*, ,g' | sed 's,\.,\\\\.,g'`; \
$(MKDEP) $< | sed "$$re" > $@-tmp
@if test -n "$o"; then \
sed 's/\.o:/$$o:/' $@-tmp > $@; \
rm $@-tmp; \
else \
mv $@-tmp $@; \
fi
# End of maintainer-only section
info:
dvi:
@@ -214,7 +224,7 @@ install-exec:
install-data:
install: install-exec install-data
install: install-exec install-data all
@:
uninstall:
@@ -259,7 +269,7 @@ maintainer-clean: maintainer-clean-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 dist info dvi check installcheck \
clean-tags maintainer-clean-tags distdir info dvi check installcheck \
install-exec install-data install uninstall all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
@@ -267,7 +277,7 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Since this directory contains two parsers, we have to be careful to avoid
# running two $(YACC)s during parallel makes. See below.
getdate.c: getdate.y
getdate.c: @MAINT@getdate.y
@echo expect 10 shift/reduce conflicts
$(YACC) $(srcdir)/getdate.y
mv y.tab.c getdate.c
@@ -276,7 +286,7 @@ getdate.c: getdate.y
# The artificial dependency on getdate.c keeps the two parsers from being
# built in parallel. Enforcing this little bit of sequentiality lets
# everyone (even those without bison) still run mostly parallel builds.
posixtm.c: posixtm.y getdate.c
posixtm.c: @MAINT@posixtm.y getdate.c
$(YACC) $(srcdir)/posixtm.y
mv y.tab.c posixtm.tab.c
sed -e 's/yy/zz/g' posixtm.tab.c > tposixtm.c

View File

@@ -63,12 +63,12 @@ char *malloc ();
#endif
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define ISASCII(c) 1
# define IN_CTYPE_DOMAIN(c) 1
#else
# define ISASCII(c) isascii(c)
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISDIGIT(c) (ISASCII ((unsigned char) (c)) \
#define ISDIGIT(c) (IN_CTYPE_DOMAIN ((unsigned char) (c)) \
&& isdigit ((unsigned char) (c)))
#if defined (HAVE_UNISTD_H)

View File

@@ -22,44 +22,44 @@ Cambridge, MA 02139, USA. */
Adapted for GNU C library by Roland McGrath. */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef S_IEXEC
#ifndef S_IXUSR
#define S_IXUSR S_IEXEC
#endif
#ifndef S_IXGRP
#define S_IXGRP (S_IEXEC >> 3)
#endif
#ifndef S_IXOTH
#define S_IXOTH (S_IEXEC >> 6)
#endif
# ifndef S_IXUSR
# define S_IXUSR S_IEXEC
# endif
# ifndef S_IXGRP
# define S_IXGRP (S_IEXEC >> 3)
# endif
# ifndef S_IXOTH
# define S_IXOTH (S_IEXEC >> 6)
# endif
#endif /* S_IEXEC */
#if defined (HAVE_UNISTD_H) || defined (_LIBC)
#include <unistd.h>
# include <unistd.h>
#endif
#ifdef _POSIX_VERSION
#include <limits.h>
#if !defined(NGROUPS_MAX) || NGROUPS_MAX < 1
#undef NGROUPS_MAX
#define NGROUPS_MAX sysconf (_SC_NGROUPS_MAX)
#endif /* NGROUPS_MAX */
# include <limits.h>
# if !defined(NGROUPS_MAX) || NGROUPS_MAX < 1
# undef NGROUPS_MAX
# define NGROUPS_MAX sysconf (_SC_NGROUPS_MAX)
# endif /* NGROUPS_MAX */
#else /* not _POSIX_VERSION */
uid_t getuid ();
gid_t getgid ();
uid_t geteuid ();
gid_t getegid ();
#include <sys/param.h>
#if !defined(NGROUPS_MAX) && defined(NGROUPS)
#define NGROUPS_MAX NGROUPS
#endif /* not NGROUPS_MAX and NGROUPS */
# include <sys/param.h>
# if !defined(NGROUPS_MAX) && defined(NGROUPS)
# define NGROUPS_MAX NGROUPS
# endif /* not NGROUPS_MAX and NGROUPS */
#endif /* not POSIX_VERSION */
#include <errno.h>
@@ -68,20 +68,31 @@ extern int errno;
#endif
#if defined(EACCES) && !defined(EACCESS)
#define EACCESS EACCES
# define EACCESS EACCES
#endif
#ifndef F_OK
#define F_OK 0
#define X_OK 1
#define W_OK 2
#define R_OK 4
# define F_OK 0
# define X_OK 1
# define W_OK 2
# define R_OK 4
#endif
#if !defined (S_IROTH) && defined (R_OK)
# define S_IROTH R_OK
#endif
#if !defined (S_IWOTH) && defined (W_OK)
# define S_IWOTH W_OK
#endif
#if !defined (S_IXOTH) && defined (X_OK)
# define S_IXOTH X_OK
#endif
#ifdef _LIBC
#define group_member __group_member
# define group_member __group_member
#else
@@ -100,11 +111,11 @@ static gid_t egid;
/* Nonzero if UID, GID, EUID, and EGID have valid values. */
static int have_ids = 0;
#ifdef HAVE_GETGROUPS
# ifdef HAVE_GETGROUPS
int group_member ();
#else
#define group_member(gid) 0
#endif
# else
# define group_member(gid) 0
# endif
#endif

View File

@@ -18,26 +18,26 @@
/* Written by Brian L. Matthews, blm@6sceng.UUCP. */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#if !defined (HAVE_ST_BLOCKS) && !defined(_POSIX_VERSION)
#include <sys/types.h>
#include <sys/param.h>
# include <sys/types.h>
# include <sys/param.h>
#ifndef NINDIR
# 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
#endif
# ifndef BSIZE
# define BSIZE 1024
# endif
/* Number of inode pointers per indirect block. */
#define NINDIR (BSIZE/sizeof(daddr_t))
#endif /* !NINDIR */
# define NINDIR (BSIZE/sizeof(daddr_t))
# endif /* !NINDIR */
/* Number of direct block addresses in an inode. */
#define NDIR 10
# define NDIR 10
/* Return the number of 512-byte blocks in a file of SIZE bytes. */
@@ -63,4 +63,8 @@ st_blocks (size)
return datablks + indrblks;
}
#else
/* This declaration is solely to ensure that after preprocessing
this file is never empty. */
extern int textutils_fileblocks_unused;
#endif

View File

@@ -37,7 +37,7 @@ int statfs ();
#include <sys/vfs.h>
#endif
#ifdef HAVE_SYS_FILSYS_H
#if defined(HAVE_SYS_FILSYS_H) && !defined(_CRAY)
#include <sys/filsys.h> /* SVR2. */
#endif
@@ -90,7 +90,8 @@ adjust_blocks (blocks, fromsize, tosize)
int
get_fs_usage (path, disk, fsp)
char *path, *disk;
const char *path;
const char *disk;
struct fs_usage *fsp;
{
#if defined (STAT_STATFS3_OSF1)

View File

@@ -25,8 +25,13 @@ struct fs_usage
long fsu_ffree; /* Free file nodes. */
};
#if __STDC__
int get_fs_usage (char *path, char *disk, struct fs_usage *fsp);
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
int get_fs_usage ();
#endif
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
int get_fs_usage __P ((const char *path, const char *disk,
struct fs_usage *fsp));

View File

@@ -1,6 +1,6 @@
/* getline.c -- Replacement for GNU C library function getline
Copyright (C) 1993 Free Software Foundation, Inc.
Copyright (C) 1993, 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
@@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# include <config.h>
#endif
/* The `getdelim' function is only declared if there following symbol
is defined. */
#define _GNU_SOURCE 1
#include <stdio.h>
#include <sys/types.h>

View File

@@ -25,11 +25,11 @@
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
#define ISASCII(c) 1
#define IN_CTYPE_DOMAIN(c) 1
#else
#define ISASCII(c) isascii(c)
#define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#if _LIBC || STDC_HEADERS
# define TOLOWER(c) tolower (c)

View File

@@ -72,7 +72,7 @@ static int oatoi ();
struct mode_change *
mode_compile (mode_string, masked_ops)
register char *mode_string;
const char *mode_string;
unsigned masked_ops;
{
struct mode_change *head; /* First element of the linked list. */
@@ -244,7 +244,7 @@ invalid:
unsigned short
mode_adjust (oldmode, changes)
unsigned oldmode;
register struct mode_change *changes;
const struct mode_change *changes;
{
unsigned short newmode; /* The adjusted mode and one operand. */
unsigned short value; /* The other operand. */

View File

@@ -44,12 +44,14 @@ struct mode_change
#define MODE_INVALID (struct mode_change *) 0
#define MODE_MEMORY_EXHAUSTED (struct mode_change *) 1
#ifdef __STDC__
struct mode_change *mode_compile (char *, unsigned);
unsigned short mode_adjust (unsigned, struct mode_change *);
void mode_free (struct mode_change *);
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
struct mode_change *mode_compile ();
unsigned short mode_adjust ();
void mode_free ();
#endif
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
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 *));

View File

@@ -80,6 +80,10 @@ void error ();
#include <sys/statfs.h>
#endif
#ifdef MOUNTED_LISTMNTENT
#include <mntent.h>
#endif
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
#include <sys/mnttab.h>
#endif
@@ -195,6 +199,36 @@ read_filesystem_list (need_fs_type, all_fs)
me->me_next = NULL;
mount_list = mtail = me;
#ifdef MOUNTED_LISTMNTENT
{
struct tabmntent *mntlist, *p;
struct mntent *mnt;
struct mount_entry *me;
/* the third and fourth arguments could be used to filter mounts,
but Crays doesn't seem to have any mounts that we want to
remove. Specifically, automount create normal NFS mounts.
*/
if(listmntent(&mntlist, KMTAB, NULL, NULL) < 0)
return NULL;
p = mntlist;
while(p){
mnt = p->ment;
me = (struct mount_entry*) xmalloc(sizeof (struct mount_entry));
me->me_devname = xstrdup(mnt->mnt_fsname);
me->me_mountdir = xstrdup(mnt->mnt_dir);
me->me_type = xstrdup(mnt->mnt_type);
me->me_dev = -1;
me->me_next = NULL;
mtail->me_next = me;
mtail = me;
p = p->next;
}
freemntlist(mntlist);
}
#endif
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
{
struct mntent *mnt;

View File

@@ -173,32 +173,32 @@ init_syntax_once ()
eliminate the && through constant folding." */
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
#define ISASCII(c) 1
#define IN_CTYPE_DOMAIN(c) 1
#else
#define ISASCII(c) isascii(c)
#define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#ifdef isblank
#define ISBLANK(c) (ISASCII (c) && isblank (c))
#define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
#else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
#define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
#else
#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
#endif
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define ISALNUM(c) (ISASCII (c) && isalnum (c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c))
#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
#define ISLOWER(c) (ISASCII (c) && islower (c))
#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
#define ISSPACE(c) (ISASCII (c) && isspace (c))
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
#ifndef NULL
#define NULL (void *)0
@@ -4505,9 +4505,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
#endif
if ((re_opcode_t) p1[3] == exactn
&& ! ((int) p2[1] * BYTEWIDTH > (int) p1[4]
&& (p2[1 + p1[4] / BYTEWIDTH]
& (1 << (p1[4] % BYTEWIDTH)))))
&& ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
&& (p2[2 + p1[5] / BYTEWIDTH]
& (1 << (p1[5] % BYTEWIDTH)))))
{
p[-3] = (unsigned char) pop_failure_jump;
DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",

View File

@@ -1,559 +1,453 @@
/* strftime - custom formatting of date and/or time
Copyright (C) 1989, 1991, 1992 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 93, 94, 95, 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.
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., 675 Mass Ave, Cambridge, MA 02139, 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.
/* Note: this version of strftime lacks locale support,
but it is standalone.
Performs `%' substitutions similar to those in printf. Except
where noted, substituted fields have a fixed size; numeric fields are
padded if necessary. Padding is with zeros by default; for fields
that display a single number, padding can be changed or inhibited by
following the `%' with one of the modifiers described below. Unknown
field specifiers are copied as normal characters. All other
characters are copied to the output without change.
Supports a superset of the ANSI C field specifiers.
Literal character fields:
% %
n newline
t tab
Numeric modifiers (a nonstandard extension):
- do not pad the field
_ pad the field with spaces
Time fields:
%H hour (00..23)
%I hour (01..12)
%k hour ( 0..23)
%l hour ( 1..12)
%M minute (00..59)
%p locale's AM or PM
%r time, 12-hour (hh:mm:ss [AP]M)
%R time, 24-hour (hh:mm)
%s time in seconds since 00:00:00, Jan 1, 1970 (a nonstandard extension)
%S second (00..61)
%T time, 24-hour (hh:mm:ss)
%X locale's time representation (%H:%M:%S)
%z RFC-822 style numeric timezone (-0500) (a nonstandard extension)
%Z time zone (EDT), or nothing if no time zone is determinable
Date fields:
%a locale's abbreviated weekday name (Sun..Sat)
%A locale's full weekday name, variable length (Sunday..Saturday)
%b locale's abbreviated month name (Jan..Dec)
%B locale's full month name, variable length (January..December)
%c locale's date and time (Sat Nov 04 12:02:33 EST 1989)
%C century (00..99)
%d day of month (01..31)
%e day of month ( 1..31)
%D date (mm/dd/yy)
%h same as %b
%j day of year (001..366)
%m month (01..12)
%U week number of year with Sunday as first day of week (00..53)
%V FIXME
%w day of week (0..6)
%W week number of year with Monday as first day of week (00..53)
%x locale's date representation (mm/dd/yy)
%y last two digits of year (00..99)
%Y year (1970...)
David MacKenzie <djm@gnu.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. */
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_MBLEN 1
# define HAVE_TM_ZONE 1
# define STDC_HEADERS 1
# include <ansidecl.h>
# include "../locale/localeinfo.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#if defined(TM_IN_SYS_TIME) || (!defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME))
#include <sys/time.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
#include <time.h>
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#ifndef STDC_HEADERS
time_t mktime ();
#if HAVE_MBLEN
# include <ctype.h>
#endif
#if defined(HAVE_TZNAME)
extern char *tzname[2];
#if HAVE_LIMITS_H
# include <limits.h>
#endif
/* Types of padding for numbers in date and time. */
enum padding
{
none, blank, zero
};
static char const* const days[] =
{
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
};
static char const * const months[] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
/* Add character C to STRING and increment LENGTH,
unless LENGTH would exceed MAX. */
#define add_char(c) \
do \
{ \
if (length + 1 <= max) \
string[length++] = (c); \
} \
while (0)
/* Add a 2 digit number to STRING, padding if specified.
Return the number of characters added, up to MAX. */
static int
add_num2 (string, num, max, pad)
char *string;
int num;
int max;
enum padding pad;
{
int top = num / 10;
int length = 0;
if (top == 0 && pad == blank)
add_char (' ');
else if (top != 0 || pad == zero)
add_char (top + '0');
add_char (num % 10 + '0');
return length;
}
/* Add a 3 digit number to STRING, padding if specified.
Return the number of characters added, up to MAX. */
static int
add_num3 (string, num, max, pad)
char *string;
int num;
int max;
enum padding pad;
{
int top = num / 100;
int mid = (num - top * 100) / 10;
int length = 0;
if (top == 0 && pad == blank)
add_char (' ');
else if (top != 0 || pad == zero)
add_char (top + '0');
if (mid == 0 && top == 0 && pad == blank)
add_char (' ');
else if (mid != 0 || top != 0 || pad == zero)
add_char (mid + '0');
add_char (num % 10 + '0');
return length;
}
/* Like strncpy except return the number of characters copied. */
static int
add_str (to, from, max)
char *to;
const char *from;
int max;
{
int i;
for (i = 0; from[i] && i <= max; ++i)
to[i] = from[i];
return i;
}
static int
add_num_time_t (string, max, num)
char *string;
int max;
time_t num;
{
/* This buffer is large enough to hold the character representation
(including the trailing NUL) of any unsigned decimal quantity
whose binary representation fits in 128 bits. */
char buf[40];
int length;
if (sizeof (num) > 16)
abort ();
sprintf (buf, "%lu", (unsigned long) num);
length = add_str (string, buf, max);
return length;
}
/* Convert MINUTES_EAST into a string suitable for use as the RFC-822
timezone indicator. Write no more than MAX bytes into STRING.
Return the number of bytes written into STRING. */
static int
add_num_tz (string, max, minutes_east)
char *string;
int max;
int minutes_east;
{
int length;
if (max < 1)
return 0;
if (minutes_east < 0)
{
*string = '-';
minutes_east = -minutes_east;
}
else
*string = '+';
length = 1 + add_num2 (&string[1], (minutes_east / 60) % 24, max - 1, zero);
length += add_num2 (&string[length], minutes_east % 60, max - length, zero);
return length;
}
/* Implement %U. Return the week in the year of the time in TM,
with the weeks starting on Sundays. */
static int
sun_week (tm)
const struct tm *tm;
{
int dl;
/* %U Week of the year (Sunday as the first day of the week) as a decimal
number [00-53]. All days in a new year preceding the first Sunday are
considered to be in week 0. */
dl = tm->tm_yday - tm->tm_wday;
return dl < 0 ? 0 : dl / 7 + 1;
}
/* Implement %V. Similar to mon_week (%W), but there is no 0'th week --
they're numbered [01-53]. And if the week containing January 1 has
four or more days in the new year, then it is considered week 1;
otherwise, it is week 53 of the previous year, and the next week is
week 1. (See the ISO 8601: 1988 standard.) */
static int
mon_week_ISO (tm)
const struct tm *tm;
{
int dl, n_days_before_first_monday;
int week_num;
n_days_before_first_monday = (tm->tm_yday + 7 - tm->tm_wday + 1) % 7;
dl = tm->tm_yday - n_days_before_first_monday;
week_num = dl < 0 ? 0 : dl / 7 + 1;
if (n_days_before_first_monday >= 4)
{
week_num = (week_num + 1) % 54;
if (week_num == 0)
week_num = 1;
}
if (week_num == 0)
week_num = 53;
return week_num;
}
/* Implement %W. Return the week in the year of the time in TM,
with the weeks starting on Mondays. */
static int
mon_week (tm)
const struct tm *tm;
{
int dl, n_days_before_first_monday;
n_days_before_first_monday = (tm->tm_yday + 7 - tm->tm_wday + 1) % 7;
dl = tm->tm_yday - n_days_before_first_monday;
return dl < 0 ? 0 : dl / 7 + 1;
}
#if !defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME)
char *
zone_name (tp)
struct tm *tp;
{
char *timezone ();
struct timeval tv;
struct timezone tz;
gettimeofday (&tv, &tz);
return timezone (tz.tz_minuteswest, tp->tm_isdst);
}
#if STDC_HEADERS
# include <stddef.h>
# include <stdlib.h>
# include <string.h>
#else
# define memcpy(d, s, n) bcopy (s, d, n)
#endif
/* Format the time given in TM according to FORMAT, and put the
results in STRING.
Return the number of characters (not including terminating null)
that were put into STRING, or 0 if the length would have
exceeded MAX. */
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
#endif /* Not __P. */
#ifndef PTR
#ifdef __STDC__
#define PTR void *
#else
#define PTR char *
#endif
#endif
static unsigned int week __P((const struct tm *const, int, int));
#define add(n, f) \
do \
{ \
i += (n); \
if (i >= maxsize) \
return 0; \
else \
if (p) \
{ \
f; \
p += (n); \
} \
} while (0)
#define cpy(n, s) add((n), memcpy((PTR) p, (PTR) (s), (n)))
#ifdef _LIBC
#define fmt(n, args) add((n), if (sprintf args != (n)) return 0)
#else
#define fmt(n, args) add((n), sprintf args; if (strlen (p) != (n)) return 0)
#endif
/* Return the week in the year specified by TP,
with weeks starting on STARTING_DAY. */
#ifdef __GNUC__
inline
#endif
static unsigned int
week (tp, starting_day, max_preceding)
const struct tm *const tp;
int starting_day;
int max_preceding;
{
int wday, dl, base;
wday = tp->tm_wday - starting_day;
if (wday < 0)
wday += 7;
/* Set DL to the day in the year of the first day of the week
containing the day specified in TP. */
dl = tp->tm_yday - wday;
/* For the computation following ISO 8601:1988 we set the number of
the week containing January 1st to 1 if this week has more than
MAX_PRECEDING days in the new year. For ISO 8601 this number is
3, for the other representation it is 7 (i.e., not to be
fulfilled). */
base = ((dl + 7) % 7) > max_preceding ? 1 : 0;
/* If DL is negative we compute the result as 0 unless we have to
compute it according ISO 8601. In this case we have to return 53
or 1 if the week containing January 1st has less than 4 days in
the new year or not. If DL is not negative we calculate the
number of complete weeks for our week (DL / 7) plus 1 (because
only for DL < 0 we are in week 0/53 and plus the number of the
first week computed in the last step. */
return dl < 0 ? (dl < -max_preceding ? 53 : base)
: base + 1 + dl / 7;
}
#ifndef _NL_CURRENT
static char const weekday_name[][10] =
{
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
};
static char const month_name[][10] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
#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
characters written. If S is NULL, nothing will be written
anywhere, so to determine how many characters would be
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
size_t
strftime (string, max, format, tm)
char *string;
size_t max;
const char *format;
const struct tm *tm;
strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
register const struct tm *tp;
{
enum padding pad; /* Type of padding to apply. */
size_t length = 0; /* Characters put in STRING so far. */
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT
const char *const a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
const char *const f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
const char *const a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
const char *const f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
const char *const ampm = _NL_CURRENT (LC_TIME,
hour12 > 11 ? PM_STR : AM_STR);
size_t aw_len = strlen(a_wkday);
size_t am_len = strlen(a_month);
size_t ap_len = strlen (ampm);
#else
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;
const char *const a_month = f_month;
const char *const ampm = "AMPM" + 2 * (hour12 > 11);
size_t aw_len = 3;
size_t am_len = 3;
size_t ap_len = 2;
#endif
size_t wkday_len = strlen(f_wkday);
size_t month_len = strlen(f_month);
const unsigned int y_week0 = week (tp, 0, 7);
const unsigned int y_week1 = week (tp, 1, 7);
const unsigned int y_week2 = week (tp, 1, 3);
const char *zone;
size_t zonelen;
register size_t i = 0;
register char *p = s;
register const char *f;
char number_fmt[5];
for (; *format && length < max; ++format)
/* Initialize the buffer we will use for the sprintf format for numbers. */
number_fmt[0] = '%';
zone = 0;
#if HAVE_TM_ZONE
zone = (const char *) tp->tm_zone;
#endif
#if HAVE_TZNAME
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
#endif
if (!(zone && *zone))
zone = "???";
zonelen = strlen (zone);
if (hour12 > 12)
hour12 -= 12;
else
if (hour12 == 0) hour12 = 12;
for (f = format; *f != '\0'; ++f)
{
if (*format != '%')
add_char (*format);
else
enum { pad_zero, pad_space, pad_none } pad; /* Padding for number. */
unsigned int maxdigits; /* Max digits for numeric format. */
unsigned int number_value; /* Numeric value to be printed. */
const char *subfmt;
#if HAVE_MBLEN
if (!isascii(*f))
{
++format;
/* Modifiers: */
if (*format == '-')
/* Non-ASCII, may be a multibyte. */
int len = mblen(f, strlen(f));
if (len > 0)
{
pad = none;
++format;
}
else if (*format == '_')
{
pad = blank;
++format;
}
else
pad = zero;
switch (*format)
{
/* Literal character fields: */
case 0:
case '%':
add_char ('%');
break;
case 'n':
add_char ('\n');
break;
case 't':
add_char ('\t');
break;
default:
add_char (*format);
break;
/* Time fields: */
case 'H':
case 'k':
length +=
add_num2 (&string[length], tm->tm_hour, max - length,
*format == 'H' ? pad : blank);
break;
case 'I':
case 'l':
{
int hour12;
if (tm->tm_hour == 0)
hour12 = 12;
else if (tm->tm_hour > 12)
hour12 = tm->tm_hour - 12;
else
hour12 = tm->tm_hour;
length +=
add_num2 (&string[length], hour12, max - length,
*format == 'I' ? pad : blank);
}
break;
case 'M':
length +=
add_num2 (&string[length], tm->tm_min, max - length, pad);
break;
case 'p':
if (tm->tm_hour < 12)
add_char ('A');
else
add_char ('P');
add_char ('M');
break;
case 'r':
length +=
strftime (&string[length], max - length, "%I:%M:%S %p", tm);
break;
case 'R':
length +=
strftime (&string[length], max - length, "%H:%M", tm);
break;
case 's':
{
struct tm writable_tm;
writable_tm = *tm;
length += add_num_time_t (&string[length], max - length,
mktime (&writable_tm));
}
break;
case 'S':
length +=
add_num2 (&string[length], tm->tm_sec, max - length, pad);
break;
case 'T':
length +=
strftime (&string[length], max - length, "%H:%M:%S", tm);
break;
case 'X':
length +=
strftime (&string[length], max - length, "%H:%M:%S", tm);
break;
case 'z':
{
time_t t;
struct tm tml, tmg;
int diff;
tml = *tm;
t = mktime (&tml);
tml = *localtime (&t); /* Canonicalize the local time */
tmg = *gmtime (&t);
/* Compute the difference */
diff = tml.tm_min - tmg.tm_min;
diff += 60 * (tml.tm_hour - tmg.tm_hour);
if (tml.tm_mon != tmg.tm_mon)
{
/* We assume no timezone differs from UTC by more than
+- 23 hours. This should be safe. */
if (tmg.tm_mday == 1)
tml.tm_mday = 0;
else /* tml.tm_mday == 1 */
tmg.tm_mday = 0;
}
diff += 1440 * (tml.tm_mday - tmg.tm_mday);
length += add_num_tz (&string[length], max - length, diff);
}
break;
case 'Z':
#ifdef HAVE_TM_ZONE
length += add_str (&string[length], tm->tm_zone, max - length);
#else
#ifdef HAVE_TZNAME
if (tm->tm_isdst && tzname[1] && *tzname[1])
length += add_str (&string[length], tzname[1], max - length);
else
length += add_str (&string[length], tzname[0], max - length);
#else
length += add_str (&string[length], zone_name (tm), max - length);
#endif
#endif
break;
/* Date fields: */
case 'a':
add_char (days[tm->tm_wday][0]);
add_char (days[tm->tm_wday][1]);
add_char (days[tm->tm_wday][2]);
break;
case 'A':
length +=
add_str (&string[length], days[tm->tm_wday], max - length);
break;
case 'b':
case 'h':
add_char (months[tm->tm_mon][0]);
add_char (months[tm->tm_mon][1]);
add_char (months[tm->tm_mon][2]);
break;
case 'B':
length +=
add_str (&string[length], months[tm->tm_mon], max - length);
break;
case 'c':
length +=
strftime (&string[length], max - length,
"%a %b %d %H:%M:%S %Z %Y", tm);
break;
case 'C':
length +=
add_num2 (&string[length], (tm->tm_year + 1900) / 100,
max - length, pad);
break;
case 'd':
length +=
add_num2 (&string[length], tm->tm_mday, max - length, pad);
break;
case 'e':
length +=
add_num2 (&string[length], tm->tm_mday, max - length, blank);
break;
case 'D':
length +=
strftime (&string[length], max - length, "%m/%d/%y", tm);
break;
case 'j':
length +=
add_num3 (&string[length], tm->tm_yday + 1, max - length, pad);
break;
case 'm':
length +=
add_num2 (&string[length], tm->tm_mon + 1, max - length, pad);
break;
case 'U':
length +=
add_num2 (&string[length], sun_week (tm), max - length, pad);
break;
case 'V':
length += add_num2 (&string[length], mon_week_ISO (tm),
max - length, pad);
break;
case 'w':
add_char (tm->tm_wday + '0');
break;
case 'W':
length +=
add_num2 (&string[length], mon_week (tm), max - length, pad);
break;
case 'x':
length +=
strftime (&string[length], max - length, "%m/%d/%y", tm);
break;
case 'y':
length +=
add_num2 (&string[length], tm->tm_year % 100,
max - length, pad);
break;
case 'Y':
add_char ((tm->tm_year + 1900) / 1000 + '0');
length +=
add_num3 (&string[length],
(1900 + tm->tm_year) % 1000, max - length, zero);
break;
cpy(len, f);
continue;
}
}
#endif
if (*f != '%')
{
add(1, *p = *f);
continue;
}
/* Check for flags that can modify a number format. */
++f;
switch (*f)
{
case '_':
pad = pad_space;
++f;
break;
case '-':
pad = pad_none;
++f;
break;
default:
pad = pad_zero;
break;
}
/* Now do the specified format. */
switch (*f)
{
case '\0':
case '%':
add(1, *p = *f);
break;
case 'a':
cpy(aw_len, a_wkday);
break;
case 'A':
cpy(wkday_len, f_wkday);
break;
case 'b':
case 'h': /* GNU extension. */
cpy(am_len, a_month);
break;
case 'B':
cpy(month_len, f_month);
break;
case 'c':
#ifdef _NL_CURRENT
subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
#else
subfmt = "%a %b %d %H:%M:%S %Z %Y";
#endif
subformat:
{
size_t len = strftime (p, maxsize - i, subfmt, tp);
if (len == 0 && *subfmt)
return 0;
add(len, );
}
break;
#define DO_NUMBER(digits, value) \
maxdigits = digits; number_value = value; goto do_number
#define DO_NUMBER_NOPAD(digits, value) \
maxdigits = digits; number_value = value; goto do_number_nopad
case 'C':
DO_NUMBER (2, (1900 + tp->tm_year) / 100);
case 'x':
#ifdef _NL_CURRENT
subfmt = _NL_CURRENT (LC_TIME, D_FMT);
goto subformat;
#endif
/* Fall through. */
case 'D': /* GNU extension. */
subfmt = "%m/%d/%y";
goto subformat;
case 'd':
DO_NUMBER (2, tp->tm_mday);
case 'e': /* GNU extension: %d, but blank-padded. */
DO_NUMBER_NOPAD (2, tp->tm_mday);
/* All numeric formats set MAXDIGITS and NUMBER_VALUE and then
jump to one of these two labels. */
do_number_nopad:
/* Force `-' flag. */
pad = pad_none;
do_number:
{
/* Format the number according to the PAD flag. */
register char *nf = &number_fmt[1];
int printed;
switch (pad)
{
case pad_zero:
*nf++ = '0';
case pad_space:
*nf++ = '0' + maxdigits;
case pad_none:
*nf++ = 'u';
*nf = '\0';
}
#ifdef _LIBC
add (maxdigits, printed = sprintf (p, number_fmt, number_value));
#else
add (maxdigits, sprintf (p, number_fmt, number_value);
printed = strlen (p));
#endif
break;
}
case 'H':
DO_NUMBER (2, tp->tm_hour);
case 'I':
DO_NUMBER (2, hour12);
case 'k': /* GNU extension. */
DO_NUMBER_NOPAD (2, tp->tm_hour);
case 'l': /* GNU extension. */
DO_NUMBER_NOPAD (2, hour12);
case 'j':
DO_NUMBER (3, 1 + tp->tm_yday);
case 'M':
DO_NUMBER (2, tp->tm_min);
case 'm':
DO_NUMBER (2, tp->tm_mon + 1);
case 'n': /* GNU extension. */
add (1, *p = '\n');
break;
case 'p':
cpy(ap_len, ampm);
break;
case 'R': /* GNU extension. */
subfmt = "%H:%M";
goto subformat;
case 'r': /* GNU extension. */
subfmt = "%I:%M:%S %p";
goto subformat;
case 'S':
DO_NUMBER (2, tp->tm_sec);
case 'X':
#ifdef _NL_CURRENT
subfmt = _NL_CURRENT (LC_TIME, T_FMT);
goto subformat;
#endif
/* Fall through. */
case 'T': /* GNU extenstion. */
subfmt = "%H:%M:%S";
goto subformat;
case 't': /* GNU extenstion. */
add (1, *p = '\t');
break;
case 'U':
DO_NUMBER (2, y_week0);
case 'V':
DO_NUMBER (2, y_week2);
case 'W':
DO_NUMBER (2, y_week1);
case 'w':
DO_NUMBER (2, tp->tm_wday);
case 'Y':
DO_NUMBER (4, 1900 + tp->tm_year);
case 'y':
DO_NUMBER (2, tp->tm_year % 100);
case 'Z':
cpy(zonelen, zone);
break;
default:
/* Bad format. */
break;
}
}
add_char (0);
return length - 1;
if (p)
*p = '\0';
return i;
}

49
lib/strndup.c Normal file
View File

@@ -0,0 +1,49 @@
/* Copyright (C) 1996 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 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#ifdef STDC_HEADERS
# include <string.h>
# include <stdlib.h>
#else
char *malloc ();
#endif
/* Duplicate S, returning an identical malloc'd string. */
char *
strndup (s, n)
const char *s;
size_t n;
{
char *new = malloc (n + 1);
if (new == NULL)
return NULL;
memcpy (new, s, n);
new[n] = '\0';
return new;
}

View File

@@ -1,5 +1,4 @@
/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -16,7 +15,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, 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -57,18 +57,41 @@ extern int errno;
# define UNSIGNED 0
# define INT LONG int
#else
# define strtol strtoul
# define INT unsigned LONG int
#endif
/* Determine the name. */
#if UNSIGNED
# ifdef USE_WIDE_CHAR
# ifdef QUAD
# define strtol wcstouq
# else
# define strtol wcstoul
# endif
# else
# ifdef QUAD
# define strtol strtouq
# else
# define strtol strtoul
# endif
# endif
#else
# ifdef USE_WIDE_CHAR
# ifdef QUAD
# define strtol wcstoq
# else
# define strtol wcstol
# endif
# else
# ifdef QUAD
# define strtol strtoq
# endif
# endif
#endif
/* If QUAD is defined, we are defining `strtoq' or `strtouq',
operating on `long long int's. */
#ifdef QUAD
# if UNSIGNED
# define strtoul strtouq
# else
# define strtol strtoq
# endif
# define LONG long long
# undef LONG_MIN
# define LONG_MIN LONG_LONG_MIN
@@ -84,13 +107,41 @@ extern int errno;
# endif
#else
# define LONG long
#ifndef ULONG_MAX
# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
#endif
#ifndef LONG_MAX
# define LONG_MAX ((long int) (ULONG_MAX >> 1))
#endif
#endif
#ifdef USE_WIDE_CHAR
# include <wchar.h>
# include <wctype.h>
# define L_(ch) L##ch
# define UCHAR_TYPE wint_t
# define STRING_TYPE wchar_t
# define ISSPACE(ch) iswspace (ch)
# define ISALPHA(ch) iswalpha (ch)
# define TOUPPER(ch) towupper (ch)
#else
# 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)
#endif
#ifdef __STDC__
# define INTERNAL(x) INTERNAL1(x)
# define INTERNAL1(x) __##x##_internal
# define WEAKNAME(x) WEAKNAME1(x)
# define WEAKNAME1(x) __##x
#else
# define INTERNAL(x) __/**/x/**/_internal
# define WEAKNAME(x) __/**/x
#endif
#ifdef USE_NUMBER_GROUPING
@@ -108,8 +159,8 @@ extern int errno;
INT
INTERNAL (strtol) (nptr, endptr, base, group)
const char *nptr;
char **endptr;
const STRING_TYPE *nptr;
STRING_TYPE **endptr;
int base;
int group;
{
@@ -117,9 +168,9 @@ INTERNAL (strtol) (nptr, endptr, base, group)
register unsigned LONG int cutoff;
register unsigned int cutlim;
register unsigned LONG int i;
register const char *s;
register unsigned char c;
const char *save, *end;
register const STRING_TYPE *s;
register UCHAR_TYPE c;
const STRING_TYPE *save, *end;
int overflow;
#ifdef USE_NUMBER_GROUPING
@@ -151,21 +202,21 @@ INTERNAL (strtol) (nptr, endptr, base, group)
if (base < 0 || base == 1 || base > 36)
base = 10;
s = nptr;
save = s = nptr;
/* Skip white space. */
while (isspace (*s))
while (ISSPACE (*s))
++s;
if (*s == '\0')
if (*s == L_('\0'))
goto noconv;
/* Check for a sign. */
if (*s == '-')
if (*s == L_('-'))
{
negative = 1;
++s;
}
else if (*s == '+')
else if (*s == L_('+'))
{
negative = 0;
++s;
@@ -173,14 +224,14 @@ INTERNAL (strtol) (nptr, endptr, base, group)
else
negative = 0;
if (base == 16 && s[0] == '0' && toupper (s[1]) == 'X')
if (base == 16 && s[0] == L_('0') && TOUPPER (s[1]) == L_('X'))
s += 2;
/* If BASE is zero, figure it out ourselves. */
if (base == 0)
if (*s == '0')
if (*s == L_('0'))
{
if (toupper (s[1]) == 'X')
if (TOUPPER (s[1]) == L_('X'))
{
s += 2;
base = 16;
@@ -199,9 +250,9 @@ INTERNAL (strtol) (nptr, endptr, base, group)
{
/* Find the end of the digit string and check its grouping. */
end = s;
for (c = *end; c != '\0'; c = *++end)
if (c != thousands && !isdigit (c) &&
(!isalpha (c) || toupper (c) - 'A' + 10 >= base))
for (c = *end; c != L_('\0'); c = *++end)
if (c != thousands && (c < L_('0') || c > L_('9'))
&& (!ISALPHA (c) || TOUPPER (c) - L_('A') + 10 >= base))
break;
if (*s == thousands)
end = s;
@@ -217,14 +268,14 @@ INTERNAL (strtol) (nptr, endptr, base, group)
overflow = 0;
i = 0;
for (c = *s; c != '\0'; c = *++s)
for (c = *s; c != L_('\0'); c = *++s)
{
if (s == end)
break;
if (isdigit (c))
c -= '0';
else if (isalpha (c))
c = toupper (c) - 'A' + 10;
if (c >= L_('0') && c <= L_('9'))
c -= L_('0');
else if (ISALPHA (c))
c = TOUPPER (c) - L_('A') + 10;
else
break;
if (c >= base)
@@ -246,13 +297,15 @@ INTERNAL (strtol) (nptr, endptr, base, group)
/* Store in ENDPTR the address of one character
past the last character we converted. */
if (endptr != NULL)
*endptr = (char *) s;
*endptr = (STRING_TYPE *) s;
#if !UNSIGNED
/* Check for a value that is within the range of
`unsigned LONG int', but outside the range of `LONG int'. */
if (i > (negative ?
-(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX))
if (overflow == 0
&& i > (negative
? -((unsigned LONG int) (LONG_MIN + 1)) + 1
: (unsigned LONG int) LONG_MAX))
overflow = 1;
#endif
@@ -270,23 +323,40 @@ INTERNAL (strtol) (nptr, endptr, base, group)
return (negative ? -i : i);
noconv:
/* There was no number to convert. */
/* We must handle a special case here: the base is 0 or 16 and the
first two characters and '0' and 'x', but the rest are no
hexadecimal digits. This is no error case. We return 0 and
ENDPTR points to the `x`. */
if (endptr != NULL)
*endptr = (char *) nptr;
if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
&& save[-2] == L_('0'))
*endptr = (STRING_TYPE *) &save[-1];
else
/* There was no number to convert. */
*endptr = (STRING_TYPE *) nptr;
return 0L;
}
/* External user entry point. */
#undef __P
#if defined (__STDC__) && __STDC__
#define __P(args) args
#else
#define __P(args) ()
#endif
/* Prototype. */
INT strtol __P ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
int base));
INT
strtol (nptr, endptr, base)
const char *nptr;
char **endptr;
const STRING_TYPE *nptr;
STRING_TYPE **endptr;
int base;
{
return INTERNAL (strtol) (nptr, endptr, base, 0);
}
#ifdef weak_symbol
weak_symbol (strtol)
#endif

View File

@@ -1,3 +1,22 @@
/* A more useful interface to strtol.
Copyright (C) 1995, 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 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. */
/* Jim Meyering (meyering@na-net.ornl.gov) */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

View File

@@ -1,10 +1,337 @@
Tue Jul 2 22:56:03 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (VERSION): Bump to 3.12p.
* src/system.h [!EXIT_SUCCESS]: Define it.
[!EXIT_FAILURE]: Define it.
* lib/strndup.c (strndup): Include stdio.h and sys/types.h to
get definition of NULL and size_t on SunOS4.1.3.
Mon Jul 1 23:47:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/ln.c (do_link): Update messages to ease translation.
Suggestion from Santiago Vila.
Sun Jun 30 16:41:45 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/install.c (usage): Fix typo, 3nd->3rd, in usage message.
From Santiago Vila <sanvila@unex.es>.
Sat Jun 29 00:33:31 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (PACKAGE_VERSION): Add `GNU ' prefix so we see
it in the output of --version. Reported by RMS.
* src/Makefile.am (BUILT_SOURCES): Guard dependency on dircolors.h
with @MAINT@ so it won't be removed with a casual disctlean.
(EXTRA_DIST): Add dcgen.pl and dircolors.hin.
Fri Jun 28 22:56:00 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/dircolors.c (dc_parse_stream): Move `enum states' dcl into
this function.
* src/ln.c (do_link): Allow `ln -sf --backup k k' to succeed in
creating the self-referential symlink, since doing so doesn't
remove the source but merely renames it.
Wed Jun 26 06:58:58 1996 Jim Meyering <meyering@na-net.ornl.gov>
* ln.c (same_name): New function.
(do_link): Use it to test reliably whether A and B (from
ln --force A B) are hard links to the same file.
From Andreas Schwab.
Tue Jun 25 00:03:43 1996 Jim Meyering <meyering@na-net.ornl.gov>
* lib/getline.c: New file.
* lib/getline.h: New file.
* lib/Makefile.am (fu_SOURCES): Add getline.c.
(noinst_HEADERS): Add getline.h.
Mon Jun 24 22:39:02 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (AC_REPLACE_FUNCS): Add strndup.
(AC_PATH_PROG): Check for perl.
* ls.c (decode_switches): Allow 0 as argument to --tabsize (-T) option.
Interpret as a directive to use no TAB characters to separate columns.
(indent): Handle TABSIZE == 0.
* dircolors.c (dc_parse_stream): Remove spurious newline in
error message.
(dc_parse_stream): Give `unrecognized keyword' diagnostic for
misspelled `TERM' keyword as well as for others.
Sun Jun 23 12:58:32 1996 Jim Meyering <meyering@na-net.ornl.gov>
* dircolors.hin: New file.
* dcgen.pl: New file.
* src/Makefile.am (dircolors.h): Add a rule to create this file.
(dcgen): Likewise.
* dircolors.c (parse_line): Rewrite to avoid modifying LINE.
Put LINE first in parameter list.
Adjust caller.
(dc_parse_stream): Free KEYWD and ARG.
(main): Give diagnostic for unreasonable combinations of
options/arguments.
* lib/Makefile.am (EXTRA_DIST): Add strndup.c.
* configure.in (AC_REPLACE_FUNCS): Add strndup.
* strndup.c: New file. From id-utils-3.0k.
(strndup): Deansify.
[!STDC_HEADERS]: Include string.h and stdlib.h.
Sat Jun 22 16:57:53 1996 Jim Meyering <meyering@na-net.ornl.gov>
* dircolors.c: Major overhaul. No longer read from /etc/DIR_COLORS
or from ~/.dircolors. Defaults are now compiled in. If you specify
a file on the command line, it is used instead of the compiled-in
defaults.
(main): New option --print-database (-p).
Detect write failure.
Add --bourne-shell and --c-shell aliases for --sh and --csh resp.
Tue Jun 18 20:54:05 1996 Jim Meyering <meyering@na-net.ornl.gov>
* cp.c (copy_reg): Cast both sides of comparison to size_t
to avoid a warning about `comparison between signed and unsigned'
from gcc -Wall.
Declare pointer parameters const as appropriate.
* ln.c (do_link): Refine last change so we don't disallow commands
like `ln --force A B' when A and B are hard links to the same file.
See comments in the source. Reported by Erik Naggum <erik@naggum.no>
and Andreas Schwab.
* ls.c (decode_switches): Correct typo in error messages:
enironment -> environment. From Santiago Vila Doncel
<sanvila@unex.es>.
* aclocal.m4: Update from gettext-0.10.20.
* ABOUT-NLS: Likewise.
* intl/*: Likewise.
* cp.c (do_copy): Change message from `missing file argument' to
more precise `missing destination file'. From Karl Berry.
* ln.c (STREQ): Remove macro definition
* system.h (STREQ): Add it here instead.
* cp.c (do_copy): Use STREQ here instead of strcmp(...) == 0.
* ls.c (parse_ls_color): Likewise.
* df.c (selected_fstype, excluded_fstype, show_disk, main): Likewise.
* cp.c (do_copy): When the force and backup options have been
specified and the source and destination are the same name for an
existing, regular file, convert the user's command, e.g.
`cp --force --backup foo foo' to `cp --force foo fooSUFFIX'
where SUFFIX is determined by any version control options used.
(usage): Update --help message.
At urging of (most recently) Karl Berry.
Sun Jun 16 13:40:22 1996 Jim Meyering <meyering@na-net.ornl.gov>
* doc/Makefile.am (EXTRA_DIST): Add texinfo.tex.
* Makefile.am (cvs-dist): Use -c option in cvs tag command.
Sat Jun 15 22:21:09 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (ALL_LINGUAS): Add pt.
(AC_REPLACE_FUNCS): Add basename.
* Makefile.am (EXTRA_DIST): Add basename.c.
(fu_SOURCES): Remove basename.c.
Thu Jun 6 21:57:08 1996 Jim Meyering <meyering@na-net.ornl.gov>
* po/Makefile.in.in: Update from gettext-0.10.16.
* intl/*: Likewise.
* ABOUT-NLS: Likewise.
* aclocal.m4 (AC_REPLACE_GNU_GETOPT): Move definition to precede
gettext-related ones.
Update from gettext-0.10.16.
Sat Jun 1 12:44:51 1996 Jim Meyering <meyering@na-net.ornl.gov>
* ls.c: Rename options and internal variables to reflect change to
--color=WHEN where WHEN is never, always, or auto (for consistency
with e.g. cp --sparse=WHEN. For at least a while, the original
slackware-supported arguments `none', `force', `yes', etc will be
supported but deprecated by lack of documentation.
(decode_switches): Use STDOUT_FILENO instead of `1' in isatty test.
(usage): Update/add description of the --color option.
* ls.c: Declare pointer parameters const as appropriate.
Tue May 28 18:39:49 1996 Jim Meyering <meyering@na-net.ornl.gov>
* dd.c (print_stats): Don't mark "%u %s" as a translatable string.
* mv.c (main): Don't mark "%s" as a translatable string.
From Göran Uddeborg.
Thu May 23 07:50:38 1996 Jim Meyering <meyering@na-net.ornl.gov>
* ls.c (usage): Make --literal (-N) description clearer.
* acconfig.h (MOUNTED_LISTMNTENT): Add it.
* fsusage [_CRAY]: Don't include sys/filsys.h because although
Unicos-9 has it, it's not needed and would cause other problems
because it requires inclusion of other, non-standard headers.
* mountlist.c (read_filesystem_list) [MOUNTED_LISTMNTENT]: New
function.
From Johan Danielsson (joda@pdc.kth.se).
* configure.in (AC_CHECK_FUNCS): Add listmntent for Unicos-9.
Define MOUNTED_LISTMNTENT #ifdef _CRAY and HAVE_GETMNTENT.
With an initial patch from Johan Danielsson.
Wed May 22 18:58:01 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (LINGUAS): Add sv.
Tue May 21 07:06:30 1996 Jim Meyering <meyering@na-net.ornl.gov>
* lib/euidaccess.c (euidaccess) [!S_IROTH]: Define.
[!S_IWOTH]: Define.
[!S_IXOTH]: Define.
Marcus Daniels <marcus@sysc.pdx.edu> reported that m68k NEXTSTEP 3.2
doesn't define S_IROTH or S_IWOTH unless some posix compile option
is used and associated symbols defined.
Sun May 19 09:32:51 1996 Jim Meyering (meyering@na-net.ornl.gov)
* chown.c: New option: --no-dereference (-h). Solaris 5.4's chown
provides -h.
(change_file_owner): Use lchown if --no-dereference (-h) was given.
(usage): Update.
(main): Fail if user requests --no-dereference on a system that
doesn't have support for it.
* chgrp.c: New option: --no-dereference (-h).
[!MAXUID]: Define to INT_MAX.
(change_file_group): Use lchown if --no-dereference (-h) was given.
(usage): Update.
(main): Fail if user requests --no-dereference on a system that
doesn't have support for it.
Wed May 15 22:54:31 1996 Jim Meyering (meyering@na-net.ornl.gov)
* fsusage.c (get_fs_usage): Declare parameter PATH to be const.
* fsusage.h: Update prototype to match.
* chmod.c (describe_change): Declare pointer parameters to be const.
(change_file_mode): Likewise.
(change_dir_mode): Likewise.
* ln.c (do_link): Declare pointer parameters to be const.
* df.c (main): Fail with a diagnostic if both --human-readable and
--portability are used.
Likewise if --megabytes and --portability are used.
Rearrange function definitions to precede respective uses to obviate
all forward dcls. Remove forward dcls.
Declare parameters const as appropriate.
* modechange.c (mode_compile): Declare parameter MODE_STRING const.
Remove register attribute.
(mode_adjust): Likewise for CHANGES.
* modechange.h: Reflect above changes in prototypes.
* lib/Makefile.am (getdate.c): Disable dependencies that can
require rerunning YACC when not in maintainer mode.
(posixtm.c): Likewise.
Tue May 14 23:36:54 1996 Jim Meyering (meyering@na-net.ornl.gov)
* dd.c (print_stats): Restructure pluralization of error message
so it's easier to translate. Reported by Göran Uddeborg
<gvran@uddeborg.pp.se>.
* mv.c (main): Likewise.
Tue May 7 22:10:20 1996 Jim Meyering (meyering@na-net.ornl.gov)
* configure.in: Require autoconf-2.10.
* aclocal.m4 (jm_MAINTAINER_MODE): New macro.
* configure.in (jm_MAINTAINER_MODE): Use it.
Sun May 5 20:27:47 1996 Jim Meyering (meyering@na-net.ornl.gov)
* src/Makefile.am (bin_PROGRAMS): Add dircolors.
(DEFS): Add -DSHAREDIR=\"$(datadir)\".
(GNUVER): Remove definition of unused variable.
Sat May 4 20:54:32 1996 Jim Meyering (meyering@na-net.ornl.gov)
* system.h [IN_CTYPE_DOMAIN]: Rename from ISASCII.
* backupfile.c [IN_CTYPE_DOMAIN]: Rename from ISASCII.
* dircolors.c: Make enumerated constants upper case.
(main): Don't use ANSI-style string concatenation.
Add `static' and/or `const' to some file scope variables.
Wed May 1 00:20:00 1996 Jim Meyering (meyering@na-net.ornl.gov)
* lib/Makefile.am (EXTRA_DIST): Add strcasecmp.c.
* configure.in (AC_REPLACE_FUNCS): Add strcasecmp.
* ls.c (parse_ls_color, usage): Remove support for alternate spellings:
--colours and LS_COLOURS.
(parse_ls_color): Reverse sense of test for LS_COLORS environment
variable and return -- save a level of indentation on a 100+-line
block.
Mon Apr 29 22:07:41 1996 Jim Meyering (meyering@na-net.ornl.gov)
* POTFILES.in: Add chgrp.c. From François Pinard.
Add dircolors.c.
* dircolors.c: New file. Written by H. Peter Anvin.
Sun Apr 28 16:32:38 1996 Jim Meyering (meyering@na-net.ornl.gov)
* ls.c: Apply color ls changes by Peter Anvin <Peter.Anvin@linux.org>
and Dennis Flaherty <dennisf@denix.elk.miles.com> based on original
patches by Greg Lee <lee@uhunix.uhcc.hawaii.edu>. And on top of all
that, a few changes from Ulrich Drepper.
* ls.c (parse_ls_color): Use strcpy to initialize 3-character array.
Automatic aggregate initialization isn't portable.
Remove all ^L's.
(get_funky_string): Declare static and move to precede single
caller: parse_ls_color.
Make some globals `static' and/or `const'.
(LEN_STR_PAIR): New macro.
(color_indicator): Use it in this declaration.
(parse_ls_color): Use error, not fprintf.
(decode_switches): Add a comment.
(print_name_with_quoting): Add braces around inner if-else
statement to clarify.
* configure.in: Add a comment that fp_C_PROTOTYPES must precede
AC_C_INLINE. Otherwise, some systems lose because the value
AC_C_INLINE choses with plain `cc' is different from that chosen
when using the ANSI-mode C compiler. From Kaveh Ghazi.
* fileblocks.c [HAVE_ST_BLOCKS || _POSIX_VERSION]: Add extern dcl
of unused variable so that after preprocessing, the file will never
be empty. Otherwise, some compilers in ANSI mode (among them, the
Dec Alpha OSF 2.0 C compiler) reject empty files. From Kaveh Ghazi.
Indent CPP conditionals.
Fri Apr 26 05:52:03 1996 Karl Eichwalder <ke@ke.Central.DE>
* ls.c (usage): Add newline at end of printf format string.
Wed Apr 24 21:33:43 1996 Jim Meyering (meyering@na-net.ornl.gov)
* ln.c (do_link): Remove duplicate `if (lstat(...' block.
* ln.c (do_link): With --force, don't remove DEST when it's
the same as SOURCE. Before, `ln -f FILE FILE' would remove FILE.
Reported by Bruno Haible.
Reported by Bruno Haible (haible@ilog.fr).
* mkdir.c (main): Use verbose_fmt_string, not string literal in
call to make_path for --parents. Reported by Ulrich Drepper.
@@ -22,11 +349,11 @@ Tue Apr 23 22:05:35 1996 Jim Meyering (meyering@na-net.ornl.gov)
* lib/Makefile.am (fu_SOURCES): Remove getopt.c and getopt1.c.
(EXTRA_DIST): Add getopt.c and getopt1.c
* configure.in (AC_CHECK_FUNCS): Add lchown.
* chgrp.c [HAVE_LCHOWN]: Define chown to lchown.
* chown.c [HAVE_LCHOWN]: Likewise.
* cp.c [HAVE_LCHOWN]: Likewise.
* mv.c [HAVE_LCHOWN]: Likewise.
* configure.in (AC_CHECK_FUNCS): Add lchown.
* chgrp.c [HAVE_LCHOWN]: Define chown to lchown.
* chown.c [HAVE_LCHOWN]: Likewise.
* cp.c [HAVE_LCHOWN]: Likewise.
* mv.c [HAVE_LCHOWN]: Likewise.
Suggested by François Pinard.
* backupfile.c (find_backup_file_name, max_backup_version,
@@ -161,13 +488,13 @@ Sun Mar 10 22:36:11 1996 Jim Meyering (meyering@na-net.ornl.gov)
Link an nls file.
(AC_OUTPUT): Reflect addition of two new directories, intl and po.
Create po/Makefile.
From François Pinard.
From François Pinard.
Thu Mar 7 20:26:07 1996 Jim Meyering (meyering@na-net.ornl.gov)
* df.c (main): Tell read_filesystem_list that it should determine
file system type when the user specifies --print-type or -T.
From Michael Rendell <michael@cs.mun.ca>.
From Michael Rendell <michael@cs.mun.ca>.
Tue Feb 27 23:13:46 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -196,7 +523,7 @@ Thu Feb 15 23:08:41 1996 Jim Meyering (meyering@na-net.ornl.gov)
destroy the source file. Before, running the commands
cd /tmp; rm -f a a~; : > a; echo A > a~; cp -b -V simple a~ a
would leave two zero-length files: a and a~.
Reported by Martin C. Martin <mcm@cs.cmu.edu>.
Reported by Martin C. Martin <mcm@cs.cmu.edu>.
Mon Feb 12 23:23:25 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -397,7 +724,7 @@ Sun Oct 29 06:06:13 1995 Jim Meyering (meyering@comco.com)
* touch.c: Change long option name `--file' to `--reference'.
Leave --file as an alias, for now. It will be removed later.
(usage): Reflect option name change. From Franc,ois Pinard.
(usage): Reflect option name change. From Franc,ois Pinard.
Wed Oct 18 23:09:55 1995 Jim Meyering (meyering@comco.com)
@@ -467,8 +794,8 @@ Sun Oct 1 13:22:36 1995 Jim Meyering (meyering@comco.com)
Tue Sep 26 23:05:01 1995 Jim Meyering (meyering@comco.com)
* man/Makefile.in (install-data, uninstall): Use sed not basename.
The GNU Coding Standard suggests that only a select set of
relatively standard utilities be used in Makefiles. basename is
The GNU Coding Standard suggests that only a select set of
relatively standard utilities be used in Makefiles. basename is
not among them. Suggested by Ulrich Drepper.
Mon Sep 25 23:12:37 1995 Jim Meyering <meyering@gremlin.comco.com>
@@ -490,7 +817,7 @@ Mon Aug 7 23:27:54 1995 Jim Meyering (meyering@comco.com)
Fri Aug 4 22:11:06 1995 Jim Meyering (meyering@comco.com)
* install.c (isnumber): Rename to is_number to avoid conflict with
FreeBSD 2.0.5 macro definition. Reported by David O'Brien
FreeBSD 2.0.5 macro definition. Reported by David O'Brien
(obrien@sea.legent.com).
* lib/save-cwd.c: New file.
@@ -649,9 +976,9 @@ Mon Feb 20 22:54:39 1995 Jim Meyering (meyering@comco.com)
Sat Feb 11 07:52:01 1995 Jim Meyering (meyering@comco.com)
* configure.in (AC_REPLACE_FUNCS): Add memcmp, memcpy, and memset.
(AC_CHECK_FUNCS): Add strchr and strrchr.
* lib/Makefile.in (SOURCES): Add memcmp.c, memcpy.c, and memset.c.
* configure.in (AC_REPLACE_FUNCS): Add memcmp, memcpy, and memset.
(AC_CHECK_FUNCS): Add strchr and strrchr.
* lib/Makefile.in (SOURCES): Add memcmp.c, memcpy.c, and memset.c.
* system.h: Remove index/rindex and bcmp/bcopy/bzero references.
Separate errno declaration from STDC_HEADERS.
@@ -662,7 +989,7 @@ Sat Feb 11 07:52:01 1995 Jim Meyering (meyering@comco.com)
* fsusage.c (get_fs_usage, statfs): Use safe_read, and safe_stat
rather than bare read and stat. From Bruno Haible.
* lib/Makefile.in (DISTFILES): Add error.h.
* lib/Makefile.in (DISTFILES): Add error.h.
* chgrp.c, chmod.c, chown.c, cp-hash.c, cp.c, df.c, du.c, install.c,
ln.c, ls.c, mv.c, mvdir.c, rm.c, touch.c: Rename SAFE_STAT and
@@ -712,16 +1039,16 @@ Sun Dec 4 14:53:12 1994 Jim Meyering (meyering@comco.com)
Fri Nov 11 11:15:20 1994 Jim Meyering (meyering@comco.com)
* mknod.c (my_strtol): New function.
(main): Use it instead of atoi to convert argument strings to
major and minor device numbers. Now, mknod diagnoses invalid
device numbers and accepts octal and hexadecimal as well as
decimal string arguments. Ralf Lammers
<rlammers@physik.uni-osnabrueck.de> suggested that mknod accept
hex device numbers for compatibility with HPUX's mknod program.
* mknod.c (my_strtol): New function.
(main): Use it instead of atoi to convert argument strings to
major and minor device numbers. Now, mknod diagnoses invalid
device numbers and accepts octal and hexadecimal as well as
decimal string arguments. Ralf Lammers
<rlammers@physik.uni-osnabrueck.de> suggested that mknod accept
hex device numbers for compatibility with HPUX's mknod program.
* configure.in (AC_REPLACE_FUNCS): Add strtol.
* lib/Makefile.in (SOURCES): Add strtol.c.
* configure.in (AC_REPLACE_FUNCS): Add strtol.
* lib/Makefile.in (SOURCES): Add strtol.c.
Sun Nov 06 00:18:56 1994 Jim Meyering (meyering@comco.com)

View File

@@ -1,8 +1,18 @@
Changes in release 3.13:
* ls accepts new option --color[=WHEN] where WHEN is `always', `never',
or `auto'. --color=never is the default. --color is equivalent
to --color=always (documented only in --help message FIXME)
* new program: dircolors (not yet documented FIXME)
* ls allows 0 as argument to --tabsize (-T) option. Using --tabsize=0
inhibits the use of TAB characters for separating columns.
* you can create a backup of FILE with cp --force --backup FILE FILE. Before,
that command failed saying that ``FILE' and `FILE' are the same file'.
* uses automake-generated Makefile templates
* chown and chgrp accept new option --no-dereference (-h)
* ln -f FILE FILE fails with a diagnostic rather than silently removing FILE
* when building on systems that have getopt_long (like Linux), the system-
provided function will be used -- so executables may be a little smaller
* chgrp, chown, cp -p, and mv all modify owner and/or group on systems
* cp -p, and mv modify owner and/or group of symlinks on systems
(like Solaris) that provide the lchown system call.
* df no longer invokes the sync system call by default. You can use the
--sync option to make df invoke sync before getting file system sizes.
@@ -35,6 +45,7 @@ Changes in release 3.13:
* du works on SunOS 4 systems even when accounting is enabled
* many programs that convert strings to integers now use strtol or strtoul
and detect overflow
User-visible changes in release 3.12:
* None.
User-visible changes in release 3.11:

View File

@@ -1,3 +1,98 @@
Sat Jun 29 18:58:20 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (PACKAGE_VERSION): Add `GNU ' prefix so we see
it in the output of --version. Reported by RMS.
Tue Jun 18 22:14:42 1996 Jim Meyering <meyering@na-net.ornl.gov>
* aclocal.m4: Update from gettext-0.10.20.
* ABOUT-NLS: Likewise.
* intl/*: Likewise.
Sun Jun 16 13:44:36 1996 Jim Meyering <meyering@na-net.ornl.gov>
* doc/Makefile.am (EXTRA_DIST): Add texinfo.tex.
Thu Jun 6 21:57:08 1996 Jim Meyering <meyering@na-net.ornl.gov>
* po/Makefile.in.in: Update from gettext-0.10.16.
* intl/*: Likewise.
* ABOUT-NLS: Likewise.
* aclocal.m4 (AC_REPLACE_GNU_GETOPT): Move definition to precede
gettext-related ones.
Update from gettext-0.10.16.
Wed May 29 21:28:53 1996 Jim Meyering <meyering@na-net.ornl.gov>
* expr.c (docolon): Give a warning when the first character
of the basic regular expression is `^'.
Mon May 20 22:56:06 1996 Jim Meyering (meyering@na-net.ornl.gov)
* id.c (xgetgroups): New function, factored out of
print_group_list and print_full_info.
(print_group_list): Call it.
(print_full_info): Call it.
* lib/Makefile.am (getdate.c): Disable dependencies that can
require rerunning YACC when not in maintainer mode.
(posixtm.c): Likewise.
Tue May 14 18:47:35 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* id.c (print_group_list): When USERNAME is specified use
getugroups to get the number of groups.
(print_full_info): Likewise.
Sun May 19 21:45:49 1996 Jim Meyering (meyering@na-net.ornl.gov)
* seq.c (usage): Make it clearer.
Sat May 18 13:29:46 1996 Jim Meyering (meyering@na-net.ornl.gov)
* expr.c (main): Don't recognize --help, --h, --he, --version,
--v, etc. if the POSIXLY_CORRECT environment variable is set.
* echo.c (main): Likewise.
* printf.c (main): Likewise.
* test.c (main): Likewise.
* expr.c (docolon) [RE_SYNTAX_POSIX_BASIC]: Revert change of Mar 1.
Tue May 7 22:10:20 1996 Jim Meyering (meyering@na-net.ornl.gov)
* configure.in: Require autoconf-2.10.
* aclocal.m4 (jm_MAINTAINER_MODE): New macro.
* configure.in (jm_MAINTAINER_MODE): Use it.
Mon May 6 22:40:54 1996 Jim Meyering (meyering@na-net.ornl.gov)
* lib/strftime.c: Update from GNU libc.
Sat May 4 20:54:32 1996 Jim Meyering (meyering@na-net.ornl.gov)
* system.h [IN_CTYPE_DOMAIN]: Rename from ISASCII.
* seq.c: Remove useless void casts of *printf return values.
Mon Apr 29 22:23:40 1996 Jim Meyering (meyering@na-net.ornl.gov)
* basename.c (usage): Mark translatable strings.
* chroot.c (main): Likewise.
* basename.c (main): Separate messages about `too few' and `too many'
arguments to ease translation.
* dirname.c (main): Likewise.
* date.c (usage): Change TAB in message to spaces. Doing that seems
to have worked around a problem with something in gettext that was
producing a truncated usage message for date's usage.
From François Pinard.
Sun Apr 28 17:10:03 1996 Jim Meyering (meyering@na-net.ornl.gov)
* configure.in: Make fp_C_PROTOTYPES precede AC_C_INLINE.
Otherwise, some systems lose because the value AC_C_INLINE choses
with plain `cc' is different from that chosen when using the ANSI-mode
C compiler. From Kaveh Ghazi.
Tue Apr 23 22:05:35 1996 Jim Meyering (meyering@na-net.ornl.gov)
* aclocal.m4 (AC_REPLACE_GNU_GETOPT): New macro.
@@ -112,7 +207,7 @@ Sun Apr 7 11:58:13 1996 Jim Meyering (meyering@na-net.ornl.gov)
* strftime.c (mon_week_ISO): New function to implement new %V format.
(sun_week): Make TM parameter `const'.
(mon_week): Likewise.
(mon_week): Rewrite to correctly implement %W format..
(mon_week): Rewrite to implement %W format correctly.
(strftime): Handle %V format.
Reported by Arne Juul.
@@ -256,7 +351,7 @@ Tue Mar 12 17:52:05 1996 Jim Meyering (meyering@na-net.ornl.gov)
Link an nls file.
(AC_OUTPUT): Reflect addition of two new directories, intl and po.
Create po/Makefile.
Mostly from François Pinard.
Mostly from François Pinard.
Wed Mar 6 21:40:34 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -267,7 +362,7 @@ Tue Mar 5 22:49:33 1996 Jim Meyering (meyering@na-net.ornl.gov)
* getdate.y (RelativeMonth): Add 1900 to the year so that relative
date specs that push the year through the end of the century work.
For example, `date -d "01/01/1998 3 years" +%Y' now prints 2001.
For example, `date -d "01/01/1998 3 years" +%Y' now prints 2001.
From Peter Dalgaard (pd@kubism.ku.dk).
Mon Mar 4 23:46:43 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -278,7 +373,7 @@ Mon Mar 4 23:46:43 1996 Jim Meyering (meyering@na-net.ornl.gov)
Fri Mar 1 23:46:32 1996 Jim Meyering (meyering@na-net.ornl.gov)
* expr.c (docolon): Don't initialize re_syntax_options to
deceptively-named RE_SYNTAX_POSIX_BASIC -- it recognizes non-BRE
deceptively-named RE_SYNTAX_POSIX_BASIC -- it recognizes non-BRE
\?, \+, and \|. Use RE_SYNTAX_POSIX_MINIMAL_BASIC instead.
* od.c (WINDOWS_SETFILEMODE_BINARY): New macro.
@@ -290,9 +385,9 @@ Fri Mar 1 23:46:32 1996 Jim Meyering (meyering@na-net.ornl.gov)
Wed Feb 28 21:48:07 1996 Paul Eggert <eggert@twinsun.com>
* configure.in (LOCALTIME_CACHE):
Also define if localtime mishandles unsetting TZ.
This works around a localtime bug in mips-dec-ultrix.
* configure.in (LOCALTIME_CACHE):
Also define if localtime mishandles unsetting TZ.
This works around a localtime bug in mips-dec-ultrix.
Wed Feb 28 23:08:24 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -300,7 +395,7 @@ Wed Feb 28 23:08:24 1996 Jim Meyering (meyering@na-net.ornl.gov)
(noinst_HEADERS): Add xstrtoul.h.
* factor.c: General cleanup. Use xstrtoul, not atoi.
Change output format. Allow inputs as large as ULONG_MAX.
Change output format. Allow inputs as large as ULONG_MAX.
Allow more than one command line argument.
* stty.c (wrapf) [!__STDC__]: Indent by one space the first line
@@ -316,9 +411,9 @@ Sun Feb 25 22:19:52 1996 Jim Meyering (meyering@na-net.ornl.gov)
* src/Makefile.am (BUILT_SOURCES): Set to `who.c users.c'.
(MOSTLYCLEANFILES): Add who.c and users.c.
(who.c): New rule to create this file. Concatenate definition of
WHO and contents of who-users.c.
WHO and contents of who-users.c.
(users.c): New rule to create this file. Concatenate definition of
USERS and contents of who-users.c.
USERS and contents of who-users.c.
Sat Feb 24 12:20:58 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -336,7 +431,7 @@ Sat Feb 24 12:20:58 1996 Jim Meyering (meyering@na-net.ornl.gov)
not int.
* expr.c (docolon): Set re_syntax_options to RE_SYNTAX_POSIX_BASIC
so expr's pattern matching uses BASIC (not GNU-extended) REs.
so expr's pattern matching uses BASIC (not GNU-extended) REs.
Reported by Jim Kingdon.
* who-users.c (print_entry): Use strchr, not index.
@@ -508,7 +603,7 @@ Sat Oct 28 00:49:13 1995 Jim Meyering (meyering@comco.com)
* date.c: New option --reference=FILE (-r FILE) analogous to the
like-named touch option.
(main): Recognize it and give diagnostic for misuse.
(main): Recognize it and give diagnostic for misuse.
(usage): Describe briefly.
From Franc,ois Pinard.
@@ -518,8 +613,8 @@ Sat Oct 28 00:49:13 1995 Jim Meyering (meyering@comco.com)
Tue Sep 26 23:05:01 1995 Jim Meyering (meyering@comco.com)
* man/Makefile.in (install-data, uninstall): Use sed not basename.
The GNU Coding Standard suggests that only a select set of
relatively standard utilities be used in Makefiles. basename is
The GNU Coding Standard suggests that only a select set of
relatively standard utilities be used in Makefiles. basename is
not among them. Suggested by Ulrich Drepper.
Tue Aug 8 22:57:34 1995 Jim Meyering (meyering@comco.com)
@@ -615,9 +710,9 @@ Sat Feb 11 08:27:12 1995 Jim Meyering (meyering@comco.com)
(SOURCES, OBJECTS, PROGS): Add seq.
* Makefile.in (PROGS): Add seq.
* configure.in (AC_REPLACE_FUNCS): Add memcmp, memcpy, and memset.
(AC_CHECK_FUNCS): Add strchr and strrchr.
* lib/Makefile.in (SOURCES): Add memcmp.c, memcpy.c, and memset.c.
* configure.in (AC_REPLACE_FUNCS): Add memcmp, memcpy, and memset.
(AC_CHECK_FUNCS): Add strchr and strrchr.
* lib/Makefile.in (SOURCES): Add memcmp.c, memcpy.c, and memset.c.
* system.h: Remove index/rindex and bcmp/bcopy/bzero references.
Separate errno declaration from STDC_HEADERS.

View File

@@ -1,11 +1,14 @@
Changes in release 1.13
* when matching, expr warns about non-portability when the first character
of the basic regular expression is `^'
* `id user' no longer prints bogus group list
* uses automake-generated Makefile templates
* date accepts new %V format
* date's %U and %W formats work properly
* nice option handling works with 2-digit old-style-option adjustments.
Now, `nice -18 -- nice' prints `18'. Before it printed `8'.
* internationalized diagnostic messages
* `date -d "01/01/1998 3 years" +%Y' now works properly. It prints 2001.
* expr's match operator has been corrected to use basic regular expressions
* New programs: chroot, factor, seq, uptime.
* date accepts new option: --rfc-822 (-R)
* date accepts new format, %z, for RFC-822 style numeric timezone (-0500)

View File

@@ -1,3 +1,211 @@
Tue Jul 2 21:51:40 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (ALL_LINGUAS): Add dutch (nl).
Mon Jul 1 23:50:19 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/md5sum.c [NEWLINE_REPLACEMENT_STRING]: Define.
(split_3): Translate NL bytes not to NUL, but to
NEWLINE_REPLACEMENT_STRING.
Suggested by Ulrich Drepper.
(main): Translate back to NL-containing filename.
Sun Jun 30 22:42:17 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/md5sum.c (split_3): Take an additional parameter, S_LEN.
Adapt caller.
Map translated NEWLINE-containing filename back into the original
NEWLINE-containing name.
(md5_check): Translate NEWLINE bytes to NUL bytes in filename.
Sat Jun 29 18:59:07 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (PACKAGE_VERSION): Add `GNU ' prefix so it
appears in the output of --version. Reported by RMS.
Wed Jun 26 21:35:10 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/Makefile.am (LDADD): Remove sort-specific hack to link
with -lm.
* aclocal.m4 (AM_FUNC_STRTOD): New macro.
* configure.in (AM_FUNC_STRTOD): Use it.
(AC_REPLACE_FUNCS): Remove strtod.
Suggested by Tom Tromey.
* po/Makefile.in.in (install-data): Add `else true;' to avoid
letting failing if-condition cause make failure.
From Fred Fish (fnf@ninemoons.com).
Tue Jun 25 21:55:18 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.18a.
Tue Jun 18 20:43:20 1996 Jim Meyering <meyering@na-net.ornl.gov>
* aclocal.m4: Update from gettext-0.10.20.
* ABOUT-NLS: Likewise.
* intl/*: Likewise.
Thu Jun 13 22:31:39 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (VERSION): Bump to 1.18a.
* po/Makefile.in.in ($(PACKAGE).pot): Reapply change of May 30.
Depend on POTFILES only when using maintainer mode.
* intl/*: Update from gettext-0.10.18.
Tue Jun 11 23:32:10 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.18.
* po/Makefile.in.in: Update from gettext-0.10.17.
* intl/*: Likewise.
* ABOUT-NLS: Likewise.
Mon Jun 10 18:22:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Makefile.am (cvs-dist): Use -c option in cvs tag command.
Fri Jun 7 22:06:46 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (VERSION): Set to 1.18.
* src/Makefile.am (sort_LDADD): Set this to -lm to get pow when using
the strtod supplied with this package. Otherwise, linking failed on
Solaris-2.4 systems. Reported by Wayne Stewart <wstewa@atl.com>.
Thu Jun 6 21:57:08 1996 Jim Meyering <meyering@na-net.ornl.gov>
* po/Makefile.in.in: Update from gettext-0.10.16.
* intl/*: Likewise.
* ABOUT-NLS: Likewise.
* aclocal.m4 (AC_REPLACE_GNU_GETOPT): Move definition to precede
gettext-related ones.
Update from gettext-0.10.16.
Fri May 31 22:04:51 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.17.
* Makefile.am (EXTRA_DIST): Set to texinfo.tex so that file is
distributed.
Thu May 30 00:07:48 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.16.
* tail.c (main): Interpret the old-style +VALUE and -VALUE options
like -c VALUE and -c +VALUE (resp) when VALUE has one of the [bkm]
suffix multipliers. This makes the code consistent with --help
output. Reported by Karl Heuer.
* sort.c (limfield): #ifdef-out a block of code that makes
GNU sort incompatible with Unix sort when a key-end spec refers
to the N'th character in a field that has fewer than N characters.
The POSIX spec doesn't appear to specify behavior for this case.
From Karl Heuer.
* po/Makefile.in.in (stamp-cat-id): Avoid using temp filename
longer than 14 characters.
(mostlyclean): Likewise.
From Karl Heuer.
* po/Makefile.in.in ($(PACKAGE).pot): Depend on POTFILES only
when using maintainer mode. Reported by Karl Heuer.
* po/Makefile.in.in (.po.mo): Reenable dependency and rule.
It is required when using native NLS, e.g. on Solaris.
From Marcus Daniels.
* od.c (decode_one_format): Use %lu (not %d) printf format
corresponding to unsigned long, SIZE.
* Version 1.15.
* intl/Makefile.in (installcheck): New target.
* po/Makefile.in.in (installcheck): New target.
* od.c (decode_one_format): Take another parameter.
Give a specific diagnostic for invalid format spec here rather
than an overly general one from caller's caller.
(decode_format_string): Update caller.
(main): Don't give diagnostic here when decode_format_string fails.
Remove assertions that could fail on some Crays because they don't
have a two-byte type.
Johan Danielsson (joda@pdc.kth.se) reported the failed assertions.
Mon May 27 17:43:31 1996 Jim Meyering <meyering@na-net.ornl.gov>
* cat.c (main): Use STDIN_FILENO and STDOUT_FILENO instead of
less portable fileno (stdin) and fileno (stdout).
* sort.c (main): Use STDIN_FILENO instead of less portable
fileno (stdin).
Mon May 20 21:50:23 1996 Jim Meyering (meyering@na-net.ornl.gov)
* Makefile.am (distcheck): Remove target and rule -- automake-0.33
adds it automatically.
Sun May 19 13:15:49 1996 Jim Meyering (meyering@na-net.ornl.gov)
* configure.in (LINGUAS): Add ko.
* Makefile.am (distcheck): Remove @MAINT@ prefix from first command.
Thu May 16 22:18:41 1996 Jim Meyering (meyering@na-net.ornl.gov)
* Makefile.am (distcheck): New target. From Gord Matzigkeit.
Fri May 10 20:46:13 1996 Jim Meyering (meyering@na-net.ornl.gov)
* po/Makefile.in.in (all-yes): Always depend on CATALOGS. Otherwise
they won't be built and install could fail. From Ulrich Drepper.
(.po.mo): Disable dependency and rule when not in maintainer mode.
* aclocal.m4 (ud_WITH_NLS): Make DATADIRNAME and CATOBJEXT depend
on whether we're using GNU gettext. From Ulrich Drepper.
Wed May 8 21:10:43 1996 Jim Meyering (meyering@na-net.ornl.gov)
* intl/Makefile.in (distdir): Renamed from dist. For compatibility
with automake-0.32.
* po/Makefile.in.in (distdir): Likewise.
* po/Makefile.in.in (all-yes): Depend on GMOFILES.
Depend on CATALOGS and GMOFILES files only in maintainer mode.
Tue May 7 22:10:20 1996 Jim Meyering (meyering@na-net.ornl.gov)
* configure.in: Require autoconf-2.10.
* aclocal.m4 (jm_MAINTAINER_MODE): New macro.
* configure.in (jm_MAINTAINER_MODE): Use it.
Sat May 4 20:40:01 1996 Jim Meyering (meyering@na-net.ornl.gov)
* configure.in (LINGUAS): Add de.
* po/de.po: New file.
* memcasecmp.c [IN_CTYPE_DOMAIN]: Rename from ISASCII.
* regex.c [IN_CTYPE_DOMAIN]: Likewise.
* system.h [IN_CTYPE_DOMAIN]: Likewise.
Sun Apr 28 17:10:03 1996 Jim Meyering (meyering@na-net.ornl.gov)
* fmt.c (copy_rest): Don't copy past end of prefix. Output
trailing spaces if the prefix had any. Before, fmt would
improperly output NUL bytes. The command
perl -e 'print "| S";' |fmt -p' | '|tr '\0' @
output `|@S'. Reported by François Pinard.
* sort.c (main): Give a better diagnostic for `sort -0'.
Reported by Karl Berry.
* configure.in: Make fp_C_PROTOTYPES precede AC_C_INLINE.
Otherwise, some systems lose because the value AC_C_INLINE choses
with plain `cc' is different from that chosen when using the ANSI-mode
C compiler. From Kaveh Ghazi.
Tue Apr 23 22:05:35 1996 Jim Meyering (meyering@na-net.ornl.gov)
* aclocal.m4 (AC_REPLACE_GNU_GETOPT): New macro.
@@ -103,8 +311,8 @@ Sun Mar 24 08:47:40 1996 Jim Meyering (meyering@na-net.ornl.gov)
* tr.c (main): Likewise.
* cat.c cksum.c comm.c csplit.c cut.c expand.c fmt.c fold.c head.c
join.c md5sum.c nl.c od.c paste.c pr.c split.c sum.c tac.c tail.c
tr.c unexpand.c uniq.c wc.c: Exit with status EXIT_SUCCESS or
join.c md5sum.c nl.c od.c paste.c pr.c split.c sum.c tac.c tail.c
tr.c unexpand.c uniq.c wc.c: Exit with status EXIT_SUCCESS or
EXIT_FAILURE, rather than 0 or 1.
Sat Mar 23 23:14:40 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -182,7 +390,7 @@ Sat Mar 9 13:30:12 1996 Jim Meyering (meyering@na-net.ornl.gov)
Link an nls file.
(AC_OUTPUT): Reflect addition of two new directories, intl and po.
Create po/Makefile.
From François Pinard.
From François Pinard.
* tr.c (star_digits_closebracket): Declare formal param, IDX,
and local I to be of type size_t (rather than int) to avoid
@@ -289,7 +497,7 @@ Fri Dec 22 21:34:55 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.
* configure.in: Touch stamp-h only if config.h is remade.
* csplit.c (extract_regexp) [!WITH_REGEX]: Intialize
syntax_parens field.
syntax_parens field.
Mon Dec 18 21:42:44 1995 Jim Meyering (meyering@comco.com)
@@ -339,7 +547,7 @@ Tue Dec 5 17:49:53 1995 Jim Meyering (meyering@comco.com)
From Karl Heuer.
* Makefile.in (mandir): @mandir@ is just $(prefix)/man.
Append `/man1'. Reported by Karl Heuer.
Append `/man1'. Reported by Karl Heuer.
* sum.c (bsd_sum_file): Remove misleading comment. From Karl Heuer.
@@ -351,7 +559,7 @@ Fri Dec 1 01:02:36 1995 Jim Meyering (meyering@comco.com)
* sort.c (numcompare): Properly order `-' and valid integers;
treat `-' as if it were zero. Reported by Ross Alexander
<r.alexander@auckland.ac.nz>.
<r.alexander@auckland.ac.nz>.
* Makefile.in (DISTFILES): Remove unused mkdep-Makefile.
(.PHONY): Depend on default.
@@ -426,7 +634,7 @@ Wed Nov 15 23:48:31 1995 Jim Meyering (meyering@comco.com)
* system.h [__P]: Define it here.
* aclocal.m4 (jm_AUTODEPS): Rename from jm_WITH_AUTODEPS.
Revamp, with suggestions from Franc,ois Pinard.
Revamp, with suggestions from Franc,ois Pinard.
(jm_WITH_GNU_MAKE): New macro.
(jm_PROG_MKDEP): New macro.
* configure.in (jm_PROG_MKDEP): Use it.
@@ -438,8 +646,8 @@ Wed Nov 15 23:48:31 1995 Jim Meyering (meyering@comco.com)
Tue Nov 14 23:10:54 1995 Jim Meyering (meyering@comco.com)
* sort.c: Add support for sorting numbers in scientific notation.
Include xstrtod.h.
(struct keyfield): Add field: general_numeric.
Include xstrtod.h.
(struct keyfield): Add field: general_numeric.
(usage): Describe -g option.
(general_numcompare): New function.
(keycompare): Use new comparison function when general_numeric
@@ -580,7 +788,7 @@ Sun Oct 29 14:04:36 1995 Jim Meyering (meyering@comco.com)
Sat Oct 28 16:02:39 1995 Jim Meyering (meyering@comco.com)
* md5sum.c (md5_check): Use the same message format when there is
a single file and it gets a read error or checksum mismatch as when
a single file and it gets a read error or checksum mismatch as when
there are more. Write that warning to standard error, not standard
output. Suggestions from Greg Troxel (gdt@b-sgi.bbn.com).
@@ -703,8 +911,8 @@ Thu Sep 28 23:16:05 1995 Jim Meyering (meyering@comco.com)
Tue Sep 26 23:05:01 1995 Jim Meyering (meyering@comco.com)
* man/Makefile.in (install-data, uninstall): Use sed not basename.
The GNU Coding Standard suggests that only a select set of
relatively standard utilities be used in Makefiles. basename is
The GNU Coding Standard suggests that only a select set of
relatively standard utilities be used in Makefiles. basename is
not among them. Suggested by Ulrich Drepper.
Sun Sep 24 08:36:47 1995 Jim Meyering (meyering@comco.com)
@@ -903,7 +1111,6 @@ Tue Jul 11 21:56:02 1995 Jim Meyering (meyering@comco.com)
* md5sum.c Add #else block after #ifdef VMS.
(main): Rename local variable.
Add FIXME: allow newlines in filenames.
Detect and report failed fclose calls on stdout and checkfile_stream.
* tr.c (unqote): Comment out unreachable break stmts.
@@ -946,7 +1153,7 @@ Thu Jul 6 23:44:20 1995 Jim Meyering (meyering@comco.com)
* od.c (dump): Correct loop-termination criterion.
Before, running `printf 1234| ./od --width=4 --read-bytes=4'
printed output for 8 bytes -- the last four were garbage.
This happened only when the dump limit, N, was specified (with
This happened only when the dump limit, N, was specified (with
--read-bytes=N) and N was a multiple of bytes_per_block
(usually 16, but 4 in this example). From Andreas Schwab.

View File

@@ -1,12 +1,30 @@
Changes in release 1.18
* when building sort, link with -lm on systems that use the replacement strtod
* update from gettext-0.10.17.
Changes in release 1.17
* include texinfo.tex in the distribution
Changes in release 1.16
* sort is compatible with Unix sort when a key-end spec refers to the N'th
character in a field that has fewer than N characters
* tail with old-style options like -20k and +31m operates on units of bytes,
as the --help usage message says. Before, it used units of lines.
Changes in release 1.15
* od gives better diagnostics for invalid format specs
* uses automake-generated Makefile templates
* configure takes a new option: --enable-maintainer-mode
* fix a bug in fmt when prefix has trailing white space
* internationalized diagnostic messages
* fix a couple bugs in tr involving use of -c and/or -d flags -- see ChangeLog
* diagnose some improper or questionable invocations of csplit
* properly handle `echo |csplit - 1 1', rather than aborting
* join without -t now ignores leading blanks
* fix join: without -t it now ignores leading blanks
* sort accepts new option: -z for NUL terminated records
* join accepts new option: --ignore-case, -i
* uniq accepts new option: --ignore-case, -i
User-visible changes in release 1.14
* sort -i and sort -d properly order strings containing ignored characters
* nl: rename misleading --first-page=N option to --starting-line-number=N.
@@ -21,6 +39,7 @@ User-visible changes in release 1.14
* tr 'a[b*512]' '[a*]' < /dev/null terminates
* tr '[:*3][:digit:]' 'a-m' and tr 'a[=*2][=c=]' 'xyyz' no longer fail
* special characters in tr's string1 and string2 may be escaped with backslash
User-visible changes in release 1.13
* md5sum: with --check, distinguish between open/read failure and bad checksum
* md5sum: remove -h, -s, -v short options
@@ -33,6 +52,7 @@ User-visible changes in release 1.13
* sort accepts -.1 +.2 options for compatibility
* od works properly when dump limit is specified and is a multiple of
bytes_per_block (set by --width, 16 by default).
User-visible changes in release 1.12
* sort no longer reports spurious errors on Ultrix systems
* new program: md5sum
@@ -49,8 +69,10 @@ User-visible changes in release 1.12
* wc is faster when not counting words
* wc now works even when file pointer isn't at beginning of file
* expand no longer seg faults with very long tab lists
User-visible changes in release 1.11
* fmt is built
User-visible changes in release 1.10
* skeletal texinfo documentation (mainly just the `invoking' nodes)
* new program: fmt

View File

@@ -30,7 +30,7 @@ exec_prefix = @exec_prefix@
datadir = $(prefix)/@DATADIRNAME@
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext
gettextsrcdir = $(prefix)/share/gettext/po
subdir = po
INSTALL = @INSTALL@
@@ -87,14 +87,15 @@ INSTOBJEXT = @INSTOBJEXT@
all: all-@USE_NLS@
all-yes all-gettext: cat-id-tbl.c $(CATALOGS)
all-yes: cat-id-tbl.c $(CATALOGS)
all-no:
$(PACKAGE).pot: $(POTFILES)
$(PACKAGE).pot: @MAINT@$(POTFILES)
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in
if cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \
if [ ! -s $(PACKAGE).po ] \
|| cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \
rm -f $(PACKAGE).po; \
else \
rm -f $(srcdir)/$(PACKAGE).pot \
@@ -103,15 +104,15 @@ $(PACKAGE).pot: $(POTFILES)
cat-id-tbl.c: stamp-cat-id
stamp-cat-id: $(PACKAGE).pot
rm -f cat-id-tbl.tmp.c
rm -f cat-id-tbl.tmp
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp.c
if cmp -s cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; then \
rm cat-id-tbl.tmp.c; \
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
rm cat-id-tbl.tmp; \
else \
echo cat-id-tbl.c changed; \
rm -f $(srcdir)/cat-id-tbl.c; \
mv cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; \
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
fi
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
@@ -140,16 +141,21 @@ install-data: all
if test -r $(srcdir)/$$cat.m ; then \
$(INSTALL_DATA) $(srcdir)/$$cat.m \
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
else \
true; \
fi; \
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
$(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
cd $(srcdir) && \
$(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/Makefile.in.in; \
else \
true; \
fi
# This installation goal is only used in GNU gettext. Packages which
# only use the library should use install instead.
install-src: install
$(top_srcdir)/mkinstalldirs $(gettextsrcdir)
cd $(srcdir) && \
$(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/po-Makefile.in.in
# Define this as empty until I found a useful application.
installcheck:
uninstall:
catalogs='$(CATALOGS)'; \
@@ -166,10 +172,10 @@ check: all
cat-id-tbl.o: ../intl/libgettext.h
TAGS ID:
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp.c
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
rm -fr *.o
clean: mostlyclean
@@ -182,7 +188,7 @@ maintainer-clean: distclean
@echo "it deletes files that may require special tools to rebuild."
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist dist-gettext: update-po $(DISTFILES)
dist distdir: update-po $(DISTFILES)
for file in $(DISTFILES); do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \

264
src/asa.c Normal file
View File

@@ -0,0 +1,264 @@
/*
TODO
mark translatable strings
add usage function
call parse_long_options
dcl, set program_name
do fclose/error checking
*/
/* asa.c - interpret ASA carriage control characters
Copyright (C) 94, 1996 Thomas Koenig
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 of the License, 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. */
/* System Headers */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/* Macros */
#define LINESIZE 135
#define NUMLINES 5
#define MAX(a,b) ((a) > (b) ? (a) : (b))
/* Structures and unions */
struct Str
{
char *chr;
size_t len;
};
typedef struct Str str;
/* File scope variables */
static str *line_buffer = (str *) 0;
static size_t line_num = 0;
static size_t linebuf_size;
/* Function declarations */
char *xmalloc ();
char *xrealloc ();
static size_t readline (FILE *fp, char **a);
static void add_line (str *);
static void flush (void);
static void copy_file (FILE *fp);
/* Local functions */
static void
form_feed ()
{
putchar ('\f');
}
static void
new_line ()
{
putchar ('\n');
}
static void
add_line (str *line)
{
if (line_num >= linebuf_size)
{
linebuf_size += NUMLINES;
line_buffer = (str *) xrealloc (line_buffer, linebuf_size * sizeof (str *));
}
line_buffer[line_num] = *line;
line_num++;
}
static void
flush ()
{
size_t i, j;
size_t max_len;
if (line_num == 0)
return;
if (line_num == 1)
{
printf ("%s\n", line_buffer[0].chr + 1);
line_num = 0;
return;
}
max_len = 0;
for (j = 0; j < line_num; j++)
max_len = MAX (max_len, line_buffer[j].len);
for (i = 1; i <= max_len; i++)
{
int printed = 0;
for (j = 0; j < line_num; j++)
{
if (line_buffer[j].len > i)
{
int ch = line_buffer[j].chr[i];
if (ch != ' ')
{
if (printed)
putchar ('\b');
putchar (ch);
printed = 1;
}
}
}
if (!printed)
putchar (' ');
}
for (j = 0; j < line_num; j++)
free (line_buffer[j].chr);
line_num = 0;
putchar ('\n');
}
static size_t
readline (FILE *fp, char **ret)
{
static char *buffer = (char *) 0;
char *ret_buff;
static int bufsize = LINESIZE;
int ch;
size_t len = 0;
int inc;
int i;
if (buffer == (char *) 0)
buffer = (char *) xmalloc (LINESIZE);
while (1)
{
ch = fgetc (fp);
if (ch == EOF)
break;
if (ch == '\t')
{
ch = ' ';
inc = 8 - (len % 8);
}
else
inc = 1;
if (len + inc > bufsize - 2)
{
bufsize += LINESIZE;
buffer = xrealloc (buffer, bufsize);
}
for (i = 0; i < inc; i++)
buffer[len + i] = ch;
len += inc;
if (ch == '\n')
break;
}
buffer[len] = '\0';
ret_buff = xmalloc (len + 1);
strcpy (ret_buff, buffer);
*ret = ret_buff;
return len;
}
static void
copy_file (FILE *fp)
{
str line;
static first_line = 1;
while ((line.len = readline (fp, &(line.chr))))
{
if (line.chr[line.len - 1] == '\n')
{
line.chr[line.len - 1] = '\0';
line.len--;
}
switch (line.chr[0])
{
case '+':
add_line (&line);
break;
case '0':
flush ();
new_line ();
add_line (&line);
break;
case '1':
flush ();
if (!first_line)
form_feed ();
add_line (&line);
break;
case ' ':
flush ();
add_line (&line);
break;
default:
flush ();
add_line (&line);
break;
}
first_line = 0;
}
}
/* Global functions */
int
main (int argc, char **argv)
{
int err;
line_buffer = (str *) xmalloc (NUMLINES * sizeof (str *));
linebuf_size = NUMLINES;
err = 0;
if (argc == 1)
copy_file (stdin);
else
{
FILE *fp;
char *fname;
while (--argc > 0)
{
fname = *++argv;
if ((fp = fopen (fname, "r")) == NULL)
{
err = 1;
error (0, errno, "%s", fname);
}
else
{
copy_file (fp);
fclose (fp);
}
}
}
flush ();
exit (err ? EXIT_FAILURE : EXIT_SUCCESS);
}

View File

@@ -43,22 +43,22 @@ static void
usage (int status)
{
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf ("\
printf (_("\
Usage: %s NAME [SUFFIX]\n\
or: %s OPTION\n\
",
"),
program_name, program_name);
printf ("\
printf (_("\
Print NAME with any leading directory components removed.\n\
If specified, also remove a trailing SUFFIX.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
"));
}
exit (status);
}
@@ -96,7 +96,8 @@ main (int argc, char **argv)
if (argc == 1 || argc > 3)
{
error (0, 0, "too %s arguments", argc == 1 ? "few" : "many");
error (0, 0, (argc == 1 ? _("too few arguments")
: _("too many arguments")));
usage (1);
}

View File

@@ -657,7 +657,7 @@ main (int argc, char **argv)
if (check_redirection
&& stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino
&& (input_desc != fileno (stdin) || output_desc != fileno (stdout)))
&& (input_desc != STDIN_FILENO || output_desc != STDOUT_FILENO))
{
error (0, 0, _("%s: input file is output file"), infile);
exit_status = 1;

View File

@@ -27,10 +27,6 @@
# include <limits.h>
#endif
#ifdef HAVE_LCHOWN
# define chown(PATH, OWNER, GROUP) lchown(PATH, OWNER, GROUP)
#endif
#ifndef UINT_MAX
# define UINT_MAX ((unsigned int) ~(unsigned int) 0)
#endif
@@ -39,6 +35,10 @@
# define INT_MAX ((int) (UINT_MAX >> 1))
#endif
#ifndef MAXUID
# define MAXUID INT_MAX
#endif
#include "system.h"
#include "xstrtoul.h"
#include "error.h"
@@ -51,6 +51,12 @@ struct group *getgrnam ();
# define endgrent() ((void) 0)
#endif
#ifdef HAVE_LCHOWN
# define LCHOWN(FILE, OWNER, GROUP) lchown (FILE, OWNER, GROUP)
#else
# define LCHOWN(FILE, OWNER, GROUP) 1
#endif
char *group_member ();
char *savedir ();
char *xmalloc ();
@@ -61,6 +67,10 @@ static int change_dir_group __P ((char *dir, int group, struct stat *statp));
/* The name the program was run with. */
char *program_name;
/* If nonzero, and the systems has support for it, change the ownership
of symbolic links rather than any files they point to. */
static int change_symlinks;
/* If nonzero, change the ownership of directories recursively. */
static int recurse;
@@ -86,6 +96,7 @@ static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"changes", no_argument, 0, 'c'},
{"no-dereference", no_argument, 0, 'h'},
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
{"verbose", no_argument, 0, 'v'},
@@ -154,9 +165,17 @@ change_file_group (char *file, int group)
if (group != file_stats.st_gid)
{
int fail;
if (verbose)
describe_change (file, 1);
if (chown (file, file_stats.st_uid, group))
if (change_symlinks)
fail = LCHOWN (file, file_stats.st_uid, group);
else
fail = chown (file, file_stats.st_uid, group);
if (fail)
{
errors = 1;
if (force_silent == 0)
@@ -169,12 +188,10 @@ change_file_group (char *file, int group)
error (0, errno, _("you are not a member of group `%s'"),
groupname);
}
#ifdef MAXUID
else if (errno == EINVAL && group > MAXUID)
{
error (0, 0, _("%s: invalid group number"), groupname);
}
#endif
else
{
error (0, errno, "%s", file);
@@ -255,6 +272,8 @@ usage (int status)
Change the group membership of each FILE to GROUP.\n\
\n\
-c, --changes like verbose but report only when a change is made\n\
-h, --no-dereference affect symbolic links instead of any referenced file\n\
(available only on systems with lchown system call)\n\
-f, --silent, --quiet suppress most error messages\n\
-v, --verbose output a diagnostic for every file processed\n\
-R, --recursive change files and directories recursively\n\
@@ -274,7 +293,7 @@ main (int argc, char **argv)
program_name = argv[0];
recurse = force_silent = verbose = changes_only = 0;
while ((optc = getopt_long (argc, argv, "Rcfv", long_options, (int *) 0))
while ((optc = getopt_long (argc, argv, "Rcfnv", long_options, (int *) 0))
!= EOF)
{
switch (optc)
@@ -291,6 +310,9 @@ main (int argc, char **argv)
case 'f':
force_silent = 1;
break;
case 'h':
change_symlinks = 1;
break;
case 'v':
verbose = 1;
break;
@@ -314,6 +336,13 @@ main (int argc, char **argv)
usage (1);
}
#ifndef HAVE_LCHOWN
if (change_symlinks)
{
error (1, 0, _("--no-dereference (-h) is not supported on this system"));
}
#endif
parse_group (argv[optind++], &group);
for (; optind < argc; ++optind)

View File

@@ -38,8 +38,9 @@ void strip_trailing_slashes ();
char *xmalloc ();
char *xrealloc ();
static int change_dir_mode __P ((char *dir, struct mode_change *changes,
struct stat *statp));
static int change_dir_mode __P ((const char *dir,
const struct mode_change *changes,
const struct stat *statp));
/* The name the program was run with. */
char *program_name;
@@ -78,7 +79,7 @@ static struct option const long_options[] =
if CHANGED is zero, FILE had that mode already. */
static void
describe_change (char *file, short unsigned int mode, int changed)
describe_change (const char *file, short unsigned int mode, int changed)
{
char perms[11]; /* "-rwxrwxrwx" ls-style modes. */
@@ -98,7 +99,8 @@ describe_change (char *file, short unsigned int mode, int changed)
links. Return 0 if successful, 1 if errors occurred. */
static int
change_file_mode (char *file, struct mode_change *changes, int deref_symlink)
change_file_mode (const char *file, const struct mode_change *changes,
const int deref_symlink)
{
struct stat file_stats;
unsigned short newmode;
@@ -152,7 +154,8 @@ change_file_mode (char *file, struct mode_change *changes, int deref_symlink)
Return 0 if successful, 1 if errors occurred. */
static int
change_dir_mode (char *dir, struct mode_change *changes, struct stat *statp)
change_dir_mode (const char *dir, const struct mode_change *changes,
const struct stat *statp)
{
char *name_space, *namep;
char *path; /* Full path of each entry to process. */

View File

@@ -38,10 +38,6 @@
#include "system.h"
#include "error.h"
#ifdef HAVE_LCHOWN
# define chown(PATH, OWNER, GROUP) lchown(PATH, OWNER, GROUP)
#endif
#ifndef _POSIX_VERSION
struct passwd *getpwnam ();
struct group *getgrnam ();
@@ -52,6 +48,12 @@ struct group *getgrgid ();
# define endpwent() ((void) 0)
#endif
#ifdef HAVE_LCHOWN
# define LCHOWN(FILE, OWNER, GROUP) lchown (FILE, OWNER, GROUP)
#else
# define LCHOWN(FILE, OWNER, GROUP) 1
#endif
char *savedir ();
char *parse_user_spec ();
void strip_trailing_slashes ();
@@ -64,6 +66,10 @@ static int change_dir_owner __P ((char *dir, uid_t user, gid_t group,
/* The name the program was run with. */
char *program_name;
/* If nonzero, and the systems has support for it, change the ownership
of symbolic links rather than any files they point to. */
static int change_symlinks;
/* If nonzero, change the ownership of directories recursively. */
static int recurse;
@@ -92,8 +98,9 @@ static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"changes", no_argument, 0, 'c'},
{"silent", no_argument, 0, 'f'},
{"no-dereference", no_argument, 0, 'h'},
{"quiet", no_argument, 0, 'f'},
{"silent", no_argument, 0, 'f'},
{"verbose", no_argument, 0, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
@@ -139,9 +146,17 @@ change_file_owner (char *file, uid_t user, gid_t group)
newgroup = group == (gid_t) -1 ? file_stats.st_gid : group;
if (newuser != file_stats.st_uid || newgroup != file_stats.st_gid)
{
int fail;
if (verbose)
describe_change (file, 1);
if (chown (file, newuser, newgroup))
if (change_symlinks)
fail = LCHOWN (file, newuser, newgroup);
else
fail = chown (file, newuser, newgroup);
if (fail)
{
if (force_silent == 0)
error (0, errno, "%s", file);
@@ -224,12 +239,14 @@ Usage: %s [OPTION]... OWNER[.[GROUP]] FILE...\n\
printf (_("\
Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
\n\
-c, --changes be verbose whenever change occurs\n\
-f, --silent, --quiet suppress most error messages\n\
-v, --verbose explain what is being done\n\
-R, --recursive change files and directories recursively\n\
--help display this help and exit\n\
--version output version information and exit\n\
-c, --changes be verbose whenever change occurs\n\
-h, --no-dereference affect symbolic links instead of any referenced file\n\
(available only on systems with lchown system call)\n\
-f, --silent, --quiet suppress most error messages\n\
-v, --verbose explain what is being done\n\
-R, --recursive change files and directories recursively\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
to login group if implied by a period. A colon may replace the period.\n"));
@@ -253,7 +270,7 @@ main (int argc, char **argv)
recurse = force_silent = verbose = changes_only = 0;
while ((optc = getopt_long (argc, argv, "Rcfv", long_options, (int *) 0))
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, (int *) 0))
!= EOF)
{
switch (optc)
@@ -270,6 +287,9 @@ main (int argc, char **argv)
case 'f':
force_silent = 1;
break;
case 'h':
change_symlinks = 1;
break;
case 'v':
verbose = 1;
break;
@@ -293,6 +313,13 @@ main (int argc, char **argv)
usage (1);
}
#ifndef HAVE_LCHOWN
if (change_symlinks)
{
error (1, 0, _("--no-dereference (-h) is not supported on this system"));
}
#endif
e = parse_user_spec (argv[optind], &user, &group, &username, &groupname);
if (e)
error (1, 0, "%s: %s", argv[optind], e);

View File

@@ -65,7 +65,7 @@ main (int argc, char **argv)
}
if (chroot (argv[1]))
error (1, errno, "cannot change root directory to %s", argv[1]);
error (1, errno, _("cannot change root directory to %s"), argv[1]);
if (argc == 2)
{
@@ -82,7 +82,7 @@ main (int argc, char **argv)
/* Execute the given command. */
execvp (argv[0], argv);
error (1, errno, "cannot execute %s", argv[0]);
error (1, errno, _("cannot execute %s"), argv[0]);
exit (1);
return 1;

View File

@@ -79,15 +79,16 @@ int euidaccess ();
int full_write ();
static int do_copy __P ((int argc, char **argv));
static int copy __P ((char *src_path, char *dst_path, int new_dst,
static int copy __P ((const char *src_path, const char *dst_path, int new_dst,
dev_t device, struct dir_list *ancestors));
static int copy_dir __P ((char *src_path_in, char *dst_path_in, int new_dst,
struct stat *src_sb, struct dir_list *ancestors));
static int make_path_private __P ((char *const_dirpath, int src_offset,
int mode, char *verbose_fmt_string,
static int copy_dir __P ((const char *src_path_in, const char *dst_path_in,
int new_dst, const struct stat *src_sb,
struct dir_list *ancestors));
static int make_path_private __P ((const char *const_dirpath, int src_offset,
int mode, const char *verbose_fmt_string,
struct dir_attr **attr_list, int *new_dst));
static int copy_reg __P ((char *src_path, char *dst_path));
static int re_protect __P ((char *const_dst_path, int src_offset,
static int copy_reg __P ((const char *src_path, const char *dst_path));
static int re_protect __P ((const char *const_dst_path, int src_offset,
struct dir_attr *attr_list));
/* Initial number of entries in each hash table entry's table of inodes. */
@@ -400,7 +401,7 @@ do_copy (int argc, char **argv)
if (optind >= argc)
usage (2, _("missing file arguments"));
if (optind >= argc - 1)
usage (2, _("missing file argument"));
usage (2, _("missing destination file"));
dest = argv[argc - 1];
@@ -463,7 +464,7 @@ do_copy (int argc, char **argv)
ap = basename (arg);
/* For `cp -R source/.. dest', don't copy into `dest/..'. */
dst_path = (strcmp (ap, "..") == 0
dst_path = (STREQ (ap, "..")
? xstrdup (dest)
: path_concat (dest, ap));
}
@@ -498,15 +499,33 @@ do_copy (int argc, char **argv)
struct stat source_stats;
if (flag_path)
usage (2, _("when preserving paths, last argument must be a directory"));
usage (2,
_("when preserving paths, last argument must be a directory"));
source = argv[optind];
/* When the force and backup options have been specified and
the source and destination are the same name for an existing
regular file, convert the user's command, e.g.,
`cp --force --backup foo foo' to `cp --force foo fooSUFFIX'
where SUFFIX is determined by any version control options used. */
if (flag_force
&& backup_type != none
&& STREQ (source, dest)
&& !new_dst && S_ISREG (sb.st_mode))
{
backup_type = none;
new_dest = find_backup_file_name (dest);
if (new_dest == NULL)
error (1, 0, _("virtual memory exhausted"));
}
/* When the destination is specified with a trailing slash and the
source exists but is not a directory, convert the user's command
`cp source dest/' to `cp source dest/basename(source)'. */
if (dest[strlen (dest) - 1] == '/'
else if (dest[strlen (dest) - 1] == '/'
&& lstat (source, &source_stats) == 0
&& !S_ISDIR (source_stats.st_mode))
{
@@ -531,7 +550,7 @@ do_copy (int argc, char **argv)
}
else
usage (2,
_("when copying multiple files, last argument must be a directory"));
_("when copying multiple files, last argument must be a directory"));
}
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
@@ -544,7 +563,7 @@ do_copy (int argc, char **argv)
Return 0 if successful, 1 if an error occurs. */
static int
copy (char *src_path, char *dst_path, int new_dst, dev_t device,
copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
struct dir_list *ancestors)
{
struct stat src_sb;
@@ -616,7 +635,7 @@ copy (char *src_path, char *dst_path, int new_dst, dev_t device,
if (S_ISDIR (dst_sb.st_mode))
{
error (0, 0,
_("%s: cannot overwrite directory with non-directory"),
_("%s: cannot overwrite directory with non-directory"),
dst_path);
return 1;
}
@@ -652,7 +671,7 @@ copy (char *src_path, char *dst_path, int new_dst, dev_t device,
destroy the source file. Before, running the commands
cd /tmp; rm -f a a~; : > a; echo A > a~; cp -b -V simple a~ a
would leave two zero-length files: a and a~. */
if (strcmp (tmp_backup, src_path) == 0)
if (STREQ (tmp_backup, src_path))
{
error (0, 0,
_("backing up `%s' would destroy source; `%s' not copied"),
@@ -790,7 +809,8 @@ copy (char *src_path, char *dst_path, int new_dst, dev_t device,
else
{
error (0, 0,
_("%s: can only make relative symbolic links in current directory"), dst_path);
_("%s: can make relative symbolic links only in current directory"),
dst_path);
goto un_backup;
}
}
@@ -946,8 +966,8 @@ un_backup:
permissions when done, otherwise 1. */
static int
make_path_private (char *const_dirpath, int src_offset, int mode,
char *verbose_fmt_string, struct dir_attr **attr_list,
make_path_private (const char *const_dirpath, int src_offset, int mode,
const char *verbose_fmt_string, struct dir_attr **attr_list,
int *new_dst)
{
struct stat stats;
@@ -1062,7 +1082,8 @@ make_path_private (char *const_dirpath, int src_offset, int mode,
when done, otherwise 1. */
static int
re_protect (char *const_dst_path, int src_offset, struct dir_attr *attr_list)
re_protect (const char *const_dst_path, int src_offset,
struct dir_attr *attr_list)
{
struct dir_attr *p;
char *dst_path; /* A copy of CONST_DST_PATH we can change. */
@@ -1132,8 +1153,8 @@ re_protect (char *const_dst_path, int src_offset, struct dir_attr *attr_list)
Return 0 if successful, -1 if an error occurs. */
static int
copy_dir (char *src_path_in, char *dst_path_in, int new_dst,
struct stat *src_sb, struct dir_list *ancestors)
copy_dir (const char *src_path_in, const char *dst_path_in, int new_dst,
const struct stat *src_sb, struct dir_list *ancestors)
{
char *name_space;
char *namep;
@@ -1186,7 +1207,7 @@ copy_dir (char *src_path_in, char *dst_path_in, int new_dst,
Return 0 if successful, -1 if an error occurred. */
static int
copy_reg (char *src_path, char *dst_path)
copy_reg (const char *src_path, const char *dst_path)
{
char *buf;
int buf_size;
@@ -1233,7 +1254,8 @@ copy_reg (char *src_path, char *dst_path)
#ifdef HAVE_ST_BLOCKS
if (flag_sparse == SPARSE_AUTO && S_ISREG (sb.st_mode))
{
/* Find out whether the file contains any sparse blocks. */
/* Use a heuristic to determine whether SRC_PATH contains any
sparse blocks. */
if (fstat (source_desc, &sb))
{
@@ -1245,7 +1267,8 @@ copy_reg (char *src_path, char *dst_path)
/* If the file has fewer blocks than would normally
be needed for a file of its size, then
at least one of the blocks in the file is a hole. */
if (S_ISREG (sb.st_mode) && sb.st_size / 512 > ST_NBLOCKS (sb))
if (S_ISREG (sb.st_mode)
&& (size_t) (sb.st_size / 512) > (size_t) ST_NBLOCKS (sb))
make_holes = 1;
}
#endif

View File

@@ -388,7 +388,7 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
%%c locale's date and time (Sat Nov 04 12:02:33 EST 1989)\n\
%%d day of month (01..31)\n\
%%D date (mm/dd/yy)\n\
%%e day of month, blank padded ( 1..31)\n\
%%e day of month, blank padded ( 1..31)\n\
%%h same as %%b\n\
%%H hour (00..23)\n\
%%I hour (01..12)\n\

View File

@@ -1039,8 +1039,10 @@ print_stats (void)
fprintf (stderr, _("%u+%u records in\n"), r_full, r_partial);
fprintf (stderr, _("%u+%u records out\n"), w_full, w_partial);
if (r_truncate > 0)
fprintf (stderr, _("%u truncated record%s\n"), r_truncate,
r_truncate == 1 ? "" : "s");
fprintf (stderr, "%u %s\n", r_truncate,
(r_truncate == 1
? _("truncated record")
: _("truncated records")));
}
static void

601
src/df.c
View File

@@ -32,18 +32,6 @@
char *xmalloc ();
char *xstrdup ();
static int selected_fstype __P ((char *fstype));
static int excluded_fstype __P ((char *fstype));
static void add_excluded_fs_type __P ((char *fstype));
static void add_fs_type __P ((char *fstype));
static void print_header __P ((void));
static void show_entry __P ((char *path, struct stat *statp));
static void show_all_entries __P ((void));
static void show_dev __P ((char *disk, char *mount_point, char *fstype));
static void show_disk __P ((char *disk));
static void show_point __P ((char *point, struct stat *statp));
static void usage __P ((int status));
/* The maximum length of a human-readable string. Be pessimistic
and assume `int' is 64-bits wide. Converting 2^63 - 1 gives the
14-character string, 8796093022208G. The number being converted
@@ -79,8 +67,7 @@ static int posix_format;
/* If nonzero, invoke the `sync' system call before getting any usage data.
Using this option can make df very slow, especially with many or very
busy disks. Note that this may make a difference on some systems --
SunOs4.1.3, for one. I have been assured that it is *not* necessary
on Linux. */
SunOs4.1.3, for one. It is *not* necessary on Linux. */
static int require_sync = 0;
/* Nonzero if errors have occurred. */
@@ -142,173 +129,6 @@ static struct option const long_options[] =
{NULL, 0, NULL, 0}
};
int
main (int argc, char **argv)
{
int i;
struct stat *stats;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
fs_select_list = NULL;
fs_exclude_list = NULL;
inode_format = 0;
show_all_fs = 0;
show_listed_fs = 0;
if (getenv ("POSIXLY_CORRECT"))
kilobyte_blocks = 0;
else
{
char *bs;
kilobyte_blocks = 1;
if ((bs = getenv ("BLOCKSIZE"))
&& strncmp (bs, "HUMAN", sizeof ("HUMAN") - 1) == 0)
human_blocks = 1;
}
print_type = 0;
posix_format = 0;
exit_status = 0;
while ((i = getopt_long (argc, argv, "aihkmPTt:vx:", long_options, NULL))
!= EOF)
{
switch (i)
{
case 0: /* Long option. */
break;
case 'a':
show_all_fs = 1;
break;
case 'i':
inode_format = 1;
break;
case 'h':
human_blocks = 1;
kilobyte_blocks = 1;
megabyte_blocks = 0;
break;
case 'k':
human_blocks = 0;
kilobyte_blocks = 1;
megabyte_blocks = 0;
break;
case 'm':
human_blocks = 0;
kilobyte_blocks = 0;
megabyte_blocks = 1;
break;
case 'T':
print_type = 1;
break;
case 'P':
posix_format = 1;
break;
case 129:
require_sync = 1;
break;
case 130:
require_sync = 0;
break;
case 't':
add_fs_type (optarg);
break;
case 'v': /* For SysV compatibility. */
break;
case 'x':
add_excluded_fs_type (optarg);
break;
default:
usage (1);
}
}
if (show_version)
{
printf ("df - %s\n", PACKAGE_VERSION);
exit (0);
}
if (show_help)
usage (0);
/* Fail if the same file system type was both selected and excluded. */
{
int match = 0;
struct fs_type_list *i;
for (i = fs_select_list; i; i = i->fs_next)
{
struct fs_type_list *j;
for (j = fs_exclude_list; j; j = j->fs_next)
{
if (strcmp (i->fs_name, j->fs_name) == 0)
{
error (0, 0,
_("file system type `%s' both selected and excluded"),
i->fs_name);
match = 1;
break;
}
}
}
if (match)
exit (1);
}
if (optind == argc)
{
#ifdef lint
/* Suppress `used before initialized' warning. */
stats = NULL;
#endif
}
else
{
/* stat all the given entries to make sure they get automounted,
if necessary, before reading the filesystem table. */
stats = (struct stat *)
xmalloc ((argc - optind) * sizeof (struct stat));
for (i = optind; i < argc; ++i)
if (stat (argv[i], &stats[i - optind]))
{
error (0, errno, "%s", argv[i]);
exit_status = 1;
argv[i] = NULL;
}
}
mount_list =
read_filesystem_list ((fs_select_list != NULL
|| fs_exclude_list != NULL
|| print_type),
show_all_fs);
if (mount_list == NULL)
error (1, errno, _("cannot read table of mounted filesystems"));
print_header ();
if (require_sync)
sync ();
if (optind == argc)
show_all_entries ();
else
{
/* Display explicitly requested empty filesystems. */
show_listed_fs = 1;
for (i = optind; i < argc; ++i)
if (argv[i])
show_entry (argv[i], &stats[i - optind]);
}
exit (exit_status);
}
static void
print_header (void)
{
@@ -332,87 +152,6 @@ print_header (void)
printf (" Mounted on\n");
}
/* Show all mounted filesystems, except perhaps those that are of
an unselected type or are empty. */
static void
show_all_entries (void)
{
struct mount_entry *me;
for (me = mount_list; me; me = me->me_next)
show_dev (me->me_devname, me->me_mountdir, me->me_type);
}
/* Determine what kind of node PATH is and show the disk usage
for it. STATP is the results of `stat' on PATH. */
static void
show_entry (char *path, struct stat *statp)
{
if (S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
show_disk (path);
else
show_point (path, statp);
}
/* Identify the directory, if any, that device
DISK is mounted on, and show its disk usage. */
static void
show_disk (char *disk)
{
struct mount_entry *me;
for (me = mount_list; me; me = me->me_next)
if (!strcmp (disk, me->me_devname))
{
show_dev (me->me_devname, me->me_mountdir, me->me_type);
return;
}
/* No filesystem is mounted on DISK. */
show_dev (disk, (char *) NULL, (char *) NULL);
}
/* Figure out which device file or directory POINT is mounted on
and show its disk usage.
STATP is the results of `stat' on POINT. */
static void
show_point (char *point, struct stat *statp)
{
struct stat disk_stats;
struct mount_entry *me;
for (me = mount_list; me; me = me->me_next)
{
if (me->me_dev == (dev_t) -1)
{
if (stat (me->me_mountdir, &disk_stats) == 0)
me->me_dev = disk_stats.st_dev;
else
{
error (0, errno, "%s", me->me_mountdir);
exit_status = 1;
/* So we won't try and fail repeatedly. */
me->me_dev = (dev_t) -2;
}
}
if (statp->st_dev == me->me_dev)
{
/* Skip bogus mtab entries. */
if (stat (me->me_mountdir, &disk_stats) != 0 ||
disk_stats.st_dev != me->me_dev)
continue;
show_dev (me->me_devname, me->me_mountdir, me->me_type);
return;
}
}
error (0, 0, _("cannot find mount point for %s"), point);
exit_status = 1;
}
/* Convert N_1K_BYTE_BLOCKS to a more readable string than %d would.
Most people visually process strings of 3-4 digits effectively,
but longer strings of digits are more prone to misinterpretation.
@@ -463,20 +202,52 @@ human_readable_1k_blocks (int n_1k_byte_blocks, char *buf, int buf_len)
return (p);
}
/* If FSTYPE is a type of filesystem that should be listed,
return nonzero, else zero. */
static int
selected_fstype (const char *fstype)
{
const struct fs_type_list *fsp;
if (fs_select_list == NULL || fstype == NULL)
return 1;
for (fsp = fs_select_list; fsp; fsp = fsp->fs_next)
if (STREQ (fstype, fsp->fs_name))
return 1;
return 0;
}
/* If FSTYPE is a type of filesystem that should be omitted,
return nonzero, else zero. */
static int
excluded_fstype (const char *fstype)
{
const struct fs_type_list *fsp;
if (fs_exclude_list == NULL || fstype == NULL)
return 0;
for (fsp = fs_exclude_list; fsp; fsp = fsp->fs_next)
if (STREQ (fstype, fsp->fs_name))
return 1;
return 0;
}
/* Display a space listing for the disk device with absolute path DISK.
If MOUNT_POINT is non-NULL, it is the path of the root of the
filesystem on DISK.
If FSTYPE is non-NULL, it is the type of the filesystem on DISK. */
static void
show_dev (char *disk, char *mount_point, char *fstype)
show_dev (const char *disk, const char *mount_point, const char *fstype)
{
struct fs_usage fsu;
long blocks_used;
long blocks_percent_used;
long inodes_used;
long inodes_percent_used;
char *stat_file;
const char *stat_file;
if (!selected_fstype (fstype) || excluded_fstype (fstype))
return;
@@ -573,15 +344,96 @@ show_dev (char *disk, char *mount_point, char *fstype)
putchar ('\n');
}
/* Identify the directory, if any, that device
DISK is mounted on, and show its disk usage. */
static void
show_disk (const char *disk)
{
struct mount_entry *me;
for (me = mount_list; me; me = me->me_next)
if (STREQ (disk, me->me_devname))
{
show_dev (me->me_devname, me->me_mountdir, me->me_type);
return;
}
/* No filesystem is mounted on DISK. */
show_dev (disk, (char *) NULL, (char *) NULL);
}
/* Figure out which device file or directory POINT is mounted on
and show its disk usage.
STATP is the results of `stat' on POINT. */
static void
show_point (const char *point, const struct stat *statp)
{
struct stat disk_stats;
struct mount_entry *me;
for (me = mount_list; me; me = me->me_next)
{
if (me->me_dev == (dev_t) -1)
{
if (stat (me->me_mountdir, &disk_stats) == 0)
me->me_dev = disk_stats.st_dev;
else
{
error (0, errno, "%s", me->me_mountdir);
exit_status = 1;
/* So we won't try and fail repeatedly. */
me->me_dev = (dev_t) -2;
}
}
if (statp->st_dev == me->me_dev)
{
/* Skip bogus mtab entries. */
if (stat (me->me_mountdir, &disk_stats) != 0 ||
disk_stats.st_dev != me->me_dev)
continue;
show_dev (me->me_devname, me->me_mountdir, me->me_type);
return;
}
}
error (0, 0, _("cannot find mount point for %s"), point);
exit_status = 1;
}
/* Determine what kind of node PATH is and show the disk usage
for it. STATP is the results of `stat' on PATH. */
static void
show_entry (const char *path, const struct stat *statp)
{
if (S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
show_disk (path);
else
show_point (path, statp);
}
/* Show all mounted filesystems, except perhaps those that are of
an unselected type or are empty. */
static void
show_all_entries (void)
{
struct mount_entry *me;
for (me = mount_list; me; me = me->me_next)
show_dev (me->me_devname, me->me_mountdir, me->me_type);
}
/* Add FSTYPE to the list of filesystem types to display. */
static void
add_fs_type (char *fstype)
add_fs_type (const char *fstype)
{
struct fs_type_list *fsp;
fsp = (struct fs_type_list *) xmalloc (sizeof (struct fs_type_list));
fsp->fs_name = fstype;
fsp->fs_name = (char *) fstype;
fsp->fs_next = fs_select_list;
fs_select_list = fsp;
}
@@ -589,48 +441,16 @@ add_fs_type (char *fstype)
/* Add FSTYPE to the list of filesystem types to be omitted. */
static void
add_excluded_fs_type (char *fstype)
add_excluded_fs_type (const char *fstype)
{
struct fs_type_list *fsp;
fsp = (struct fs_type_list *) xmalloc (sizeof (struct fs_type_list));
fsp->fs_name = fstype;
fsp->fs_name = (char *) fstype;
fsp->fs_next = fs_exclude_list;
fs_exclude_list = fsp;
}
/* If FSTYPE is a type of filesystem that should be listed,
return nonzero, else zero. */
static int
selected_fstype (char *fstype)
{
struct fs_type_list *fsp;
if (fs_select_list == NULL || fstype == NULL)
return 1;
for (fsp = fs_select_list; fsp; fsp = fsp->fs_next)
if (!strcmp (fstype, fsp->fs_name))
return 1;
return 0;
}
/* If FSTYPE is a type of filesystem that should be omitted,
return nonzero, else zero. */
static int
excluded_fstype (char *fstype)
{
struct fs_type_list *fsp;
if (fs_exclude_list == NULL || fstype == NULL)
return 0;
for (fsp = fs_exclude_list; fsp; fsp = fsp->fs_next)
if (!strcmp (fstype, fsp->fs_name))
return 1;
return 0;
}
static void
usage (int status)
{
@@ -655,12 +475,187 @@ or all filesystems by default.\n\
-x, --exclude-type=TYPE limit listing to filesystems not of type TYPE\n\
-v (ignored)\n\
-P, --portability use the POSIX output format\n\
FIXME: this should override or conflict with --human and --megabytes\n\
FIXME-bug: currently, even with --portability, blocksize is 1024 bytes\n\
FIXME-bug: make sure that's allowed by POSIX.\n\
-T, --print-type print filesystem type\n\
--help display this help and exit\n\
--version output version information and exit\n"));
}
exit (status);
}
int
main (int argc, char **argv)
{
int i;
struct stat *stats;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
fs_select_list = NULL;
fs_exclude_list = NULL;
inode_format = 0;
show_all_fs = 0;
show_listed_fs = 0;
if (getenv ("POSIXLY_CORRECT"))
kilobyte_blocks = 0;
else
{
char *bs;
kilobyte_blocks = 1;
if ((bs = getenv ("BLOCKSIZE"))
&& strncmp (bs, "HUMAN", sizeof ("HUMAN") - 1) == 0)
human_blocks = 1;
}
print_type = 0;
posix_format = 0;
exit_status = 0;
while ((i = getopt_long (argc, argv, "aihkmPTt:vx:", long_options, NULL))
!= EOF)
{
switch (i)
{
case 0: /* Long option. */
break;
case 'a':
show_all_fs = 1;
break;
case 'i':
inode_format = 1;
break;
case 'h':
human_blocks = 1;
kilobyte_blocks = 1;
megabyte_blocks = 0;
break;
case 'k':
human_blocks = 0;
kilobyte_blocks = 1;
megabyte_blocks = 0;
break;
case 'm':
human_blocks = 0;
kilobyte_blocks = 0;
megabyte_blocks = 1;
break;
case 'T':
print_type = 1;
break;
case 'P':
posix_format = 1;
break;
case 129:
require_sync = 1;
break;
case 130:
require_sync = 0;
break;
case 't':
add_fs_type (optarg);
break;
case 'v': /* For SysV compatibility. */
/* ignore */
break;
case 'x':
add_excluded_fs_type (optarg);
break;
default:
usage (1);
}
}
if (show_version)
{
printf ("df - %s\n", PACKAGE_VERSION);
exit (0);
}
if (show_help)
usage (0);
if (posix_format && megabyte_blocks)
error (1, 0, _("the option for counting 1MB blocks may not be used\n\
with the portable output format"));
if (posix_format && human_blocks)
error (1, 0,
_("the option for printing with adaptive units may not be used\n\
with the portable output format"));
/* Fail if the same file system type was both selected and excluded. */
{
int match = 0;
struct fs_type_list *i;
for (i = fs_select_list; i; i = i->fs_next)
{
struct fs_type_list *j;
for (j = fs_exclude_list; j; j = j->fs_next)
{
if (STREQ (i->fs_name, j->fs_name))
{
error (0, 0,
_("file system type `%s' both selected and excluded"),
i->fs_name);
match = 1;
break;
}
}
}
if (match)
exit (1);
}
if (optind == argc)
{
#ifdef lint
/* Suppress `used before initialized' warning. */
stats = NULL;
#endif
}
else
{
/* stat all the given entries to make sure they get automounted,
if necessary, before reading the filesystem table. */
stats = (struct stat *)
xmalloc ((argc - optind) * sizeof (struct stat));
for (i = optind; i < argc; ++i)
if (stat (argv[i], &stats[i - optind]))
{
error (0, errno, "%s", argv[i]);
exit_status = 1;
argv[i] = NULL;
}
}
mount_list =
read_filesystem_list ((fs_select_list != NULL
|| fs_exclude_list != NULL
|| print_type),
show_all_fs);
if (mount_list == NULL)
error (1, errno, _("cannot read table of mounted filesystems"));
print_header ();
if (require_sync)
sync ();
if (optind == argc)
show_all_entries ();
else
{
/* Display explicitly requested empty filesystems. */
show_listed_fs = 1;
for (i = optind; i < argc; ++i)
if (argv[i])
show_entry (argv[i], &stats[i - optind]);
}
exit (exit_status);
}

517
src/dircolors.c Normal file
View File

@@ -0,0 +1,517 @@
/* FIXME: dircolors - parse a Slackware-style DIR_COLORS file.
Copyright (C) 1994, 1995 H. Peter Anvin
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 distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h>
#include <getopt.h>
#include <stdio.h>
#include "system.h"
#include "getline.h"
#include "long-options.h"
#include "error.h"
#include "obstack.h"
#include "dircolors.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
char *xmalloc ();
char *basename ();
char *strndup();
enum Shell_syntax
{
SHELL_SYNTAX_BOURNE,
SHELL_SYNTAX_C,
SHELL_SYNTAX_UNKNOWN
};
#define APPEND_CHAR(C) obstack_1grow (&lsc_obstack, C)
#define APPEND_TWO_CHAR_STRING(S) \
do \
{ \
APPEND_CHAR (S[0]); \
APPEND_CHAR (S[1]); \
} \
while (0)
/* Accumulate in this obstack the value for the LS_COLORS environment
variable. */
static struct obstack lsc_obstack;
/* Nonzero if the input file was the standard input. */
static int have_read_stdin;
/* FIXME: associate with ls_codes? */
static const char *const slack_codes[] =
{
"NORMAL", "NORM", "FILE", "DIR", "LNK", "LINK",
"SYMLINK", "ORPHAN", "MISSING", "FIFO", "PIPE", "SOCK", "BLK", "BLOCK",
"CHR", "CHAR", "EXEC", "LEFT", "LEFTCODE", "RIGHT", "RIGHTCODE", "END",
"ENDCODE", NULL
};
static const char *const ls_codes[] =
{
"no", "no", "fi", "di", "ln", "ln", "ln", "or", "mi", "pi", "pi",
"so", "bd", "bd", "cd", "cd", "ex", "lc", "lc", "rc", "rc", "ec", "ec"
};
static struct option const long_options[] =
{
{"bourne-shell", no_argument, NULL, 'b'},
{"sh", no_argument, NULL, 'b'},
{"csh", no_argument, NULL, 'c'},
{"c-shell", no_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
};
char *program_name;
static void
usage (int status)
{
if (status != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("Usage: %s [OPTION]... [FILE]\n"), program_name);
printf (_("\
-h, --help display this help and exit\n\
--version output version information and exit\n\
Determine format of output:\n\
-p, --print-data-base output defaults\n\
-b, --sh, --bourne-shell output Bourne shell code to set LS_COLOR\n\
-c, --csh, --c-shell output C-shell code to set LS_COLOR\n"));
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
static void *
xstrndup (const char *s, size_t n)
{
char *new = strndup (s, n);
if (new == NULL)
error (EXIT_FAILURE, 0, _("Memory exhausted"));
return new;
}
/* If the SHELL environment variable is set to `csh' or `tcsh,'
assume C-shell. Else Bourne shell. */
static enum Shell_syntax
guess_shell_syntax (void)
{
char *shell;
shell = getenv ("SHELL");
if (shell == NULL || *shell == '\0')
return SHELL_SYNTAX_UNKNOWN;
shell = basename (shell);
if (STREQ (shell, "csh") || STREQ (shell, "tcsh"))
return SHELL_SYNTAX_C;
return SHELL_SYNTAX_BOURNE;
}
static void
parse_line (const char *line, char **keyword, char **arg)
{
const char *p;
const char *keyword_start;
const char *arg_start;
*keyword = NULL;
*arg = NULL;
for (p = line; isspace (*p); ++p)
;
/* Ignore blank lines and shell-style comments. */
if (*p == '\0' || *p == '#')
return;
keyword_start = p;
while (!isspace (*p) && *p != '\0')
{
++p;
}
*keyword = xstrndup (keyword_start, p - keyword_start);
if (*p == '\0')
return;
do
{
++p;
}
while (isspace (*p));
if (*p == '\0' || *p == '#')
return;
arg_start = p;
while (*p != '\0' && *p != '#')
++p;
for (--p; isspace (*p); --p)
{
/* empty */
}
++p;
*arg = xstrndup (arg_start, p - arg_start);
}
/* FIXME: Write a string to standard out, while watching for "dangerous"
sequences like unescaped : and = characters. */
static void
append_quoted (const char *str)
{
int need_backslash = 1;
while (*str != '\0')
{
switch (*str)
{
case '\\':
case '^':
need_backslash = !need_backslash;
break;
case ':':
case '=':
if (need_backslash)
APPEND_CHAR ('\\');
/* Fall through */
default:
need_backslash = 1;
break;
}
APPEND_CHAR (*str);
++str;
}
}
/* Read the file open on FP (with name FILENAME). First, look for a
`TERM name' directive where name matches the current terminal type.
Once found, translate and accumulate the associated directives onto
the global obstack LSC_OBSTACK. Give a diagnostic and return nonzero
upon failure (unrecognized keyword is the only way to fail here).
Return zero otherwise. */
static int
dc_parse_stream (FILE *fp, const char *filename)
{
size_t line_number = 0;
char *line = NULL;
size_t line_chars_allocated = 0;
int state;
char *term;
int err = 0;
/* State for the parser. */
enum states { ST_TERMNO, ST_TERMYES, ST_TERMSURE, ST_GLOBAL };
state = ST_GLOBAL;
/* Get terminal type */
term = getenv ("TERM");
if (term == NULL || *term == '\0')
term = "none";
while (1)
{
int line_length;
char *keywd, *arg;
int unrecognized;
++line_number;
if (fp)
{
line_length = getline (&line, &line_chars_allocated, fp);
if (line_length <= 0)
{
if (line)
free (line);
break;
}
}
else
{
line = (char *) (G_line[line_number - 1]);
line_length = G_line_length[line_number - 1];
if (line_number > G_N_LINES)
break;
}
parse_line (line, &keywd, &arg);
if (keywd == NULL)
continue;
unrecognized = 0;
if (strcasecmp (keywd, "TERM") == 0)
{
if (strcmp (arg, term) == 0)
state = ST_TERMSURE;
else if (state != ST_TERMSURE)
state = ST_TERMNO;
}
else
{
if (state == ST_TERMSURE)
state = ST_TERMYES; /* Another TERM can cancel */
if (state != ST_TERMNO)
{
if (keywd[0] == '.')
{
APPEND_CHAR ('*');
append_quoted (keywd);
APPEND_CHAR ('=');
append_quoted (arg);
APPEND_CHAR (':');
}
else if (keywd[0] == '*')
{
append_quoted (keywd);
APPEND_CHAR ('=');
append_quoted (arg);
APPEND_CHAR (':');
}
else if (strcasecmp (keywd, "OPTIONS") == 0
|| strcasecmp (keywd, "COLOR") == 0
|| strcasecmp (keywd, "EIGHTBIT") == 0)
{
/* Ignore. */
}
else
{
int i;
for (i = 0; slack_codes[i] != NULL; ++i)
if (strcasecmp (keywd, slack_codes[i]) == 0)
break;
if (slack_codes[i] != NULL)
{
APPEND_TWO_CHAR_STRING (ls_codes[i]);
APPEND_CHAR ('=');
append_quoted (arg);
APPEND_CHAR (':');
}
else
{
unrecognized = 1;
}
}
}
else
{
unrecognized = 1;
}
}
if (unrecognized)
{
error (0, 0, _("%s:%lu: unrecognized keyword `%s'"),
filename, (long unsigned) line_number, keywd);
err = 1;
}
free (keywd);
if (arg)
free (arg);
}
return err;
}
static int
dc_parse_file (const char *filename)
{
FILE *fp;
int err;
if (strcmp (filename, "-") == 0)
{
have_read_stdin = 1;
fp = stdin;
}
else
{
/* OPENOPTS is a macro. It varies with the system.
Some systems distinguish between internal and
external text representations. */
fp = fopen (filename, "r");
if (fp == NULL)
{
error (0, errno, "%s", filename);
return 1;
}
}
err = dc_parse_stream (fp, filename);
if (fp != stdin && fclose (fp) == EOF)
{
error (0, errno, "%s", filename);
return 1;
}
return err;
}
int
main (int argc, char **argv)
{
int err = 0;
int optc;
enum Shell_syntax syntax = SHELL_SYNTAX_UNKNOWN;
int print_database = 0;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, "dircolors", PACKAGE_VERSION, usage);
while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL))
!= EOF)
switch (optc)
{
case 'b': /* Bourne shell syntax. */
syntax = SHELL_SYNTAX_BOURNE;
break;
case 'c': /* C-shell syntax. */
syntax = SHELL_SYNTAX_C;
break;
case 'p':
print_database = 1;
break;
default:
usage (1);
}
argc -= optind;
argv += optind;
/* It doesn't make sense to use --print with either of
--bourne or --c-shell. */
if (print_database && syntax != SHELL_SYNTAX_UNKNOWN)
{
error (0, 0,
_("the options to output dircolors' internal database and\n\
to select a shell syntax are mutually exclusive"));
usage (1);
}
if (print_database && argc > 0)
{
error (0, 0,
_("no FILE arguments may be used with the option to output\n\
dircolors' internal database"));
usage (1);
}
if (!print_database && argc > 1)
{
error (0, 0, _("too many arguments"));
usage (1);
}
if (print_database)
{
int i;
for (i = 0; i < G_N_LINES; i++)
{
fwrite (G_line[i], 1, G_line_length[i], stdout);
fputc ('\n', stdout);
}
}
else
{
/* If shell syntax was not explicitly specified, try to guess it. */
if (syntax == SHELL_SYNTAX_UNKNOWN)
{
syntax = guess_shell_syntax ();
if (syntax == SHELL_SYNTAX_UNKNOWN)
{
error (EXIT_FAILURE, 0,
_("no SHELL environment variable, and no shell type option given"));
}
}
obstack_init (&lsc_obstack);
if (argc == 0)
err = dc_parse_stream (NULL, NULL);
else
err = dc_parse_file (argv[0]);
if (!err)
{
size_t len = obstack_object_size (&lsc_obstack);
char *s = obstack_finish (&lsc_obstack);
const char *prefix;
const char *suffix;
if (syntax == SHELL_SYNTAX_BOURNE)
{
prefix = "LS_COLORS='";
suffix = "';\nexport LS_COLORS\n";
}
else
{
prefix = "setenv LS_COLORS '";
suffix = "'\n";
}
fputs (prefix, stdout);
fwrite (s, 1, len, stdout);
fputs (suffix, stdout);
}
}
if (fclose (stdout) == EOF)
error (EXIT_FAILURE, errno, _("write error"));
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));
exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}

65
src/dircolors.hin Normal file
View File

@@ -0,0 +1,65 @@
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM xterm
TERM vt100
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 01;34 # directory
LINK 01;36 # symbolic link
FIFO 40;33 # pipe
SOCK 01;35 # socket
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
# This is for files with execute permission:
EXEC 01;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
.cmd 01;32 # executables (bright green)
.exe 01;32
.com 01;32
.btm 01;32
.bat 01;32
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.z 01;31
.Z 01;31
.gz 01;31
.jpg 01;35 # image formats
.gif 01;35
.bmp 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35

View File

@@ -69,7 +69,8 @@ main (int argc, char **argv)
if (argc != 2)
{
error (0, 0, _("too %s arguments"), argc < 2 ? _("few") : _("many"));
error (0, 0, argc < 2 ? _("too few arguments")
: _("too many arguments"));
usage (1);
}

View File

@@ -109,7 +109,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, "echo", PACKAGE_VERSION, usage);
/* Don't recognize --help or --version if POSIXLY_CORRECT is set. */
if (getenv ("POSIXLY_CORRECT") == NULL)
parse_long_options (argc, argv, "echo", PACKAGE_VERSION, usage);
/* System V machines already have a /bin/sh with a v9 behaviour. We
use the identical behaviour for these machines so that the

View File

@@ -158,7 +158,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, "expr", PACKAGE_VERSION, usage);
/* Don't recognize --help or --version if POSIXLY_CORRECT is set. */
if (getenv ("POSIXLY_CORRECT") == NULL)
parse_long_options (argc, argv, "expr", PACKAGE_VERSION, usage);
if (argc == 1)
{
@@ -419,13 +421,21 @@ docolon (VALUE *sv, VALUE *pv)
tostring (sv);
tostring (pv);
if (pv->u.s[0] == '^')
{
error (0, 0, _("\
warning: unportable BRE: `%s': using `^' as the first character \n\
of the basic regular expression is not portable; it is being ignored"),
pv->u.s);
}
len = strlen (pv->u.s);
memset (&re_buffer, 0, sizeof (re_buffer));
memset (&re_regs, 0, sizeof (re_regs));
re_buffer.allocated = 2 * len;
re_buffer.buffer = (unsigned char *) xmalloc (re_buffer.allocated);
re_buffer.translate = 0;
re_syntax_options = RE_SYNTAX_POSIX_MINIMAL_BASIC;
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
if (errmsg)
error (2, 0, "%s", errmsg);

View File

@@ -575,8 +575,9 @@ copy_rest (FILE *f, register int c)
if (in_column > next_prefix_indent && c != '\n' && c != EOF)
{
put_space (next_prefix_indent);
for (s = prefix; out_column != in_column; out_column++)
for (s = prefix; out_column != in_column && *s; out_column++)
putchar (*s++);
put_space (in_column - out_column);
}
while (c != '\n' && c != EOF)
{

View File

@@ -218,7 +218,41 @@ print_group (int gid)
printf ("%s", grp->gr_name);
}
/* Print all of the distinct groups the user is in . */
static int
xgetgroups (const char *username, int *n_groups, GETGROUPS_T **groups)
{
int max_n_groups;
int ng;
GETGROUPS_T *g;
int fail = 0;
if (username == 0)
max_n_groups = getgroups (0, NULL);
else
max_n_groups = getugroups (0, NULL, username);
/* Add 1 just in case max_n_groups is zero. */
g = (GETGROUPS_T *) xmalloc (max_n_groups * sizeof (GETGROUPS_T) + 1);
if (username == 0)
ng = getgroups (max_n_groups, g);
else
ng = getugroups (max_n_groups, g, username);
if (ng < 0)
{
error (0, errno, _("cannot get supplemental group list"));
++fail;
free (groups);
}
if (!fail)
{
*n_groups = ng;
*groups = g;
}
return fail;
}
/* Print all of the distinct groups the user is in. */
static void
print_group_list (char *username)
@@ -232,23 +266,13 @@ print_group_list (char *username)
#if HAVE_GETGROUPS
{
int ng, n_groups;
int n_groups;
GETGROUPS_T *groups;
register int i;
n_groups = getgroups (0, NULL);
/* Add 1 just in case n_groups is zero. */
groups = (GETGROUPS_T *) xmalloc (n_groups * sizeof (GETGROUPS_T) + 1);
if (username == 0)
ng = getgroups (n_groups, groups);
else
ng = getugroups (n_groups, groups, username);
if (ng < 0)
if (xgetgroups (username, &n_groups, &groups))
{
error (0, errno, _("cannot get supplemental group list"));
++problems;
free (groups);
return;
}
@@ -307,22 +331,13 @@ print_full_info (char *username)
#if HAVE_GETGROUPS
{
int ng, n_groups;
int n_groups;
GETGROUPS_T *groups;
register int i;
n_groups = getgroups (0, NULL);
/* Add 1 just in case n_groups is zero. */
groups = (GETGROUPS_T *) xmalloc (n_groups * sizeof (GETGROUPS_T) + 1);
if (username == 0)
ng = getgroups (n_groups, groups);
else
ng = getugroups (n_groups, groups, username);
if (ng < 0)
if (xgetgroups (username, &n_groups, &groups))
{
error (0, errno, _("cannot get supplemental group list"));
problems++;
free (groups);
++problems;
return;
}

View File

@@ -584,7 +584,7 @@ usage (int status)
printf (_("\
Usage: %s [OPTION]... SOURCE DEST (1st format)\n\
or: %s [OPTION]... SOURCE... DIRECTORY (2nd format)\n\
or: %s -d [OPTION]... DIRECTORY... (3nd format)\n\
or: %s -d [OPTION]... DIRECTORY... (3rd format)\n\
"),
program_name, program_name, program_name);
printf (_("\

View File

@@ -37,9 +37,9 @@ int symlink ();
#endif
#ifdef S_ISLNK
# define SYMBOLIC_SPACE_STRING symbolic_link ? _("symbolic ") : ""
# define LINK_TYPE symbolic_link ? _("symbolic link") : _("hard link")
#else
# define SYMBOLIC_SPACE_STRING ""
# define LINK_TYPE ""
#endif
/* Construct a string NEW_DEST by concatenating DEST, a slash, and
@@ -63,6 +63,7 @@ int symlink ();
while (0)
char *basename ();
char *dirname ();
enum backup_type get_version ();
int isdir ();
int yesno ();
@@ -119,13 +120,44 @@ static struct option const long_options[] =
{NULL, 0, NULL, 0}
};
/* Return nonzero if SOURCE and DEST point to the same name in the same
directory. */
static int
same_name (const char *source, const char *dest)
{
struct stat source_dir_stats;
struct stat dest_dir_stats;
char *source_dirname, *dest_dirname;
source_dirname = dirname (source);
dest_dirname = dirname (dest);
if (source_dirname == NULL || dest_dirname == NULL)
error (1, 0, _("virtual memory exhausted"));
if (stat (source_dirname, &source_dir_stats))
/* Shouldn't happen. */
error (1, errno, "%s", source_dirname);
if (stat (dest_dirname, &dest_dir_stats))
/* Shouldn't happen. */
error (1, errno, "%s", dest_dirname);
free (source_dirname);
free (dest_dirname);
return (source_dir_stats.st_dev == dest_dir_stats.st_dev
&& source_dir_stats.st_ino == dest_dir_stats.st_ino
&& STREQ (basename (source), basename (dest)));
}
/* Make a link DEST to the (usually) existing file SOURCE.
Symbolic links to nonexistent files are allowed.
If DEST is a directory, put the link to SOURCE in that directory.
Return 1 if there is an error, otherwise 0. */
static int
do_link (char *source, char *dest)
do_link (const char *source, const char *dest)
{
struct stat source_stats;
struct stat dest_stats;
@@ -158,14 +190,27 @@ do_link (char *source, char *dest)
return 1;
}
/* If --force (-f) has been specified, before making a link ln must
remove the destination file if it exists. But if the source and
destination are the same, don't remove anything and fail right here. */
/* If --force (-f) has been specified without --backup, then before
making a link ln must remove the destination file if it exists.
(with --backup, it just renames any existing destination file)
But if the source and destination are the same, don't remove
anything and fail right here. */
if (remove_existing_files
&& lstat_status == 0
/* Allow `ln -sf --backup k k' to succeed in creating the
self-referential symlink, but don't allow the hard-linking
equivalent: `ln -f k k' (with or without --backup) to get
beyond this point, because the error message you'd get is
misleading. */
&& (backup_type == none || !symlink)
&& (!symlink || stat (source, &source_stats) == 0)
&& source_stats.st_dev == dest_stats.st_dev
&& source_stats.st_ino == dest_stats.st_ino)
&& source_stats.st_ino == dest_stats.st_ino
/* The following detects whether removing DEST will also remove
SOURCE. If the file has only one link then both are surely
the same link. Otherwise check whether they point to the same
name in the same directory. */
&& (source_stats.st_nlink == 1 || same_name (source, dest)))
{
error (0, 0, _("`%s' and `%s' are the same file"), source, dest);
return 1;
@@ -244,7 +289,7 @@ do_link (char *source, char *dest)
}
if (verbose)
printf (_("create %slink %s to %s\n"), SYMBOLIC_SPACE_STRING,
printf (_("create %s %s to %s\n"), LINK_TYPE,
dest, source);
if ((*linkfunc) (source, dest) == 0)
@@ -252,8 +297,8 @@ do_link (char *source, char *dest)
return 0;
}
error (0, errno, _("cannot %slink `%s' to `%s'"), SYMBOLIC_SPACE_STRING,
source, dest);
error (0, errno, _("cannot create %s `%s' to `%s'"), LINK_TYPE,
dest, source);
if (dest_backup)
{

760
src/ls.c

File diff suppressed because it is too large Load Diff

View File

@@ -59,6 +59,14 @@
# define TOLOWER(c) (ISUPPER (c) ? tolower (c) : (c))
#endif
/* The string with which to replace NEWLINE characters in filenames.
This is required to make it so md5sum --check can parse the output
of `md5sum FILENAME' for FILENAME contain NL characters. */
#define NEWLINE_REPLACEMENT_STRING "<\"NL'\\>"
#define NEWLINE_REPLACEMENT_STRING_LENGTH \
(sizeof (NEWLINE_REPLACEMENT_STRING) - 1)
/* Nonzero if any of the files read were the standard input. */
static int have_read_stdin;
@@ -121,10 +129,8 @@ text), and name for each FILE.\n"),
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* FIXME: this format loses with filenames containing newline. */
static int
split_3 (char *s, char **u, int *binary, char **w)
split_3 (char *s, size_t s_len, char **u, int *binary, char **w)
{
size_t i;
@@ -136,13 +142,14 @@ split_3 (char *s, char **u, int *binary, char **w)
/* The line has to be at least 35 characters long to contain correct
message digest information. */
if (strlen (&s[i]) >= 35)
if (s_len >= 32 + 2 + 1)
{
char *p;
*u = &s[i];
/* The first field has to be the 32-character hexadecimal
representation of the message digest. If it not immediately
followed by a white space it's an error. */
representation of the message digest. If it is not followed
immediately by a white space it's an error. */
i += 32;
if (!ISWHITE (s[i]))
return 1;
@@ -151,15 +158,25 @@ split_3 (char *s, char **u, int *binary, char **w)
if (s[i] != ' ' && s[i] != '*')
return 1;
*binary = s[i++] == '*';
*binary = (s[i++] == '*');
/* All characters between the type indicator and end of line are
significant -- that includes leading and trailing white space. */
*w = &s[i];
/* So this line is valid as long as there is at least one character
for the filename. */
return (**w ? 0 : 1);
/* Translate each NEWLINE_REPLACEMENT_STRING in the file name
to a NEWLINE. */
p = &s[i];
while ((p = strstr (p, NEWLINE_REPLACEMENT_STRING)))
{
size_t len;
*p++ = '\n';
len = s_len - (p - s) - (NEWLINE_REPLACEMENT_STRING_LENGTH - 1) + 1;
memmove (p, p + NEWLINE_REPLACEMENT_STRING_LENGTH - 1, len);
s_len -= NEWLINE_REPLACEMENT_STRING_LENGTH - 1;
}
return 0;
}
return 1;
}
@@ -274,7 +291,7 @@ md5_check (const char *checkfile_name, int binary)
if (line[line_length - 1] == '\n')
line[--line_length] = '\0';
err = split_3 (line, &md5num, &type_flag, &filename);
err = split_3 (line, line_length, &md5num, &type_flag, &filename);
if (err || !hex_digits (md5num))
{
if (warn)
@@ -362,9 +379,10 @@ md5_check (const char *checkfile_name, int binary)
if (n_open_or_read_failures > 0)
{
error (0, 0,
_("WARNING: %d of %d listed file%s could not be read\n"),
_("WARNING: %d of %d listed %s could not be read\n"),
n_open_or_read_failures, n_properly_formated_lines,
(n_properly_formated_lines == 1 ? "" : "s"));
(n_properly_formated_lines == 1
? _("file") : _("files")));
}
if (n_mismatched_checksums > 0)
@@ -506,15 +524,35 @@ main (int argc, char **argv)
{
size_t i;
int fail;
char *file = argv[optind];
fail = md5_file (argv[optind], binary, md5buffer);
fail = md5_file (file, binary, md5buffer);
err |= fail;
if (!fail)
{
size_t filename_len;
for (i = 0; i < 16; ++i)
printf ("%02x", md5buffer[i]);
printf (" %c%s\n", binary ? '*' : ' ', argv[optind]);
putchar (' ');
if (binary)
putchar ('*');
else
putchar (' ');
/* Translate each NEWLINE byte to the string,
NEWLINE_REPLACEMENT_STRING. But first record
the length of the filename, FILE. */
filename_len = strlen (file);
for (i = 0; i < filename_len; ++i)
{
if (file[i] == '\n')
fputs (NEWLINE_REPLACEMENT_STRING, stdout);
else
putchar (file[i]);
}
putchar ('\n');
}
}
}

View File

@@ -471,7 +471,9 @@ main (int argc, char **argv)
if (argc < optind + 2)
{
error (0, 0, _("missing file argument%s"), argc == optind ? "s" : "");
error (0, 0, "%s", (argc == optind
? _("missing file arguments")
: _("missing file argument")));
usage (1);
}

View File

@@ -656,22 +656,25 @@ simple_strtoul (const char *s, const char **p, long unsigned int *val)
return 0;
}
/* If S points to a single valid POSIX-style od format string, put a
description of that format in *TSPEC, make *NEXT point at the character
following the just-decoded format (if *NEXT is non-NULL), and return
zero. If S is not valid, don't modify *NEXT or *TSPEC and return
nonzero. For example, if S were "d4afL" *NEXT would be set to "afL"
and *TSPEC would be
/* If S points to a single valid POSIX-style od format string, put
a description of that format in *TSPEC, make *NEXT point at the
character following the just-decoded format (if *NEXT is non-NULL),
and return zero. If S is not valid, don't modify *NEXT or *TSPEC,
give a diagnostic, and return nonzero. For example, if S were
"d4afL" *NEXT would be set to "afL" and *TSPEC would be
{
fmt = SIGNED_DECIMAL;
size = INT or LONG; (whichever integral_type_size[4] resolves to)
print_function = print_int; (assuming size == INT)
fmt_string = "%011d%c";
}
S_ORIG is solely for reporting errors. It should be the full format
string argument.
*/
static int
decode_one_format (const char *s, const char **next, struct tspec *tspec)
decode_one_format (const char *s_orig, const char *s, const char **next,
struct tspec *tspec)
{
enum size_spec size_spec;
unsigned long int size;
@@ -716,14 +719,24 @@ decode_one_format (const char *s, const char **next, struct tspec *tspec)
default:
if (simple_strtoul (s, &p, &size) != 0)
return 1;
{
/* The integer at P in S would overflow an unsigned long.
A digit string that long is sufficiently odd looking
that the following diagnostic is sufficient. */
error (0, 0, _("invalid type string `%s'"), s_orig);
return 1;
}
if (p == s)
size = sizeof (int);
else
{
if (size > MAX_INTEGRAL_TYPE_SIZE
|| integral_type_size[size] == NO_SIZE)
return 1;
{
error (0, 0, _("invalid type string `%s';\n\
this system doesn't provide a %lu-byte integral type"), s_orig, size);
return 1;
}
s = p;
}
break;
@@ -819,14 +832,24 @@ decode_one_format (const char *s, const char **next, struct tspec *tspec)
default:
if (simple_strtoul (s, &p, &size) != 0)
return 1;
{
/* The integer at P in S would overflow an unsigned long.
A digit string that long is sufficiently odd looking
that the following diagnostic is sufficient. */
error (0, 0, _("invalid type string `%s'"), s_orig);
return 1;
}
if (p == s)
size = sizeof (double);
else
{
if (size > MAX_FP_TYPE_SIZE
|| fp_type_size[size] == NO_SIZE)
return 1;
{
error (0, 0, _("invalid type string `%s';\n\
this system doesn't provide a %lu-byte floating point type"), s_orig, size);
return 1;
}
s = p;
}
break;
@@ -884,6 +907,8 @@ decode_one_format (const char *s, const char **next, struct tspec *tspec)
break;
default:
error (0, 0, _("invalid character `%c' in type string `%s'"),
*s, s_orig);
return 1;
}
@@ -905,6 +930,7 @@ decode_one_format (const char *s, const char **next, struct tspec *tspec)
static int
decode_format_string (const char *s)
{
const char *s_orig = s;
assert (s != NULL);
while (*s != '\0')
@@ -912,7 +938,7 @@ decode_format_string (const char *s)
struct tspec tspec;
const char *next;
if (decode_one_format (s, &next, &tspec))
if (decode_one_format (s_orig, s, &next, &tspec))
return 1;
assert (s != next);
@@ -925,7 +951,8 @@ decode_format_string (const char *s)
* sizeof (struct tspec)));
}
memcpy ((char *) &spec[n_specs], (char *) &tspec, sizeof (struct tspec));
memcpy ((char *) &spec[n_specs], (char *) &tspec,
sizeof (struct tspec));
++n_specs;
}
@@ -1581,6 +1608,7 @@ main (int argc, char **argv)
unsigned int address_pad_len;
unsigned long int desired_width;
int width_specified = 0;
int n_failed_decodes = 0;
int err;
/* The old-style `pseudo starting address' to be printed in parentheses
@@ -1706,7 +1734,7 @@ the maximum\nrepresentable value of type off_t"), optarg);
case 't':
if (decode_format_string (optarg))
error (EXIT_FAILURE, 0, _("invalid type string `%s'"), optarg);
++n_failed_decodes;
break;
case 'v':
@@ -1725,9 +1753,8 @@ the maximum\nrepresentable value of type off_t"), optarg);
#define CASE_OLD_ARG(old_char,new_string) \
case old_char: \
{ \
int tmp; \
tmp = decode_format_string (new_string); \
assert (tmp == 0); \
if (decode_format_string (new_string)) \
++n_failed_decodes; \
} \
break
@@ -1764,6 +1791,9 @@ the maximum\nrepresentable value of type off_t"), optarg);
}
}
if (n_failed_decodes > 0)
exit (EXIT_FAILURE);
if (show_version)
{
printf ("od - %s\n", PACKAGE_VERSION);
@@ -1841,14 +1871,14 @@ the maximum\nrepresentable value of type off_t"), optarg);
else
{
error (0, 0,
_("in compatibility mode the last 2 arguments must be offsets"));
_("in compatibility mode the last 2 arguments must be offsets"));
usage (1);
}
}
else
{
error (0, 0,
_("in compatibility mode there may be no more than 3 arguments"));
_("in compatibility mode there may be no more than 3 arguments"));
usage (1);
}
@@ -1879,9 +1909,13 @@ the maximum\nrepresentable value of type off_t"), optarg);
if (n_specs == 0)
{
int d_err = decode_one_format ("o2", NULL, &(spec[0]));
if (decode_one_format ("o2", "o2", NULL, &(spec[0])))
{
/* This happens on Cray systems that don't have a 2-byte
integral type. */
exit (EXIT_FAILURE);
}
assert (d_err == 0);
n_specs = 1;
}

View File

@@ -137,7 +137,9 @@ main (int argc, char **argv)
exit_status = 0;
parse_long_options (argc, argv, "printf", PACKAGE_VERSION, usage);
/* Don't recognize --help or --version if POSIXLY_CORRECT is set. */
if (getenv ("POSIXLY_CORRECT") == NULL)
parse_long_options (argc, argv, "printf", PACKAGE_VERSION, usage);
if (argc == 1)
{

View File

@@ -77,14 +77,16 @@ static void
usage (int status)
{
if (status != 0)
(void) fprintf (stderr, _("Try `%s --help' for more information.\n"),
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
(void) printf (_("\
Usage: %s [OPTION]... [FIRST [INCREMENT]] LAST\n\
"), program_name);
(void) printf (_("\
printf (_("\
Usage: %s [OPTION]... LAST\n\
or: %s [OPTION]... FIRST LAST\n\
or: %s [OPTION]... FIRST INCREMENT LAST\n\
"), program_name, program_name, program_name);
printf (_("\
Print numbers from FIRST (default 1) to LAST, moving by STEP (default 1).\n\
\n\
-f, --format FORMAT use printf(3) style FORMAT (default: %%g)\n\
@@ -158,7 +160,7 @@ main (int argc, char **argv)
if (show_version)
{
(void) printf ("seq - %s\n", PACKAGE_VERSION);
printf ("seq - %s\n", PACKAGE_VERSION);
exit (0);
}
@@ -324,14 +326,14 @@ get_width_format ()
max_val = first + step * floor ((last - first) / step);
}
(void) sprintf (buffer, "%g", rint (max_val));
sprintf (buffer, "%g", rint (max_val));
if (buffer[strspn (buffer, "0123456789")] != '\0')
return "%g";
width1 = strlen (buffer);
if (min_val < 0.0)
{
(void) sprintf (buffer, "%g", rint (min_val));
sprintf (buffer, "%g", rint (min_val));
if (buffer[strspn (buffer, "-0123456789")] != '\0')
return "%g";
width2 = strlen (buffer);
@@ -340,7 +342,7 @@ get_width_format ()
}
full_width = width1;
(void) sprintf (buffer, "%g", 1.0 + modf (min_val, &temp));
sprintf (buffer, "%g", 1.0 + modf (min_val, &temp));
width1 = strlen (buffer);
if (width1 == 1)
width1 = 0;
@@ -352,7 +354,7 @@ get_width_format ()
width1 -= 2;
}
(void) sprintf (buffer, "%g", 1.0 + modf (step, &temp));
sprintf (buffer, "%g", 1.0 + modf (step, &temp));
width2 = strlen (buffer);
if (width2 == 1)
width2 = 0;
@@ -366,9 +368,9 @@ get_width_format ()
frac_width = width1 > width2 ? width1 : width2;
if (frac_width)
(void) sprintf (buffer, "%%0%d.%df", full_width + 1 + frac_width, frac_width);
sprintf (buffer, "%%0%d.%df", full_width + 1 + frac_width, frac_width);
else
(void) sprintf (buffer, "%%0%dg", full_width);
sprintf (buffer, "%%0%dg", full_width);
return buffer;
}

View File

@@ -610,6 +610,36 @@ limfield (const struct line *line, const struct keyfield *key)
++ptr;
}
#ifdef POSIX_UNSPECIFIED
/* The following block of code makes GNU sort incompatible with
standard Unix sort, so it's ifdef'd out for now.
The POSIX spec isn't clear on how to interpret this.
FIXME: request clarification.
From: kwzh@gnu.ai.mit.edu (Karl Heuer)
Date: Thu, 30 May 96 12:20:41 -0400
[...]I believe I've found another bug in `sort'.
$ cat /tmp/sort.in
a b c 2 d
pq rs 1 t
$ textutils-1.15/src/sort +0.6 -0.7 </tmp/sort.in
a b c 2 d
pq rs 1 t
$ /bin/sort +0.6 -0.7 </tmp/sort.in
pq rs 1 t
a b c 2 d
Unix sort produced the answer I expected: sort on the single character
in column 6. GNU sort produced different results, because it disagrees
on the interpretation of the key-end spec "-M.N". Unix sort reads this
as "skip M fields, then N characters"; but GNU sort wants it to mean
"skip M fields, then either N characters or the rest of the current
field, whichever comes first". This extra clause applies only to
key-ends, not key-starts.
*/
/* Make LIM point to the end of (one byte past) the current field. */
if (tab)
{
@@ -628,6 +658,7 @@ limfield (const struct line *line, const struct keyfield *key)
++newlim;
lim = newlim;
}
#endif
/* If we're skipping leading blanks, don't start counting characters
until after skipping past any leading blanks. */
@@ -1773,7 +1804,12 @@ main (int argc, char **argv)
if (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])]))
{
if (!key)
usage (SORT_FAILURE);
{
/* Provoke with `sort -9'. */
error (0, 0, _("when using the old-style +POS and -POS \
key specifiers,\nthe +POS specifier must come first"));
usage (SORT_FAILURE);
}
for (t = 0; digits[UCHAR (*s)]; ++s)
t = t * 10 + *s - '0';
t2 = 0;
@@ -2049,7 +2085,7 @@ but lacks following character offset"));
struct stat instat;
if ((strcmp (files[i], "-")
? stat (files[i], &instat)
: fstat (fileno (stdin), &instat)) != 0)
: fstat (STDIN_FILENO, &instat)) != 0)
{
error (0, errno, "%s", files[i]);
cleanup ();

View File

@@ -179,6 +179,18 @@ extern int errno;
char *getenv ();
#endif /* STDC_HEADERS */
/* The following test is to work around the gross typo in
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
is defined to 0, not 1. */
#if !EXIT_FAILURE
# undef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#else
@@ -285,32 +297,32 @@ char *alloca ();
#include <ctype.h>
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
#define ISASCII(c) 1
#define IN_CTYPE_DOMAIN(c) 1
#else
#define ISASCII(c) isascii(c)
#define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#ifdef isblank
#define ISBLANK(c) (ISASCII (c) && isblank (c))
#define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
#else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
#define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
#else
#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
#endif
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define ISALNUM(c) (ISASCII (c) && isalnum (c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c))
#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
#define ISLOWER(c) (ISASCII (c) && islower (c))
#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
#define ISSPACE(c) (ISASCII (c) && isspace (c))
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
@@ -337,3 +349,5 @@ char *alloca ();
# define textdomain(Domain) /* empty */
# define _(Text) Text
#endif
#define STREQ(a,b) (strcmp((a), (b)) == 0)

View File

@@ -861,7 +861,8 @@ main (int argc, char **argv)
if (argc > 1
&& ((argv[1][0] == '-' && ISDIGIT (argv[1][1]))
|| (argv[1][0] == '+' && (ISDIGIT (argv[1][1]) || argv[1][1] == 0))))
|| (argv[1][0] == '+' && (ISDIGIT (argv[1][1])
|| argv[1][1] == 0))))
{
/* Old option syntax: a dash or plus, one or more digits (zero digits
are acceptable with a plus), and one or more option letters. */
@@ -878,6 +879,11 @@ main (int argc, char **argv)
{
STRTOL_FATAL_ERROR (argv[1], _("argument"), s_err);
}
/* If a [bkm] suffix was given then count bytes, not lines. */
if (p[-1] == 'b' || p[-1] == 'k' || p[-1] == 'm')
count_lines = 0;
/* Parse any appended option letters. */
while (*p)
{

View File

@@ -1073,7 +1073,9 @@ main (int margc, char **margv)
if (margv[0] && strcmp (margv[0], "[") == 0)
{
parse_long_options (argc, argv, COMMAND_NAME, PACKAGE_VERSION, usage);
/* Don't recognize --help or --version if POSIXLY_CORRECT is set. */
if (getenv ("POSIXLY_CORRECT") == NULL)
parse_long_options (argc, argv, COMMAND_NAME, PACKAGE_VERSION, usage);
--margc;