Compare commits

...

290 Commits

Author SHA1 Message Date
Jim Meyering
6522d1a579 *** empty log message *** 1999-01-05 05:10:14 +00:00
Jim Meyering
dbe0ba8119 *** empty log message *** 1999-01-05 05:09:52 +00:00
Jim Meyering
ec29f8c718 *** empty log message *** 1999-01-05 04:38:35 +00:00
Jim Meyering
d7d06726a7 . 1999-01-05 04:29:34 +00:00
Jim Meyering
2b8ef64969 *** empty log message *** 1999-01-05 04:29:16 +00:00
Jim Meyering
5118d57563 (main): remove unused `i' 1999-01-04 20:16:31 +00:00
Jim Meyering
6bff151edc remove strcasecmp.cin 1999-01-04 20:14:26 +00:00
Jim Meyering
f8453c637e *** empty log message *** 1999-01-04 20:09:28 +00:00
Jim Meyering
551f17ed6f *** empty log message *** 1999-01-03 15:47:46 +00:00
Jim Meyering
944dc00d0c (usage): Remove third program_name argument -- there
were only two `%s' in the format string.
1999-01-03 15:47:38 +00:00
Jim Meyering
e38501be52 *** empty log message *** 1999-01-02 20:38:45 +00:00
Jim Meyering
7b36cfca74 (argmatch_invalid): Remove double quotes from the
offending quoted argument before using it in explanatory diagnostic.
Use a single fprintf stmt.
1999-01-02 20:35:06 +00:00
Jim Meyering
75b8fb688f . 1999-01-02 20:07:41 +00:00
Jim Meyering
5667ae159f *** empty log message *** 1999-01-02 20:07:04 +00:00
Jim Meyering
88d0241214 Replace strcasecmp and strncasecmp. 1999-01-02 20:06:59 +00:00
Jim Meyering
c3f528b978 . 1999-01-02 19:38:36 +00:00
Jim Meyering
fb888f11ab *** empty log message *** 1999-01-02 19:38:05 +00:00
Jim Meyering
731688ecd5 (tsort): Use a single call to error instead of two to fprintf.
(main): Remove `%s: ' prefix on format string.
1999-01-02 19:37:56 +00:00
Jim Meyering
7004c53ab4 (parse_options): Use XARGMATCH in place of argmatch. 1999-01-02 19:35:46 +00:00
Jim Meyering
501ee2ebd6 (format_vals): New array.
(main): Use XARGMATCH in place of argmatch.
1999-01-02 19:35:18 +00:00
Jim Meyering
e159d72704 *** empty log message *** 1999-01-02 19:33:33 +00:00
Jim Meyering
a31aa355b3 tsort docs 1999-01-02 19:32:14 +00:00
Jim Meyering
69834c7c98 (strcasecmp.c strncasecmp.c): Remove rules. 1999-01-02 19:31:19 +00:00
Jim Meyering
bfea519d18 . 1999-01-02 19:30:32 +00:00
Jim Meyering
51282eaf75 *** empty log message *** 1999-01-02 19:30:05 +00:00
Jim Meyering
1e25b6e3d3 Adapt to use new interface to XARGMATCH. 1999-01-02 19:29:47 +00:00
Jim Meyering
38acb920eb . 1999-01-02 19:28:42 +00:00
Jim Meyering
8b3cbe63d8 (get_version): Adapt to use new interface to XARGMATCH. 1999-01-02 19:28:31 +00:00
Jim Meyering
c7c2516a4d (XARGMATCH): Don't return a value; instead, modify a parameter.
Add a `Die_stmt' parameter.
Add parentheses.
1999-01-02 18:33:08 +00:00
Jim Meyering
fa7427c2ea (__xargmatch_internal): Remove now-unused function.
(argmatch_to_argument): Add `const' attribute to first parameter.
1999-01-02 18:32:50 +00:00
Jim Meyering
c39158b8ec *** empty log message *** 1999-01-02 16:36:25 +00:00
Jim Meyering
041b69340d use XARGMATCH, not XARGCASEMATCH 1999-01-02 16:35:55 +00:00
Jim Meyering
f4db32ef36 Add #ifdefs so it can be used for strncasecmp, too. 1999-01-02 15:55:52 +00:00
Jim Meyering
b966f347ee *** empty log message *** 1999-01-02 15:55:44 +00:00
Jim Meyering
49f27cd70e *** empty log message *** 1999-01-02 12:45:50 +00:00
Jim Meyering
2bb9d3c528 Move inclusion of assert.h to follow that of stdio.h.
Some losing systems require this.
Use STREQ macro instead of strcmp in a few places.
1999-01-02 05:54:07 +00:00
Jim Meyering
b311b41561 Remove definition of setlocale.
Remove definitions of bindtextdomain and textdomain.
1999-01-02 05:30:07 +00:00
Jim Meyering
0cb6dcf585 Include locale.h and libintl.h, and define `_()'.
Mark translatable strings.
1999-01-02 05:27:32 +00:00
Jim Meyering
e213c687aa *** empty log message *** 1999-01-02 05:17:17 +00:00
Jim Meyering
cb1d4eb4f2 (make_dir): New function, factored out of make_path.
(make_path): Use make_dir rather than open-coding it twice.
This effectively reverses the order of the latter pair of stat/mkdir
calls and fixes a race condition bug whereby one of two concurrent
`mkdir -p' processes could fail with EEXIST.
1999-01-02 05:16:57 +00:00
Jim Meyering
45ed22a319 *** empty log message *** 1999-01-02 02:34:47 +00:00
Jim Meyering
977e79ed76 Include readtokens.h.
(zeros): Rename global from `rr'.
(getstr): Remove function.
(tsort) Use readtoken instead of getstr.
1999-01-02 02:34:11 +00:00
Jim Meyering
a842553181 *** empty log message *** 1999-01-01 23:48:23 +00:00
Jim Meyering
1f6728404c *** empty log message *** 1999-01-01 23:46:52 +00:00
Jim Meyering
1b4f931bf4 . 1999-01-01 23:31:36 +00:00
Jim Meyering
2da1b2088f fix typo in comment 1999-01-01 22:55:53 +00:00
Jim Meyering
b99ab6e97d (PATH_MAX_IN_DIR) [HAVE_UNISTD_H]: New macro, for max
file name characters in a given directory.
(tempname): Make sure the temp file name is unique even if long
file names aren't supported.
1999-01-01 22:51:58 +00:00
Jim Meyering
13e5d17494 (cwrite) [O_BINARY]: Write output in binary mode.
(main) [O_BINARY]: Read input in binary mode.
1999-01-01 22:49:44 +00:00
Jim Meyering
f92719d4dc (bsd_sum_file, sysv_sum_file) [O_BINARY]: Read input in binary mode. 1999-01-01 22:48:51 +00:00
Jim Meyering
e60b747ade (tail_lines, tail_bytes) [O_BINARY]: Use binary I/O when appropriate. 1999-01-01 22:48:03 +00:00
Jim Meyering
7cb251e782 Add comments about peculiarities of Textutils operation on MS-DOS/MS-Windows. 1999-01-01 22:44:21 +00:00
Jim Meyering
f3ade72018 (wc): Use binary mode for input. 1999-01-01 22:42:36 +00:00
Jim Meyering
59998135d0 (unexpand): Use binary I/O where appropriate. 1999-01-01 22:41:58 +00:00
Jim Meyering
87f9e231c3 (main) [O_BINARY]: Use binary I/O when appropriate. 1999-01-01 22:40:48 +00:00
Jim Meyering
8e7da4a47c (skip, read_char, read_block) [O_BINARY]: Switch input
stream to binary mode.
1999-01-01 22:33:15 +00:00
Jim Meyering
f54c8f6d80 (OPENOPTS) [O_BINARY]: Use binary I/O when non-zero argument.
(md5_file) [O_BINARY]: Switch redirected stdin to binary mode.
(main) [O_BINARY]: Use binary reads by default on those systems
which care about the difference.
1999-01-01 22:29:32 +00:00
Jim Meyering
9eedfd2482 (head_bytes, head_lines) [O_BINARY]: Use binary I/O. 1999-01-01 22:28:40 +00:00
Jim Meyering
a498f54f37 (expand): Use binary I/O where appropriate. 1999-01-01 22:27:36 +00:00
Jim Meyering
4394c38352 (cksum) [O_BINARY]: Read redirected stdin in binary mode. 1999-01-01 22:22:02 +00:00
Jim Meyering
7914fb4069 (usage) [O_BINARY]: Describe -B,--binary option.
(main) [O_BINARY]: binary_files, binary_output, file_open_mode:
new variables. 	Add --binary to long_options[].  Switch stdin and
stdout to binary mode unless file contents are not important
anyway.  Open files in binary mode when required.
1999-01-01 22:20:23 +00:00
Jim Meyering
e6e8ae14c9 . 1999-01-01 22:11:50 +00:00
Jim Meyering
c704267b26 *** empty log message *** 1999-01-01 21:56:21 +00:00
Jim Meyering
3972420f3b (parse_options): Use XARGCASEMATCH in place of argmatch. 1999-01-01 21:47:08 +00:00
Jim Meyering
94c2a11f47 *** empty log message *** 1999-01-01 19:31:43 +00:00
Jim Meyering
d15c8cbe43 *** empty log message *** 1999-01-01 19:30:08 +00:00
Jim Meyering
b5c28b7097 Rename globals N and R so they don't shadow locals.
(tsort): Rename from `sort'.
1999-01-01 19:29:31 +00:00
Jim Meyering
06adce5358 remove trailing blanks 1999-01-01 19:05:47 +00:00
Jim Meyering
d9ce52992c from Mark Kettenis 1999-01-01 19:05:05 +00:00
Jim Meyering
83db4858d0 *** empty log message *** 1999-01-01 17:43:50 +00:00
Jim Meyering
21b87a6ab7 (quoting_style_vals): New public array. 1999-01-01 17:43:10 +00:00
Jim Meyering
975daefaad Add comments.
(xcalloc, xmalloc, xrealloc): Remove prototypes.
(calloc): Remove `#ifdef NOT_USED' that used to hide this function.
1999-01-01 17:40:08 +00:00
Jim Meyering
3b3e52352c Add comments.
(PARAMS, XMALLOC, XCALLOC, XREALLOC): Define.
Based on changes from Akim Demaille.
1999-01-01 17:36:43 +00:00
Jim Meyering
aa014b906c remove leading _ from _ARGMATCH_H_ 1999-01-01 17:34:18 +00:00
Jim Meyering
2a5e98c9a4 *** empty log message *** 1999-01-01 07:10:00 +00:00
Jim Meyering
dcaa4b656e . 1999-01-01 07:09:08 +00:00
Jim Meyering
5c6d6248e9 . 1999-01-01 07:08:54 +00:00
Jim Meyering
f8be5ac8df *** empty log message *** 1999-01-01 07:06:23 +00:00
Jim Meyering
32acfd66d0 (quotearg_n_options): Make options' parameter be const'. 1999-01-01 07:03:16 +00:00
Jim Meyering
dd16dfb3e3 (quotearg_buffer): Cast -1 to size_t before comparing.
(quotearg_n): Change type of 1st parameter from int to unsigned int.
(quotearg_n_options): Likewise.
From Akim Demaille.
1999-01-01 07:02:16 +00:00
Jim Meyering
2d4f0fea3a (humblock): Use ARGMATCH in place of argmatch. 1999-01-01 06:47:04 +00:00
Jim Meyering
46166ad9b7 (get_version): Use XARGCASEMATCH in place of argmatch & co. 1999-01-01 06:43:04 +00:00
Jim Meyering
bf97e5a0b8 . 1998-12-31 23:24:08 +00:00
Jim Meyering
422a7fdc78 (libfu_a_SOURCES): Remove strcasecmp.c.
(BUILT_SOURCES): Add strcasecmp.c and strncasecmp.c.
(EXTRA_DIST): Add strcasecmp.cin.
(strcasecmp.c): New rule.
(strncasecmp.c): New rule.
1998-12-31 22:03:13 +00:00
Jim Meyering
19270e99bc *** empty log message *** 1998-12-31 21:59:58 +00:00
Jim Meyering
91dc8874b0 (main): Use XARGCASEMATCH in place of argmatch & co. 1998-12-31 21:59:42 +00:00
Jim Meyering
58d6acdfd3 (indicator_style_types): New variable.
(format_types): Rename from `formats'.
(color_args): Remove unnecessary `no' string.
(color_types): Remove corresponding `color_never' entry.
(main): Use ARGMATCH_TO_ARGUMENT.
(decode_switches): Use ARGCASEMATCH instead of argmatch code
in each of several cases.
From Akim Demaille.
1998-12-31 21:49:36 +00:00
Jim Meyering
431652a886 (main): Use XARGCASEMATCH in place of argmatch & co. 1998-12-31 21:41:04 +00:00
Jim Meyering
2e487bb6da fix typo 1998-12-31 18:12:40 +00:00
Jim Meyering
c92163b6e9 white space changes 1998-12-31 18:10:53 +00:00
Jim Meyering
8782f7a817 (strncasecmp): Move to a separate file.
Add curly braces around some one-stmt-but-multiline blocks.
1998-12-31 18:07:23 +00:00
Jim Meyering
a58c222775 *** empty log message *** 1998-12-31 17:53:59 +00:00
Jim Meyering
44538bbbd8 remove trailing blanks 1998-12-31 16:19:31 +00:00
Jim Meyering
65df533705 lots of changes from Akim Demaille. 1998-12-31 16:18:46 +00:00
Jim Meyering
392902344a lots of changes from Akim Demaille. 1998-12-31 16:18:13 +00:00
Jim Meyering
bf588140c5 (addext): Protoize.
Indent cpp directives to match nesting.
1998-12-31 14:56:20 +00:00
Jim Meyering
0f2fbadbea (posix_time_parse): Change type of index `i' from int to unsigned int. 1998-12-31 14:53:16 +00:00
Jim Meyering
50225cad77 Fix warnings from gcc -W -Wall
(__attribute__): Define.
(ATTRIBUTE_UNUSED): Define.
(yyerror): Mark parameter as unused with ATTRIBUTE_UNUSED.
(MonthDayTable): Add initializers for last entry.
(UnitsTable): Likewise.
(OtherTable): Likewise.
(MilitaryTable): Likewise.
1998-12-31 14:37:21 +00:00
Jim Meyering
b15af47b49 . 1998-12-22 22:46:53 +00:00
Jim Meyering
9199178402 *** empty log message *** 1998-12-22 21:57:52 +00:00
Jim Meyering
f82c03de2d . 1998-12-20 13:50:13 +00:00
Jim Meyering
1a162983f4 *** empty log message *** 1998-12-20 02:31:54 +00:00
Jim Meyering
63ceb4f304 Use absolute path for final rm. 1998-12-20 02:31:47 +00:00
Jim Meyering
12838cec9b remove .saved-state 1998-12-19 21:07:32 +00:00
Jim Meyering
b5bfb1d399 *** empty log message *** 1998-12-19 17:21:00 +00:00
Jim Meyering
9497429d9b break long line 1998-12-19 17:20:03 +00:00
Jim Meyering
b80e127286 break long line 1998-12-19 17:19:13 +00:00
Jim Meyering
e53076d42c split long line 1998-12-19 17:18:23 +00:00
Jim Meyering
01fe7e76f4 . 1998-12-19 13:54:04 +00:00
Jim Meyering
bcf9971e84 *** empty log message *** 1998-12-19 13:53:37 +00:00
Jim Meyering
e107deb940 (my-distcheck): Run make with CFLAGS='-Wformat -Werror'. 1998-12-19 13:53:21 +00:00
Jim Meyering
7bf1f374e0 . 1998-12-18 22:11:39 +00:00
Jim Meyering
ede498bfb0 remove semicolon -- from Lars 1998-12-18 15:32:54 +00:00
Jim Meyering
2b00f4f4b6 *** empty log message *** 1998-12-18 15:32:29 +00:00
Jim Meyering
e93093d5e1 *** empty log message *** 1998-12-18 14:49:38 +00:00
Jim Meyering
f2606a6ba0 *** empty log message *** 1998-12-18 14:49:30 +00:00
Jim Meyering
58a77bf4f6 (Makefile.am): Simplify rule.
Based on suggestion from Lars Hecking.
1998-12-18 14:49:01 +00:00
Jim Meyering
344f43313d *** empty log message *** 1998-12-18 14:48:32 +00:00
Jim Meyering
e68c81a48f (copy_internal): Remove errnoeous `%s: ' prefix
from format string.  From Michiel Bacchiani.
1998-12-18 14:22:50 +00:00
Jim Meyering
0e49de1acb *** empty log message *** 1998-12-18 14:22:30 +00:00
Jim Meyering
a3e473c522 (UID_T_MAX, GID_T_MAX): Define them here instead. 1998-12-18 14:09:29 +00:00
Jim Meyering
6408b52640 (UID_T_MAX, GID_T_MAX): Remove definitions. 1998-12-18 14:09:19 +00:00
Jim Meyering
e28821d5f8 (MAXGID): Define.
Use gid_t (not int) as the type for `group' variables.
(parse_group): Use MAXGID, not INT_MAX.
1998-12-18 14:07:58 +00:00
Jim Meyering
621691b296 New options for tail: --follow=name, --follow=descriptor, --allow-missing
(Follow_mode): New enum.
(n_live_files): New function.
(tail_forever): Avoid starvation with --follow=name and a
continually-growing unlinked or renamed file.
1998-12-17 13:56:25 +00:00
Jim Meyering
72c9472cc0 import latest 1998-12-16 13:41:13 +00:00
Jim Meyering
7dfd5ca1cd add comment about opening exclusively 1998-12-13 19:26:35 +00:00
Jim Meyering
c5195207db . 1998-12-13 19:19:07 +00:00
Jim Meyering
8a644a90ef . 1998-12-13 19:01:59 +00:00
Jim Meyering
29ab746b79 Don't include stdlib.h and declare malloc and free.
This works around Solaris 2.7's conflicting prototype.
Reported by Karl Berry.
1998-12-13 18:04:11 +00:00
Jim Meyering
7cf7f3706f (EXTRA_DIST): Add xstat.in. 1998-12-13 17:19:51 +00:00
Jim Meyering
297e2cb744 . 1998-12-12 06:22:56 +00:00
Jim Meyering
9507d3559a In order to distinguish col(umn|or):
(init_column_info): Renamed from init_col_info.
(struct column_info): Renamed from struct col_info.
(struct color_ext_type): Renamed from struct col_ext_type.
From Akim Demaille.
1998-12-12 06:20:42 +00:00
Jim Meyering
876d24a3ed * src/ls.c: Group DIRED's code together.
(full_time, inhibit_group, col_ext_type): Declare static.
(dired_dump_obstack): Apply sizeof to variable, instead of its type.
(parse_ls_color): Rename ext2 as e2.  Move into the block where it is used.
From Akim Demaille.
1998-12-12 06:11:24 +00:00
Jim Meyering
1384f07f77 . 1998-12-12 05:48:25 +00:00
Jim Meyering
8ff77278a2 *** empty log message *** 1998-12-12 05:46:44 +00:00
Jim Meyering
8c97b5c46e (lstat.c): Add rule to generate this from xstat.in.
(stat.c): Likewise.
1998-12-12 05:46:02 +00:00
Jim Meyering
4ff6b43025 *** empty log message *** 1998-12-12 05:45:39 +00:00
Jim Meyering
af36c75750 . 1998-12-12 05:45:29 +00:00
Jim Meyering
fd65b86607 (quotearg_buffer): Use 7' as the mask, not 3'.
From Bruno Haible.
1998-12-11 14:14:16 +00:00
Jim Meyering
bc0c0e635c *** empty log message *** 1998-12-11 14:13:40 +00:00
Jim Meyering
0e65b3e861 Add a test for the quotearg_buffer bug. 1998-12-11 14:13:29 +00:00
Jim Meyering
458aad90ab *** empty log message *** 1998-12-11 13:47:28 +00:00
Jim Meyering
74235b07fa *** empty log message *** 1998-12-11 13:39:42 +00:00
Jim Meyering
a17cdb1173 (main): Arrange to exit unsuccessfully when stime fails.
From Andreas Schwab.
1998-12-11 13:37:52 +00:00
Jim Meyering
b2747b91a8 import version 1.006 1998-12-11 13:34:23 +00:00
Jim Meyering
0963c4ba11 . 1998-12-07 06:26:12 +00:00
Jim Meyering
b4640ed990 (dir_name): Rename from dirname.
Make argument `const'.  Include "dirname.h"
1998-12-07 06:25:54 +00:00
Jim Meyering
1698d53f72 (noinst_HEADERS): Add dirname.h. 1998-12-07 06:25:29 +00:00
Jim Meyering
5ae5d486a9 . 1998-12-07 06:24:28 +00:00
Jim Meyering
ef234641de *** empty log message *** 1998-12-07 06:21:12 +00:00
Jim Meyering
52dedbfebb Use dir_name, not dirname. Include dirname.h. 1998-12-07 06:20:50 +00:00
Jim Meyering
f5e9896c18 . 1998-12-07 05:54:49 +00:00
Jim Meyering
572632b8eb *** empty log message *** 1998-12-07 05:54:29 +00:00
Jim Meyering
a467be8ae8 *** empty log message *** 1998-12-07 05:18:06 +00:00
Jim Meyering
5551e54672 *** empty log message *** 1998-12-07 05:14:42 +00:00
Jim Meyering
b7e610bfdb (rpmatch) [!ENABLE_NLS]: Hard-code tests to use ^[yY]' and ^[nN]'.
From Karl Heuer.
1998-12-07 05:14:07 +00:00
Jim Meyering
7e6c89fc63 *** empty log message *** 1998-12-07 05:12:48 +00:00
Jim Meyering
7273e22923 declare base_name 1998-12-07 04:35:20 +00:00
Jim Meyering
6f5e749ea6 *** empty log message *** 1998-12-07 04:33:20 +00:00
Jim Meyering
376d67374f *** empty log message *** 1998-12-07 03:12:21 +00:00
Jim Meyering
7d60769bea ansideclify 1998-12-07 03:12:10 +00:00
Jim Meyering
604b3b397d *** empty log message *** 1998-12-06 23:09:39 +00:00
Jim Meyering
a68f3dee80 add ls -R . test 1998-12-06 23:09:29 +00:00
Jim Meyering
dd3bad9b7c . 1998-12-06 23:09:14 +00:00
Jim Meyering
6207f6f804 Fix `ls -R .' formatting bug that broke mktexlsr.
Include path-concat.h.
(basename_is_dot_or_dotdot): New function, derived from
is_not_dot_or_dotdot.
(is_not_dot_or_dotdot): Remove function.
(extract_dirs_from_files): Use `!basename_is_dot_or_dotdot'
instead of is_not_dot_or_dotdot and use path_concat instead of attach.
1998-12-06 23:08:55 +00:00
Jim Meyering
16c8a66a54 (TESTS): s/quoting/tests/. 1998-12-06 23:03:32 +00:00
Jim Meyering
9069b306dc renamed from quote 1998-12-06 23:01:12 +00:00
Jim Meyering
76223aedef *** empty log message *** 1998-12-06 22:18:38 +00:00
Jim Meyering
2ec7385fb0 Redefine putenv before including stdlib.h to work
around Solaris 2.7's conflicting prototype.  Reported by Karl Berry.
1998-12-06 22:18:17 +00:00
Jim Meyering
46dd5092ee . 1998-12-06 21:06:22 +00:00
Jim Meyering
e5f51be9f1 . 1998-12-06 21:06:02 +00:00
Jim Meyering
1e422ea7ec (DOT_OR_DOTDOT): New definition (moved here from remove.c.). 1998-11-30 03:01:24 +00:00
Jim Meyering
9d7c18290e (DOT_OR_DOTDOT): Move definition from this file... 1998-11-30 03:00:51 +00:00
Jim Meyering
90dbea92c4 (dd_copy): Rename function from `copy'. 1998-11-30 02:58:21 +00:00
Jim Meyering
d9878753d1 (do_copy): Rename local: s/unused/copy_into_self/ 1998-11-30 02:57:43 +00:00
Jim Meyering
4dbf57ed78 (do_move): Don't arrange to remove DEST in the copied-into-self case. 1998-11-30 02:56:05 +00:00
Jim Meyering
438a33770b *** empty log message *** 1998-11-30 02:54:28 +00:00
Jim Meyering
f7cd44c64c (TESTS): Add hard-link-1. 1998-11-30 02:53:57 +00:00
Jim Meyering
32df3704e4 (copy_internal): Remove earlier (but less effective)
test for move/copy-into-self.
Instead, deduce the move-into-self condition from errno==EINVAL
after a failed rename.
1998-11-30 02:10:13 +00:00
Jim Meyering
955d2c6ae5 *** empty log message *** 1998-11-30 02:03:01 +00:00
Jim Meyering
75d5ed8b58 (movefile): Don't free new_dest.
Bob McCracken reported that mv couldn't handle certain combinations
of hard linked source files.
1998-11-30 02:01:18 +00:00
Jim Meyering
b9c6c84a8c handle VERBOSE 1998-11-30 00:46:14 +00:00
Jim Meyering
3c6a1e9f08 (TESTS): Add into-self-3. 1998-11-30 00:45:44 +00:00
Jim Meyering
bb6a835cc1 *** empty log message *** 1998-11-30 00:44:59 +00:00
Jim Meyering
78f7236408 don't mention package name in comments 1998-11-21 17:43:41 +00:00
Jim Meyering
976ca67266 tweak comment 1998-11-21 17:33:45 +00:00
Jim Meyering
aba712c3bc *** empty log message *** 1998-11-17 02:14:16 +00:00
Jim Meyering
3ec7a99af6 Double-quote the uname... expression. 1998-11-17 02:14:12 +00:00
Jim Meyering
d60ac7e850 (AC_LFS): Add support for HP-UX 10.20 and HP-UX 11. 1998-11-17 02:09:52 +00:00
Jim Meyering
4c15e09a2c *** empty log message *** 1998-11-16 05:51:31 +00:00
Jim Meyering
a1d63c6f15 *** empty log message *** 1998-11-15 17:43:26 +00:00
Jim Meyering
e781ee9e60 *** empty log message *** 1998-11-15 17:36:02 +00:00
Jim Meyering
9764f6e3e1 *** empty log message *** 1998-11-15 17:35:45 +00:00
Jim Meyering
e77961586a (error): Don't use strerror_r's return value. 1998-11-15 17:35:34 +00:00
Jim Meyering
11135e1307 *** empty log message *** 1998-11-14 15:33:42 +00:00
Jim Meyering
d8a0eef528 (cvs-dist): Search for `$tag:' rather than just $tag
to avoid matching a prefix of another tag.
1998-11-14 15:33:34 +00:00
Jim Meyering
b7657496c3 update from master copy 1998-11-14 15:00:39 +00:00
Jim Meyering
01c7f17f33 Correct comment. POSIX does not permit it to succeed. 1998-11-14 13:23:22 +00:00
Jim Meyering
a211252152 *** empty log message *** 1998-11-14 13:23:08 +00:00
Jim Meyering
24c0a0a99d Correct comment. POSIX does not permit it to succeed. 1998-11-14 13:22:58 +00:00
Jim Meyering
df521a1b29 revert-to-4.0-b7 1998-11-14 13:17:34 +00:00
Jim Meyering
686a7e9ff3 *** empty log message *** 1998-11-14 13:15:22 +00:00
Jim Meyering
1d738b51d1 revert backupfile change 1998-11-14 13:13:50 +00:00
Jim Meyering
84c2d0e52e revert-last-change 1998-11-14 13:13:10 +00:00
Jim Meyering
6c0c08eb29 back out last change: there is a better way 1998-11-11 05:16:09 +00:00
Jim Meyering
7de9edecfc (BACKUPFILE_EXIT_FAILURE): Define.
(get_version): Use it in place of EXIT_FAILURE.
1998-11-11 05:01:26 +00:00
Jim Meyering
9e3f43b368 [EXIT_FAILURE]: Define.
(get_version): Use EXIT_FAILURE as exit status rather than
hard-coding `2'.  From Franois Pinard.
1998-11-10 05:57:56 +00:00
Jim Meyering
d7b702d0d0 avoid new warnings from texinfo-1.12b 1998-11-08 16:20:00 +00:00
Jim Meyering
ed5b1cad23 . 1998-11-08 16:13:13 +00:00
Jim Meyering
532074e1c7 . 1998-11-08 03:49:22 +00:00
Jim Meyering
deef42170f *** empty log message *** 1998-11-08 03:44:44 +00:00
Jim Meyering
b808de586b *** empty log message *** 1998-11-08 03:42:44 +00:00
Jim Meyering
ac7f057d98 Rewrite to set HAVE_LSTAT_EMPTY_STRING_BUG. 1998-11-08 03:42:35 +00:00
Jim Meyering
2daa912c53 Rewrite to set HAVE_STAT_EMPTY_STRING_BUG. 1998-11-08 03:42:20 +00:00
Jim Meyering
7bf8c634eb . 1998-11-08 03:42:04 +00:00
Jim Meyering
c091e6fe83 [lstat]: Remove #undef.
(rpl_lstat): Protoize.  Use ENOENT, not EINVAL, to be consistent
with lib/stat.c.
1998-11-08 03:40:04 +00:00
Jim Meyering
dc61111cc6 (rpl_stat): Protoize.
(stat): Remove #undef.
1998-11-08 03:39:42 +00:00
Jim Meyering
920680fe4f [HAVE_LSTAT_EMPTY_STRING_BUG]: Define lstat to rpl_lstat and declare the latter. 1998-11-08 03:38:06 +00:00
Jim Meyering
c9f0e3d343 *** empty log message *** 1998-11-02 17:08:44 +00:00
Jim Meyering
b4c9bd2b7e . 1998-11-01 17:17:52 +00:00
Jim Meyering
453be366da latest from ftp.gnu.org 1998-11-01 16:41:46 +00:00
Jim Meyering
f51e80f564 *** empty log message *** 1998-11-01 05:26:06 +00:00
Jim Meyering
993a56e8e0 . 1998-11-01 01:04:11 +00:00
Jim Meyering
d8e4dccdca . 1998-11-01 01:02:24 +00:00
Jim Meyering
427e67b196 Rewrite to use new testing framework. 1998-11-01 00:52:32 +00:00
Jim Meyering
90ffddc87e . 1998-11-01 00:52:16 +00:00
Jim Meyering
8458f55338 *** empty log message *** 1998-11-01 00:52:06 +00:00
Jim Meyering
bf5ef10371 . 1998-11-01 00:51:26 +00:00
Jim Meyering
d087967041 . 1998-11-01 00:50:23 +00:00
Jim Meyering
cfb54dec88 *** empty log message *** 1998-11-01 00:49:44 +00:00
Jim Meyering
e1958a7253 *** empty log message *** 1998-11-01 00:12:41 +00:00
Jim Meyering
cf50a06294 (TESTS): Add new test `empty-name', but comment it out. 1998-11-01 00:12:07 +00:00
Jim Meyering
c96d9a880f *** empty log message *** 1998-11-01 00:09:44 +00:00
Jim Meyering
25bf05e45e update from master copy 1998-10-31 15:19:09 +00:00
Jim Meyering
99b35637c4 . 1998-10-25 14:30:46 +00:00
Jim Meyering
09b8756e33 . 1998-10-25 14:30:15 +00:00
Jim Meyering
9c5d11d5c5 . 1998-10-25 14:28:04 +00:00
Jim Meyering
bf6c2a07af *** empty log message *** 1998-10-25 14:12:47 +00:00
Jim Meyering
c729fe037e (TESTS): Add new test `unreadable'. But comment
it out since we're so close to release and since the test compares the
text of diagnostics that are likely to vary between systems.
(TEST_ENVIRONMENT): Add required framework.
1998-10-25 14:08:38 +00:00
Jim Meyering
02cde32c0a *** empty log message *** 1998-10-25 14:03:09 +00:00
Jim Meyering
7741f87086 *** empty log message *** 1998-10-25 13:58:56 +00:00
Jim Meyering
9e630b86cb (remove_cwd_entries): Don't apply CLOSEDIR to a NULL
pointer. (provoke with `mkdir -m 0100 x; rm -rf x')
Upon CLOSEDIR failure, set `status' to RM_ERROR, not RM_OK.
(remove_dir): Return `status', rather than always RM_OK.
1998-10-25 13:58:50 +00:00
Jim Meyering
2e19f14a91 *** empty log message *** 1998-10-23 02:08:48 +00:00
Jim Meyering
65b1a6ec82 (usage): Add mention of --version and --help. 1998-10-23 02:08:35 +00:00
Jim Meyering
06d1a87e3b *** empty log message *** 1998-10-18 14:18:22 +00:00
Jim Meyering
f417e8b9d4 . 1998-10-18 14:14:09 +00:00
Jim Meyering
4fb556ee0e Don't invoke localtime_r or gmtime_r unless it's the GNU C
library's localtime_r and gmtime_r; there are too many buggy
	implementations of localtime_r and gmtime_r out there, and
	it's not worth keeping track of all the different bugs.

	* strftime.c (__EXTENSIONS__): Remove.
	(my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed.
	(my_strftime_localtime_r): Renamed from localtime_r; all uses changed.
	Base them on localtime/gmtime if not _LIBC.
1998-10-18 14:09:48 +00:00
Jim Meyering
c850393032 Don't invoke localtime_r or gmtime_r unless it's the GNU C
library's localtime_r and gmtime_r; there are too many buggy
	implementations of localtime_r and gmtime_r out there, and
	it's not worth keeping track of all the different bugs.

	* mktime.c (__EXTENSIONS__, HAVE_LOCALTIME_R): Remove.
	(my_mktime_localtime_r): Renamed from localtime_r; all uses changed.
	Base it on localtime unless _LIBC.
1998-10-18 14:08:35 +00:00
Jim Meyering
61ece919c6 (jm_CHECK_DECL_LOCALTIME_R): Remove macro. 1998-10-18 14:08:09 +00:00
Jim Meyering
843b44b3f7 *** empty log message *** 1998-10-18 01:50:53 +00:00
Jim Meyering
5edb65b5c4 . 1998-10-18 01:49:44 +00:00
Jim Meyering
a71cb7cad1 Declare localtime_r if necessary. 1998-10-18 01:11:35 +00:00
Jim Meyering
e2d1b297e7 Declare localtime_r if necessary. 1998-10-18 01:10:21 +00:00
Jim Meyering
70bea7fd3e *** empty log message *** 1998-10-18 01:08:54 +00:00
Jim Meyering
ec936db8d7 (jm_CHECK_DECLS): Reflect interface change.
(jm_CHECK_DECL_LOCALTIME_R): New macro.
1998-10-18 01:08:22 +00:00
Jim Meyering
2b69ce2d89 (jm_CHECK_DECLARATION): Don't hard-code which headers to
include, though we still hard-code the `require'-like AC_CHECK_HEADERS
calls for those previously hard-coded headers.  Instead, take a new parameter.
(jm_CHECK_DECLARATIONS): Reflect interface change.
1998-10-18 01:07:17 +00:00
Jim Meyering
0a25bc498d Test for spring-forward gap before long-running test. 1998-10-18 00:58:07 +00:00
Jim Meyering
6cc7e13732 (run_tests): Run $prog with --version only if $verbose. 1998-10-17 12:47:21 +00:00
Jim Meyering
0e1c643956 *** empty log message *** 1998-10-17 12:39:57 +00:00
Jim Meyering
2e29b32116 Some systems require <unistd.h> to be included before <time.h> for
localtime_r to be declared properly.
1998-10-17 12:39:30 +00:00
Jim Meyering
082787996c Use the more portable "TZ=PST8PDT,M4.1.0,M10.5.0"
instead of "TZ=America/Vancouver".  From Paul Eggert.
1998-10-14 21:27:52 +00:00
Jim Meyering
edef42bf40 *** empty log message *** 1998-10-12 03:51:35 +00:00
Jim Meyering
efce5c3bdf . 1998-10-12 03:50:44 +00:00
Jim Meyering
18ac22d2fc . 1998-10-12 03:50:24 +00:00
Jim Meyering
c20eae80c7 add jm_ prefix to cache variable 1998-10-12 03:20:21 +00:00
Jim Meyering
6f43239736 *** empty log message *** 1998-10-12 02:56:35 +00:00
Jim Meyering
c6b7de061f *** empty log message *** 1998-10-12 02:55:35 +00:00
Jim Meyering
10d64e02c4 Require jm_AM_FUNC_MKTIME, not AM_FUNC_MKTIME. 1998-10-12 02:55:28 +00:00
Jim Meyering
852a30165b (jm_AM_FUNC_MKTIME): New file and macro. 1998-10-12 02:55:17 +00:00
Jim Meyering
e4d0cf679c . 1998-10-12 02:51:10 +00:00
Jim Meyering
57c0968203 *** empty log message *** 1998-10-12 02:51:01 +00:00
Jim Meyering
761ed79f4d (_REENTRANT): Define again -- linux-2.0.33 needs it. 1998-10-12 02:00:59 +00:00
Jim Meyering
f49ea966c3 *** empty log message *** 1998-10-12 01:18:08 +00:00
Jim Meyering
8c6d49c84d *** empty log message *** 1998-10-11 23:04:04 +00:00
Jim Meyering
061a10d1ff (__mktime_internal): When the requested time falls
in a spring-forward gap of size DT, return a time that is DT
away from the requested time, preferring a time whose tm_isdst
differs from the requested value.  Bump the max number of
probes from 4 to 6 to account for the extra probes needed to
discover a spring-forward gap in the worst case.
1998-10-11 23:03:41 +00:00
Jim Meyering
787dfe9c83 . 1998-10-10 18:38:05 +00:00
Jim Meyering
9e3949fa6f . 1998-10-10 18:37:44 +00:00
Jim Meyering
62b64a0e92 *** empty log message *** 1998-10-08 12:24:40 +00:00
Jim Meyering
37c289ea31 (my_mktime_localtime_r): Renamed from localtime_r.
Define also if HAVE_LOCALTIME_R && defined (localtime_r), with
a body that merely expands localtime_r; this works around a
bug in Digital Unix 4.0A and 4.0D.
1998-10-08 12:19:48 +00:00
Jim Meyering
297a13a5a3 import 1.5b 1998-10-06 04:07:25 +00:00
Jim Meyering
2aae4df6ef *** empty log message *** 1998-10-05 12:27:03 +00:00
Jim Meyering
8670ecb6cb (long_options): Add entry for --suffix=SUFFIX option. 1998-10-05 12:23:21 +00:00
Jim Meyering
1b1bcc5e29 *** empty log message *** 1998-10-05 04:30:40 +00:00
Jim Meyering
03d1ff2dea *** empty log message *** 1998-10-05 04:24:42 +00:00
Jim Meyering
1381664a56 . 1998-10-05 04:21:39 +00:00
Jim Meyering
3ed45d5062 back out last change 1998-10-05 04:20:33 +00:00
Jim Meyering
dfd3465715 half-hearted attempt to support file name quoting 1998-10-05 04:20:12 +00:00
Jim Meyering
86488adef8 *** empty log message *** 1998-10-05 04:05:41 +00:00
Jim Meyering
3564013e18 add double quotes 1998-10-05 03:34:17 +00:00
Jim Meyering
a019f34623 (TESTS_ENVIRONMENT): Define PERL. 1998-10-05 03:30:41 +00:00
Jim Meyering
0e2247a55b *** empty log message *** 1998-10-04 13:53:18 +00:00
148 changed files with 3965 additions and 1924 deletions

View File

@@ -18,7 +18,7 @@ cvs-dist: maintainer-check
ver=`echo "$(VERSION)" | sed 's/\./_/g'`; \
tag="$$pkg-$$ver"; \
echo tag=$$tag; \
if cvs -n log -h README| grep -e $$tag > /dev/null; then \
if cvs -n log -h README| grep -e $$tag: > /dev/null; then \
echo "VERSION not new; not tagging" 1>&2; \
exit 1; \
fi; \
@@ -33,7 +33,7 @@ my-distcheck: dist
GZIP=$(GZIP) $(TAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) \
&& $(MAKE) CFLAGS='-Wformat -Werror' \
&& $(MAKE) dvi \
&& $(MAKE) check \
&& $(MAKE) distclean
@@ -50,7 +50,8 @@ THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
PREV_VERSION := $(shell echo $(VERSION)|tr a-z Xa-y)
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
v = Version
url = ftp://alpha.gnu.org/gnu/fetish/$(distdir).tar.gz
url-host-prefix = ftp://alpha.gnu.org
url = $(url-host-prefix)/gnu/fetish/$(distdir).tar.gz
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
rel-check:
@@ -87,7 +88,7 @@ alpha:
ln $(distdir).tar.gz ../release
chmod a-w $(distdir).tar.gz
@echo =====================================
@echo 'ncftp -u $(dir $(url))'
@echo 'ncftp -u $(url-host-prefix)/fs/share/ftp/gnu/fetish/'
@echo '# put $(distdir).tar.gz'
@echo '# send the /tmp/announcement e-mail'
@echo 'pot-mail $(distdir).tar.gz | bash'

8
THANKS
View File

@@ -2,7 +2,9 @@ This is just a start at listing e-mail addresses of contributors.
The rest of the addresses are still in the ChangeLog.
Achim Blumensath: blume@corona.oche.de
aldomel: aldomel@ix.netcom.com
Akim Demaille: demaille@inf.enst.fr
Andreas Jaeger: jaeger@gnu.org
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
Andries Brouwer: Andries.Brouwer@cwi.nl
Arne Henrik Juul: arnej@imf.unit.no
@@ -10,6 +12,7 @@ Bauke Jan Douma: bjdouma@xs4all.nl
Bengt Martensson: bengt@mathematik.uni-Bremen.de
Bernd Leibing: bernd.leibing@rz.uni-ulm.de
Bjorn Helgaas: helgaas@rsn.hp.com
Bob McCracken: kerouac@ravenet.com
Brendan O'Dea: bod@compusol.com.au
Charles Karney: karney@pppl.gov
Christian von Roques: roques@pond.sub.org
@@ -28,8 +31,11 @@ James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
James Tanis: jtt@soscorp.com
Jesse Thilo: jgt2@eecs.lehigh.edu
Joakim Rosqvist: dvljrt@cs.umu.se
Johan Danielsson: joda@pdc.kth.se
John Gatewood Ham: zappaman@alphabox.compsci.buu.ac.th
Karl Heuer: kwzh@gnu.org
Kjetil Torgrim Homme: kjetilho@ifi.uio.no
Lars Hecking: lhecking@nmrc.ucc.ie
Lorne Baker: lbaker@nitro.avint.net
Marcus Daniels: marcus@sysc.pdx.edu
Mark A. Thomas: thommark@access.digex.net
@@ -38,9 +44,11 @@ Mark Kettenis: kettenis@phys.uva.nl
Marty Leisner: leisner@sdsp.mc.xerox.com
Masami Takikawa: takikawm@CS.ORST.EDU
Matthew S. Levine: mslevine@theory.lcs.mit.edu
Michiel Bacchiani: bacchian@raven.bu.edu
Miles Bader: miles@gnu.ai.mit.edu
Noel Cragg: noel@red-bean.com
Olav Morkrid: olav@funcom.com
Per Kristian Hove: perhov@math.ntnu.no
Peter Eriksson: peter@ifm.liu.se
Paul Eggert: eggert@twinsun.com
Philippe De Muyter: phdm@macqel.be

View File

@@ -3,8 +3,12 @@ info_TEXINFOS = fileutils.texi
EXTRA_DIST = perm.texi getdate.texi
# Tell makeinfo to put everything in a single info file: sh-utils.info.
# Otherwise, it would also generate files with names like sh-utils.info-[123],
# and those names all map to one 14-byte name (sh-utils.info-) on some crufty
# The following is necessary if the package name is 8 characters or longer.
# If the info documentation would be split into 10 or more separate files,
# then this is necessary even if the package name is 7 characters long.
#
# Tell makeinfo to put everything in a single info file: <package>.info.
# Otherwise, it would also generate files with names like <package>.info-[123],
# and those names all map to one 14-byte name (<package>.info-) on some crufty
# old systems.
MAKEINFO = makeinfo --no-split

View File

@@ -93,9 +93,13 @@ info_TEXINFOS = fileutils.texi
EXTRA_DIST = perm.texi getdate.texi
# Tell makeinfo to put everything in a single info file: sh-utils.info.
# Otherwise, it would also generate files with names like sh-utils.info-[123],
# and those names all map to one 14-byte name (sh-utils.info-) on some crufty
# The following is necessary if the package name is 8 characters or longer.
# If the info documentation would be split into 10 or more separate files,
# then this is necessary even if the package name is 7 characters long.
#
# Tell makeinfo to put everything in a single info file: <package>.info.
# Otherwise, it would also generate files with names like <package>.info-[123],
# and those names all map to one 14-byte name (<package>.info-) on some crufty
# old systems.
MAKEINFO = makeinfo --no-split
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -245,10 +249,11 @@ dist-info: $(INFO_DEPS)
mostlyclean-aminfo:
-rm -f fileutils.aux fileutils.cp fileutils.cps fileutils.dvi \
fileutils.fn fileutils.fns fileutils.ky fileutils.kys \
fileutils.ps fileutils.log fileutils.pg fileutils.toc \
fileutils.tp fileutils.tps fileutils.vr fileutils.vrs \
fileutils.op fileutils.tr fileutils.cv fileutils.cn
fileutils.fl fileutils.fn fileutils.fns fileutils.ky \
fileutils.kys fileutils.ps fileutils.log fileutils.pg \
fileutils.toc fileutils.tp fileutils.tps fileutils.vr \
fileutils.vrs fileutils.op fileutils.tr fileutils.cv \
fileutils.cn
clean-aminfo:

View File

@@ -1,5 +1,9 @@
% texinfo.tex -- TeX macros to handle Texinfo files.
\def\texinfoversion{1998-09-30}%
%
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{1998-12-19}%
%
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
% Free Software Foundation, Inc.
@@ -50,12 +54,6 @@
% Sometimes one run after texindex suffices, and sometimes you need more
% than two; texi2dvi does it as many times as necessary.
% Make it possible to create a .fmt file just by loading this file:
% if the underlying format is not loaded, start by loading it now.
% Added by gildea November 1993.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
\message{Loading texinfo [version \texinfoversion]:}
% If in a .fmt file, print the version number
@@ -189,13 +187,16 @@
\shipout\vbox{%
\ifcropmarks \vbox to \outervsize\bgroup
\hsize = \outerhsize
\line{\ewtop\hfil\ewtop}%
\nointerlineskip
\line{%
\vbox{\moveleft\cornerthick\nstop}%
\hfill
\vbox{\moveright\cornerthick\nstop}%
}%
\vskip-\topandbottommargin
\vtop to0pt{%
\line{\ewtop\hfil\ewtop}%
\nointerlineskip
\line{%
\vbox{\moveleft\cornerthick\nstop}%
\hfill
\vbox{\moveright\cornerthick\nstop}%
}%
\vss}%
\vskip\topandbottommargin
\line\bgroup
\hfil % center the page within the outer (page) hsize.
@@ -218,13 +219,15 @@
\hfil\egroup % end of (centering) \line\bgroup
\vskip\topandbottommargin plus1fill minus1fill
\boxmaxdepth = \cornerthick
\line{%
\vbox{\moveleft\cornerthick\nsbot}%
\hfill
\vbox{\moveright\cornerthick\nsbot}%
\vbox to0pt{\vss
\line{%
\vbox{\moveleft\cornerthick\nsbot}%
\hfill
\vbox{\moveright\cornerthick\nsbot}%
}%
\nointerlineskip
\line{\ewbot\hfil\ewbot}%
}%
\nointerlineskip
\line{\ewbot\hfil\ewbot}%
\egroup % \vbox from first cropmarks clause
\fi
}% end of \shipout\vbox
@@ -846,7 +849,7 @@ where each line of input produces a line of output.}
\immediate\write16{If you are running another version of TeX, relax.}
\immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
\immediate\write16{ Then upgrade your TeX installation if you can.}
\immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
\immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
\immediate\write16{If you are stuck with version 3.0, run the}
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
\immediate\write16{ to use a workaround.}
@@ -980,7 +983,7 @@ where each line of input produces a line of output.}
%
\def\expandablevalue#1{%
\expandafter\ifx\csname SET#1\endcsname\relax
{[No value for ``#1'']v}%
{[No value for ``#1'']}%
\else
\csname SET#1\endcsname
\fi
@@ -1536,7 +1539,7 @@ where each line of input produces a line of output.}
\newif\iffinishedtitlepage
% Do an implicit @contents or @shortcontents after @end titlepage if the
% user says @contentsaftertitlepage or @shortcontentsaftertitlepage.
% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
%
\newif\ifsetcontentsaftertitlepage
\let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
@@ -2142,31 +2145,44 @@ July\or August\or September\or October\or November\or December\fi
\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}
% #1 is the part of the @columnfraction before the decimal point, which
% is presumably either 0 or the empty string (but we don't check, we
% just throw it away). #2 is the decimal part, which we use as the
% percent of \hsize for this column.
\def\pickupwholefraction#1.#2 {%
\global\advance\colcount by 1
\expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
\setuptable
}
\newcount\colcount
\def\setuptable#1{\def\firstarg{#1}%
\ifx\firstarg\xendsetuptable\let\go\relax%
\else
\ifx\firstarg\xcolumnfractions\global\setpercenttrue%
\def\setuptable#1{%
\def\firstarg{#1}%
\ifx\firstarg\xendsetuptable
\let\go = \relax
\else
\ifsetpercent
\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.
\ifx\firstarg\xcolumnfractions
\global\setpercenttrue
\else
\global\advance\colcount by1
\setbox0=\hbox{#1 }% Add a normal word space as a separator;
% typically that is always in the input, anyway.
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
\ifsetpercent
\let\go\pickupwholefraction
\else
\global\advance\colcount by 1
\setbox0=\hbox{#1\unskip }% Add a normal word space as a separator;
% typically that is always in the input, anyway.
\expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
\fi
\fi
\ifx\go\pickupwholefraction
% Put the argument back for the \pickupwholefraction call, so
% we'll always have a period there to be parsed.
\def\go{\pickupwholefraction#1}%
\else
\let\go = \setuptable
\fi%
\fi%
\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
\fi\go}
\fi
\go
}
% multitable syntax
\def\tab{&\hskip1sp\relax} % 2/2/96
@@ -2174,7 +2190,7 @@ July\or August\or September\or October\or November\or December\fi
% maintained, even if it is never used.
% @multitable ... @end multitable definitions:
%
\def\multitable{\parsearg\dotable}
\def\dotable#1{\bgroup
\vskip\parskip
@@ -2385,8 +2401,9 @@ width0pt\relax} \fi
% (Must be a way to avoid doing expansion at all, and thus not have to
% laboriously list every single command here.)
\def\@{@}% will be @@ when we switch to @ as escape char.
%\let\{ = \lbracecmd
%\let\} = \rbracecmd
% need these in case \tex is in effect and \{ is a \delimiter again.
\let\{ = \lbracecmd
\let\} = \rbracecmd
\def\_{{\realbackslash _}}%
\def\w{\realbackslash w }%
\def\bf{\realbackslash bf }%
@@ -2408,6 +2425,11 @@ width0pt\relax} \fi
\def\copyright{\realbackslash copyright}%
\def\tclose##1{\realbackslash tclose {##1}}%
\def\code##1{\realbackslash code {##1}}%
\def\uref##1{\realbackslash uref {##1}}%
\def\url##1{\realbackslash url {##1}}%
\def\env##1{\realbackslash env {##1}}%
\def\command##1{\realbackslash command {##1}}%
\def\option##1{\realbackslash option {##1}}%
\def\dotless##1{\realbackslash dotless {##1}}%
\def\samp##1{\realbackslash samp {##1}}%
\def\,##1{\realbackslash ,{##1}}%
@@ -2423,6 +2445,7 @@ width0pt\relax} \fi
\def\kbd##1{\realbackslash kbd {##1}}%
\def\dfn##1{\realbackslash dfn {##1}}%
\def\emph##1{\realbackslash emph {##1}}%
\def\acronym##1{\realbackslash acronym {##1}}%
%
% Handle some cases of @value -- where the variable name does not
% contain - or _, and the value does not contain any
@@ -2486,6 +2509,11 @@ width0pt\relax} \fi
%\let\tt=\indexdummyfont
\let\tclose=\indexdummyfont
\let\code=\indexdummyfont
\let\url=\indexdummyfont
\let\uref=\indexdummyfont
\let\env=\indexdummyfont
\let\command=\indexdummyfont
\let\option=\indexdummyfont
\let\file=\indexdummyfont
\let\samp=\indexdummyfont
\let\kbd=\indexdummyfont
@@ -5205,7 +5233,7 @@ width0pt\relax} \fi
\vsize = #1\relax
\advance\vsize by \topskip
\outervsize = \vsize
\advance\outervsize by 0.6in
\advance\outervsize by 2\topandbottommargin
\pageheight = \vsize
%
\hsize = #2\relax
@@ -5445,10 +5473,9 @@ width0pt\relax} \fi
@rm
@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
@c page-delimiter: "^\\\\message"
@c update-date-leading-regexp: "def\\texinfoversion{"
@c update-date-date-regexp: "[-0-9.]+"
@c update-date-format-string: "%Y-%m-%d"
@c update-date-trailing-regexp: "}"
@c eval: (and(load "update-date" t t)(add-hook 'write-file-hooks 'update-date))
@c time-stamp-start: "def\\\\texinfoversion{"
@c time-stamp-format: "%:y-%02m-%02d"
@c time-stamp-end: "}"
@c End:

View File

@@ -41,6 +41,7 @@ START-INFO-DIR-ENTRY
* sum: (textutils)sum invocation. Print traditional checksum.
* tac: (textutils)tac invocation. Reverse files.
* tail: (textutils)tail invocation. Output the last part of files.
* tsort: (textutils)tsort invocation. Topological sort.
* tr: (textutils)tr invocation. Translate characters.
* unexpand: (textutils)unexpand invocation. Convert spaces to tabs.
* uniq: (textutils)uniq invocation. Uniqify files.
@@ -118,7 +119,7 @@ This manual documents version @value{VERSION} of the GNU text utilities.
* Formatting file contents:: fmt pr fold
* Output of parts of files:: head tail split csplit
* Summarizing files:: wc sum cksum md5sum
* Operating on sorted files:: sort uniq comm ptx
* Operating on sorted files:: sort uniq comm ptx tsort
* Operating on fields within a line:: cut paste join
* Operating on characters:: tr expand unexpand
* Opening the software toolbox:: The software tools philosophy.
@@ -160,6 +161,7 @@ Operating on sorted files
* uniq invocation:: Uniqify files.
* comm invocation:: Compare two sorted files line by line.
* ptx invocation:: Produce a permuted index of file contents.
* tsort invocation:: Topological sort.
@code{ptx}: Produce permuted indexes
@@ -307,11 +309,32 @@ The program accepts the following options. Also see @ref{Common options}.
@opindex --show-all
Equivalent to @samp{-vET}.
@item -B
@itemx --binary
@opindex -B
@opindex --binary
@cindex binary and text I/O in cat
On MS-DOS and MS-Windows only, causes @code{cat} read and write the
files in binary mode. By default, @code{cat} on MS-DOS/MS-Windows uses
binary mode only when standard output is redirected to a file or a pipe;
this option overrides that. Binary file I/O is used so that the files
retain their format (Unix text as opposed to DOS text and binary),
because @code{cat} is frequently used as file copying program. Some
options (see below) cause @code{cat} read and write files in text mode
because then the original file contents aren't important (e.g., when
lines are numbered by @code{cat}, or when line endings should be
marked). This is so these options work as DOS/Windows users would
expect; for example, DOS-style text files have their lines end with
@key{CR-LF} pair of characters which won't be processed as an empty line
by @samp{-b} unless the file is read in text mode.
@item -b
@itemx --number-nonblank
@opindex -b
@opindex --number-nonblank
Number all nonblank output lines, starting with 1.
Number all nonblank output lines, starting with 1. On MS-DOS and
MS-Windows, this option causes @code{cat} to read and write files in
text mode.
@item -e
@opindex -e
@@ -321,20 +344,25 @@ Equivalent to @samp{-vE}.
@itemx --show-ends
@opindex -E
@opindex --show-ends
Display a @samp{$} after the end of each line.
Display a @samp{$} after the end of each line. On MS-DOS and
MS-Windows, this option causes @code{cat} to read and write files in
text mode.
@item -n
@itemx --number
@opindex -n
@opindex --number
Number all output lines, starting with 1.
Number all output lines, starting with 1. On MS-DOS and MS-Windows,
this option causes @code{cat} to read and write files in text mode.
@item -s
@itemx --squeeze-blank
@opindex -s
@opindex --squeeze-blank
@cindex squeezing blank lines
Replace multiple adjacent blank lines with a single blank line.
Replace multiple adjacent blank lines with a single blank line. On
MS-DOS and MS-Windows, this option causes @code{cat} to read and write
files in text mode.
@item -t
@opindex -t
@@ -355,8 +383,10 @@ Ignored; for Unix compatibility.
@opindex -v
@opindex --show-nonprinting
Display control characters except for @key{LFD} and @key{TAB} using
@samp{^} notation and precede characters that have the high bit set
with @samp{M-}.
@samp{^} notation and precede characters that have the high bit set with
@samp{M-}. On MS-DOS and MS-Windows, this option causes @code{cat} to
read files and standard input in DOS binary mode, so the @key{CR}
characters at the end of each line are also visible.
@end table
@@ -394,7 +424,10 @@ precedes in the file.
@itemx --regex
@opindex -r
@opindex --regex
Treat the separator string as a regular expression.
Treat the separator string as a regular expression. Users of @code{tac}
on MS-DOS/MS-Windows should note that, since @code{tac} reads files in
binary mode, each line of a text file might end with a CR/LF pair
instead of the Unix-style LF.
@item -s @var{separator}
@itemx --separator=@var{separator}
@@ -1788,7 +1821,8 @@ The program accepts the following options. Also see @ref{Common options}.
Treat all input files as binary. This option has no effect on Unix
systems, since they don't distinguish between binary and text files.
This option is useful on systems that have different internal and
external character representations.
external character representations. On MS-DOS and MS-Windows, this is
the default.
@item -c
@itemx --check
@@ -1858,7 +1892,8 @@ These commands work with (or produce) sorted files.
* sort invocation:: Sort text files.
* uniq invocation:: Uniqify files.
* comm invocation:: Compare two sorted files line by line.
* ptx invocation::
* ptx invocation:: Produce a permuted index of file contents.
* tsort invocation:: Topological sort.
@end menu
@@ -2183,6 +2218,16 @@ and an explicit @samp{n} with the second key specifier.
sort -t : -b -k 5,5 -k 3,3n /etc/passwd
@end example
@c This example is a bit contrived and needs more explanation.
@c @item
@c Sort records separated by an arbitrary string by using a pipe to convert
@c each record delimiter string to @samp{\0}, then using sort's -z option,
@c and converting each @samp{\0} back to the original record delimiter.
@c
@c @example
@c printf 'c\n\nb\n\na\n'|perl -0pe 's/\n\n/\n\0/g'|sort -z|perl -0pe 's/\0/\n/g'
@c @end example
@end itemize
@@ -2309,6 +2354,57 @@ Upon normal completion @code{comm} produces an exit code of zero.
If there is an error it exits with nonzero status.
@node tsort invocation
@section @code{tsort}: Topological sort
@pindex tsort
@cindex topological sort
@code{tsort} performs a topological sort on the given @var{file}, or
standard input if no input file is given or for a @var{file} of
@samp{-}. Synopsis:
@example
tsort [@var{option}] [@var{file}]
@end example
@code{tsort} reads its input as pairs of strings, separated by blanks,
indicating a partial ordering. The output is a total ordering that
corresponds to the given partial ordering.
For example
@example
tsort <<EOF
a b c
d
e f
b c d e
EOF
@end example
@noindent
will produce the output
@example
a
b
c
d
e
f
@end example
@code{tsort} will detect cycles in the input and writes the first cycle
encountered to standard error.
Note that for a given partial ordering, generally there is no unique
total ordering.
The only options are @samp{--help} and @samp{--version}. @xref{Common
options}.
@node ptx invocation
@section @code{ptx}: Produce permuted indexes
@@ -2327,7 +2423,7 @@ all GNU extensions and revert to traditional mode, thus introducing some
limitations, and changes several of the program's default option values.
When @samp{-G} is not specified, GNU extensions are always enabled. GNU
extensions to @code{ptx} are documented wherever appropriate in this
document. See @xref{Compatibility in ptx} for an explicit list of them.
document. For the full list, see @xref{Compatibility in ptx}.
Individual options are explained in incoming sections.
@@ -2471,9 +2567,9 @@ only if it is given in the Only file and not given in the Ignore file.
On each input line, the leading sequence of non white characters will be
taken to be a reference that has the purpose of identifying this input
line on the produced permuted index. See @xref{Output formatting in ptx} for
more information about reference production. Using this option change
the default value for option @code{-S}.
line on the produced permuted index. For more information about reference
production, see @xref{Output formatting in ptx}.
Using this option changes the default value for option @code{-S}.
Using this option, the program does not try very hard to remove
references from contexts in output, but it succeeds in doing so
@@ -3950,9 +4046,9 @@ appropriate tool, build one.
As of this writing, all the programs we've discussed are available via
anonymous @code{ftp} from @code{prep.ai.mit.edu} as
@file{/pub/gnu/textutils-1.9.tar.gz} directory.@footnote{Version 1.9 was
current when this column was written. Check the nearest GNU archive for
the current version.}
@file{/pub/gnu/textutils-1.9.tar.gz}.@footnote{Version 1.9 was current
when this column was written. Check the nearest GNU archive for the
current version. The main GNU FTP site is now @code{ftp.gnu.org}.}
None of what I have presented in this column is new. The Software Tools
philosophy was first introduced in the book @cite{Software Tools},

View File

@@ -1,8 +1,10 @@
.deps
Makefile
getdate.c
safe-stat.h
safe-stat.c
getdate.tab.c
lstat.c
safe-lstat.c
safe-lstat.h
getdate.tab.c
.deps
safe-stat.c
safe-stat.h
stat.c

View File

@@ -18,10 +18,19 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h filemode.h fnmatch.h fsusage.h \
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c
BUILT_SOURCES = getdate.c lstat.c stat.c
EXTRA_DIST = xstat.in
lstat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/lstat/g' $(srcdir)/xstat.in > $@-t
mv $@-t $@
stat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
mv $@-t $@

View File

@@ -108,13 +108,15 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h filemode.h fnmatch.h fsusage.h \
dirname.h error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c
BUILT_SOURCES = getdate.c lstat.c stat.c
EXTRA_DIST = xstat.in
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -144,8 +146,8 @@ error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getgroups.c getline.c group-member.c lchown.c lstat.c \
malloc.c memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
obstack.c obstack.h realloc.c regex.c rename.c rmdir.c rpmatch.c stat.c \
stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c \
strtoul.c strverscmp.c utime.c ylwrap
stpcpy.c strcasecmp.c strdup.c strftime.c strncasecmp.c strndup.c \
strstr.c strtol.c strtoul.c strverscmp.c utime.c ylwrap
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -159,14 +161,15 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
.deps/ftruncate.P .deps/full-write.P .deps/getdate .deps/getdate.P \
.deps/getgroups.P .deps/getline.P .deps/getopt.P .deps/getopt1.P \
.deps/group-member.P .deps/hash.P .deps/human.P .deps/idcache.P \
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
.deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P .deps/save-cwd.P \
.deps/savedir.P .deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P \
.deps/strdup.P .deps/strftime.P .deps/stripslash.P .deps/strndup.P \
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat \
.deps/lstat.P .deps/makepath.P .deps/malloc.P .deps/memcmp.P \
.deps/memcpy.P .deps/memset.P .deps/mkdir.P .deps/mktime.P \
.deps/modechange.P .deps/mountlist.P .deps/obstack.P \
.deps/path-concat.P .deps/posixtm.P .deps/quotearg.P .deps/realloc.P \
.deps/regex.P .deps/rename.P .deps/rmdir.P .deps/rpmatch.P \
.deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stat \
.deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P .deps/strdup.P \
.deps/strftime.P .deps/stripslash.P .deps/strncasecmp.P .deps/strndup.P \
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/strverscmp.P \
.deps/userspec.P .deps/utime.P .deps/xgetcwd.P .deps/xmalloc.P \
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
@@ -350,6 +353,8 @@ strftime_.c: strftime.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strftime.c; then echo $(srcdir)/strftime.c; else echo strftime.c; fi` | $(ANSI2KNR) > strftime_.c
stripslash_.c: stripslash.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stripslash.c; then echo $(srcdir)/stripslash.c; else echo stripslash.c; fi` | $(ANSI2KNR) > stripslash_.c
strncasecmp_.c: strncasecmp.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strncasecmp.c; then echo $(srcdir)/strncasecmp.c; else echo strncasecmp.c; fi` | $(ANSI2KNR) > strncasecmp_.c
strndup_.c: strndup.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strndup.c; then echo $(srcdir)/strndup.c; else echo strndup.c; fi` | $(ANSI2KNR) > strndup_.c
strstr_.c: strstr.c $(ANSI2KNR)
@@ -385,9 +390,9 @@ makepath_.o malloc_.o memcmp_.o memcpy_.o memset_.o mkdir_.o mktime_.o \
modechange_.o mountlist_.o obstack_.o path-concat_.o posixtm_.o \
quotearg_.o realloc_.o regex_.o rename_.o rmdir_.o rpmatch_.o \
safe-read_.o save-cwd_.o savedir_.o stat_.o stpcpy_.o strcasecmp_.o \
strdup_.o strftime_.o stripslash_.o strndup_.o strstr_.o strtol_.o \
strtoul_.o strverscmp_.o userspec_.o utime_.o xgetcwd_.o xmalloc_.o \
xstrdup_.o xstrtol_.o xstrtoul_.o yesno_.o : $(ANSI2KNR)
strdup_.o strftime_.o stripslash_.o strncasecmp_.o strndup_.o strstr_.o \
strtol_.o strtoul_.o strverscmp_.o userspec_.o utime_.o xgetcwd_.o \
xmalloc_.o xstrdup_.o xstrtol_.o xstrtoul_.o yesno_.o : $(ANSI2KNR)
tags: TAGS
@@ -513,6 +518,13 @@ install-data install uninstall all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
lstat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/lstat/g' $(srcdir)/xstat.in > $@-t
mv $@-t $@
stat.c: xstat.in
sed -e '/@IGNORE@/d' -e 's/@xstat@/stat/g' $(srcdir)/xstat.in > $@-t
mv $@-t $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -1,5 +1,5 @@
/* addext.c -- add an extension to a file name
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,10 +23,10 @@
#endif
#ifndef HAVE_DOS_FILE_NAMES
#define HAVE_DOS_FILE_NAMES 0
# define HAVE_DOS_FILE_NAMES 0
#endif
#ifndef HAVE_LONG_FILE_NAMES
#define HAVE_LONG_FILE_NAMES 0
# define HAVE_LONG_FILE_NAMES 0
#endif
#include <backupfile.h>
@@ -35,7 +35,7 @@
# include <limits.h>
#endif
#ifndef _POSIX_NAME_MAX
#define _POSIX_NAME_MAX 14
# define _POSIX_NAME_MAX 14
#endif
#include <sys/types.h>
@@ -53,10 +53,7 @@
in which case just append the character E. */
void
addext (filename, ext, e)
char *filename;
char const *ext;
int e;
addext (char *filename, char const *ext, int e)
{
char *s = base_name (filename);
size_t slen = strlen (s), extlen = strlen (ext);

View File

@@ -161,8 +161,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
alloca (unsigned size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);

View File

@@ -1,5 +1,5 @@
/* argmatch.c -- find a match for a string in an array
Copyright (C) 1990, 1997 Free Software Foundation, Inc.
Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,36 +12,60 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
/* Written by David MacKenzie <djm@ai.mit.edu>
Modified by Akim Demaille <demaille@inf.enst.fr> */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <argmatch.h>
#include <sys/types.h>
#include "argmatch.h"
#include <stdio.h>
#if HAVE_STRING_H
#ifdef STDC_HEADERS
# include <string.h>
#else
# include <strings.h>
#endif
/* If ARG is an unambiguous match for an element of the
null-terminated array OPTLIST, return the index in OPTLIST
of the matched element, else -1 if it does not match any element
or -2 if it is ambiguous (is a prefix of more than one element). */
#if HAVE_LOCALE_H
# include <locale.h>
#endif
int
argmatch (const char *arg, const char *const *optlist)
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# define _(Text) Text
#endif
#include "quotearg.h"
/* When reporting a failing argument, make sure to show invisible
characters hidden using the quoting style
ARGMATCH_QUOTING_STYLE. literal_quoting_style is not good. */
#ifndef ARGMATCH_QUOTING_STYLE
# define ARGMATCH_QUOTING_STYLE c_quoting_style
#endif
extern char *program_name;
/* If ARG is an unambiguous match for an element of the
null-terminated array ARGLIST, return the index in ARGLIST
of the matched element, else -1 if it does not match any element
or -2 if it is ambiguous (is a prefix of more than one element).
If SENSITIVE, comparison is case sensitive.
If VALLIST is none null, use it to resolve ambiguities limited to
synonyms, i.e., for
"yes", "yop" -> 0
"no", "nope" -> 1
"y" is a valid argument, for `0', and "n" for `1'. */
static int
__argmatch_internal (const char *arg, const char *const *arglist,
const char *vallist, size_t valsize,
int case_sensitive)
{
int i; /* Temporary index in OPTLIST. */
int i; /* Temporary index in ARGLIST. */
size_t arglen; /* Length of ARG. */
int matchind = -1; /* Index of first nonexact match. */
int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */
@@ -49,19 +73,30 @@ argmatch (const char *arg, const char *const *optlist)
arglen = strlen (arg);
/* Test all elements for either exact match or abbreviated matches. */
for (i = 0; optlist[i]; i++)
for (i = 0; arglist[i]; i++)
{
if (!strncmp (optlist[i], arg, arglen))
if (case_sensitive
? !strncmp (arglist[i], arg, arglen)
: !strncasecmp (arglist[i], arg, arglen))
{
if (strlen (optlist[i]) == arglen)
if (strlen (arglist[i]) == arglen)
/* Exact match found. */
return i;
else if (matchind == -1)
/* First nonexact match found. */
matchind = i;
else
/* Second nonexact match found. */
ambiguous = 1;
{
/* Second nonexact match found. */
if (vallist == NULL
|| memcmp (vallist + valsize * matchind,
vallist + valsize * i, valsize))
{
/* There is a real ambiguity, or we could not
disambiguate. */
ambiguous = 1;
}
}
}
}
if (ambiguous)
@@ -70,16 +105,166 @@ argmatch (const char *arg, const char *const *optlist)
return matchind;
}
/* argmatch - case sensitive version */
int
argmatch (const char *arg, const char *const *arglist,
const char *vallist, size_t valsize)
{
return __argmatch_internal (arg, arglist, vallist, valsize, 1);
}
/* argcasematch - case insensitive version */
int
argcasematch (const char *arg, const char *const *arglist,
const char *vallist, size_t valsize)
{
return __argmatch_internal (arg, arglist, vallist, valsize, 0);
}
/* Error reporting for argmatch.
KIND is a description of the type of entity that was being matched.
VALUE is the invalid value that was given.
PROBLEM is the return value from argmatch. */
void
invalid_arg (const char *kind, const char *value, int problem)
argmatch_invalid (const char *kind, const char *value, int problem)
{
const char *fmt = (problem == -1
? "%s: invalid %s `%s'\n"
: "%s: ambiguous %s `%s'\n");
fprintf (stderr, fmt, program_name, kind, value);
enum quoting_style saved_quoting_style;
char const *format;
char *quoted_arg;
/* Make sure to have a good quoting style to report errors.
literal is insane here. */
saved_quoting_style = get_quoting_style (NULL);
set_quoting_style (NULL, ARGMATCH_QUOTING_STYLE);
/* There is an error */
quoted_arg = quotearg (value);
/* Skip over the first quote character, and overwrite the last one. */
++quoted_arg;
quoted_arg[strlen (quoted_arg) - 1] = '\0';
format = (problem == -1
? _("%s: invalid argument `%s' for `%s'\n")
: _("%s: ambiguous argument `%s' for `%s'\n"));
fprintf (stderr, format, program_name, quoted_arg, kind);
set_quoting_style (NULL, saved_quoting_style);
}
/* List the valid arguments for argmatch.
ARGLIST is the same as in argmatch.
VALLIST is a pointer to an array of values.
VALSIZE is the size of the elements of VALLIST */
void
argmatch_valid (const char *const *arglist,
const char *vallist, size_t valsize)
{
int i;
const char *last_val = NULL;
/* We try to put synonyms on the same line. The assumption is that
synonyms follow each other */
fprintf (stderr, _("Valid arguments are:"));
for (i = 0; arglist[i]; i++)
if ((i == 0)
|| memcmp (last_val, vallist + valsize * i, valsize))
{
fprintf (stderr, "\n - `%s'", arglist[i]);
last_val = vallist + valsize * i;
}
else
{
fprintf (stderr, ", `%s'", arglist[i]);
}
putc ('\n', stderr);
}
/* Look for VALUE in VALLIST, an array of objects of size VALSIZE and
return the first corresponding argument in ARGLIST */
const char *
argmatch_to_argument (const char *value,
const char *const *arglist,
const char *vallist, size_t valsize)
{
int i;
for (i = 0; arglist[i]; i++)
if (!memcmp (value, vallist + valsize * i, valsize))
return arglist[i];
return NULL;
}
#ifdef TEST
/*
* Based on "getversion.c" by David MacKenzie <djm@gnu.ai.mit.edu>
*/
char *rogram_name;
extern const char *getenv ();
/* When to make backup files. */
enum backup_type
{
/* Never make backups. */
none,
/* Make simple backups of every file. */
simple,
/* Make numbered backups of files that already have numbered backups,
and simple backups of the others. */
numbered_existing,
/* Make numbered backups of every file. */
numbered
};
/* Two tables describing arguments (keys) and their corresponding
values */
static const char *const backup_args[] =
{
"no", "none", "off",
"simple", "never",
"existing", "nil",
"numbered", "t",
0
};
static const enum backup_type backup_vals[] =
{
none, none, none,
simple, simple,
numbered_existing, numbered_existing,
numbered, numbered
};
int
main (int argc, const char *const *argv)
{
const char *cp;
enum backup_type backup_type = none;
program_name = (char *) argv[0];
if (argc > 2)
{
fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", program_name);
exit (1);
}
if ((cp = getenv ("VERSION_CONTROL")))
backup_type = XARGCASEMATCH ("$VERSION_CONTROL", cp,
backup_args, backup_vals);
if (argc == 2)
backup_type = XARGCASEMATCH (program_name, argv[1],
backup_args, backup_vals);
printf ("The version control is `%s'\n",
ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals));
return 0;
}
#endif

View File

@@ -1,12 +1,111 @@
/* argmatch.h -- declarations for matching arguments against option lists */
/* argmatch.h -- definitions and prototypes for argmatch.c
Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
#if defined __STDC__ || __GNUC__
# define __ARGMATCH_P(args) args
#else
# define __ARGMATCH_P(args) ()
#endif
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.
int argmatch __ARGMATCH_P ((const char *, const char * const *));
void invalid_arg __ARGMATCH_P ((const char *, const char *, int));
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.
extern char *program_name;
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie <djm@ai.mit.edu>
Modified by Akim Demaille <demaille@inf.enst.fr> */
#ifndef ARGMATCH_H_
# define ARGMATCH_H_ 1
# if HAVE_CONFIG_H
# include <config.h>
# endif
# include <sys/types.h>
# ifndef PARAMS
# if PROTOTYPES || (defined (__STDC__) && __STDC__)
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif /* GCC. */
# endif /* Not PARAMS. */
/* Return the index of the element of ARGLIST (NULL terminated) that
matches with ARG. If VALLIST is not NULL, then use it to resolve
false ambiguities (i.e., different matches of ARG but corresponding
to the same values in VALLIST). */
int argmatch
PARAMS ((const char *arg, const char *const *arglist,
const char *vallist, size_t valsize));
int argcasematch
PARAMS ((const char *arg, const char *const *arglist,
const char *vallist, size_t valsize));
# define ARGMATCH(Arg, Arglist, Vallist) \
argmatch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
# define ARGCASEMATCH(Arg, Arglist, Vallist) \
argcasematch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
/* Report on stderr why argmatch failed. Report correct values. */
void argmatch_invalid
PARAMS ((const char *kind, const char *value, int problem));
/* Left for compatibility with the old name invalid_arg */
# define invalid_arg(Kind, Value, Problem) \
argmatch_invalid ((Kind), (Value), (Problem))
/* Report on stderr the list of possible arguments. */
void argmatch_valid
PARAMS ((const char *const *arglist,
const char *vallist, size_t valsize));
# define ARGMATCH_VALID(Arglist, Vallist) \
argmatch_valid (Arglist, (const char *) Vallist, sizeof (*Vallist))
/* Set *Result_ptr to the value in Vallist corresponding to the Arg
in Arglist. If Arg doesn't match any string in Arglist, give a
diagnostic and (presumably) exit via the Die_stmt, leaving *Result_ptr
unmodified. */
# define XARGMATCH(Result_ptr, Kind, Arg, Arglist, Vallist, Die_stmt) \
do \
{ \
int _i = ARGMATCH (Arg, Arglist, Vallist); \
if (_i >= 0) \
*(Result_ptr) = (Vallist) [_i]; \
else \
{ \
argmatch_invalid ((Kind), (Arg), _i); \
ARGMATCH_VALID (Arglist, Vallist); \
Die_stmt; \
} \
} \
while (0)
/* Convert a value into a corresponding argument. */
const char *argmatch_to_argument
PARAMS ((char const *value, const char *const *arglist,
const char *vallist, size_t valsize));
# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
argmatch_to_argument ((char const *) &(Value), (Arglist), \
(const char *) (Vallist), sizeof (*(Vallist)))
#endif /* ARGMATCH_H_ */

View File

@@ -1,5 +1,5 @@
/* backupfile.c -- make Emacs style backup file names
Copyright (C) 1990-1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -228,15 +228,11 @@ static const enum backup_type backup_types[] =
enum backup_type
get_version (const char *version)
{
int i;
enum backup_type type;
if (version == 0 || *version == 0)
return numbered_existing;
i = argmatch (version, backup_args);
if (i < 0)
{
invalid_arg ("version control type", version, i);
exit (2);
}
return backup_types[i];
type = numbered_existing;
else
XARGMATCH (&type, "version control type", version,
backup_args, backup_types, exit (2));
return type;
}

View File

@@ -34,10 +34,7 @@
/* FIXME: describe. */
int
rpl_chown (file, uid, gid)
const char *file;
uid_t uid;
gid_t gid;
rpl_chown (const char *file, uid_t uid, gid_t gid)
{
if (gid == (gid_t) -1 || uid == (uid_t) -1)
{

View File

@@ -33,14 +33,15 @@ char *malloc ();
# endif
#endif
#include "dirname.h"
/* Return the leading directories part of PATH,
allocated with malloc. If out of memory, return 0.
Assumes that trailing slashes have already been
removed. */
char *
dirname (path)
char *path;
dir_name (const char *path)
{
char *newpath;
char *slash;

31
lib/dirname.h Normal file
View File

@@ -0,0 +1,31 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef DIRNAME_H_
# define DIRNAME_H_ 1
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
char *
dir_name PARAMS ((const char *path));
#endif /* not DIRNAME_H_ */

View File

@@ -152,7 +152,10 @@ error (status, errnum, message, va_alist)
{
#if defined HAVE_STRERROR_R || defined _LIBC
char errbuf[1024];
fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
/* Don't use __strerror_r's return value because on some systems
(at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
__strerror_r (errnum, errbuf, sizeof errbuf);
fprintf (stderr, ": %s", errbuf);
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif

View File

@@ -1,5 +1,5 @@
/* euidaccess -- check if effective user id can access file
Copyright (C) 1990, 1991, 1995 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1995, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -127,9 +127,7 @@ int group_member ();
filesystem, text busy, etc. */
int
euidaccess (path, mode)
const char *path;
int mode;
euidaccess (const char *path, int mode)
{
struct stat stats;
int granted;

View File

@@ -50,8 +50,7 @@ typedef long daddr_t; /* for disk address */
/* Return the number of 512-byte blocks in a file of SIZE bytes. */
off_t
st_blocks (size)
off_t size;
st_blocks (off_t size)
{
off_t datablks = size / 512 + (size % 512 != 0);
off_t indrblks = 0;

View File

@@ -55,10 +55,7 @@ extern int errno;
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
int
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
fnmatch (const char *pattern, const char *string, int flags)
{
register const char *p = pattern, *n = string;
register char c;

View File

@@ -101,10 +101,7 @@ int safe_read ();
ERRNO is either a system error value, or zero if DISK is NULL
on a system that requires a non-NULL value. */
int
get_fs_usage (path, disk, fsp)
const char *path;
const char *disk;
struct fs_usage *fsp;
get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp)
{
#ifdef STAT_STATFS3_OSF1
@@ -262,9 +259,7 @@ get_fs_usage (path, disk, fsp)
/* AIX PS/2 does not supply statfs. */
int
statfs (path, fsb)
char *path;
struct statfs *fsb;
statfs (char *path, struct statfs *fsb)
{
struct stat stats;
struct dustat fsd;

View File

@@ -11,9 +11,7 @@
#ifdef F_CHSIZE
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
return fcntl (fd, F_CHSIZE, length);
}
@@ -30,9 +28,7 @@ ftruncate (fd, length)
# endif
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
struct flock fl;
struct stat filebuf;
@@ -75,9 +71,7 @@ ftruncate (fd, length)
# if HAVE_CHSIZE
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
return chsize (fd, length);
}
@@ -90,9 +84,7 @@ extern int errno;
# endif
int
ftruncate (fd, length)
int fd;
off_t length;
ftruncate (int fd, off_t length)
{
errno = EIO;
return -1;

View File

@@ -53,6 +53,14 @@
# include <string.h>
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
/* Some old versions of bison generate parsers that use bcopy.
That loses on systems that don't provide the function, so we have
to redefine it here. */
@@ -471,7 +479,7 @@ static TABLE const MonthDayTable[] = {
{ "thurs", tDAY, 4 },
{ "friday", tDAY, 5 },
{ "saturday", tDAY, 6 },
{ NULL }
{ NULL, 0, 0 }
};
/* Time units table. */
@@ -486,7 +494,7 @@ static TABLE const UnitsTable[] = {
{ "min", tMINUTE_UNIT, 1 },
{ "second", tSEC_UNIT, 1 },
{ "sec", tSEC_UNIT, 1 },
{ NULL }
{ NULL, 0, 0 }
};
/* Assorted relative-time words. */
@@ -511,7 +519,7 @@ static TABLE const OtherTable[] = {
{ "eleventh", tUNUMBER, 11 },
{ "twelfth", tUNUMBER, 12 },
{ "ago", tAGO, 1 },
{ NULL }
{ NULL, 0, 0 }
};
/* The timezone table. */
@@ -596,7 +604,7 @@ static TABLE const TimezoneTable[] = {
{ "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
{ "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
{ "idle", tZONE, -HOUR (12) }, /* International Date Line East */
{ NULL }
{ NULL, 0, 0 }
};
/* Military timezone table. */
@@ -626,7 +634,7 @@ static TABLE const MilitaryTable[] = {
{ "x", tZONE, HOUR (-11) },
{ "y", tZONE, HOUR (-12) },
{ "z", tZONE, HOUR ( 0) },
{ NULL }
{ NULL, 0, 0 }
};
@@ -635,7 +643,7 @@ static TABLE const MilitaryTable[] = {
/* ARGSUSED */
static int
yyerror (s)
char *s;
char *s ATTRIBUTE_UNUSED;
{
return 0;
}

View File

@@ -1,6 +1,6 @@
/* getline.c -- Replacement for GNU C library function getline
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -34,10 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if defined __GNU_LIBRARY__ && HAVE_GETDELIM
int
getline (lineptr, n, stream)
char **lineptr;
size_t *n;
FILE *stream;
getline (char **lineptr, size_t *n, FILE *stream)
{
return getdelim (lineptr, n, '\n', stream);
}
@@ -64,12 +61,7 @@ char *malloc (), *realloc ();
null terminator), or -1 on error or EOF. */
int
getstr (lineptr, n, stream, terminator, offset)
char **lineptr;
size_t *n;
FILE *stream;
char terminator;
size_t offset;
getstr (char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset)
{
int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
char *read_pos; /* Where we're reading into *LINEPTR. */
@@ -138,20 +130,13 @@ getstr (lineptr, n, stream, terminator, offset)
}
int
getline (lineptr, n, stream)
char **lineptr;
size_t *n;
FILE *stream;
getline (char **lineptr, size_t *n, FILE *stream)
{
return getstr (lineptr, n, stream, '\n', 0);
}
int
getdelim (lineptr, n, delimiter, stream)
char **lineptr;
size_t *n;
int delimiter;
FILE *stream;
getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream)
{
return getstr (lineptr, n, stream, delimiter, 0);
}

View File

@@ -1,5 +1,5 @@
/* getversion.c -- select backup filename type
Copyright (C) 1990 Free Software Foundation, Inc.
Copyright (C) 1990, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,8 +46,7 @@ static const enum backup_type backup_types[] =
Unique abbreviations are accepted. */
enum backup_type
get_version (version)
char *version;
get_version (const char *version)
{
int i;

View File

@@ -1,5 +1,5 @@
/* human.c -- print human readable file size
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -258,7 +258,7 @@ humblock (char const *spec, int *block_size)
if (! spec && ! (spec = getenv ("BLOCK_SIZE")))
*block_size = getenv ("POSIXLY_CORRECT") ? 512 : DEFAULT_BLOCK_SIZE;
else if (0 <= (i = argmatch (spec, block_size_args)))
else if (0 <= (i = ARGMATCH (spec, block_size_args, block_size_types)))
*block_size = block_size_types[i];
else
{

View File

@@ -1,5 +1,6 @@
/* idcache.c -- map user and group IDs, cached for speed
Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -34,8 +34,7 @@
return nonzero, else 0. */
int
isdir (path)
char *path;
isdir (const char *path)
{
struct stat stats;

View File

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

View File

@@ -1,5 +1,5 @@
/* makepath.c -- Ensure that a directory path exists.
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -81,6 +81,17 @@ extern int errno;
#define WX_USR (S_IWUSR | S_IXUSR)
#if HAVE_LOCALE_H
# include <locale.h>
#endif
#if ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# define _(Text) Text
#endif
#ifdef __MSDOS__
typedef int uid_t;
typedef int gid_t;
@@ -99,9 +110,9 @@ void strip_trailing_slashes ();
Restore working directory. */ \
if (do_chdir) \
{ \
int fail = restore_cwd (&cwd, NULL, NULL); \
int _fail = restore_cwd (&cwd, NULL, NULL); \
free_cwd (&cwd); \
if (fail) \
if (_fail) \
return 1; \
} \
} \
@@ -115,6 +126,56 @@ void strip_trailing_slashes ();
} \
while (0)
/* Attempt to create directory DIR (aka DIRPATH) with the specified MODE.
If CREATED_DIR_P is non-NULL, set *CREATED_DIR_P to non-zero if this
function creates DIR and to zero otherwise. Give a diagnostic and
return non-zero if DIR cannot be created or cannot be determined to
exist already. Use DIRPATH in any diagnostic, not DIR.
Note that if DIR already exists, this function will return zero
(indicating success) and will set *CREATED_DIR_P to zero. */
static int
make_dir (const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
{
int fail = 0;
int created_dir;
created_dir = (mkdir (dir, mode) == 0);
if (!created_dir)
{
struct stat stats;
/* The mkdir and stat calls below may appear to be reversed.
They are not. It is important to call mkdir first and then to
call stat (to distinguish the three cases) only if mkdir fails.
The alternative to this approach is to `stat' each directory,
then to call mkdir if it doesn't exist. But if some other process
were to create the directory between the stat & mkdir, the mkdir
would fail with EEXIST. */
if (stat (dir, &stats))
{
error (0, errno, _("cannot create directory `%s'"), dirpath);
fail = 1;
}
else if (!S_ISDIR (stats.st_mode))
{
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
fail = 1;
}
else
{
/* DIR (aka DIRPATH) already exists and is a directory. */
}
}
if (created_dir_p)
*created_dir_p = created_dir;
return fail;
}
/* Ensure that the directory ARGPATH exists.
Remove any trailing slashes from ARGPATH before calling this function.
@@ -203,7 +264,8 @@ make_path (const char *argpath,
while (1)
{
int newly_created_dir = 1;
int newly_created_dir;
int fail;
/* slash points to the leftmost unprocessed component of dirpath. */
basename_dir = slash;
@@ -217,34 +279,12 @@ make_path (const char *argpath,
if (!do_chdir)
basename_dir = dirpath;
/* The mkdir and stat calls below appear to be reversed.
They are not. It is important to call mkdir first and then to
call stat (to distinguish the three cases) only if mkdir fails.
The alternative to this approach is to `stat' each directory,
then to call mkdir if it doesn't exist. But if some other process
were to create the directory between the stat & mkdir, the mkdir
would fail with EEXIST. */
*slash = '\0';
if (mkdir (basename_dir, tmp_mode))
fail = make_dir (basename_dir, dirpath, tmp_mode, &newly_created_dir);
if (fail)
{
if (stat (basename_dir, &stats))
{
error (0, errno, "cannot create directory `%s'", dirpath);
CLEANUP;
return 1;
}
else if (!S_ISDIR (stats.st_mode))
{
error (0, 0, "`%s' exists but is not a directory", dirpath);
CLEANUP;
return 1;
}
else
{
/* DIRPATH already exists and is a directory. */
newly_created_dir = 0;
}
CLEANUP;
return 1;
}
if (newly_created_dir)
@@ -280,7 +320,7 @@ make_path (const char *argpath,
stat and mkdir process O(n^2) file name components. */
if (do_chdir && chdir (basename_dir) < 0)
{
error (0, errno, "cannot chdir to directory, %s", dirpath);
error (0, errno, _("cannot chdir to directory, %s"), dirpath);
CLEANUP;
return 1;
}
@@ -299,12 +339,8 @@ make_path (const char *argpath,
/* We're done making leading directories.
Create the final component of the path. */
/* The path could end in "/." or contain "/..", so test
if we really have to create the directory. */
if (stat (basename_dir, &stats) && mkdir (basename_dir, mode))
if (make_dir (basename_dir, dirpath, mode, NULL))
{
error (0, errno, "cannot create directory `%s'", dirpath);
CLEANUP;
return 1;
}
@@ -323,13 +359,13 @@ make_path (const char *argpath,
#endif
)
{
error (0, errno, "cannot chown %s", dirpath);
error (0, errno, _("cannot chown %s"), dirpath);
retval = 1;
}
/* chown may have turned off some permission bits we wanted. */
if ((mode & 07000) != 0 && chmod (basename_dir, mode))
{
error (0, errno, "cannot chmod %s", dirpath);
error (0, errno, _("cannot chmod %s"), dirpath);
retval = 1;
}
}
@@ -357,7 +393,7 @@ make_path (const char *argpath,
if (!S_ISDIR (stats.st_mode))
{
error (0, 0, "`%s' exists but is not a directory", dirpath);
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
return 1;
}

View File

@@ -1,5 +1,5 @@
/* Work around bug on some systems where malloc (0) fails.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,8 +30,7 @@ char *malloc ();
If N is zero, allocate a 1-byte block. */
char *
rpl_malloc (n)
size_t n;
rpl_malloc (size_t n)
{
if (n == 0)
n = 1;

View File

@@ -104,8 +104,7 @@ static int memcmp_bytes __P((op_t, op_t));
__inline
# endif
static int
memcmp_bytes (a, b)
op_t a, b;
memcmp_bytes (long unsigned int a, long unsigned int b)
{
long int srcp1 = (long int) &a;
long int srcp2 = (long int) &b;
@@ -132,10 +131,7 @@ static int memcmp_common_alignment __P((long, long, size_t));
__inline
#endif
static int
memcmp_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
memcmp_common_alignment (long int srcp1, long int srcp2, size_t len)
{
op_t a0, a1;
op_t b0, b1;
@@ -222,10 +218,7 @@ static int memcmp_not_common_alignment __P((long, long, size_t));
__inline
#endif
static int
memcmp_not_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len)
{
op_t a0, a1, a2, a3;
op_t b0, b1, b2, b3;
@@ -325,10 +318,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len)
}
int
rpl_memcmp (s1, s2, len)
const __ptr_t s1;
const __ptr_t s2;
size_t len;
rpl_memcmp (const void *s1, const void *s2, size_t len)
{
op_t a0;
op_t b0;

View File

@@ -16,10 +16,7 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
char *
memset (str, c, len)
char *str;
int c;
unsigned len;
memset (char *str, int c, unsigned int len)
{
register char *st = str;

View File

@@ -1,5 +1,5 @@
/* BSD compatible make directory function for System V
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
Copyright (C) 1988, 1990, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -48,9 +48,7 @@ extern int errno;
subroutine didn't return EEXIST. It does now. */
int
mkdir (dpath, dmode)
char *dpath;
int dmode;
mkdir (const char *dpath, int dmode)
{
int cpid, status;
struct stat statbuf;

View File

@@ -1,4 +1,4 @@
/* mktime: convert a `struct tm' to a time_t value zzzzzz
/* mktime: convert a `struct tm' to a time_t value
Copyright (C) 1993-1997, 1998 Free Software Foundation, Inc.
Contributed by Paul Eggert (eggert@twinsun.com).
@@ -28,14 +28,8 @@
# include <config.h>
#endif
/* Some systems need this in order to declare localtime_r properly. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_LOCALTIME_R 1
# define STDC_HEADERS 1
#endif
@@ -125,16 +119,14 @@ time_t __mktime_internal __P ((struct tm *,
#ifdef _LIBC
# define localtime_r __localtime_r
# define my_mktime_localtime_r __localtime_r
#else
# if ! HAVE_LOCALTIME_R && ! defined localtime_r
/* Approximate localtime_r as best we can in its absence. */
# define localtime_r my_mktime_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
/* If we're a mktime substitute in a GNU program, then prefer
localtime to localtime_r, since many localtime_r implementations
are buggy. */
static struct tm *my_mktime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
const time_t *t;
struct tm *tp;
my_mktime_localtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = localtime (t);
if (! l)
@@ -142,7 +134,6 @@ localtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
#endif /* ! _LIBC */
@@ -153,9 +144,8 @@ localtime_r (t, tp)
If TP is null, return a nonzero value.
If overflow occurs, yield the low order bits of the correct answer. */
static time_t
ydhms_tm_diff (year, yday, hour, min, sec, tp)
int year, yday, hour, min, sec;
const struct tm *tp;
ydhms_tm_diff (int year, int yday, int hour, int min, int sec,
const struct tm *tp)
{
if (!tp)
return 1;
@@ -187,8 +177,7 @@ static time_t localtime_offset;
/* Convert *TP to a time_t value. */
time_t
mktime (tp)
struct tm *tp;
mktime (struct tm *tp)
{
#ifdef _LIBC
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
@@ -197,17 +186,15 @@ mktime (tp)
__tzset ();
#endif
return __mktime_internal (tp, localtime_r, &localtime_offset);
return __mktime_internal (tp, my_mktime_localtime_r, &localtime_offset);
}
/* Use CONVERT to convert *T to a broken down time in *TP.
If *T is out of range for conversion, adjust it so that
it is the nearest in-range value and then convert that. */
static struct tm *
ranged_convert (convert, t, tp)
struct tm *(*convert) __P ((const time_t *, struct tm *));
time_t *t;
struct tm *tp;
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
time_t *t, struct tm *tp)
{
struct tm *r;
@@ -254,19 +241,18 @@ ranged_convert (convert, t, tp)
compared to what the result would be for UTC without leap seconds.
If *OFFSET's guess is correct, only one CONVERT call is needed. */
time_t
__mktime_internal (tp, convert, offset)
struct tm *tp;
struct tm *(*convert) __P ((const time_t *, struct tm *));
time_t *offset;
__mktime_internal (struct tm *tp,
struct tm *(*convert) (const time_t *, struct tm *),
time_t *offset)
{
time_t t, dt, t0;
time_t t, dt, t0, t1, t2;
struct tm tm;
/* The maximum number of probes (calls to CONVERT) should be enough
to handle any combinations of time zone rule changes, solar time,
and leap seconds. POSIX.1 prohibits leap seconds, but some hosts
have them anyway. */
int remaining_probes = 4;
leap seconds, and oscillations around a spring-forward gap.
POSIX.1 prohibits leap seconds, but some hosts have them anyway. */
int remaining_probes = 6;
/* Time requested. Copy it in case CONVERT modifies *TP; this can
occur if TP is localtime's returned value and CONVERT is localtime. */
@@ -312,15 +298,27 @@ __mktime_internal (tp, convert, offset)
tm.tm_yday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
t0 = ydhms_tm_diff (year, yday, hour, min, sec, &tm);
for (t = t0 + *offset;
for (t = t1 = t2 = t0 + *offset;
(dt = ydhms_tm_diff (year, yday, hour, min, sec,
ranged_convert (convert, &t, &tm)));
t += dt)
if (--remaining_probes == 0)
t1 = t2, t2 = t, t += dt)
if (t == t1 && t != t2
&& (isdst < 0 || tm.tm_isdst < 0
|| (isdst != 0) != (tm.tm_isdst != 0)))
/* We can't possibly find a match, as we are oscillating
between two values. The requested time probably falls
within a spring-forward gap of size DT. Follow the common
practice in this case, which is to return a time that is DT
away from the requested time, preferring a time whose
tm_isdst differs from the requested value. In practice,
this is more useful than returning -1. */
break;
else if (--remaining_probes == 0)
return -1;
/* Check whether tm.tm_isdst has the requested value, if any. */
if (0 <= isdst && 0 <= tm.tm_isdst)
/* If we have a match, check whether tm.tm_isdst has the requested
value, if any. */
if (dt == 0 && 0 <= isdst && 0 <= tm.tm_isdst)
{
int dst_diff = (isdst != 0) - (tm.tm_isdst != 0);
if (dst_diff)
@@ -531,6 +529,6 @@ main (argc, argv)
/*
Local Variables:
compile-command: "gcc -DDEBUG -D__EXTENSIONS__ -DHAVE_LIMITS_H -DHAVE_LOCALTIME_R -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
End:
*/

View File

@@ -42,10 +42,7 @@ char *malloc ();
BASE in the returned concatenation. */
char *
path_concat (dir, base, base_in_result)
const char *dir;
const char *base;
char **base_in_result;
path_concat (const char *dir, const char *base, char **base_in_result)
{
char *p;
char *p_concat;

View File

@@ -117,7 +117,7 @@ posix_time_parse (const char *s, unsigned int syntax_bits)
const char *dot = NULL;
int pair[6];
int *p;
int i;
unsigned int i;
size_t s_len = strlen (s);
size_t len = (((syntax_bits & PDS_SECONDS) && (dot = strchr (s, '.')))

View File

@@ -23,16 +23,15 @@
# include <config.h>
#endif
/* Disable the definition of putenv to rpl_putenv (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_putenv on
systems like Irix 5.3. */
#undef putenv
#include <sys/types.h>
#if defined (__GNU_LIBRARY__) || defined (HAVE_STDLIB_H)
# include <stdlib.h>
#endif
/* Don't include stdlib.h because some (e.g., Solaris 2.7) declare putenv
with a non-const argument. That would conflict with the declaration of
rpl_putenv below (due to the #define putenv rpl_putenv from config.h). */
char *malloc ();
void free ();
#if defined (__GNU_LIBRARY__) || defined (HAVE_STRING_H)
# include <string.h>
#endif
@@ -60,8 +59,7 @@ extern char **environ;
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int
rpl_putenv (string)
const char *string;
rpl_putenv (const char *string)
{
const char *const name_end = strchr (string, '=');
register size_t size;

View File

@@ -1,5 +1,5 @@
/* quotearg.c - quote arguments for output
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -71,7 +71,22 @@ struct quoting_options
/* Names of quoting styles. */
char const *const quoting_style_args[] =
{
"literal", "shell", "shell-always", "c", "escape", 0
"literal",
"shell",
"shell-always",
"c",
"escape",
0
};
/* Correspondances to quoting style names. */
enum quoting_style const quoting_style_vals[] =
{
literal_quoting_style,
shell_quoting_style,
shell_always_quoting_style,
c_quoting_style,
escape_quoting_style
};
/* The default quoting options. */
@@ -151,7 +166,7 @@ quotearg_buffer (char *buffer, size_t buffersize,
switch (quoting_style)
{
case shell_quoting_style:
if (! (argsize == -1 ? arg[0] == '\0' : argsize == 0))
if (! (argsize == (size_t) -1 ? arg[0] == '\0' : argsize == 0))
{
switch (arg[0])
{
@@ -162,7 +177,7 @@ quotearg_buffer (char *buffer, size_t buffersize,
len = 0;
for (i = 0; ; i++)
{
if (argsize == -1 ? arg[i] == '\0' : i == argsize)
if (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize)
goto done;
c = arg[i];
@@ -209,7 +224,7 @@ quotearg_buffer (char *buffer, size_t buffersize,
if (quote_mark)
STORE (quote_mark);
for (i = 0; ! (argsize == -1 ? arg[i] == '\0' : i == argsize); i++)
for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++)
{
c = arg[i];
@@ -258,8 +273,8 @@ quotearg_buffer (char *buffer, size_t buffersize,
{
STORE ('\\');
STORE ('0' + (c >> 6));
STORE ('0' + ((c >> 3) & 3));
c = '0' + (c & 3);
STORE ('0' + ((c >> 3) & 7));
c = '0' + (c & 7);
goto store_c;
}
break;
@@ -291,9 +306,10 @@ quotearg_buffer (char *buffer, size_t buffersize,
reused by the next call to this function with the same value of N.
N must be nonnegative. */
static char *
quotearg_n_options (int n, char const *arg, struct quoting_options *options)
quotearg_n_options (unsigned int n, char const *arg,
struct quoting_options const *options)
{
static unsigned nslots;
static unsigned int nslots;
static struct slotvec
{
size_t size;
@@ -328,7 +344,7 @@ quotearg_n_options (int n, char const *arg, struct quoting_options *options)
}
char *
quotearg_n (int n, char const *arg)
quotearg_n (unsigned int n, char const *arg)
{
return quotearg_n_options (n, arg, &default_quoting_options);
}

View File

@@ -1,5 +1,5 @@
/* quotearg.h - quote arguments for output
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,8 +33,9 @@ enum quoting_style
# define DEFAULT_QUOTING_STYLE literal_quoting_style
#endif
/* Names of quoting styles. */
/* Names of quoting styles and their corresponding values. */
extern char const *const quoting_style_args[];
extern enum quoting_style const quoting_style_vals[];
struct quoting_options;
@@ -87,9 +88,9 @@ size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize,
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
N must be nonnegative. */
char *quotearg_n PARAMS ((int n, char const *arg));
char *quotearg_n PARAMS ((unsigned int n, char const *arg));
/* Equivalent to quotearg_n (ARG, 0). */
/* Equivalent to quotearg_n (0, ARG). */
char *quotearg PARAMS ((char const *arg));
/* Like quotearg (ARG), except also quote any instances of CH. */

View File

@@ -38,9 +38,7 @@ extern int errno;
Return 0 if successful, -1 if not. */
int
rename (from, to)
char *from;
char *to;
rename (char *from, char *to)
{
struct stat from_stats, to_stats;
int pid, status;

View File

@@ -29,24 +29,15 @@
# endif
#endif
#include <sys/types.h>
#include <regex.h>
#if ENABLE_NLS
# include <sys/types.h>
# include <regex.h>
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# define _(Text) Text
#endif
static int
try (response, pattern, match, nomatch, lastp, re)
const char *response;
const char *pattern;
const int match;
const int nomatch;
const char **lastp;
regex_t *re;
try (const char *response, const char *pattern, const int match,
const int nomatch, const char **lastp, regex_t *re)
{
if (pattern != *lastp)
{
@@ -66,12 +57,13 @@ try (response, pattern, match, nomatch, lastp, re)
/* See if the regular expression matches RESPONSE. */
return regexec (re, response, 0, NULL, 0) == 0 ? match : nomatch;
}
#endif
int
rpmatch (response)
const char *response;
rpmatch (const char *response)
{
#if ENABLE_NLS
/* Match against one of the response patterns, compiling the pattern
first if necessary. */
@@ -84,4 +76,9 @@ rpmatch (response)
&yesexpr, &yesre))
? result
: try (response, _("^[nN]"), 0, -1, &noexpr, &nore));
#else
/* Test against "^[yY]" and "^[nN]", hardcoded to avoid requiring regex */
return (*response == 'y' || *response == 'Y' ? 1
: *response == 'n' || *response == 'N' ? 0 : -1);
#endif
}

View File

@@ -57,8 +57,7 @@ char *xgetcwd PARAMS ((void));
called, but doing so is ok. Otherwise, return zero. */
int
save_cwd (cwd)
struct saved_cwd *cwd;
save_cwd (struct saved_cwd *cwd)
{
static int have_working_fchdir = 1;
@@ -118,10 +117,7 @@ save_cwd (cwd)
*/
int
restore_cwd (cwd, dest, from)
const struct saved_cwd *cwd;
const char *dest;
const char *from;
restore_cwd (const struct saved_cwd *cwd, const char *dest, const char *from)
{
int fail = 0;
if (cwd->desc >= 0)
@@ -144,8 +140,7 @@ restore_cwd (cwd, dest, from)
}
void
free_cwd (cwd)
struct saved_cwd *cwd;
free_cwd (struct saved_cwd *cwd)
{
if (cwd->desc >= 0)
close (cwd->desc);

View File

@@ -76,9 +76,7 @@ char *stpcpy ();
Return NULL if DIR cannot be opened or if out of memory. */
char *
savedir (dir, name_size)
const char *dir;
unsigned int name_size;
savedir (const char *dir, unsigned int name_size)
{
DIR *dirp;
struct dirent *dp;

View File

@@ -34,9 +34,7 @@
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
char *
__stpcpy (dest, src)
char *dest;
const char *src;
__stpcpy (char *dest, const char *src)
{
register char *d = dest;
register const char *s = src;

63
lib/strcasecmp.c Normal file
View File

@@ -0,0 +1,63 @@
/* strcasecmp.c -- case insensitive string comparator
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef LENGTH_LIMIT
# define STRXCASECMP_FUNCTION strncasecmp
# define STRXCASECMP_DECLARE_N , size_t n
# define LENGTH_LIMIT_EXPR(Expr) Expr
#else
# define STRXCASECMP_FUNCTION strcasecmp
# define STRXCASECMP_DECLARE_N /* empty */
# define LENGTH_LIMIT_EXPR(Expr) 0
#endif
#include <sys/types.h>
#include <ctype.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare {{no more than N characters of }}strings S1 and S2,
ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less
than, equal to or greater than S2. */
int
STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0))
return 0;
do
{
c1 = TOLOWER (*p1++);
c2 = TOLOWER (*p2++);
if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0')
break;
}
while (c1 == c2);
return c1 - c2;
}

View File

@@ -31,8 +31,7 @@ char *strcpy ();
or 0 if out of memory. */
char *
strdup (str)
const char *str;
strdup (const char *str)
{
char *newstr;

View File

@@ -22,11 +22,6 @@
# include <config.h>
#endif
/* Some systems need this in order to declare localtime_r properly. */
#ifndef _REENTRANT
# define _REENTRANT 1
#endif
#ifdef _LIBC
# define HAVE_LIMITS_H 1
# define HAVE_MBLEN 1
@@ -136,7 +131,7 @@ extern char *tzname[];
add one for integer division truncation;
add one more for a minus sign if t is signed. */
#define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 100 + 1 + TYPE_SIGNED (t))
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 + 1 + TYPE_SIGNED (t))
#define TM_YEAR_BASE 1900
@@ -149,21 +144,20 @@ extern char *tzname[];
#ifdef _LIBC
# define gmtime_r __gmtime_r
# define localtime_r __localtime_r
# define my_strftime_gmtime_r __gmtime_r
# define my_strftime_localtime_r __localtime_r
# define tzname __tzname
# define tzset __tzset
#else
# if ! HAVE_LOCALTIME_R
# if ! HAVE_TM_GMTOFF
/* Approximate gmtime_r as best we can in its absence. */
# undef gmtime_r
# define gmtime_r my_gmtime_r
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
/* If we're a strftime substitute in a GNU program, then prefer gmtime
to gmtime_r, since many gmtime_r implementations are buggy.
Similarly for localtime_r. */
# if ! HAVE_TM_GMTOFF
static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
static struct tm *
gmtime_r (t, tp)
const time_t *t;
struct tm *tp;
my_strftime_gmtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = gmtime (t);
if (! l)
@@ -171,16 +165,11 @@ gmtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_TM_GMTOFF */
# endif /* ! HAVE_TM_GMTOFF */
/* Approximate localtime_r as best we can in its absence. */
# undef localtime_r
# define localtime_r my_ftime_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
const time_t *t;
struct tm *tp;
my_strftime_localtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = localtime (t);
if (! l)
@@ -188,7 +177,6 @@ localtime_r (t, tp)
*tp = *l;
return tp;
}
# endif /* ! HAVE_LOCALTIME_R */
#endif /* ! defined _LIBC */
@@ -282,10 +270,7 @@ static const char zeroes[16] = /* "0000000000000000" */
static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
static char *
memcpy_lowcase (dest, src, len)
char *dest;
const char *src;
size_t len;
memcpy_lowcase (char *dest, const char *src, size_t len)
{
while (len-- > 0)
dest[len] = TOLOWER ((unsigned char) src[len]);
@@ -295,10 +280,7 @@ memcpy_lowcase (dest, src, len)
static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
static char *
memcpy_uppcase (dest, src, len)
char *dest;
const char *src;
size_t len;
memcpy_uppcase (char *dest, const char *src, size_t len)
{
while (len-- > 0)
dest[len] = TOUPPER ((unsigned char) src[len]);
@@ -312,9 +294,7 @@ memcpy_uppcase (dest, src, len)
# define tm_diff ftime_tm_diff
static int tm_diff __P ((const struct tm *, const struct tm *));
static int
tm_diff (a, b)
const struct tm *a;
const struct tm *b;
tm_diff (const struct tm *a, const struct tm *b)
{
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid int overflow in leap day calculations,
@@ -349,9 +329,7 @@ static int iso_week_days __P ((int, int));
__inline__
#endif
static int
iso_week_days (yday, wday)
int yday;
int wday;
iso_week_days (int yday, int wday)
{
/* Add enough to the first operand of % to make it nonnegative. */
int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
@@ -376,34 +354,35 @@ static char const month_name[][10] =
#ifdef emacs
# define my_strftime emacs_strftime
/* Emacs 20.2 uses `-Dstrftime=emacs_strftime' when compiling,
because that's how strftime used to be configured.
Undo this, since it gets in the way of accessing the underlying strftime,
which is needed for things like %Ec in Solaris.
The following two lines can be removed once Emacs stops compiling with
`-Dstrftime=emacs_strftime'. */
# undef strftime
size_t strftime __P ((char *, size_t, const char *, const struct tm *));
# define my_strftime emacs_strftimeu
# define ut_argument , ut
# define ut_argument_spec int ut;
# define ut_argument_spec_iso , int ut
#else
# define my_strftime strftime
# define ut_argument
# define ut_argument_spec
# define ut_argument_spec_iso
/* We don't have this information in general. */
# define ut 0
#endif
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
Work around this bug by copying *tp before it might be munged. */
size_t _strftime_copytm __P ((char *, size_t, const char *,
const struct tm *));
const struct tm * ut_argument_spec_iso));
size_t
my_strftime (s, maxsize, format, tp)
my_strftime (s, maxsize, format, tp ut_argument)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
ut_argument_spec
{
struct tm tmcopy;
tmcopy = *tp;
return _strftime_copytm (s, maxsize, format, &tmcopy);
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
}
# undef my_strftime
# define my_strftime(S, Maxsize, Format, Tp) \
@@ -418,41 +397,40 @@ size_t strftime __P ((char *, size_t, const char *, const struct tm *));
anywhere, so to determine how many characters would be
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
size_t
my_strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp
ut_argument_spec)
{
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);
/* We cannot make the following values variables since we must delay
the evaluation of these values until really needed since some
expressions might not be valid in every situation. The `struct tm'
might be generated by a strptime() call that initialized
only a few elements. Dereference the pointers only if the format
requires this. Then it is ok to fail if the pointers are invalid. */
# define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)
# define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
# define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)
# define f_month _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon)
# define ampm _NL_CURRENT (LC_TIME, tp->tm_hour > 11 ? PM_STR : AM_STR)
# define aw_len strlen (a_wkday)
# define am_len strlen (a_month)
# define ap_len strlen (ampm)
#else
# if !HAVE_STRFTIME
const char *const f_wkday = weekday_name[tp->tm_wday];
const char *const f_month = month_name[tp->tm_mon];
const char *const a_wkday = f_wkday;
const char *const a_month = f_month;
const char *const ampm = "AMPM" + 2 * (hour12 > 11);
# define f_wkday (weekday_name[tp->tm_wday])
# define f_month (month_name[tp->tm_mon])
# define a_wkday f_wkday
# define a_month f_month
# define ampm ("AMPM" + 2 * (tp->tm_hour > 11))
size_t aw_len = 3;
size_t am_len = 3;
size_t ap_len = 2;
# endif
#endif
#if defined _NL_CURRENT || !HAVE_STRFTIME
size_t wkday_len = strlen (f_wkday);
size_t month_len = strlen (f_month);
#endif
const char *zone;
size_t zonelen;
size_t i = 0;
char *p = s;
const char *f;
@@ -468,25 +446,27 @@ my_strftime (s, maxsize, format, tp)
zone = (const char *) tp->tm_zone;
#endif
#if HAVE_TZNAME
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
if (ut)
{
if (! (zone && *zone))
zone = "GMT";
}
else
{
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
# if HAVE_TZSET
tzset ();
tzset ();
# endif
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
}
#endif
if (! zone)
zone = ""; /* POSIX.2 requires the empty string here. */
zonelen = strlen (zone);
if (hour12 > 12)
hour12 -= 12;
else
if (hour12 == 0) hour12 = 12;
if (hour12 == 0)
hour12 = 12;
for (f = format; *f != '\0'; ++f)
{
@@ -552,7 +532,13 @@ my_strftime (s, maxsize, format, tp)
if (bytes == 0)
break;
if (bytes == (size_t) -2 || bytes == (size_t) -1)
if (bytes == (size_t) -2)
{
len += strlen (f + len);
break;
}
if (bytes == (size_t) -1)
{
len++;
break;
@@ -563,6 +549,7 @@ my_strftime (s, maxsize, format, tp)
while (! mbsinit (&mbstate));
cpy (len, f);
f += len - 1;
continue;
}
}
@@ -672,7 +659,7 @@ my_strftime (s, maxsize, format, tp)
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (wkday_len, f_wkday);
cpy (strlen (f_wkday), f_wkday);
break;
#else
goto underlying_strftime;
@@ -698,7 +685,7 @@ my_strftime (s, maxsize, format, tp)
to_lowcase = 0;
}
#if defined _NL_CURRENT || !HAVE_STRFTIME
cpy (month_len, f_month);
cpy (strlen (f_month), f_month);
break;
#else
goto underlying_strftime;
@@ -722,9 +709,7 @@ my_strftime (s, maxsize, format, tp)
subformat:
{
char *old_start = p;
size_t len = my_strftime (NULL, maxsize - i, subfmt, tp);
if (len == 0 && *subfmt)
return 0;
size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp);
add (len, my_strftime (p, maxsize - i, subfmt, tp));
if (to_uppcase)
@@ -750,7 +735,6 @@ my_strftime (s, maxsize, format, tp)
*u++ = modifier;
*u++ = format_char;
*u = '\0';
ubuf[0] = '\1';
len = strftime (ubuf, sizeof ubuf, ufmt, tp);
if (len == 0 && ubuf[0] != '\0')
return 0;
@@ -1150,7 +1134,16 @@ my_strftime (s, maxsize, format, tp)
to_uppcase = 0;
to_lowcase = 1;
}
cpy (zonelen, zone);
#if HAVE_TZNAME
/* The tzset() call might have changed the value. */
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
#endif
if (! zone)
zone = ""; /* POSIX.2 requires the empty string here. */
cpy (strlen (zone), zone);
break;
case 'z': /* GNU extension. */
@@ -1162,34 +1155,39 @@ my_strftime (s, maxsize, format, tp)
#if HAVE_TM_GMTOFF
diff = tp->tm_gmtoff;
#else
struct tm gtm;
struct tm ltm;
time_t lt;
ltm = *tp;
lt = mktime (&ltm);
if (lt == (time_t) -1)
if (ut)
diff = 0;
else
{
/* mktime returns -1 for errors, but -1 is also a
valid time_t value. Check whether an error really
occurred. */
struct tm tm;
localtime_r (&lt, &tm);
struct tm gtm;
struct tm ltm;
time_t lt;
if ((ltm.tm_sec ^ tm.tm_sec)
| (ltm.tm_min ^ tm.tm_min)
| (ltm.tm_hour ^ tm.tm_hour)
| (ltm.tm_mday ^ tm.tm_mday)
| (ltm.tm_mon ^ tm.tm_mon)
| (ltm.tm_year ^ tm.tm_year))
ltm = *tp;
lt = mktime (&ltm);
if (lt == (time_t) -1)
{
/* mktime returns -1 for errors, but -1 is also a
valid time_t value. Check whether an error really
occurred. */
struct tm tm;
if (! my_strftime_localtime_r (&lt, &tm)
|| ((ltm.tm_sec ^ tm.tm_sec)
| (ltm.tm_min ^ tm.tm_min)
| (ltm.tm_hour ^ tm.tm_hour)
| (ltm.tm_mday ^ tm.tm_mday)
| (ltm.tm_mon ^ tm.tm_mon)
| (ltm.tm_year ^ tm.tm_year)))
break;
}
if (! my_strftime_gmtime_r (&lt, &gtm))
break;
diff = tm_diff (&ltm, &gtm);
}
if (! gmtime_r (&lt, &gtm))
break;
diff = tm_diff (&ltm, &gtm);
#endif
if (diff < 0)
@@ -1222,7 +1220,23 @@ my_strftime (s, maxsize, format, tp)
}
}
if (p)
if (p && i < maxsize)
*p = '\0';
return i;
}
#ifdef emacs
/* For Emacs we have a separate interface which corresponds to the normal
strftime function and does not have the extra information whether the
TP arguments comes from a `gmtime' call or not. */
size_t
emacs_strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
{
return my_strftime (s, maxsize, format, tp, 0);
}
#endif

View File

@@ -32,8 +32,7 @@
when given a path that ends in "/" (except for the root directory). */
void
strip_trailing_slashes (path)
char *path;
strip_trailing_slashes (char *path)
{
int last;

2
lib/strncasecmp.c Normal file
View File

@@ -0,0 +1,2 @@
#define LENGTH_LIMIT
#include "strcasecmp.c"

View File

@@ -33,9 +33,7 @@ char *malloc ();
/* Duplicate S, returning an identical malloc'd string. */
char *
strndup (s, n)
const char *s;
size_t n;
strndup (const char *s, size_t n)
{
char *new = malloc (n + 1);

View File

@@ -30,9 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef unsigned chartype;
char *
strstr (phaystack, pneedle)
const char *phaystack;
const char *pneedle;
strstr (const char *phaystack, const char *pneedle)
{
register const unsigned char *haystack, *needle;
register chartype b, c;

View File

@@ -43,9 +43,7 @@
*/
int
strverscmp (s1, s2)
const char *s1;
const char *s2;
strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;

View File

@@ -1,5 +1,5 @@
/* userspec.c -- Parse a user and group string.
Copyright (C) 1989, 1990, 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1989-1992, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -93,8 +93,7 @@ char *strdup ();
otherwise return 0. */
static int
is_number (str)
const char *str;
is_number (const char *str)
{
for (; *str; str++)
if (!isdigit (*str))
@@ -115,11 +114,8 @@ is_number (str)
Return NULL if successful, a static error message string if not. */
const char *
parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg)
const char *spec_arg;
uid_t *uid;
gid_t *gid;
char **username_arg, **groupname_arg;
parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
char **username_arg, char **groupname_arg)
{
static const char *tired = "virtual memory exhausted";
const char *error_msg;

View File

@@ -1,21 +1,52 @@
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
/* xalloc.h -- malloc with out-of-memory checking
Copyright (C) 1990-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef XALLOC_H_
# define XALLOC_H_
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
#endif
/* Exit value when the requested amount of memory is not available.
The caller may set it to some other value. */
It is initialized to EXIT_FAILURE, but the caller may set it to
some other value. */
extern int xalloc_exit_failure;
/* FIXME: describe */
extern char *const xalloc_msg_memory_exhausted;
/* FIXME: describe */
/* If this pointer is non-zero, run the specified function upon each
allocation failure. It is initialized to zero. */
extern void (*xalloc_fail_func) ();
/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this
message must be non-NULL. It is translated via gettext.
The default value is "Memory exhausted". */
extern char *const xalloc_msg_memory_exhausted;
void *xmalloc PARAMS ((size_t n));
void *xcalloc PARAMS ((size_t n, size_t s));
void *xrealloc PARAMS ((void *p, size_t n));
# define XMALLOC(Type, N_bytes) ((Type *) xmalloc (sizeof (Type) * (N_bytes)))
# define XCALLOC(Type, N_bytes) ((Type *) xcalloc (sizeof (Type), (N_bytes)))
# define XREALLOC(Ptr, Type, N_bytes) \
((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_bytes)))
#endif /* !XALLOC_H_ */

View File

@@ -1,5 +1,5 @@
/* xmalloc.c -- malloc with out of memory checking
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 98 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,13 +46,6 @@ void free ();
# define EXIT_FAILURE 1
#endif
/* Prototypes for functions defined here. */
#if defined (__STDC__) && __STDC__
void *xmalloc (size_t n);
void *xcalloc (size_t n, size_t s);
void *xrealloc (void *p, size_t n);
#endif
#ifndef HAVE_DONE_WORKING_MALLOC_CHECK
you must run the autoconf test for a properly working malloc -- see malloc.m4
#endif
@@ -65,20 +58,15 @@ you must run the autoconf test for a properly working realloc -- see realloc.m4
The caller may set it to some other value. */
int xalloc_exit_failure = EXIT_FAILURE;
/* FIXME: describe */
char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
/* FIXME: describe */
/* If non NULL, call this function when memory is exhausted. */
void (*xalloc_fail_func) () = 0;
#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
void error (int, int, const char *, ...);
#else
void error ();
#endif
/* If XALLOC_FAIL_FUNC is NULL, or does return, display this message
before exiting when memory is exhausted. Goes through gettext. */
char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
static void
xalloc_fail ()
xalloc_fail (void)
{
if (xalloc_fail_func)
(*xalloc_fail_func) ();
@@ -88,8 +76,7 @@ xalloc_fail ()
/* Allocate N bytes of memory dynamically, with error checking. */
void *
xmalloc (n)
size_t n;
xmalloc (size_t n)
{
void *p;
@@ -104,9 +91,7 @@ xmalloc (n)
If P is NULL, run xmalloc. */
void *
xrealloc (p, n)
void *p;
size_t n;
xrealloc (void *p, size_t n)
{
p = realloc (p, n);
if (p == 0)
@@ -114,13 +99,10 @@ xrealloc (p, n)
return p;
}
#ifdef NOT_USED
/* Allocate memory for N elements of S bytes, with error checking. */
void *
xcalloc (n, s)
size_t n, s;
xcalloc (size_t n, size_t s)
{
void *p;
@@ -129,5 +111,3 @@ xcalloc (n, s)
xalloc_fail ();
return p;
}
#endif /* NOT_USED */

View File

@@ -1,5 +1,8 @@
/* Work around the bug in some systems whereby stat succeeds when
given the zero-length file name argument. The stat from SunOS4.1.4
/* @IGNORE@ -*- c -*- */
/* @IGNORE@ This file is a template from which both stat.c and lstat.c
@IGNORE@ are generated. */
/* Work around the bug in some systems whereby @xstat@ succeeds when
given the zero-length file name argument. The @xstat@ from SunOS4.1.4
has this bug.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
@@ -21,11 +24,6 @@
#include <config.h>
/* Disable the definition of stat to rpl_stat (from config.h) in this
file. Otherwise, we'd get conflicting prototypes for rpl_stat on
most systems. */
#undef stat
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@ -33,18 +31,16 @@
extern int errno;
#endif
/* This is a wrapper for stat(2).
/* This is a wrapper for @xstat@(2).
If FILE is the empty string, fail with errno == ENOENT.
Otherwise, return the result of calling the real stat.
Otherwise, return the result of calling the real @xstat@.
This works around the bug in some systems whereby stat succeeds when
given the zero-length file name argument. The stat from SunOS4.1.4
This works around the bug in some systems whereby @xstat@ succeeds when
given the zero-length file name argument. The @xstat@ from SunOS4.1.4
has this bug. */
int
rpl_stat (file, sbuf)
const char *file;
struct stat *sbuf;
rpl_@xstat@ (const char *file, struct stat *sbuf)
{
if (file && *file == 0)
{
@@ -52,5 +48,5 @@ rpl_stat (file, sbuf)
return -1;
}
return stat (file, sbuf);
return @xstat@ (file, sbuf);
}

View File

@@ -1,3 +1,57 @@
1999-01-02 Jim Meyering <meyering@ascend.com>
* jm-macros.m4: Replace strcasecmp and strncasecmp.
1998-12-18 Jim Meyering <meyering@ascend.com>
* Makefile.am.in (Makefile.am): Simplify rule.
Based on a suggestion from Lars Hecking.
1998-11-16 Jim Meyering <meyering@ascend.com>
* lfs.m4: Double-quote the `uname...` expression.
1998-11-16 Paul Eggert <eggert@twinsun.com>
* lfs.m4 (AC_LFS): Add support for HP-UX 10.20 and HP-UX 11.
1998-11-14 Jim Meyering <meyering@ascend.com>
* lstat.m4: Correct comment. POSIX does not permit it to succeed.
* stat.m4: Likewise.
1998-11-03 Jim Meyering <meyering@ascend.com>
* stat.m4: Rewrite to set HAVE_STAT_EMPTY_STRING_BUG.
* lstat.m4: Rewrite to set HAVE_LSTAT_EMPTY_STRING_BUG.
1998-10-18 Jim Meyering <meyering@ascend.com>
* check-decl.m4 (jm_CHECK_DECL_LOCALTIME_R): Remove macro.
1998-10-17 Jim Meyering <meyering@ascend.com>
* decl.m4 (jm_CHECK_DECLARATION): Don't hard-code which headers to
include, though we still hard-code the `require'-like AC_CHECK_HEADERS
calls for those previously hard-coded headers. Instead, take a new
parameter.
(jm_CHECK_DECLARATIONS): Reflect interface change.
* check-decl.m4 (jm_CHECK_DECLS): Likewise.
(jm_CHECK_DECL_LOCALTIME_R): New macro.
* mktime.m4: Test for spring-forward gap before long-running test.
1998-10-14 Jim Meyering <meyering@ascend.com>
* mktime.m4: Use the more portable "TZ=PST8PDT,M4.1.0,M10.5.0"
instead of "TZ=America/Vancouver". From Paul Eggert.
1998-10-11 Jim Meyering <meyering@ascend.com>
* mktime.m4 (jm_AM_FUNC_MKTIME): New file and macro.
This adds a test for a recently added compatibility fix for mktime.c.
* jm-mktime.m4: Require jm_AM_FUNC_MKTIME, not AM_FUNC_MKTIME.
1998-09-27 Jim Meyering <meyering@ascend.com>
* jm-macros.m4 (jm_MACROS): Require jm_FUNC_FNMATCH.

View File

@@ -6,8 +6,8 @@ chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fnmatch.m4 \
fstypename.m4 getgroups.m4 getline.m4 getloadavg.m4 gettext.m4 glibc.m4 \
inttypes_h.m4 isc-posix.m4 jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 \
jm-winsz1.m4 jm-winsz2.m4 lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 \
lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 progtest.m4 putenv.m4 \
readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
lstat.m4 malloc.m4 memcmp.m4 mktime.m4 perl.m4 prereq.m4 progtest.m4 \
putenv.m4 readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
##m4-files-end
@@ -15,10 +15,9 @@ strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
Makefile.am: Makefile.am.in
rm -f $@ $@t
sed -n '1,/^##m4-files-begin/p' $< > $@t
( echo EXTRA_DIST = README Makefile.am.in; \
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|fmt | (tr '\012' @; echo) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
echo EXTRA_DIST = README Makefile.am.in *.m4 \
|fmt | (tr '\012' @; echo) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
>> $@t
sed -n '/^##m4-files-end/,$$p' $< >> $@t
chmod a-w $@t

View File

@@ -6,10 +6,9 @@
Makefile.am: Makefile.am.in
rm -f $@ $@t
sed -n '1,/^##m4-files-begin/p' $< > $@t
( echo EXTRA_DIST = README Makefile.am.in; \
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|fmt | (tr '\012' @; echo) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
echo EXTRA_DIST = README Makefile.am.in *.m4 \
|fmt | (tr '\012' @; echo) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
>> $@t
sed -n '/^##m4-files-end/,$$p' $< >> $@t
chmod a-w $@t

View File

@@ -62,7 +62,6 @@ CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@@ -77,17 +76,16 @@ LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
POW_LIBM = @POW_LIBM@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 check-type.m4 \
@@ -95,8 +93,8 @@ chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fnmatch.m4 \
fstypename.m4 getgroups.m4 getline.m4 getloadavg.m4 gettext.m4 glibc.m4 \
inttypes_h.m4 isc-posix.m4 jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 \
jm-winsz1.m4 jm-winsz2.m4 lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 \
lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 progtest.m4 putenv.m4 \
readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
lstat.m4 malloc.m4 memcmp.m4 mktime.m4 perl.m4 prereq.m4 progtest.m4 \
putenv.m4 readdir.m4 realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 \
strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
@@ -187,10 +185,9 @@ maintainer-clean
Makefile.am: Makefile.am.in
rm -f $@ $@t
sed -n '1,/^##m4-files-begin/p' $< > $@t
( echo EXTRA_DIST = README Makefile.am.in; \
find . -type f -name '*.m4' -print |sed 's,^\./,,' |sort ) \
|fmt | (tr '\012' @; echo) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
echo EXTRA_DIST = README Makefile.am.in *.m4 \
|fmt | (tr '\012' @; echo) \
|sed 's/@$$/%/;s/@/ \\@/g' |tr @% '\012\012' \
>> $@t
sed -n '/^##m4-files-end/,$$p' $< >> $@t
chmod a-w $@t

View File

@@ -4,5 +4,4 @@ used by autoconf to create the configure script at the the top level in
this distribution.
The Makefile.am file in this directory is automatically generated
from the template file, Makefile.am.in. The generation will fail
if you don't have all the right tools.
from the template file, Makefile.am.in.

View File

@@ -1,10 +1,29 @@
#serial 2
#serial 4
dnl This is just a wrapper function to encapsulate this kludge.
dnl Putting it in a separate file like this helps share it between
dnl different packages.
AC_DEFUN(jm_CHECK_DECLS,
[
headers='
#include <stdio.h>
#ifdef HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
'
if test x = y; then
dnl This code is deliberately never run via ./configure.
dnl FIXME: this is a gross hack to make autoheader put entries
@@ -14,5 +33,6 @@ AC_DEFUN(jm_CHECK_DECLS,
AC_CHECK_FUNCS(DECL_FREE DECL_LSEEK DECL_MALLOC DECL_MEMCHR DECL_REALLOC \
DECL_STPCPY DECL_STRSTR)
fi
jm_CHECK_DECLARATIONS(free lseek malloc memchr realloc stpcpy strstr)
jm_CHECK_DECLARATIONS($headers, free lseek malloc \
memchr realloc stpcpy strstr)
])

View File

@@ -1,4 +1,4 @@
#serial 2
#serial 3
AC_DEFUN(jm_CHECK_DECLARATION,
[
@@ -10,24 +10,7 @@ AC_DEFUN(jm_CHECK_DECLARATION,
test -z "$ac_cv_header_unistd_h" && AC_CHECK_HEADERS(unistd.h)
AC_MSG_CHECKING([whether $1 is declared])
AC_CACHE_VAL(jm_cv_func_decl_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif],
[AC_TRY_COMPILE($2,
[
#ifndef $1
char *(*pfn) = (char *(*)) $1
@@ -38,23 +21,23 @@ char *(*pfn) = (char *(*)) $1
if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
ifelse([$3], , :, [$3])
else
AC_MSG_RESULT(no)
ifelse([$3], , , [$3
ifelse([$4], , , [$4
])dnl
fi
])dnl
dnl jm_CHECK_DECLARATIONS(FUNCTION... [, ACTION-IF-DECLARED
dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED
dnl [, ACTION-IF-NOT-DECLARED]])
AC_DEFUN(jm_CHECK_DECLARATIONS,
[
for jm_func in $1
for jm_func in $2
do
jm_CHECK_DECLARATION($jm_func,
jm_CHECK_DECLARATION($jm_func, $1,
[
jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
AC_DEFINE_UNQUOTED($jm_tr_func) $2], $3)dnl
AC_DEFINE_UNQUOTED($jm_tr_func) $3], $4)dnl
done
])

View File

@@ -30,4 +30,5 @@ AC_DEFUN(jm_MACROS,
AC_REQUIRE([jm_FUNC_MEMCMP])
AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
AC_REQUIRE([jm_FUNC_FNMATCH])
AC_REPLACE_FUNCS(strcasecmp strncasecmp)
])

View File

@@ -7,12 +7,12 @@ dnl /* Define to rpl_mktime if the replacement function should be used. */
dnl #undef mktime
dnl
AC_DEFUN(jm_FUNC_MKTIME,
[AC_REQUIRE([AM_FUNC_MKTIME])dnl
[AC_REQUIRE([jm_AM_FUNC_MKTIME])dnl
dnl mktime.c uses localtime_r if it exists. Check for it.
AC_CHECK_FUNCS(localtime_r)
if test $am_cv_func_working_mktime = no; then
if test $jm_am_cv_func_working_mktime = no; then
AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
fi
])

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
dnl The problem is that the default compilation flags in Solaris 2.6 won't
dnl let programs access large files; you need to tell the compiler that
@@ -28,6 +28,19 @@ AC_DEFUN(AC_LFS,
ac_getconfs=$ac_getconfs$ac_getconf
eval ac_test_$ac_shellvar=\$ac_getconf
done
case "$ac_result" in
no)
case "`(uname -s -r) 2>/dev/null`" in
HP-UX' '?.10.[[2-9]][[0-9]]* | HP-UX' '?.1[[1-9]]* | HP-UX' '?.[[2-9]][[0-9]]*)
# HP-UX 10.20 and later support large files,
# but do not support `getconf LFS_CFLAGS'.
ac_test_CPPFLAGS='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
ac_test_LDFLAGS=
ac_test_LIBS=
ac_getconfs=nonempty
ac_result=yes ;;
esac ;;
esac
case "$ac_result$ac_getconfs" in
yes) ac_result=no ;;
esac

View File

@@ -1,20 +1,18 @@
#serial 1
#serial 2
dnl From Jim Meyering.
dnl Determine whether lstat has the bug that it succeeds when given the
dnl zero-length file name argument. The lstat from SunOS4.1.4 does this.
dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
dnl (as of 1998-11-01) do this.
dnl
dnl If it doesn't, arrange to use the replacement function.
dnl
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_lstat if the replacement function should be used. */
dnl #undef lstat
dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
dnl compile the wrapper function.
dnl
AC_DEFUN(jm_FUNC_LSTAT,
[
AC_CACHE_CHECK([for working lstat], jm_cv_func_working_lstat,
AC_CACHE_CHECK([whether lstat accepts an empty string],
jm_cv_func_lstat_empty_string_bug,
[AC_TRY_RUN([
# include <sys/types.h>
# include <sys/stat.h>
@@ -23,16 +21,31 @@ AC_DEFUN(jm_FUNC_LSTAT,
main ()
{
struct stat sbuf;
exit (lstat ("", &sbuf) == 0 ? 1 : 0);
exit (lstat ("", &sbuf) ? 1 : 0);
}
],
jm_cv_func_working_lstat=yes,
jm_cv_func_working_lstat=no,
jm_cv_func_lstat_empty_string_bug=yes,
jm_cv_func_lstat_empty_string_bug=no,
dnl When crosscompiling, assume lstat is broken.
jm_cv_func_working_lstat=no)
jm_cv_func_lstat_empty_string_bug=yes)
])
if test $jm_cv_func_working_lstat = no; then
if test $jm_cv_func_lstat_empty_string_bug = yes; then
LIBOBJS="$LIBOBJS lstat.o"
AC_DEFINE_UNQUOTED(lstat, rpl_lstat)
if test $jm_cv_func_lstat_empty_string_bug = yes; then
if test x = y; then
# This code is deliberately never run via ./configure.
# FIXME: this is a hack to make autoheader put the corresponding
# HAVE_* undef for this symbol in config.h.in. This saves me the
# trouble of having to maintain the #undef in acconfig.h manually.
AC_CHECK_FUNCS(LSTAT_EMPTY_STRING_BUG)
fi
# Defining it this way (rather than via AC_DEFINE) short-circuits the
# autoheader check -- autoheader doesn't know it's already been taken
# care of by the hack above.
ac_kludge=HAVE_LSTAT_EMPTY_STRING_BUG
AC_DEFINE_UNQUOTED($ac_kludge)
fi
fi
])

166
m4/mktime.m4 Normal file
View File

@@ -0,0 +1,166 @@
#serial 1001
dnl Just like mktime.m4 from automake-1.3b, but with an additional test.
dnl Renamed to have jm_ prefix and to use jm_ prefix on cache variable names.
AC_DEFUN(jm_AM_FUNC_MKTIME,
[AC_REQUIRE([AC_HEADER_TIME])dnl
AC_CHECK_HEADERS(sys/time.h unistd.h)
AC_CHECK_FUNCS(alarm)
AC_CACHE_CHECK([for working mktime], jm_am_cv_func_working_mktime,
[AC_TRY_RUN(
changequote(<<, >>)dnl
<</* Test program from Paul Eggert (eggert@twinsun.com)
and Tony Leneis (tony@plaza.ds.adp.com). */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#if !HAVE_ALARM
# define alarm(X) /* empty */
#endif
/* Work around redefinition to rpl_putenv by other config tests. */
#undef putenv
static time_t time_t_max;
/* Values we'll use to set the TZ environment variable. */
static const char *const tz_strings[] = {
(const char *) 0, "TZ=GMT0", "TZ=JST-9",
"TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
};
#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
/* Fail if mktime fails to convert a date in the spring-forward gap.
Based on a problem report from Andreas Jaeger. */
static void
spring_forward_gap ()
{
/* glibc (up to about 1998-10-07) failed this test) */
struct tm tm;
/* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
instead of "TZ=America/Vancouver" in order to detect the bug even
on systems that don't support the Olson extension, or don't have the
full zoneinfo tables installed. */
putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
tm.tm_year = 98;
tm.tm_mon = 3;
tm.tm_mday = 5;
tm.tm_hour = 2;
tm.tm_min = 0;
tm.tm_sec = 0;
tm.tm_isdst = -1;
if (mktime (&tm) == (time_t)-1)
exit (1);
}
static void
mktime_test (now)
time_t now;
{
struct tm *lt;
if ((lt = localtime (&now)) && mktime (lt) != now)
exit (1);
now = time_t_max - now;
if ((lt = localtime (&now)) && mktime (lt) != now)
exit (1);
}
static void
irix_6_4_bug ()
{
/* Based on code from Ariel Faigon. */
struct tm tm;
tm.tm_year = 96;
tm.tm_mon = 3;
tm.tm_mday = 0;
tm.tm_hour = 0;
tm.tm_min = 0;
tm.tm_sec = 0;
tm.tm_isdst = -1;
mktime (&tm);
if (tm.tm_mon != 2 || tm.tm_mday != 31)
exit (1);
}
static void
bigtime_test (j)
int j;
{
struct tm tm;
time_t now;
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
/* This test makes some buggy mktime implementations loop.
Give up after 10 seconds. */
alarm (10);
now = mktime (&tm);
alarm (0);
if (now != (time_t) -1)
{
struct tm *lt = localtime (&now);
if (! (lt
&& lt->tm_year == tm.tm_year
&& lt->tm_mon == tm.tm_mon
&& lt->tm_mday == tm.tm_mday
&& lt->tm_hour == tm.tm_hour
&& lt->tm_min == tm.tm_min
&& lt->tm_sec == tm.tm_sec
&& lt->tm_yday == tm.tm_yday
&& lt->tm_wday == tm.tm_wday
&& ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
== (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
exit (1);
}
}
int
main ()
{
time_t t, delta;
int i, j;
spring_forward_gap ();
for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
continue;
time_t_max--;
delta = time_t_max / 997; /* a suitable prime number */
for (i = 0; i < N_STRINGS; i++)
{
if (tz_strings[i])
putenv (tz_strings[i]);
for (t = 0; t <= time_t_max - delta; t += delta)
mktime_test (t);
mktime_test ((time_t) 60 * 60);
mktime_test ((time_t) 60 * 60 * 24);
for (j = 1; 0 < j; j *= 2)
bigtime_test (j);
bigtime_test (j - 1);
}
irix_6_4_bug ();
exit (0);
}
>>,
changequote([, ])dnl
jm_am_cv_func_working_mktime=yes, jm_am_cv_func_working_mktime=no,
dnl When crosscompiling, assume mktime is missing or broken.
jm_am_cv_func_working_mktime=no)
])
if test $jm_am_cv_func_working_mktime = no; then
LIBOBJS="$LIBOBJS mktime.o"
fi
])

View File

@@ -1,20 +1,18 @@
#serial 1
#serial 2
dnl From Jim Meyering.
dnl Determine whether stat has the bug that it succeeds when given the
dnl zero-length file name argument. The stat from SunOS4.1.4 does this.
dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
dnl (as of 1998-11-01) do this.
dnl
dnl If it doesn't, arrange to use the replacement function.
dnl
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_stat if the replacement function should be used. */
dnl #undef stat
dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
dnl compile the wrapper function.
dnl
AC_DEFUN(jm_FUNC_STAT,
[
AC_CACHE_CHECK([for working stat], jm_cv_func_working_stat,
AC_CACHE_CHECK([whether stat accepts an empty string],
jm_cv_func_stat_empty_string_bug,
[AC_TRY_RUN([
# include <sys/types.h>
# include <sys/stat.h>
@@ -23,16 +21,31 @@ AC_DEFUN(jm_FUNC_STAT,
main ()
{
struct stat sbuf;
exit (stat ("", &sbuf) == 0 ? 1 : 0);
exit (stat ("", &sbuf) ? 1 : 0);
}
],
jm_cv_func_working_stat=yes,
jm_cv_func_working_stat=no,
jm_cv_func_stat_empty_string_bug=yes,
jm_cv_func_stat_empty_string_bug=no,
dnl When crosscompiling, assume stat is broken.
jm_cv_func_working_stat=no)
jm_cv_func_stat_empty_string_bug=yes)
])
if test $jm_cv_func_working_stat = no; then
if test $jm_cv_func_stat_empty_string_bug = yes; then
LIBOBJS="$LIBOBJS stat.o"
AC_DEFINE_UNQUOTED(stat, rpl_stat)
if test $jm_cv_func_stat_empty_string_bug = yes; then
if test x = y; then
# This code is deliberately never run via ./configure.
# FIXME: this is a hack to make autoheader put the corresponding
# HAVE_* undef for this symbol in config.h.in. This saves me the
# trouble of having to maintain the #undef in acconfig.h manually.
AC_CHECK_FUNCS(STAT_EMPTY_STRING_BUG)
fi
# Defining it this way (rather than via AC_DEFINE) short-circuits the
# autoheader check -- autoheader doesn't know it's already been taken
# care of by the hack above.
ac_kludge=HAVE_STAT_EMPTY_STRING_BUG
AC_DEFINE_UNQUOTED($ac_kludge)
fi
fi
])

View File

@@ -18,30 +18,22 @@
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Written by Brendan O'Dea <bod@compusol.com.au>
# and François Pinard <pinard@IRO.UMontreal.CA>
require 5.003;
use 5.004;
use strict;
use Getopt::Long;
use POSIX 'strftime';
use POSIX qw(strftime setlocale LC_TIME);
my $RCS_Id = '$Id: help2man,v 1.2 1998/10/03 19:15:41 meyering Exp $';
my $this_program = 'help2man';
my $this_version = '0.0';
if ($RCS_Id =~ /\$Id:\s+(\S+)\s+(\S+)/)
{
$this_version = $2;
($this_program = $1) =~ s/(\.\w+)?,v$//;
}
my $this_version = '1.006';
my $version_info = <<EOT;
$this_program $this_version
Copyright (C) 1997, 98 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Brendan O'Dea <bod\@compusol.com.au>
EOT
my $help_info = <<EOT;
@@ -53,14 +45,14 @@ Usage: $this_program [OPTION]... EXECUTABLE
--include=FILE include material from `FILE'
--opt-include=FILE include material from `FILE' if it exists
--output=FILE send output to `FILE'
--no-info suppress pointer to Texinfo manual
--help print this help, then exit
--version print $this_program program version number, then exit
EXECUTABLE should accept `--help' and `version' options.
EOT
my ($include, $opt_name, $opt_include, $opt_output, $opt_help,
$opt_version);
my ($include, $opt_name, $opt_include, $opt_output, $opt_no_info);
# Parse options.
GetOptions (
@@ -68,6 +60,7 @@ GetOptions (
'include=s' => \$include,
'opt-include=s' => \$opt_include,
'output=s' => \$opt_output,
'no-info' => \$opt_no_info,
help => sub { print $help_info; exit },
version => sub { print $version_info; exit },
) or die $help_info;
@@ -112,7 +105,7 @@ if ($include or $opt_include)
die "$this_program: no valid information found in `$include'\n"
unless %include;
# Compress trailing blank lines
# Compress trailing blank lines.
for (keys %include)
{
$include{$_} =~ s/\n+$//;
@@ -128,17 +121,16 @@ if ($include or $opt_include)
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
# Turn off localisation of date (for strftime)
setlocale LC_TIME, 'C';
# Grab help and version paragraphs from executable
# Invoke program with `--manhelp' only if --name=STRING not specified.
my @help = split /\n\n+/, `$ARGV[0] --manhelp 2>/dev/null`
if !defined $opt_name;
my @help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null`
or die "$this_program: can't get `--help' info from $ARGV[0]\n";
my @version = split /\n\n+/, `$ARGV[0] --version 2>/dev/null`
or die "$this_program: can't get `--version' info from $ARGV[0]\n";
@help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null`
or die "$this_program: can't get `--help' info from $ARGV[0]\n"
unless @help;
my $date = strftime "%B %Y", localtime;
(my $program = $ARGV[0]) =~ s!.*/!!;
my $package = $program;
@@ -187,14 +179,10 @@ else
$program =~ s!.*/!!;
# Check for name in help output
if ($help[0] =~ s/^(?:name|oneliner):\s*(\S.*)//)
{
($include{NAME} = "$program \\- $1") =~ s/\s+$//;
shift @help unless length $help[0];
}
# no info for `info' itself
$opt_no_info = 1 if $program eq 'info';
# --name overrides --include contents and/or --manhelp oneliner
# --name overrides --include contents
$include{NAME} = "$program \\- $opt_name" if $opt_name;
# Default (useless) NAME paragraph
@@ -239,14 +227,14 @@ for (@help)
$accumulate = 0;
} while s/^(?:Usage|\s*or):\s+\S+\s+(.*)\n?//;
# Include file overrides SYNOPSIS
# Include file overrides SYNOPSIS.
print ".SH SYNOPSIS\n", $include{SYNOPSIS} || $synopsis;
# Dump any accumulated description text.
print ".SH DESCRIPTION\n";
print @description;
# Add additional description text from include file
# Add additional description text from include file.
if ($include{DESCRIPTION})
{
print ".PP\n" unless $include{DESCRIPTION} =~ /^\..P/;
@@ -324,12 +312,12 @@ for (@include)
}
# Refer to the real documentation.
if ($include{'SEE ALSO'} or $program ne 'info')
if ($include{'SEE ALSO'} or !$opt_no_info)
{
print qq(.SH "SEE ALSO"\n);
print $include{'SEE ALSO'}, ".PP\n" if $include{'SEE ALSO'};
print <<EOT unless $program eq 'info';
print <<EOT unless $opt_no_info;
The full documentation for
.B $program
is maintained as a Texinfo manual. If the
@@ -349,16 +337,19 @@ for (@version)
{
chomp;
# Convert copyright symbol or (c) to nroff character
# Join hyphenated lines.
s/([A-Za-z])-\n */$1/g;
# Convert copyright symbol or (c) to nroff character.
s/Copyright\s+(?:\xa9|\([Cc]\))/Copyright \\(co/g;
# Insert appropriate headings for copyright and author
# Insert appropriate headings for copyright and author.
if (/^Copyright\s\\/) { print ".SH COPYRIGHT\n" }
elsif (/^Written\s+by/) { print ".SH AUTHOR\n" }
else { print ".PP\n"; }
# Insert line breaks before additional copyright messages and the
# disclaimer
# disclaimer.
s/(.)\n(Copyright\s|This is free software)/$1\n.br\n$2/g;
print "$_\n";

2
man/ptx.x Normal file
View File

@@ -0,0 +1,2 @@
[DESCRIPTION]
.\" Add any additional description here

2
man/tsort.x Normal file
View File

@@ -0,0 +1,2 @@
[DESCRIPTION]
.\" Add any additional description here

View File

@@ -1,3 +1,345 @@
1999-01-04 Jim Meyering <meyering@ascend.com>
* Version 4.1-b2.
1999-01-02 Jim Meyering <meyering@ascend.com>
* lib/argmatch.c (argmatch_invalid): Remove double quotes from the
offending quoted argument before using it in explanatory diagnostic.
Use a single fprintf stmt.
* lib/argmatch.h (XARGMATCH): Don't return a value; instead,
modify a parameter. Add a `Die_stmt' parameter.
Add parentheses.
* lib/argmatch.c (__xargmatch_internal): Remove now-unused function.
(argmatch_to_argument): Add `const' attribute to first parameter.
* configure.in (AC_REPLACE_FUNCS): Remove strcasecmp (now it's
done in m4/jm-macros.m4).
* lib/backupfile.c (get_version): Adapt to use new interface to
XARGMATCH.
* src/cp.c: Likewise.
* src/ls.c: Likewise.
* src/touch.c: Likewise.
1999-01-01 Jim Meyering <meyering@ascend.com>
* lib/makepath.c (make_dir): New function, factored out of make_path.
(make_path): Use make_dir rather than open-coding it twice.
This effectively reverses the order of the latter pair of stat/mkdir
calls and fixes a race condition bug whereby one of two concurrent
`mkdir -p' processes could fail with EEXIST.
Include locale.h and libintl.h, and define `_()'.
Mark translatable strings.
* lib/xmalloc.c: Add comments.
(xcalloc, xmalloc, xrealloc): Remove prototypes.
(xcalloc): Remove `#ifdef NOT_USED' that used to hide this function.
* lib/xalloc.h: Add comments.
(PARAMS, XMALLOC, XCALLOC, XREALLOC): Define.
(xcalloc, xmalloc, xrealloc): Add prototypes here.
Based on changes from Akim Demaille.
* lib/quotearg.c (quotearg_buffer): Cast -1 to size_t before comparing.
(quotearg_n): Change type of 1st parameter from int to unsigned int.
(quotearg_n_options): Likewise.
* lib/quotearg.h (quoting_style_vals): New public array.
From Akim Demaille.
(quotearg_n_options): Declare `options' parameter to be `const'.
* lib/human.c (humblock): Use ARGMATCH in place of argmatch.
* lib/backupfile.c (get_version): Use XARGMATCH in place of
argmatch & co.
1998-12-31 Jim Meyering <meyering@ascend.com>
* src/ls.c (indicator_style_types): New variable.
(format_types): Rename from `formats'.
(color_args): Remove unnecessary `no' string.
(color_types): Remove corresponding `color_never' entry.
(main): Use ARGMATCH_TO_ARGUMENT.
(decode_switches): Use ARGMATCH instead of argmatch code
in each of several cases.
From Akim Demaille.
* src/cp.c (main): Use XARGMATCH in place of argmatch & co.
* src/touch.c (main): Likewise.
* lib/backupfile.c (get_version): Likewise.
From Akim Demaille.
* lib/strncasecmp.c: New file.
* lib/strcasecmp.c: Add #ifdefs so it can be used for strncasecmp, too.
* lib/argmatch.c (strncasecmp): Move to a separate file.
Add curly braces around some one-stmt-but-multiline blocks.
* lib/argmatch.c: Improvements from Akim Demaille.
* lib/argmatch.h: Likewise.
* lib/addext.c (addext): Protoize.
Indent cpp directives to match nesting.
Fix warnings from gcc -W -Wall
* lib/posixtm.c (posix_time_parse): Change type of index `i' from
int to unsigned int.
* lib/getdate.y (__attribute__): Define.
(ATTRIBUTE_UNUSED): Define.
(yyerror): Mark parameter as unused with ATTRIBUTE_UNUSED.
(MonthDayTable): Add initializers for last entry.
(UnitsTable): Likewise.
(OtherTable): Likewise.
(MilitaryTable): Likewise.
1998-12-22 Jim Meyering <meyering@ascend.com>
* Version 4.1-b1.
* configure.in (ALL_LINGUAS): Add chinese (zh).
1998-12-19 Jim Meyering <meyering@ascend.com>
* tests/ln/misc: Use absolute path for final rm.
* Makefile.maint (my-distcheck): Run make with
CFLAGS='-Wformat -Werror'.
1998-12-18 Jim Meyering <meyering@ascend.com>
* src/copy.c (copy_internal): Remove errnoeous `%s: ' prefix
from format string. From Michiel Bacchiani.
* src/chgrp.c (MAXGID): Define.
Use gid_t (not int) as the type for `group' variables.
(parse_group): Use MAXGID, not INT_MAX.
* src/install.c (UID_T_MAX, GID_T_MAX): Remove definitions.
* src/sys2.h (UID_T_MAX, GID_T_MAX): Define them here instead.
1998-12-13 Jim Meyering <meyering@ascend.com>
* lib/Makefile.am (EXTRA_DIST): Add xstat.in.
1998-12-12 Jim Meyering <meyering@ascend.com>
1998-10-15 Akim Demaille <demaille@inf.enst.fr>
* src/ls.c: Group DIRED's code together.
(full_time, inhibit_group, col_ext_type): Declare static.
(dired_dump_obstack): Apply sizeof to variable, instead of its type.
(parse_ls_color): Rename ext2 as e2. Move into the block where it
is used.
1998-10-15 Akim Demaille <demaille@inf.enst.fr>
* src/ls.c: In order to distinguish col(umn|or):
(init_column_info): Renamed from init_col_info.
(struct column_info): Renamed from struct col_info.
(struct color_ext_type): Renamed from struct col_ext_type.
1998-12-11 Jim Meyering <meyering@ascend.com>
* lib/Makefile.am (lstat.c): Add rule to generate this from xstat.in.
(stat.c): Likewise.
* lib/stat.c: Remove file.
* lib/lstat.c: Remove file.
* lib/xstat.in (xstat@): New file.
* lib/quotearg.c (quotearg_buffer): Use `7' as the mask, not `3'.
From Bruno Haible.
* tests/ls-2/tests: Add a test for this.
* man/help2man: import version 1.006.
1998-12-07 Jim Meyering <meyering@ascend.com>
* src/copy.c: Use dir_name, not dirname. Include dirname.h.
* src/cp.c: Likewise.
* src/df.c: Likewise.
* src/install.c: Likewise.
* src/ln.c: Likewise.
* src/mvdir.c: Likewise.
* lib/dirname.c (dir_name): Rename from dirname.
Make argument `const'. Include "dirname.h"
* lib/dirname.h: New file.
* lib/Makefile.am (noinst_HEADERS): Add dirname.h.
1998-12-06 Jim Meyering <meyering@ascend.com>
* lib/rpmatch.c (rpmatch) [!ENABLE_NLS]: Hard-code tests to use
`^[yY]' and `^[nN]' (avoiding regex). From Karl Heuer.
* lib/*.c: Ansideclify.
Fix `ls -R .' formatting bug that broke mktexlsr.
* src/ls.c: Include path-concat.h.
(basename_is_dot_or_dotdot): New function, derived from
is_not_dot_or_dotdot.
(is_not_dot_or_dotdot): Remove function.
(extract_dirs_from_files): Use `!basename_is_dot_or_dotdot'
instead of is_not_dot_or_dotdot and use path_concat instead of attach.
* tests/ls-2/tests: New file (renamed from quoting),
with new test for the `ls -R .' fix.
* tests/ls-2/quoting: Remove file.
* tests/ls-2/Makefile.am (TESTS): s/quoting/tests/.
1998-11-29 Jim Meyering <meyering@ascend.com>
* src/remove.c (DOT_OR_DOTDOT): Move definition from this file...
* src/sys2.h (DOT_OR_DOTDOT): ...to this one.
* src/dd.c (dd_copy): Rename function from `copy'.
* src/cp.c (do_copy): Rename local: s/unused/copy_into_self/.
Per Kristian Hove reported that a certain move-directory-into-self
wasn't properly diagnosed.
* tests/mv/into-self-3: New file.
* tests/mv/Makefile.am (TESTS): Add into-self-3.
* src/copy.c (copy_internal): Remove earlier (but less effective)
test for move/copy-into-self.
Instead, deduce the move-into-self condition from errno==EINVAL
after a failed rename.
* src/mv.c (do_move): Don't arrange to remove DEST in the
copied-into-self case.
1998-11-15 Jim Meyering <meyering@ascend.com>
Bob McCracken reported that mv couldn't handle certain combinations
of hard linked source files.
* tests/mv/hard-link-1: New file.
* tests/mv/Makefile.am (TESTS): Add hard-link-1.
* src/mv.c (movefile): Don't free new_dest.
* lib/error.c (error): Don't use strerror_r's return value.
From Johan Danielsson.
1998-11-14 Jim Meyering <meyering@ascend.com>
* Version 4.0.
* Makefile.maint (cvs-dist): Search for `$tag:' rather than just $tag
to avoid matching a prefix of another tag.
1998-11-10 Jim Meyering <meyering@ascend.com>
* configure.in (ALL_LINGUAS): Add greek (el).
1998-11-07 Jim Meyering <meyering@ascend.com>
* Version 4.0-b7.
Accommodate the Hurd (defining lstat to rpl_lstat via config.h didn't
work on Hurd systems because of an inline definition of lstat in a
system header file). This also makes it so that you may run `ls '' '
on systems that let l?stat operate on the empty string.
* src/remove.c [HAVE_LSTAT_EMPTY_STRING_BUG]: Define lstat to rpl_lstat
and declare the latter.
* lib/stat.c [stat]: Remove #undef.
(rpl_stat): Protoize.
* lib/lstat.c [lstat]: Remove #undef.
(rpl_lstat): Protoize. Use ENOENT, not EINVAL, to be consistent
with lib/stat.c.
* acconfig.h: Remove #undef's for lstat and stat.
1998-10-31 Jim Meyering <meyering@ascend.com>
* tests/rm/Makefile.am (TESTS): Add new test `empty-name',
but comment it out.
* tests/rm/empty-name: New file.
* acconfig.h (stat): New #undef.
This omission was uncovered when Mark Kettenis reported that
`rm -r ''' got a failed assertion on the Hurd. This change
doesn't fix *that* problem -- see above.
1998-10-25 Jim Meyering <meyering@ascend.com>
* Version 4.0-b6.
* README: Man pages will now be supported to the extent that
people send patches.
* tests/rm/unreadable: Two new tests.
* tests/rm/Makefile.am (TESTS): Add new test `unreadable'. But comment
it out since we're so close to release and since the test compares the
text of diagnostics that are likely to vary between systems.
(TEST_ENVIRONMENT): Add required framework.
* src/remove.c (remove_cwd_entries): Don't apply CLOSEDIR to a NULL
pointer. (provoke with `mkdir -m 0100 x; rm -rf x')
Upon CLOSEDIR failure, set `status' to RM_ERROR, not RM_OK.
(remove_dir): Return `status', rather than always RM_OK.
1998-10-18 Jim Meyering <meyering@ascend.com>
* Version 4.0-b5.
* lib/mktime.c: Update from libc with this additional change from Paul.
* lib/strftime.c: Likewise.
1998-10-17 Paul Eggert <eggert@twinsun.com>
Don't invoke localtime_r or gmtime_r unless it's the GNU C
library's localtime_r and gmtime_r; there are too many buggy
implementations of localtime_r and gmtime_r out there, and
it's not worth keeping track of all the different bugs.
* mktime.c (__EXTENSIONS__, HAVE_LOCALTIME_R): Remove.
(my_mktime_localtime_r): Renamed from localtime_r; all uses changed.
Base it on localtime unless _LIBC.
* strftime.c (__EXTENSIONS__): Remove.
(my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed.
(my_strftime_localtime_r): Renamed from localtime_r; all uses changed.
Base them on localtime/gmtime if not _LIBC.
1998-10-17 Jim Meyering <meyering@ascend.com>
* Version 4.0-b4.
* lib/mktime.c: Declare localtime_r if necessary.
* lib/strftime.c: Likewise.
* tests/Fetish.pm (run_tests): Run $prog with --version only
if $verbose.
1998-10-11 Jim Meyering <meyering@ascend.com>
* Version 4.0-b3.
1998-10-08 Paul Eggert <eggert@twinsun.com>
* mktime.c (__mktime_internal): When the requested time falls
in a spring-forward gap of size DT, return a time that is DT
away from the requested time, preferring a time whose tm_isdst
differs from the requested value. Bump the max number of
probes from 4 to 6 to account for the extra probes needed to
discover a spring-forward gap in the worst case.
1998-10-08 Paul Eggert <eggert@twinsun.com>
* mktime.c (my_mktime_localtime_r): Renamed from localtime_r.
Define also if HAVE_LOCALTIME_R && defined (localtime_r), with
a body that merely expands localtime_r; this works around a
bug in Digital Unix 4.0A and 4.0D.
1998-10-05 Jim Meyering <meyering@ascend.com>
* po/Makefile.in.in (uninstall): Remove (historical?) command that
removed po-Makefile.in.in. From Akim Demaille.
* src/install.c (long_options): Add entry for --suffix=SUFFIX option.
From aldomel.
1998-10-04 Jim Meyering <meyering@ascend.com>
* tests/mv/Makefile.am (TESTS_ENVIRONMENT): Define PERL.
From Kaveh Ghazi.
1998-10-03 Jim Meyering <meyering@ascend.com>
* Version 4.0-b2.

View File

@@ -1,4 +1,39 @@
Changes in release 3.17:
Changes in release 4.1:
[4.1-b2]
* concurrent `mkdir -p' processes no longer fail when creating the
same hierarchy
* argmatch.c has been fixed so that the unambiguous usage `ls --color=n'
no longer evokes an error.
* now, specifying an improper argument for an option that accepts enumerated
values evokes diagnostics like this:
$ src/touch --time=x file
src/touch: invalid argument `x' for `--time'
Valid arguments are:
- `atime', `access', `use'
- `mtime', `modify'
Try `src/touch --help' for more information.
[4.1-b1]
* ls --quoting-style=c prints correct octal escapes for certain nonprinting
characters in file names.
* fix `ls -R .' formatting bug that broke mktexlsr
* moving a directory into itself is properly diagnosed in more cases
* moving a directory containing hard-linked files now works
Changes in release 4.0:
[4.0-b7]
* rm -rf '' no longer gets a failed assertion on the Hurd
[4.0-b6]
* rm simply fails as it should (rather than segfaulting) for
`mkdir -m 0100 x; rm -rf x'
[4.0-b5]
* still *more* mktime.c portability tweaks
[4.0-b4]
* mktime.c portability tweak for headers with GNU libc 5.4.44.
[4.0-b3]
* mktime.c works around problems with Digital Unix 4.0A and 4.0D.
* mktime.c handles dates in the spring-forward gap the same way other
implementations do
* install accepts long option --suffix=SUFFIX
[4.0-b2]
* man/Makefile.maint framework tweaks
* add test for `mv -i' bug

View File

@@ -1,3 +1,28 @@
1998-12-10 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* src/date.c (main): Arrange to exit unsuccessfully when stime fails.
1998-12-07 Jim Meyering <meyering@ascend.com>
* configure.in (ALL_LINGUAS): Add Russian (ru).
1998-12-06 Jim Meyering <meyering@ascend.com>
* lib/putenv.c: Redefine putenv before including stdlib.h to work
around Solaris 2.7's conflicting prototype. Reported by Karl Berry.
1998-10-31 Jim Meyering <meyering@ascend.com>
* tests/Makefile.am (EXTRA_DIST): Add Fetish.pm.
* tests/Fetish.pm: New file.
* tests/factor/Makefile.am: Rewrite to use new testing framework.
* tests/factor/Test.pm: Remove file.
* tests/factor/factor-tests: Remove file.
* tests/factor/basic: New file (rewrite of Test.pm).
* acconfig.h (stat): New #undef.
1998-10-03 Jim Meyering <meyering@ascend.com>
* man/Makefile.am: Switch to using help2man.

View File

@@ -1,5 +1,6 @@
Changes in release 1.17
[1.16f]
* `date -s' now exits with nonzero status upon failure
* new autoconf tests detect bugs in vendor mktime from Irix-6.4 and SunOS4.1.4
Your executables will be a little larger on such systems because you'll use
GNU's mktime function, but date will work more reliably.

View File

@@ -1,8 +1,192 @@
1999-01-03 Jim Meyering <meyering@ascend.com>
* src/md5sum.c (usage): Remove third program_name argument -- there
were only two `%s' in the format string.
1999-01-02 Jim Meyering <meyering@ascend.com>
* Version 1.22g.
* src/tsort.c (tsort): Use a single call to error instead of two
to fprintf.
(main): Remove `%s: ' prefix on format string.
* src/tail.c (parse_options): Use XARGMATCH in place of argmatch.
* src/ptx.c (format_vals): New array.
(main): Use XARGMATCH in place of argmatch.
* lib/argmatch.h (XARGMATCH): Don't return a value; instead,
modify a parameter. Add a `Die_stmt' parameter.
Add parentheses.
* lib/argmatch.c (__xargmatch_internal): Remove now-unused function.
(argmatch_to_argument): Add `const' attribute to first parameter.
1999-01-01 Jim Meyering <meyering@ascend.com>
* src/tsort.c: Move inclusion of assert.h to follow that of stdio.h.
Some losing systems require this.
Use STREQ macro instead of strcmp in a few places.
* po/POTFILES.in: Add tsort.c.
* man/Makefile.maint ($(man_MANS)): `exit 1' if any of help2man,
chmod, or mv fails. Otherwise, the failure could go unnoticed.
* man/Makefile.summ: Add entries for ptx and tsort.
* src/tsort.c: Include readtokens.h.
(zeros): Rename global from `rr'.
(getstr): Remove function.
(tsort) Use readtoken instead of getstr.
* lib/readtokens.c: New file.
* lib/readtokens.h: New file.
* lib/Makefile.am (libtu_a_SOURCES): Add readtokens.c.
(noinst_HEADERS): Add readtokens.h.
* man/Makefile.am (man_MANS): Add ptx.1.
* man/ptx.x: New file.
* src/tail.c (parse_options): Use XARGMATCH in place of argmatch.
* man/Makefile.am (man_MANS): Add tsort.1.
* man/tsort.x: New (essentially empty) file.
* src/tsort.c: Rename globals N and R so they don't shadow locals.
(tsort): Rename from `sort'.
1998-11-07 Mark Kettenis <kettenis@phys.uva.nl>
* src/Makefile.am (bin_PROGRAMS): Add tsort.
* src/tsort.c: New program.
* lib/Makefile.am (libtu_a_SOURCES): Add quotearg.c.
(noinst_HEADERS): Add quotearg.h.
============================
All of the following are from:
1998-04-17 Eli Zaretskii <eliz@is.elta.co.il>
* src/system.h (SET_BINARY, SET_BINARY2, fileno, setmode): New
macros.
* src/cat.c (usage) [O_BINARY]: Describe -B,--binary option.
(main) [O_BINARY]: binary_files, binary_output, file_open_mode:
new variables. Add --binary to long_options[]. Switch stdin and
stdout to binary mode unless file contents are not important
anyway. Open files in binary mode when required.
* src/cksum.c (cksum) [O_BINARY]: Read redirected stdin in binary
mode.
* src/expand.c (expand): Use binary I/O where appropriate.
* src/head.c (head_bytes, head_lines) [O_BINARY]: Use binary I/O.
* src/md5sum.c (OPENOPTS) [O_BINARY]: Use binary I/O when non-zero
argument.
(md5_file) [O_BINARY]: Switch redirected stdin to binary mode.
(main) [O_BINARY]: Use binary reads by default on those systems
which care about the difference.
* src/od.c (skip, read_char, read_block) [O_BINARY]: Switch input
stream to binary mode.
* src/sort.c (PATH_MAX_IN_DIR) [HAVE_UNISTD_H]: New macro, for max
file name characters in a given directory.
(tempname): Make sure the temp file name is unique even if long
file names aren't supported.
* src/split.c (cwrite) [O_BINARY]: Write output in binary mode.
(main) [O_BINARY]: Read input in binary mode.
* src/sum.c (bsd_sum_file, sysv_sum_file) [O_BINARY]: Read input
in binary mode.
* src/tac.c (record_tempfile, unlink_tempfile)
[DONT_UNLINK_WHILE_OPEN]: New functions, for systems where a file
cannot be removed before it is closed.
(save_stdin) [DONT_UNLINK_WHILE_OPEN]: Record the temporary file,
to be removed before exit.
(tac_file, save_stdin, main): Use binary I/O when appropriate.
* src/tail.c (tail_lines, tail_bytes) [O_BINARY]: Use binary I/O
when appropriate.
* src/tr.c (main) [O_BINARY]: Use binary I/O when appropriate.
* src/unexpand.c (unexpand): Use binary I/O where appropriate.
* src/wc.c (wc): Use binary mode for input.
* doc/textutil.texi: Add comments about peculiarities of Textutils
operation on MS-DOS/MS-Windows.
1998-12-22 Jim Meyering <meyering@ascend.com>
* configure.in (ALL_LINGUAS): Add chinese (zh).
1998-12-17 Jim Meyering <meyering@ascend.com>
New options for tail:
--follow=name, --follow=descriptor, --allow-missing
* src/tail.c (Follow_mode): New enum.
(n_live_files): New function.
(tail_forever): Avoid starvation with --follow=name and a
continually-growing unlinked or renamed file.
1998-12-13 Jim Meyering <meyering@ascend.com>
* tests/uniq/Test.pm: New file.
* tests/uniq/Makefile.am: New file.
* tests/uniq: New directory.
* tests/Makefile.am (SUBDIRS): Add uniq.
* configure.in (AC_OUTPUT): Add tests/uniq/Makefile.
From Jochen Hein.
* lib/Makefile.am (lstat.c): Add rule to generate this from xstat.in.
(stat.c): Likewise.
(EXTRA_DIST): Add xstat.in.
* lib/stat.c: Remove file.
* lib/lstat.c: Remove file.
* lib/xstat.in (xstat@): New file.
* configure.in (ALL_LINGUAS): Add Russian (ru).
1998-10-31 Jim Meyering <meyering@ascend.com>
* acconfig.h (stat): New #undef.
1998-10-22 Jim Meyering <meyering@ascend.com>
* src/fold.c (usage): Add mention of --version and --help.
Reported by Matej Vela <mvela@public.srce.hr>.
1998-10-04 Jim Meyering <meyering@ascend.com>
* lib/fnmatch.h: New file. (unused)
* lib/fnmatch.c: New file. (unused)
* lib/Makefile.am (noinst_HEADERS): Add fnmatch.h.
1998-10-03 Jim Meyering <meyering@ascend.com>
* man/Makefile.am: Switch to using help2man.
(EXTRA_DIST): Add Makefile.summ.
* man/help2man: Invoke program with --manhelp option only if
--name=STRING not specified. Otherwise, this would fail with `yes'.
* man/Makefile.summ: New file.
* man/Makefile.maint: Include it.
* man/help2man: New file.
* man/GNUmakefile: New file.
* man/Makefile.maint: New file.
* man/*.x: New files.
* man/*.1: Remove files.
* src/md5sum.c (split_3): Rename local variable, to `escaped_filename'.
(main): Output the leading backslash not just when there's a newline
in the file name, but also when there's a backslash.
Reported by Jim Dennis.
* tests/md5sum/basic-1: Add tests with filenames containing newline
and backslash characters. (for the bug fixed above)

View File

@@ -1,5 +1,7 @@
Changes in release 1.23
[1.22g]
* new program: tsort
* tail has several new options: FIXME
* md5sum can handle file names with embedded backslash characters
* pr accepts long option names (see `pr --help')
* new program: ptx (moved to this package from being its own distribution)

View File

@@ -1,5 +1,5 @@
/* cat -- concatenate files and print on the standard output.
Copyright (C) 88, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 88, 90, 91, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -102,6 +102,12 @@ Concatenate FILE(s), or standard input, to standard output.\n\
\n\
With no FILE, or when FILE is -, read standard input.\n\
"));
#if O_BINARY
printf (_("\
\n\
-B, --binary use binary writes to the console device.\n\n\
"));
#endif
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}
exit (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
@@ -495,6 +501,11 @@ main (int argc, char **argv)
int mark_line_ends = 0;
int quote = 0;
int output_tabs = 1;
#if O_BINARY
int binary_files = 0;
int binary_output = 0;
#endif
int file_open_mode = O_RDONLY;
/* If nonzero, call cat, otherwise call simple_cat to do the actual work. */
int options = 0;
@@ -514,6 +525,9 @@ main (int argc, char **argv)
{"show-ends", no_argument, NULL, 'E'},
{"show-tabs", no_argument, NULL, 'T'},
{"show-all", no_argument, NULL, 'A'},
#if O_BINARY
{"binary", no_argument, NULL, 'B'},
#endif
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
@@ -526,7 +540,13 @@ main (int argc, char **argv)
/* Parse command line options. */
while ((c = getopt_long (argc, argv, "benstuvAET", long_options, NULL)) != -1)
while ((c = getopt_long (argc, argv,
#if O_BINARY
"benstuvABET"
#else
"benstuvAET"
#endif
, long_options, NULL)) != -1)
{
switch (c)
{
@@ -577,6 +597,13 @@ main (int argc, char **argv)
output_tabs = 0;
break;
#if O_BINARY
case 'B':
++options;
binary_files = 1;
break;
#endif
case 'E':
++options;
mark_line_ends = 1;
@@ -629,6 +656,39 @@ main (int argc, char **argv)
#endif
}
#if O_BINARY
/* We always read and write in BINARY mode, since this is the
best way to copy the files verbatim. Exceptions are when
they request line numbering, squeezing of empty lines or
marking lines' ends: then we use text I/O, because otherwise
-b, -s and -E would surprise users on DOS/Windows where a line
with only CR-LF is an empty line. (Besides, if they ask for
one of these options, they don't care much about the original
file contents anyway). */
if ((!isatty (output_desc)
&& !(numbers || squeeze_empty_lines || mark_line_ends))
|| binary_files)
{
/* Switch stdout to BINARY mode. */
binary_output = 1;
SET_BINARY (output_desc);
}
else if (quote)
{
/* If they want to see the non-printables, let's show them
those CR characters as well, so make the input binary.
But keep console output in text mode, so that LF causes
both CR and LF on output, and the output is readable. */
file_open_mode |= O_BINARY;
SET_BINARY (0);
/* Setting stdin to binary switches the console device to
raw I/O, which also affects stdout to console. Undo that. */
if (isatty (output_desc))
setmode (output_desc, O_TEXT);
}
#endif
/* Check if any of the input files are the same as the output file. */
/* Main loop. */
@@ -645,10 +705,37 @@ main (int argc, char **argv)
{
have_read_stdin = 1;
input_desc = 0;
#if O_BINARY
/* Switch stdin to BINARY mode if needed. */
if (binary_output)
{
int tty_in = isatty (input_desc);
/* If stdin is a terminal device, and it is the ONLY
input file (i.e. we didn't write anything to the
output yet), switch the output back to TEXT mode.
This is so "cat > xyzzy" creates a DOS-style text
file, like people expect. */
if (tty_in && optind <= argc)
setmode (output_desc, O_TEXT);
else
{
SET_BINARY (input_desc);
# ifdef __DJGPP__
/* This is DJGPP-specific. By default, switching console
to binary mode disables SIGINT. But we want terminal
reads to be interruptible. */
if (tty_in)
__djgpp_set_ctrl_c (1);
# endif
}
}
#endif
}
else
{
input_desc = open (infile, O_RDONLY);
input_desc = open (infile, file_open_mode);
if (input_desc < 0)
{
error (0, errno, "%s", infile);

View File

@@ -32,7 +32,10 @@
/* MAXUID may come from limits.h *or* sys/params.h (via system.h) above. */
#ifndef MAXUID
# define MAXUID INT_MAX
# define MAXUID UID_T_MAX
#endif
#ifndef MAXGID
# define MAXGID GID_T_MAX
#endif
#ifndef _POSIX_VERSION
@@ -68,7 +71,7 @@ enum Verbosity
V_off
};
static int change_dir_group PARAMS ((const char *dir, int group,
static int change_dir_group PARAMS ((const char *dir, gid_t group,
const struct stat *statp));
/* The name the program was run with. */
@@ -141,7 +144,7 @@ describe_change (const char *file, enum Change_status changed)
/* Set *G according to NAME. */
static void
parse_group (const char *name, int *g)
parse_group (const char *name, gid_t *g)
{
struct group *grp;
@@ -162,7 +165,7 @@ parse_group (const char *name, int *g)
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (name, _("group number"), s_err);
if (tmp_long > INT_MAX)
if (tmp_long > MAXGID)
error (1, 0, _("invalid group number `%s'"), name);
*g = tmp_long;
@@ -177,7 +180,7 @@ parse_group (const char *name, int *g)
Return 0 if successful, 1 if errors occurred. */
static int
change_file_group (const char *file, int group)
change_file_group (const char *file, gid_t group)
{
struct stat file_stats;
int errors = 0;
@@ -242,7 +245,7 @@ change_file_group (const char *file, int group)
Return 0 if successful, 1 if errors occurred. */
static int
change_dir_group (const char *dir, int group, const struct stat *statp)
change_dir_group (const char *dir, gid_t group, const struct stat *statp)
{
char *name_space, *namep;
char *path; /* Full path of each entry to process. */
@@ -323,7 +326,7 @@ Change the group membership of each FILE to GROUP.\n\
int
main (int argc, char **argv)
{
int group;
gid_t group;
int errors = 0;
int optc;

View File

@@ -1,5 +1,5 @@
/* cksum -- calculate and print POSIX.2 checksums and sizes of files
Copyright (C) 92, 95, 96, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 92, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -217,6 +217,9 @@ cksum (char *file, int print_name)
}
}
/* Read input in BINARY mode, unless it is a console device. */
SET_BINARY (fileno (fp));
while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0)
{
unsigned char *cp = buf;

View File

@@ -33,6 +33,7 @@
#include "copy.h"
#include "cp-hash.h"
#include "path-concat.h"
#include "dirname.h"
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
(Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \
@@ -51,7 +52,6 @@ struct dir_list
int full_write ();
int euidaccess ();
int yesno ();
char *dirname ();
static int copy_internal PARAMS ((const char *src_path, const char *dst_path,
int new_dst, dev_t device,
@@ -387,14 +387,6 @@ copy_internal (const char *src_path, const char *dst_path,
earlier_file = remember_copied (dst_path, src_sb.st_ino, src_sb.st_dev);
/* Did we just create this file? */
if (earlier_file == &new_file)
{
*copy_into_self = 1;
return 0;
}
src_mode = src_sb.st_mode;
src_type = src_sb.st_mode;
@@ -603,7 +595,7 @@ copy_internal (const char *src_path, const char *dst_path,
directories). */
if (S_ISDIR (src_type))
{
error (0, 0, _("%s: won't create hard link `%s' to directory `%s'"),
error (0, 0, _("won't create hard link `%s' to directory `%s'"),
dst_path, earlier_file);
goto un_backup;
}
@@ -617,13 +609,30 @@ copy_internal (const char *src_path, const char *dst_path,
return 0;
}
if (move_mode && rename (src_path, dst_path) == 0)
if (move_mode)
{
if (x->verbose && S_ISDIR (src_type))
printf ("%s -> %s\n", src_path, dst_path);
if (rename_succeeded)
*rename_succeeded = 1;
return 0;
if (rename (src_path, dst_path) == 0)
{
if (x->verbose && S_ISDIR (src_type))
printf ("%s -> %s\n", src_path, dst_path);
if (rename_succeeded)
*rename_succeeded = 1;
return 0;
}
/* FIXME: someday, consider what to do when moving a directory into
itself but when source and destination are on different devices. */
/* This happens when attempting to rename a directory to a
subdirectory of itself. */
if (errno == EINVAL)
{
/* FIXME: this is a little fragile in that it relies on rename(2)
returning a specific errno (EINVAL). Expect problems on
non-POSIX systems. */
*copy_into_self = 1;
return 0;
}
}
if (S_ISDIR (src_type))
@@ -691,7 +700,7 @@ copy_internal (const char *src_path, const char *dst_path,
char *dst_parent;
int in_current_dir;
dst_parent = dirname (dst_path);
dst_parent = dir_name (dst_path);
if (dst_parent == NULL)
error (1, 0, _("virtual memory exhausted"));

View File

@@ -1,5 +1,5 @@
/* cp.c -- file copying (main routines)
Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation.
Copyright (C) 89, 90, 91, 95, 96, 97, 1998, 1999 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,6 +35,7 @@
#include "cp-hash.h"
#include "copy.h"
#include "error.h"
#include "dirname.h"
#ifndef _POSIX_VERSION
uid_t geteuid ();
@@ -54,7 +55,6 @@ int stat ();
int lstat ();
char *base_name ();
char *dirname ();
enum backup_type get_version ();
void strip_trailing_slashes ();
char *xstrdup ();
@@ -308,7 +308,7 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
src = dirpath + src_offset;
tmp_dst_dirname = dirname (dirpath);
tmp_dst_dirname = dir_name (dirpath);
dst_dirname = (char *) alloca (strlen (tmp_dst_dirname) + 1);
strcpy (dst_dirname, tmp_dst_dirname);
free (tmp_dst_dirname);
@@ -444,7 +444,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
char *arg;
char *ap;
char *dst_path;
int parent_exists = 1; /* True if dirname (dst_path) exists. */
int parent_exists = 1; /* True if dir_name (dst_path) exists. */
struct dir_attr *attr_list;
char *arg_in_concat = NULL;
@@ -460,7 +460,7 @@ do_copy (int argc, char **argv, const struct cp_options *x)
error (1, 0, _("virtual memory exhausted"));
/* For --parents, we have to make sure that the directory
dirname (dst_path) exists. We may have to create a few
dir_name (dst_path) exists. We may have to create a few
leading directories. */
parent_exists = !make_path_private (dst_path,
arg_in_concat - dst_path,
@@ -488,8 +488,8 @@ do_copy (int argc, char **argv, const struct cp_options *x)
}
else
{
int unused;
ret |= copy (arg, dst_path, new_dst, x, &unused, NULL);
int copy_into_self;
ret |= copy (arg, dst_path, new_dst, x, &copy_into_self, NULL);
forget_all ();
if (flag_path)
@@ -655,18 +655,8 @@ main (int argc, char **argv)
break;
case CHAR_MAX + 1:
{
int i;
/* --sparse={never,auto,always} */
i = argmatch (optarg, sparse_type_string);
if (i < 0)
{
invalid_arg (_("sparse type"), optarg, i);
usage (1);
}
x.sparse_mode = sparse_type[i];
}
XARGMATCH (&x.sparse_mode, "--sparse", optarg,
sparse_type_string, sparse_type, usage (1));
break;
case 'a': /* Like -dpR. */

View File

@@ -344,7 +344,10 @@ argument must be a format string beginning with `+'."),
/* Set the system clock to the specified date, then regardless of
the success of that operation, format and print that date. */
if (stime (&when) == -1)
error (0, errno, _("cannot set date"));
{
error (0, errno, _("cannot set date"));
status = 1;
}
}
/* When given a universal time option, set TZ to UTC0 after

View File

@@ -932,7 +932,7 @@ copy_with_unblock (unsigned char *buf, int nread)
/* The main loop. */
static int
copy (void)
dd_copy (void)
{
unsigned char *ibuf, *bufstart; /* Input buffer. */
int nread; /* Bytes read in the current block. */
@@ -1174,7 +1174,7 @@ main (int argc, char **argv)
install_handler (SIGPIPE, interrupt_handler);
install_handler (SIGINFO, siginfo_handler);
exit_status = copy ();
exit_status = dd_copy ();
quit (exit_status);
}

View File

@@ -35,8 +35,8 @@
#include "closeout.h"
#include "error.h"
#include "human.h"
#include "dirname.h"
char *dirname ();
void strip_trailing_slashes ();
char *xstrdup ();
char *xgetcwd ();
@@ -411,7 +411,7 @@ find_mount_point (const char *file, const struct stat *file_stat)
char *dir;
strip_trailing_slashes (tmp);
dir = dirname (tmp);
dir = dir_name (tmp);
free (tmp);
rv = chdir (dir);
free (dir);

View File

@@ -1,5 +1,5 @@
/* expand - convert tabs to spaces
Copyright (C) 89, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 89, 91, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -252,6 +252,10 @@ expand (void)
fp = next_file ((FILE *) NULL);
if (fp == NULL)
return;
/* Binary I/O will preserve the original EOL style (DOS/Unix) of files. */
SET_BINARY2 (fileno (fp), STDOUT_FILENO);
for (;;)
{
c = getc (fp);
@@ -261,7 +265,10 @@ expand (void)
if (fp == NULL)
break; /* No more files. */
else
continue;
{
SET_BINARY2 (fileno (fp), STDOUT_FILENO);
continue;
}
}
if (c == '\n')

View File

@@ -74,6 +74,8 @@ standard output.\n\
-b, --bytes count bytes rather than columns\n\
-s, --spaces break at spaces\n\
-w, --width=WIDTH use WIDTH columns instead of 80\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}

View File

@@ -1,5 +1,5 @@
/* head -- output first part of file(s)
Copyright (C) 89, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 89, 90, 91, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -124,6 +124,9 @@ head_bytes (const char *filename, int fd, U_LONG_LONG bytes_to_write)
char buffer[BUFSIZE];
int bytes_read;
/* Need BINARY I/O for the byte counts to be accurate. */
SET_BINARY2 (fd, fileno (stdout));
while (bytes_to_write)
{
bytes_read = safe_read (fd, buffer, BUFSIZE);
@@ -150,6 +153,9 @@ head_lines (const char *filename, int fd, U_LONG_LONG lines_to_write)
int bytes_read;
int bytes_to_write;
/* Need BINARY I/O for the byte counts to be accurate. */
SET_BINARY2 (fd, fileno (stdout));
while (lines_to_write)
{
bytes_read = safe_read (fd, buffer, BUFSIZE);

View File

@@ -81,6 +81,7 @@
#include "path-concat.h"
#include "cp-hash.h"
#include "copy.h"
#include "dirname.h"
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
@@ -118,16 +119,7 @@ gid_t getgid ();
/* Number of bytes of a file to copy at a time. */
#define READ_SIZE (32 * 1024)
#ifndef UID_T_MAX
# define UID_T_MAX TYPE_MAXIMUM (uid_t)
#endif
#ifndef GID_T_MAX
# define GID_T_MAX TYPE_MAXIMUM (gid_t)
#endif
char *base_name ();
char *dirname ();
int full_write ();
int isdir ();
enum backup_type get_version ();
@@ -193,6 +185,7 @@ static struct option const long_options[] =
{"owner", required_argument, NULL, 'o'},
{"preserve-timestamps", no_argument, NULL, 'p'},
{"backup", no_argument, NULL, 'b'},
{"suffix", required_argument, NULL, 'S'},
{"version-control", required_argument, NULL, 'V'},
{"verbose", no_argument, NULL, 'v'},
{"help", no_argument, &show_help, 1},
@@ -410,7 +403,7 @@ install_file_to_path (const char *from, const char *to,
char *dest_dir;
int fail;
dest_dir = dirname (to);
dest_dir = dir_name (to);
/* check to make sure this is a path (not install a b ) */
if (!STREQ (dest_dir, ".")

View File

@@ -30,6 +30,7 @@
#include "backupfile.h"
#include "closeout.h"
#include "error.h"
#include "dirname.h"
int link (); /* Some systems don't declare this anywhere. */
@@ -58,7 +59,6 @@ int symlink ();
while (0)
char *base_name ();
char *dirname ();
enum backup_type get_version ();
int isdir ();
int yesno ();
@@ -131,8 +131,8 @@ same_name (const char *source, const char *dest)
struct stat dest_dir_stats;
char *source_dirname, *dest_dirname;
source_dirname = dirname (source);
dest_dirname = dirname (dest);
source_dirname = dir_name (source);
dest_dirname = dir_name (dest);
if (source_dirname == NULL || dest_dirname == NULL)
error (1, 0, _("virtual memory exhausted"));

305
src/ls.c
View File

@@ -1,5 +1,5 @@
/* `dir', `vdir' and `ls' directory listing programs for GNU.
Copyright (C) 85, 88, 90, 91, 95, 96, 97, 1998 Free Software Foundation, Inc.
Copyright (C) 85, 88, 90, 91, 95, 96, 97, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -73,10 +73,14 @@
#include "strverscmp.h"
#include "quotearg.h"
#include "filemode.h"
#include "path-concat.h"
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
#define MY_XARGMATCH(Result_ptr, Msg, Arg, Arg_list, Val_list) \
XARGMATCH (Result_ptr, Msg, Arg, Arg_list, Val_list, usage (1))
/* Return an int indicating the result of comparing two integers.
Subtracting doesn't always work, due to overflow. */
#define longdiff(a, b) ((a) < (b) ? -1 : (a) > (b))
@@ -133,11 +137,11 @@ struct bin_str
time_t time ();
#endif
char *base_name ();
char *getgroup ();
char *getuser ();
void strip_trailing_slashes ();
char *xstrdup ();
void invalid_arg ();
static size_t quote_name PARAMS ((FILE *out, const char *name,
struct quoting_options const *options));
@@ -174,7 +178,6 @@ static int decode_switches PARAMS ((int argc, char **argv));
static int file_interesting PARAMS ((const struct dirent *next));
static uintmax_t gobble_file PARAMS ((const char *name, int explicit_arg,
const char *dirname));
static int is_not_dot_or_dotdot PARAMS ((const char *name));
static void print_color_indicator PARAMS ((const char *name, unsigned int mode,
int linkok));
static void put_indicator PARAMS ((const struct bin_str *ind));
@@ -186,7 +189,7 @@ static void extract_dirs_from_files PARAMS ((const char *dirname,
int recursive));
static void get_link_name PARAMS ((const char *filename, struct fileinfo *f));
static void indent PARAMS ((int from, int to));
static void init_col_info PARAMS ((void));
static void init_column_info PARAMS ((void));
static void print_current_files PARAMS ((void));
static void print_dir PARAMS ((const char *name, const char *realname));
static void print_file_name_and_frills PARAMS ((const struct fileinfo *f));
@@ -283,7 +286,7 @@ static enum time_type time_type;
/* print the full time, otherwise the standard unix heuristics. */
int full_time;
static int full_time;
/* The file characteristic to sort by. Controlled by -t, -S, -U, -X, -v. */
@@ -309,7 +312,7 @@ static int sort_reverse;
/* Nonzero means to NOT display group information. -G */
int inhibit_group;
static int inhibit_group;
/* Nonzero means print the user and group id's as numbers rather
than as names. -n */
@@ -352,6 +355,11 @@ static char const *const indicator_style_args[] =
"none", "classify", "file-type", 0
};
static enum indicator_style const indicator_style_types[]=
{
none, classify, file_type
};
/* Nonzero means use colors to mark types. Also define the different
colors as well as the stuff for the LS_COLORS environment variable.
The LS_COLORS variable is now in a termcap-like format. */
@@ -377,11 +385,11 @@ static const char *const indicator_name[]=
"bd", "cd", "mi", "or", "ex", NULL
};
struct col_ext_type
struct color_ext_type
{
struct bin_str ext; /* The extension we're looking for */
struct bin_str seq; /* The sequence to output when we do */
struct col_ext_type *next; /* Next in list */
struct color_ext_type *next; /* Next in list */
};
static struct bin_str color_indicator[] =
@@ -403,7 +411,7 @@ static struct bin_str color_indicator[] =
};
/* FIXME: comment */
struct col_ext_type *col_ext_list = NULL;
static struct color_ext_type *color_ext_list = NULL;
/* Buffer for color sequences */
static char *color_buf;
@@ -544,7 +552,7 @@ static char const *const format_args[] =
"vertical", "single-column", 0
};
static enum format const formats[] =
static enum format const format_types[] =
{
long_format, long_format, with_commas, horizontal, horizontal,
many_per_line, one_per_line
@@ -565,6 +573,45 @@ static char const *const time_args[] =
"atime", "access", "use", "ctime", "status", 0
};
static enum time_type const time_types[] =
{
time_atime, time_atime, time_atime, time_ctime, time_ctime
};
static char const *const color_args[] =
{
/* force and none are for compatibility with another color-ls version */
"always", "yes", "force",
"never", "no", "none",
"auto", "tty", "if-tty", 0
};
static enum color_type const color_types[] =
{
color_always, color_always, color_always,
color_never, color_never, color_never,
color_if_tty, color_if_tty, color_if_tty
};
/* Information about filling a column. */
struct column_info
{
int valid_len;
int line_len;
int *col_arr;
};
/* Array with information about column filledness. */
static struct column_info *column_info;
/* Maximum number of columns ever possible for this display. */
static int max_idx;
/* The minimum width of a colum is 3: 1 character for the name and 2
for the separating white space. */
#define MIN_COLUMN_WIDTH 3
/* This zero-based index is used solely with the --dired option.
When that option is in effect, this counter is incremented for each
character of output generated by this program so that the beginning
@@ -611,46 +658,6 @@ static struct obstack subdired_obstack;
} \
while (0)
static enum time_type const time_types[] =
{
time_atime, time_atime, time_atime, time_ctime, time_ctime
};
static char const *const color_args[] =
{
/* Note: "no" is a prefix of "none" so we don't include it. */
/* force and none are for compatibility with another color-ls version */
"always", "yes", "force",
"never", "none",
"auto", "tty", "if-tty", 0
};
static enum color_type const color_types[] =
{
color_always, color_always, color_always,
color_never, color_never,
color_if_tty, color_if_tty, color_if_tty
};
/* Information about filling a column. */
struct col_info
{
int valid_len;
int line_len;
int *col_arr;
};
/* Array with information about column filledness. */
static struct col_info *col_info;
/* Maximum number of columns ever possible for this display. */
static int max_idx;
/* The minimum width of a colum is 3: 1 character for the name and 2
for the separating white space. */
#define MIN_COLUMN_WIDTH 3
/* Write to standard output PREFIX, followed by the quoting style and
a space-separated list of the integers stored in OS all on one line. */
@@ -660,7 +667,7 @@ dired_dump_obstack (const char *prefix, struct obstack *os)
{
int n_pos;
n_pos = obstack_object_size (os) / sizeof (size_t);
n_pos = obstack_object_size (os) / sizeof (dired_pos);
if (n_pos > 0)
{
int i;
@@ -779,7 +786,8 @@ main (int argc, char **argv)
dired_dump_obstack ("//DIRED//", &dired_obstack);
dired_dump_obstack ("//SUBDIRED//", &subdired_obstack);
printf ("//DIRED-OPTIONS// --quoting-style=%s\n",
quoting_style_args[get_quoting_style (filename_quoting_options)]);
ARGMATCH_TO_ARGUMENT (filename_quoting_options,
quoting_style_args, quoting_style_vals));
}
/* Restore default color before exiting */
@@ -856,9 +864,10 @@ decode_switches (int argc, char **argv)
really_all_files = 0;
ignore_patterns = 0;
/* FIXME: Shouldn't we complain on wrong values? */
if ((p = getenv ("QUOTING_STYLE"))
&& 0 <= (i = argmatch (p, quoting_style_args)))
set_quoting_style (NULL, (enum quoting_style) i);
&& 0 <= (i = ARGCASEMATCH (p, quoting_style_args, quoting_style_vals)))
set_quoting_style (NULL, quoting_style_vals[i]);
human_block_size (getenv ("LS_BLOCK_SIZE"), 0, &output_block_size);
@@ -1093,52 +1102,24 @@ decode_switches (int argc, char **argv)
break;
case 10: /* --sort */
i = argmatch (optarg, sort_args);
if (i < 0)
{
invalid_arg (_("sort type"), optarg, i);
usage (EXIT_FAILURE);
}
sort_type = sort_types[i];
MY_XARGMATCH (&sort_type, "--sort", optarg, sort_args, sort_types);
break;
case 11: /* --time */
i = argmatch (optarg, time_args);
if (i < 0)
{
invalid_arg (_("time type"), optarg, i);
usage (EXIT_FAILURE);
}
time_type = time_types[i];
MY_XARGMATCH (&time_type, "--time", optarg, time_args, time_types);
break;
case 12: /* --format */
i = argmatch (optarg, format_args);
if (i < 0)
{
invalid_arg (_("format type"), optarg, i);
usage (EXIT_FAILURE);
}
format = formats[i];
MY_XARGMATCH (&format, "--format", optarg, format_args, format_types);
break;
case 13: /* --color */
if (optarg)
{
i = argmatch (optarg, color_args);
if (i < 0)
{
invalid_arg (_("colorization criterion"), optarg, i);
usage (EXIT_FAILURE);
}
i = color_types[i];
}
MY_XARGMATCH (&i, "--color", optarg, color_args, color_types);
else
{
/* Using --color with no argument is equivalent to using
--color=always. */
i = color_always;
}
/* Using --color with no argument is equivalent to using
--color=always. */
i = color_always;
print_with_color = (i == color_always
|| (i == color_if_tty
@@ -1154,23 +1135,19 @@ decode_switches (int argc, char **argv)
break;
case 14: /* --indicator-style */
i = argmatch (optarg, indicator_style_args);
if (i < 0)
{
invalid_arg (_("indicator style"), optarg, i);
usage (EXIT_FAILURE);
}
indicator_style = (enum indicator_style) i;
MY_XARGMATCH (&indicator_style, "--indicator-style", optarg,
indicator_style_args,
indicator_style_types);
break;
case 15: /* --quoting-style */
i = argmatch (optarg, quoting_style_args);
if (i < 0)
{
invalid_arg (_("quoting style"), optarg, i);
usage (EXIT_FAILURE);
}
set_quoting_style (NULL, (enum quoting_style) i);
{
enum quoting_style qs;
MY_XARGMATCH (&qs, "--quoting-style", optarg,
quoting_style_args,
quoting_style_vals);
set_quoting_style (NULL, qs);
}
break;
case 16:
@@ -1382,7 +1359,7 @@ get_funky_string (char **dest, const char **src, int equals_end)
*(q++) = *(p++) & 037;
++count;
}
else if ( *p == '?')
else if (*p == '?')
{
*(q++) = 127;
++count;
@@ -1392,7 +1369,7 @@ get_funky_string (char **dest, const char **src, int equals_end)
break;
default:
abort();
abort ();
}
}
@@ -1410,8 +1387,7 @@ parse_ls_color (void)
int state; /* State of parser */
int ind_no; /* Indicator number */
char label[3]; /* Indicator label */
struct col_ext_type *ext; /* Extension we are working on */
struct col_ext_type *ext2; /* Extra pointer */
struct color_ext_type *ext; /* Extension we are working on */
if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0')
return;
@@ -1443,10 +1419,10 @@ parse_ls_color (void)
override an earlier one, which can be useful for
having terminal-specific defs override global). */
ext = (struct col_ext_type *)
xmalloc (sizeof (struct col_ext_type));
ext->next = col_ext_list;
col_ext_list = ext;
ext = (struct color_ext_type *)
xmalloc (sizeof (struct color_ext_type));
ext->next = color_ext_list;
color_ext_list = ext;
++p;
ext->ext.string = buf;
@@ -1510,16 +1486,17 @@ parse_ls_color (void)
if (state < 0)
{
struct col_ext_type *e;
struct color_ext_type *e;
struct color_ext_type *e2;
error (0, 0,
_("unparsable value for LS_COLORS environment variable"));
free (color_buf);
for (e = col_ext_list; e != NULL ; /* empty */)
for (e = color_ext_list; e != NULL; /* empty */)
{
ext2 = e;
e2 = e;
e = e->next;
free (ext2);
free (e2);
}
print_with_color = 0;
}
@@ -1873,6 +1850,16 @@ make_link_path (const char *path, const char *linkname)
}
#endif
/* Return nonzero if base_name (NAME) ends in `.' or `..'
This is so we don't try to recurse on `././././. ...' */
static int
basename_is_dot_or_dotdot (const char *name)
{
char *base = base_name (name);
return DOT_OR_DOTDOT (base);
}
/* Remove any entries from `files' that are for directories,
and queue them to be listed as directories instead.
`dirname' is the prefix to prepend to each dirname
@@ -1884,7 +1871,6 @@ static void
extract_dirs_from_files (const char *dirname, int recursive)
{
register int i, j;
register char *path;
int dirlen;
dirlen = strlen (dirname) + 2;
@@ -1892,7 +1878,7 @@ extract_dirs_from_files (const char *dirname, int recursive)
order. */
for (i = files_index - 1; i >= 0; i--)
if ((files[i].filetype == directory || files[i].filetype == arg_directory)
&& (!recursive || is_not_dot_or_dotdot (files[i].name)))
&& (!recursive || !basename_is_dot_or_dotdot (files[i].name)))
{
if (files[i].name[0] == '/' || dirname[0] == 0)
{
@@ -1900,8 +1886,7 @@ extract_dirs_from_files (const char *dirname, int recursive)
}
else
{
path = (char *) xmalloc (strlen (files[i].name) + dirlen);
attach (path, dirname, files[i].name);
char *path = path_concat (dirname, files[i].name, NULL);
queue_directory (path, files[i].linkname);
free (path);
}
@@ -1918,26 +1903,6 @@ extract_dirs_from_files (const char *dirname, int recursive)
files_index = j;
}
/* Return nonzero if `name' doesn't end in `.' or `..'
This is so we don't try to recurse on `././././. ...' */
static int
is_not_dot_or_dotdot (const char *name)
{
char *t;
t = strrchr (name, '/');
if (t)
name = t + 1;
if (name[0] == '.'
&& (name[1] == '\0'
|| (name[1] == '.' && name[2] == '\0')))
return 0;
return 1;
}
/* Sort the files now in the table. */
static void
@@ -2143,12 +2108,12 @@ print_current_files (void)
break;
case many_per_line:
init_col_info ();
init_column_info ();
print_many_per_line ();
break;
case horizontal:
init_col_info ();
init_column_info ();
print_horizontal ();
break;
@@ -2464,7 +2429,7 @@ static void
print_color_indicator (const char *name, unsigned int mode, int linkok)
{
int type = C_FILE;
struct col_ext_type *ext; /* Color extension */
struct color_ext_type *ext; /* Color extension */
size_t len; /* Length of name */
/* Is this a nonexistent file? If so, linkok == -1. */
@@ -2516,7 +2481,7 @@ print_color_indicator (const char *name, unsigned int mode, int linkok)
len = strlen (name);
name += len; /* Pointer to final \0. */
for (ext = col_ext_list; ext != NULL; ext = ext->next)
for (ext = color_ext_list; ext != NULL; ext = ext->next)
{
if ((size_t) ext->ext.len <= len
&& strncmp (name - ext->ext.len, ext->ext.string,
@@ -2587,7 +2552,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
static void
print_many_per_line (void)
{
struct col_info *line_fmt;
struct column_info *line_fmt;
int filesno; /* Index into files. */
int row; /* Current row. */
int max_name_length; /* Length of longest file name + frills. */
@@ -2611,17 +2576,17 @@ print_many_per_line (void)
for (i = 0; i < max_cols; ++i)
{
if (col_info[i].valid_len)
if (column_info[i].valid_len)
{
int idx = filesno / ((files_index + i) / (i + 1));
int real_length = name_length + (idx == i ? 0 : 2);
if (real_length > col_info[i].col_arr[idx])
if (real_length > column_info[i].col_arr[idx])
{
col_info[i].line_len += (real_length
- col_info[i].col_arr[idx]);
col_info[i].col_arr[idx] = real_length;
col_info[i].valid_len = col_info[i].line_len < line_length;
column_info[i].line_len += (real_length
- column_info[i].col_arr[idx]);
column_info[i].col_arr[idx] = real_length;
column_info[i].valid_len = column_info[i].line_len < line_length;
}
}
}
@@ -2630,11 +2595,11 @@ print_many_per_line (void)
/* Find maximum allowed columns. */
for (cols = max_cols; cols > 1; --cols)
{
if (col_info[cols - 1].valid_len)
if (column_info[cols - 1].valid_len)
break;
}
line_fmt = &col_info[cols - 1];
line_fmt = &column_info[cols - 1];
/* Calculate the number of rows that will be in each column except possibly
for a short column on the right. */
@@ -2666,7 +2631,7 @@ print_many_per_line (void)
static void
print_horizontal (void)
{
struct col_info *line_fmt;
struct column_info *line_fmt;
int filesno;
int max_name_length;
int name_length;
@@ -2689,17 +2654,17 @@ print_horizontal (void)
for (i = 0; i < max_cols; ++i)
{
if (col_info[i].valid_len)
if (column_info[i].valid_len)
{
int idx = filesno % (i + 1);
int real_length = name_length + (idx == i ? 0 : 2);
if (real_length > col_info[i].col_arr[idx])
if (real_length > column_info[i].col_arr[idx])
{
col_info[i].line_len += (real_length
- col_info[i].col_arr[idx]);
col_info[i].col_arr[idx] = real_length;
col_info[i].valid_len = col_info[i].line_len < line_length;
column_info[i].line_len += (real_length
- column_info[i].col_arr[idx]);
column_info[i].col_arr[idx] = real_length;
column_info[i].valid_len = column_info[i].line_len < line_length;
}
}
}
@@ -2708,11 +2673,11 @@ print_horizontal (void)
/* Find maximum allowed columns. */
for (cols = max_cols; cols > 1; --cols)
{
if (col_info[cols - 1].valid_len)
if (column_info[cols - 1].valid_len)
break;
}
line_fmt = &col_info[cols - 1];
line_fmt = &column_info[cols - 1];
pos = 0;
@@ -2799,6 +2764,8 @@ indent (int from, int to)
}
/* Put DIRNAME/NAME into DEST, handling `.' and `/' properly. */
/* FIXME: maybe remove this function someday. See about using a
non-malloc'ing version of path_concat. */
static void
attach (char *dest, const char *dirname, const char *name)
@@ -2820,7 +2787,7 @@ attach (char *dest, const char *dirname, const char *name)
}
static void
init_col_info (void)
init_column_info (void)
{
int i;
int allocate = 0;
@@ -2829,10 +2796,10 @@ init_col_info (void)
if (max_idx == 0)
max_idx = 1;
if (col_info == NULL)
if (column_info == NULL)
{
col_info = (struct col_info *) xmalloc (max_idx
* sizeof (struct col_info));
column_info = (struct column_info *) xmalloc (max_idx
* sizeof (struct column_info));
allocate = 1;
}
@@ -2840,14 +2807,14 @@ init_col_info (void)
{
int j;
col_info[i].valid_len = 1;
col_info[i].line_len = (i + 1) * MIN_COLUMN_WIDTH;
column_info[i].valid_len = 1;
column_info[i].line_len = (i + 1) * MIN_COLUMN_WIDTH;
if (allocate)
col_info[i].col_arr = (int *) xmalloc ((i + 1) * sizeof (int));
column_info[i].col_arr = (int *) xmalloc ((i + 1) * sizeof (int));
for (j = 0; j <= i; ++j)
col_info[i].col_arr[j] = MIN_COLUMN_WIDTH;
column_info[i].col_arr[j] = MIN_COLUMN_WIDTH;
}
}

View File

@@ -1,6 +1,6 @@
/* Compute MD5 checksum of files or strings according to the definition
of MD5 in RFC 1321 from April 1992.
Copyright (C) 95, 96, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,17 +35,18 @@
/* Most systems do not distinguish between external and internal
text representations. */
/* FIXME: This begs for an autoconf test. */
#if UNIX || __UNIX__ || unix || __unix__ || _POSIX_VERSION
# define OPENOPTS(BINARY) "r"
#else
#if O_BINARY
# define OPENOPTS(BINARY) ((BINARY) != 0 ? TEXT1TO1 : TEXTCNVT)
# ifdef MSDOS
# define TEXT1TO1 "rb"
# define TEXTCNVT "r"
# define TEXT1TO1 "rb"
# define TEXTCNVT "r"
#else
# if defined VMS
# define OPENOPTS(BINARY) ((BINARY) != 0 ? TEXT1TO1 : TEXTCNVT)
# define TEXT1TO1 "rb", "ctx=stm"
# define TEXTCNVT "r", "ctx=stm"
# else
# if defined VMS
# define TEXT1TO1 "rb", "ctx=stm"
# define TEXTCNVT "r", "ctx=stm"
# if UNIX || __UNIX__ || unix || __unix__ || _POSIX_VERSION
# define OPENOPTS(BINARY) "r"
# else
/* The following line is intended to evoke an error.
Using #error is not portable enough. */
@@ -106,7 +107,7 @@ Usage: %s [OPTION] [FILE]...\n\
Print or check MD5 checksums.\n\
With no FILE, or when FILE is -, read standard input.\n\
\n\
-b, --binary read files in binary mode\n\
-b, --binary read files in binary mode (default on DOS/Windows)\n\
-c, --check check MD5 sums against given list\n\
-t, --text read files in text mode (default)\n\
\n\
@@ -121,7 +122,7 @@ The sums are computed as described in RFC 1321. When checking, the input\n\
should be a former output of this program. The default mode is to print\n\
a line with checksum, a character indicating type (`*' for binary, ` ' for\n\
text), and name for each FILE.\n"),
program_name, program_name, program_name);
program_name, program_name);
puts (_("\nReport bugs to <bug-textutils@gnu.org>."));
}
@@ -244,6 +245,12 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
{
have_read_stdin = 1;
fp = stdin;
#if O_BINARY
/* If we need binary reads from a pipe or redirected stdin, we need
to switch it to BINARY mode here, since stdin is already open. */
if (binary)
SET_BINARY (fileno (stdin));
#endif
}
else
{
@@ -450,8 +457,14 @@ main (int argc, char **argv)
size_t err = 0;
int file_type_specified = 0;
#if O_BINARY
/* Binary is default on MSDOS, so the actual file contents
are used in computation. */
int binary = 1;
#else
/* Text is default of the Plumb/Lankester format. */
int binary = 0;
#endif
/* Setting values of global variables. */
program_name = argv[0];

View File

@@ -195,7 +195,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
copied-into-self directory, DEST (`b/b' in the example),
and failing. */
dir_to_remove = dest;
dir_to_remove = NULL;
error (0, 0,
_("cannot move `%s' to a subdirectory of itself, `%s'"),
source, dest);
@@ -308,7 +308,9 @@ movefile (char *source, char *dest, int dest_is_dir, const struct cp_options *x)
if (new_dest == NULL)
error (1, 0, _("virtual memory exhausted"));
fail = do_move (source, new_dest, x);
free (new_dest);
/* Do not free new_dest. It may have been squirelled away by
the remember_copied function. */
}
else
{

View File

@@ -50,22 +50,6 @@ typedef double LONG_DOUBLE;
# define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#if defined (_WIN32) && defined (_O_BINARY)
# define WINDOWS_SETFILEMODE_BINARY(IN_STREAM, FILENAME) \
do \
{ /* Turn off DOS text file modes, "rb" doesn't work on stdin. */\
if (_setmode (_fileno ((IN_STREAM)), _O_BINARY) == -1) \
{ \
error (0, errno, "%s", (FILENAME)); \
err = 1; \
continue; \
} \
} \
while (0)
#else
# define WINDOWS_SETFILEMODE_BINARY(IN_STREAM, FILENAME) /* empty */
#endif
/* The default number of input bytes per output line. */
#define DEFAULT_BYTES_PER_BLOCK 16
@@ -978,7 +962,7 @@ skip (off_t n_skip)
continue;
}
}
WINDOWS_SETFILEMODE_BINARY (in_stream, input_filename);
SET_BINARY (fileno (in_stream));
if (n_skip == 0)
break;
@@ -1236,7 +1220,7 @@ read_char (int *c)
err = 1;
}
}
WINDOWS_SETFILEMODE_BINARY (in_stream, input_filename);
SET_BINARY (fileno (in_stream));
}
while (in_stream == NULL);
}
@@ -1309,7 +1293,7 @@ read_block (size_t n, char *block, size_t *n_bytes_in_buffer)
err = 1;
}
}
WINDOWS_SETFILEMODE_BINARY (in_stream, input_filename);
SET_BINARY (fileno (in_stream));
}
while (in_stream == NULL);
}

View File

@@ -472,7 +472,7 @@ static int page_number;
When printing files across (-a flag), ...
1 foo 2 moo 3 goo
4 hoo 3 too 6 zoo
4 hoo 5 too 6 zoo
Otherwise, line numbering is as follows:
1 foo 3 goo 5 too

View File

@@ -1,5 +1,5 @@
/* Permuted index for GNU, with keywords in their context.
Copyright © 1990, 1991, 1993, 1998 Free Software Foundation, Inc.
Copyright © 1990, 1991, 1993, 1998, 1999 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
This program is free software; you can redistribute it and/or modify
@@ -1944,6 +1944,11 @@ static char const* const format_args[] =
"roff", "tex", 0
};
static enum Format const format_vals[] =
{
ROFF_FORMAT, TEX_FORMAT
};
int
main (int argc, char *const argv[])
{
@@ -2059,19 +2064,8 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"),
break;
case 10:
switch (argmatch (optarg, format_args))
{
default:
usage (EXIT_FAILURE);
case 0:
output_format = ROFF_FORMAT;
break;
case 1:
output_format = TEX_FORMAT;
break;
}
XARGMATCH (&output_format, "--format", optarg,
format_args, format_vals, usage (1));
}
}

View File

@@ -51,6 +51,13 @@ typedef enum {false = 0, true = 1} bool;
# endif
#endif
/* On systems with an lstat function that accepts the empty string,
arrange to make lstat calls go through the wrapper function. */
#if HAVE_LSTAT_EMPTY_STRING_BUG
int rpl_lstat PARAMS((const char *, struct stat *));
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
#endif
#ifdef D_INO_IN_DIRENT
# define D_INO(dp) ((dp)->d_ino)
# define ENABLE_CYCLE_CHECK
@@ -63,10 +70,6 @@ typedef enum {false = 0, true = 1} bool;
# define S_ISLNK(Mode) 0
#endif
#define DOT_OR_DOTDOT(Basename) \
(Basename[0] == '.' && (Basename[1] == '\0' \
|| (Basename[1] == '.' && Basename[2] == '\0')))
#if defined strdupa
# define ASSIGN_STRDUPA(DEST, S) \
do { DEST = strdupa(S); } while (0)
@@ -575,12 +578,15 @@ remove_cwd_entries (const struct rm_options *x)
}
while (dirp == NULL);
if (CLOSEDIR (dirp))
if (dirp)
{
error (0, errno, "%s", full_filename ("."));
status = RM_OK;
if (CLOSEDIR (dirp))
{
error (0, errno, "%s", full_filename ("."));
status = RM_ERROR;
}
dirp = NULL;
}
dirp = NULL;
if (ht)
{
@@ -766,7 +772,7 @@ remove_dir (struct File_spec *fs, int need_save_cwd, const struct rm_options *x)
return RM_ERROR;
}
return RM_OK;
return status;
}
/* Remove the file or directory specified by FS after checking appropriate

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