Compare commits

...

453 Commits

Author SHA1 Message Date
Jim Meyering
6efc19263f update from libc 2001-06-18 08:01:38 +00:00
Jim Meyering
6fcc39f7e0 *** empty log message *** 2001-06-17 04:12:05 +00:00
Jim Meyering
f5ad53838f *** empty log message *** 2001-06-17 04:11:21 +00:00
Jim Meyering
50a600c47f Include Makefile.cfg. 2001-06-17 04:11:12 +00:00
Jim Meyering
c784ec50bb New file with package-specific definitions. 2001-06-17 04:11:03 +00:00
Jim Meyering
2ddbd39163 Factor out definitions specific to fileutils,
sh-utils, and textutils, so that other packages can use the framework.
2001-06-17 04:10:49 +00:00
Jim Meyering
4b4de06dbc . 2001-06-16 14:50:37 +00:00
Jim Meyering
30398caa8f *** empty log message *** 2001-06-16 14:32:38 +00:00
Jim Meyering
75660e5da7 *** empty log message *** 2001-06-16 14:29:20 +00:00
Jim Meyering
da4170a71f . 2001-06-16 14:28:07 +00:00
Jim Meyering
01c0d9e91c *** empty log message *** 2001-06-16 13:23:33 +00:00
Jim Meyering
0c8eed4f57 (main): Recheck global print_with_color after calling
parse_ls_color, since that function may have reset it.
Based on a patch from Richard Dawe.
2001-06-16 13:22:43 +00:00
Jim Meyering
dea75949e0 (print_long_format): Don't truncate user names
or group names that are longer than 8 characters.
2001-06-16 13:17:40 +00:00
Jim Meyering
f6a97a1483 . 2001-06-16 11:12:01 +00:00
Jim Meyering
45d73bae97 *** empty log message *** 2001-06-16 11:11:57 +00:00
Jim Meyering
8d948d3ae7 Reflect renaming: s/omni-/core/. 2001-06-16 11:11:48 +00:00
Jim Meyering
8c9c61851e (info_TEXINFOS): Reflect renaming: s/omni-/core/. 2001-06-16 11:08:17 +00:00
Jim Meyering
cfda7b7224 *** empty log message *** 2001-06-16 11:07:44 +00:00
Jim Meyering
0dfd4b7782 renamed from omni-utils.texi 2001-06-16 11:06:49 +00:00
Jim Meyering
8d4c961d53 renamed to coreutils.texi 2001-06-16 11:06:48 +00:00
Jim Meyering
23d0e1c18e *** empty log message *** 2001-06-16 11:06:09 +00:00
Jim Meyering
f1bc30be6f (ls invocation): Mention the effect of locale. 2001-06-16 11:05:30 +00:00
Jim Meyering
6560a8c784 *** empty log message *** 2001-06-16 08:09:13 +00:00
Jim Meyering
a39efe1575 *** empty log message *** 2001-06-11 03:31:12 +00:00
Jim Meyering
98d2a14011 *** empty log message *** 2001-06-11 02:49:20 +00:00
Jim Meyering
88a10b132b Update from GNU libc. 2001-06-11 02:48:14 +00:00
Jim Meyering
1be4401ecb *** empty log message *** 2001-06-10 08:44:56 +00:00
Jim Meyering
d18b37d719 Add a test based on a report from Herbert Xu. 2001-06-10 08:44:49 +00:00
Jim Meyering
3384735e06 *** empty log message *** 2001-06-09 18:45:45 +00:00
Jim Meyering
62e0b734d6 . 2001-06-09 09:01:38 +00:00
Jim Meyering
c31e4314d8 *** empty log message *** 2001-06-09 09:00:29 +00:00
Jim Meyering
2beac10424 Add options to make `who' more POSIX compliant.
Accept new options: --all (-a), --boot (-b), --dead (-d),
--login, --process (-p), --runlevel (-r), --short (-s), --time (-t),
--users (-u).
The -u option now produces POSIX-specified results and is the same as
the long option `--users'.  --idle is no longer the same as -u.
(time_string, print_line, print_boottime, print_deadprocs, print_login,
print_initspawn, print_clockchange, print_runlevel): New functions.
(print_user): Renamed from print_entry and reworked.
(search_entries): Remove function.
(who_am_i): Likewise.
(usage): Describe new options.
(main): Handle new options.
Mostly from Michael Stone.
2001-06-09 09:00:24 +00:00
Jim Meyering
7c976d9485 *** empty log message *** 2001-06-05 08:08:09 +00:00
Jim Meyering
961f6fb0c9 *** empty log message *** 2001-05-27 15:03:43 +00:00
Jim Meyering
e41436072c . 2001-05-27 15:03:29 +00:00
Jim Meyering
d72341c0c8 (main): Add const' to declaration of local, result'. 2001-05-27 15:03:09 +00:00
Jim Meyering
31867cf5cb *** empty log message *** 2001-05-27 13:46:52 +00:00
Jim Meyering
5d896be5dc (UT_TYPE): Define. 2001-05-27 13:46:31 +00:00
Jim Meyering
0e94296ac1 (jm_PREREQ_READUTMP): Check for ut_type in struct utmpx.
Check for ut_type in struct utmp.
2001-05-27 13:45:39 +00:00
Jim Meyering
a99fb13160 . 2001-05-24 22:08:45 +00:00
Jim Meyering
8b4468d407 *** empty log message *** 2001-05-24 22:07:41 +00:00
Jim Meyering
c8f712ac70 Add definitions that let me factor the wget rule while still letting
me accommodate the fact that these files reside in several different
directories and come from different places.

(wget-files): Define.
(get-targets, *-local_dir, *-url_prefix): Likewise.
(target, url, local_file): Convenience variables.
($(get-targets)): The factored rule.
2001-05-24 22:07:35 +00:00
Jim Meyering
a3c3e5dc3b Update from master source. 2001-05-24 21:58:56 +00:00
Jim Meyering
bce3cdb26f *** empty log message *** 2001-05-24 21:58:45 +00:00
Jim Meyering
adb94428ac . 2001-05-24 21:55:49 +00:00
Jim Meyering
1b7ca0aeb7 fix typo 2001-05-24 21:31:08 +00:00
Jim Meyering
8025ccf64d *** empty log message *** 2001-05-24 21:30:27 +00:00
Jim Meyering
c52ca035b1 (move-if-change): Define.
(wget-update): Use it in place of mv.
2001-05-24 21:30:14 +00:00
Jim Meyering
7d6896c0d9 *** empty log message *** 2001-05-24 20:10:36 +00:00
Jim Meyering
0473003f8a (wget-update): Have wget write to a temporary file,
and replace the original only if wget succeeds.
Also get ansi2nkr.c.
2001-05-24 20:10:31 +00:00
Jim Meyering
756e2026fc *** empty log message *** 2001-05-24 20:06:25 +00:00
Jim Meyering
38a7b45e0e Use `#if D_TYPE_IN_DIRENT && defined DTTOIF' to
determine whether to enable the DT_INIT definition, not the less
portable `#if defined _DIRENT_HAVE_D_TYPE || defined DTTOIF'.
Reported by Eli Zaretskii.
2001-05-24 20:06:21 +00:00
Jim Meyering
2ccc189bd6 *** empty log message *** 2001-05-24 08:08:00 +00:00
Jim Meyering
774376d731 (ls invocation): Document more clearly what ls does when given no arguments. 2001-05-24 08:07:54 +00:00
Jim Meyering
418c24dd7e *** empty log message *** 2001-05-24 06:12:07 +00:00
Jim Meyering
908a517100 Include "quote.h".
(argmatch_invalid): Remove explicit `' quotes.  Instead, use the
quote function.  Reported by Gran Uddeborg.
2001-05-24 06:12:00 +00:00
Jim Meyering
97606853e8 *** empty log message *** 2001-05-24 06:08:53 +00:00
Jim Meyering
8636b9323e (main): Remove quotes around %s.
The argument is already quoted via the quote function.
2001-05-24 06:08:33 +00:00
Jim Meyering
574916aa9f *** empty log message *** 2001-05-22 06:56:48 +00:00
Jim Meyering
61e7341926 (_jm_STRFTIME_PREREQS): Don't use AC_LIBOBJ(strftime),
now that we use the package-supplied version unconditionally.
(jm_FUNC_STRFTIME): Don't replace strftime, for the same reason.
2001-05-22 06:56:43 +00:00
Jim Meyering
b0b1bd5ae2 . 2001-05-21 12:39:35 +00:00
Jim Meyering
d736fb1b2c . 2001-05-21 12:38:25 +00:00
Jim Meyering
4893d6c53b . 2001-05-21 12:37:24 +00:00
Jim Meyering
c025720350 *** empty log message *** 2001-05-21 12:35:40 +00:00
Jim Meyering
ee7bb8de6e *** empty log message *** 2001-05-21 12:35:14 +00:00
Jim Meyering
5bb5ceb5a2 ($(DVIS), $(INFO_DEPS)): Depend on $(EXTRA_DIST).
(DISABLED_constants.texi): New rule -- disabled for now.
2001-05-21 12:34:57 +00:00
Jim Meyering
3cbc678ef0 . 2001-05-21 10:53:11 +00:00
Jim Meyering
6f960a3224 *** empty log message *** 2001-05-21 10:52:36 +00:00
Jim Meyering
1053d6cc80 Change a couple backticks to single quotes to avoid shell syntax errors. 2001-05-21 10:52:02 +00:00
Jim Meyering
0352337f1e . 2001-05-21 07:35:22 +00:00
Jim Meyering
d87fc7bc94 *** empty log message *** 2001-05-21 07:05:42 +00:00
Jim Meyering
ca7fc5d683 Add new --time-style option.
Change --full-time to be equivalent to --time-style=full-iso.
2001-05-21 07:05:37 +00:00
Jim Meyering
e204540061 . 2001-05-21 06:59:27 +00:00
Jim Meyering
692f81b371 *** empty log message *** 2001-05-21 06:46:56 +00:00
Jim Meyering
8e1897a33b (jm_AC_DOS): Check for _WIN32, __WIN32__, and __MSDOS__. 2001-05-21 06:46:52 +00:00
Jim Meyering
2c3988dbca *** empty log message *** 2001-05-21 06:36:43 +00:00
Jim Meyering
760d4e6f3a (dir_name): Compute append_dot using path, not newpath
which is not yet declared.
2001-05-21 06:36:36 +00:00
Jim Meyering
52ba9d8815 *** empty log message *** 2001-05-21 05:49:47 +00:00
Jim Meyering
49d1716c11 (wget-update): depcomp and missing are now in automake's lib/ subdirectory. 2001-05-21 05:49:42 +00:00
Jim Meyering
02095a6616 . 2001-05-20 21:09:06 +00:00
Jim Meyering
1926146ed5 Include "hard-locale.h".
(nstrftime): New decl.
(enum time_style): New enum.
(time_style_args, time_style_types): New constants.
(full_time): Remove.
(long_time_format): Initialize to POSIX defaults.
(TIME_STYLE_OPTION): New constant.
(long_options, decode_switches, usage): Add --time-style support.
(long_time_expected_width): Use nstrftime, not strftime.
(print_long_format): Likewise.
Increase initial size to match new full-iso time style.
2001-05-20 20:44:33 +00:00
Jim Meyering
017ada27dd *** empty log message *** 2001-05-20 20:44:08 +00:00
Jim Meyering
f7b3fa35e6 Unset QUOTING_STYLE and TIME_STYLE. Set TZ.
Adjust to change in full-time format.
Fix typo in failure messages (-a and -m were interchanged).
2001-05-20 20:43:52 +00:00
Jim Meyering
c9277ec2a9 *** empty log message *** 2001-05-20 20:41:32 +00:00
Jim Meyering
8b7078eada (my_strftime):
Define to nstrftime if emacs, but only if my_strftime is not defined.
(extra_args, extra_args_spec, extra_args_spec_iso): Rename from
ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively.
Add one more extra argument: a nanoseconds value.
All uses changed.
(ns): New macro.
(my_strftime function): Add %N format.
(emacs_strftimeu): Renamed from emacs_strftime,
with extra ut argument.
2001-05-20 20:41:20 +00:00
Jim Meyering
a917db5ab2 (libfetish_a_SOURCES):
Add strftime.c, since we now compile it on all hosts.
2001-05-20 20:39:28 +00:00
Jim Meyering
8033ceb4ae *** empty log message *** 2001-05-20 20:38:29 +00:00
Jim Meyering
79bb16b328 (jm_FUNC_GNU_STRFTIME):
Don't bother to check library strftime, since
we'll be using our own my_strftime function anyway.
Define my_strftime instead of strftime.
2001-05-20 20:38:25 +00:00
Jim Meyering
ee5f88a66f *** empty log message *** 2001-05-20 18:46:20 +00:00
Jim Meyering
b85edfac45 (parse_obsolescent_option): Accept a b suffix. 2001-05-20 18:46:09 +00:00
Jim Meyering
67785d9d82 . 2001-05-20 18:18:17 +00:00
Jim Meyering
4b532bfa2f (EXTRA_DIST): Add constants.texi and doclicense.texi.
(info_TEXINFOS): s/fileutils/omni-utils/.
(check-texinfo): New rule.
(check): Depend on check-texinfo.
2001-05-20 08:21:05 +00:00
Jim Meyering
175fa8ef06 Make all references to POSIX use @sc{posix}. 2001-05-20 07:24:08 +00:00
Jim Meyering
5f64ac353e . 2001-05-20 07:12:33 +00:00
Jim Meyering
df80cbe561 (uniq invocation): Document the new optional
arguments to the --all-repeated option.
2001-05-20 06:57:37 +00:00
Jim Meyering
c04dab58ad *** empty log message *** 2001-05-20 06:56:32 +00:00
Jim Meyering
62c7564165 Rename new option values: s/all/precede/ and s/minimum/separate/. 2001-05-20 06:56:24 +00:00
Jim Meyering
f251729f7a *** empty log message *** 2001-05-20 06:55:06 +00:00
Jim Meyering
c08d959056 reflect option value renamings 2001-05-20 06:54:05 +00:00
Jim Meyering
1f0fb076ba . 2001-05-19 10:35:01 +00:00
Jim Meyering
352912e2b2 *** empty log message *** 2001-05-19 09:33:08 +00:00
Jim Meyering
43624d4052 (delimit_method_map): Remove trailing comma. 2001-05-19 08:45:13 +00:00
Jim Meyering
43614bef5f *** empty log message *** 2001-05-19 08:44:04 +00:00
Jim Meyering
cfb5f2d82a Test new, --all-repeated options. 2001-05-19 08:43:57 +00:00
Jim Meyering
85601384c9 *** empty log message *** 2001-05-19 07:58:17 +00:00
Jim Meyering
16b0a807af Support new modes for uniq's --all-repeated option.
The default behavior is unchanged.

Include argmatch.h.
(usage): Update.
(check_file): Implement it.
(main): Handle new, optional arguments.
Patch by Padraig Brady.
2001-05-19 07:55:43 +00:00
Jim Meyering
22732cd352 s/GNU text/GNU command line/ ... utilities. 2001-05-19 07:09:30 +00:00
Jim Meyering
12fb893bba s/was/were/ 2001-05-19 06:14:26 +00:00
Jim Meyering
025550c34d *** empty log message *** 2001-05-19 05:58:18 +00:00
Jim Meyering
04c04ad4e9 Change a few uses of timezone' to time zone'. 2001-05-19 05:57:50 +00:00
Jim Meyering
c397b531b7 (my-distcheck): Remove work-around kludge and
associated comment, now that automake has ben fixed.
2001-05-16 08:14:19 +00:00
Jim Meyering
7a9eebbc9c *** empty log message *** 2001-05-16 07:33:31 +00:00
Jim Meyering
cd470239ae Use proper quoting so brackets appear in the test program. 2001-05-16 07:33:22 +00:00
Jim Meyering
531822b168 . 2001-05-16 07:30:54 +00:00
Jim Meyering
f1c7411a97 *** empty log message *** 2001-05-15 15:46:59 +00:00
Jim Meyering
786d944b5e (parse_obsolescent_option): Use t_count_lines, not
count_lines, in error message.
2001-05-15 15:45:58 +00:00
Jim Meyering
8f0403a90f *** empty log message *** 2001-05-15 14:02:28 +00:00
Jim Meyering
bd510c7b11 Use proper quoting so brackets appear in the test program. 2001-05-15 14:02:19 +00:00
Jim Meyering
345f20440e *** empty log message *** 2001-05-15 10:11:19 +00:00
Jim Meyering
9e879e9c09 (struct fileinfo.linkmode): Now st_mode.
(print_color_indicator, print_name_with_quoting, print_type_indicator,
length_of_file_name_and_frills):
Use mode_t, not unsigned int, to store modes.
(dired_dump_obstack): Do not assume size fits in 'int'.
(get_link_name): readlink returns ssize_t, not int.
(make_link_path): Store buffer size as size_t, not int.
(print_long_format): Use unsigned long, not unsigned, to print
nlink_t, uid_t, gid_t, major_t, minor_t.
2001-05-15 10:11:15 +00:00
Jim Meyering
3b6ddee01e *** empty log message *** 2001-05-13 18:24:57 +00:00
Jim Meyering
c2fc3f28dd (major_t, minor_t): Define to unsigned int if undefined. 2001-05-13 18:24:44 +00:00
Jim Meyering
f7eab80b3c *** empty log message *** 2001-05-13 18:23:39 +00:00
Jim Meyering
a8219ddccd (main): Check for NODEV device only if NODEV is defined. 2001-05-13 18:23:05 +00:00
Jim Meyering
b8b5b82220 (NODEV): Remove, undoing previous change. 2001-05-13 18:22:54 +00:00
Jim Meyering
8cc6b069b6 *** empty log message *** 2001-05-13 15:29:21 +00:00
Jim Meyering
a5bd412ed0 (dir_name, dir_len): Define to different names
to avoid shadowing warnings due to new declarations from dirname.h.
2001-05-13 15:29:15 +00:00
Jim Meyering
dad1592217 *** empty log message *** 2001-05-13 15:23:54 +00:00
Jim Meyering
2f7d346fb1 Add new --dereference-command-line option.
-H now means this instead of meaning --si, as POSIX requires.
2001-05-13 15:23:20 +00:00
Jim Meyering
1650fcd3f7 *** empty log message *** 2001-05-13 15:22:28 +00:00
Jim Meyering
cf3a6f7638 (run_tests): Fail if any test name is longer than 12 bytes. 2001-05-13 15:22:23 +00:00
Jim Meyering
f4456619fa Shorten test names so the length of a resulting file name doesn't exceed 14. 2001-05-13 15:21:50 +00:00
Jim Meyering
b1cb63869d Rename slink-dir test to slink-dir-dF. Add new tests
slink-dir-F, slink-dir-dFH, slink-dir-dFL.
2001-05-13 15:14:20 +00:00
Jim Meyering
8bd003b434 (enum Dereference_symlink): New type.
(dereference): New var, replacing trace_links, which was removed.
(long_options, main, decode_switches, gobble_file, usage):
Implement the changes.
2001-05-13 15:14:00 +00:00
Jim Meyering
331635b016 *** empty log message *** 2001-05-13 10:21:25 +00:00
Jim Meyering
271a090daa (NODEV): New macro, if not already defined. 2001-05-13 10:21:08 +00:00
Jim Meyering
9426be56f5 (main): Check for overflow when converting out of uintmax_t.
Do not assume that major_t and minor_t are no wider than int.
Check for makedev failures.  Convert device numbers via uintmax_t, not
unsigned long, just in case.  Coalesce duplicate code in the block and
character device cases.
2001-05-13 10:20:36 +00:00
Jim Meyering
ed582f5612 . 2001-05-12 20:55:19 +00:00
Jim Meyering
e364b0d6b8 *** empty log message *** 2001-05-12 16:06:36 +00:00
Jim Meyering
2227cb6a07 Include "dirname.h".
(base_name): Remove decl; now in dirname.h.
2001-05-12 16:05:51 +00:00
Jim Meyering
04a872f0d3 Include "dirname.h".
(base_name, strip_trailing_slashes): Remove decls; now in dirname.h.
(main): Use base_len instead of strip_trailing_slashes to strip
trailing slashes.
2001-05-12 16:05:12 +00:00
Jim Meyering
992b068bd2 (strip_trailing_slashes): Remove decl; now in dirname.h.
(main): Use dir_len rather than dir_name_r.
2001-05-12 16:03:19 +00:00
Jim Meyering
d8535172f6 *** empty log message *** 2001-05-12 15:50:50 +00:00
Jim Meyering
b6678c419b (ISSLASH): Remove; now in dirname.h.
(strip_trailing_slashes): Return nonzero if
a slash was stripped.  Do not strip the last slash after a
file system prefix.
2001-05-12 15:50:27 +00:00
Jim Meyering
8989b5b65c (base_name): Remove; now in dirname.h.
(STREQ): Remove.
(same_name): Handle the case where the basename ends in trailing '/'.
2001-05-12 15:48:00 +00:00
Jim Meyering
dbe66b162b (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN): New macros.
(base_name, base_len, dir_len, strip_trailing_slashes): New decls.
2001-05-12 15:46:36 +00:00
Jim Meyering
f6e82b7dea (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH): Remove; now in dirname.h.
(path_concat): Use base_len to compute
base length, not strlen; this means we cannot rely on memcpy
to null-terminate.
2001-05-12 15:45:43 +00:00
Jim Meyering
1450c855b6 Use "", not <> to include non-system header files. 2001-05-12 15:41:11 +00:00
Jim Meyering
3c9e00c4fd Use "", not <> to include non-system header files. 2001-05-12 15:40:47 +00:00
Jim Meyering
e149a84b32 Use "", not <> to include dirname.h. 2001-05-12 15:39:45 +00:00
Jim Meyering
521f5344c8 (FILESYSTEM_PREFIX_LEN, ISSLASH): Remove; now in dirname.h.
Include <string.h> instead of <stdlib.h>.
Do not include <assert.h>; no longer needed.
Include xalloc.h.
(memrchr): Remove decl.
(dir_name_r): Remove.
(dir_len): Renamed from dirlen.  All callers changed.
Rewrite in terms of base_name, for simplicity and consistency.
(dir_name): Never return NULL.  All callers changed.
Do not include <stdlib.h> in test program; no longer needed.
return 0; is fine for test program.
2001-05-12 15:38:00 +00:00
Jim Meyering
4b8000742f (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Remove; now in dirname.h.
Do not include <stdio.h>, <assert.h>; no longer needed.
Include <string.h>, <dirname.h>.
(base_name): Allow file names ending in slashes, other than names
that are all slashes.  In this case, return the basename followed
by the slashes.  This is more general, and can be used in places
where the original base_name purposely had an assertion failure.
(base_len): New function.
2001-05-12 14:23:49 +00:00
Jim Meyering
9ce2d23774 (base_name): Remove; now in dirname.h.
Include <dirname.h> after size_t is defined.
(find_backup_file_name, max_backup_version): Use base_len instead of
rolling it ourselves.
Handle the case of "" and (on DOS) "C:" correctly.
2001-05-12 14:20:43 +00:00
Jim Meyering
d45e530c21 (ISSLASH, base_name): Remove; now in dirname.h.
Include <dirname.h> after size_t is defined.

(addext): Use base_len to trim redundant
trailing slashes instead of doing it ourselves.
But do not trim the last slash if it is not redundant.
2001-05-12 14:13:36 +00:00
Jim Meyering
1fecbd7863 Include dirname.h.
(strip_trailing_slashes): Remove decl; now in dirname.h.
2001-05-12 10:05:42 +00:00
Jim Meyering
bef1bc6137 Include dirname.h.
(strip_trailing_slashes): Remove decl; now in dirname.h.
2001-05-12 10:05:15 +00:00
Jim Meyering
daa8b2b1a3 . 2001-05-12 10:04:13 +00:00
Jim Meyering
37f9f5ed29 *** empty log message *** 2001-05-12 10:03:16 +00:00
Jim Meyering
b4c2f799ec (strip_trailing_slashes): Likewise.
(find_mount_point): No need to strip trailing
slashes before invoking new dir_name.
2001-05-12 10:03:07 +00:00
Jim Meyering
98e643ab3b (strip_trailing_slashes): Remove; now in dirname.h.
(make_path_private): Use dir_len instead of
dir_name, and avoid an extra mealloc call.
2001-05-12 10:00:52 +00:00
Jim Meyering
b2604c5d12 (copy_internal): Remove the code that tested for NULL
dir_name return value.  That can't happen.
2001-05-12 09:58:03 +00:00
Jim Meyering
b489ba12d8 Include "dirname.h".
(strip_trailing_slashes_2): Remove; now done by
strip_trailing_slashes.  All callers changed.
2001-05-12 09:54:19 +00:00
Jim Meyering
966d1cd6e6 (base_name): Remove decl; now in dirname.h. 2001-05-12 09:53:45 +00:00
Jim Meyering
99fa315bf8 Include dirname.h, to get base_name 2001-05-12 09:52:56 +00:00
Jim Meyering
7ed10357bc include dirname.h. 2001-05-12 09:51:59 +00:00
Jim Meyering
4a94a06aa6 (strip_trailing_slashes): Remove declaration; now in dirname.h. 2001-05-12 09:51:23 +00:00
Jim Meyering
c29cb48a98 Wording changes related to -o, -n, and -g. 2001-05-12 08:44:31 +00:00
Jim Meyering
2034cba6f7 (usage): Minor wording changes related to -o, -n, and -g.
From Paul Eggert.
2001-05-12 08:23:23 +00:00
Jim Meyering
8e3f835a46 *** empty log message *** 2001-05-12 08:10:33 +00:00
Jim Meyering
b338208678 *** empty log message *** 2001-05-12 08:04:52 +00:00
Jim Meyering
ba94ef5b1b (mode_changed, change_file_mode):
There's no need to invoke both lstat and stat here, so call just
one of the two functions.
2001-05-12 08:04:44 +00:00
Jim Meyering
1af93e3d71 . 2001-05-11 14:06:22 +00:00
Jim Meyering
5848516f26 (shred invocation): Warn about backups and mirrors. 2001-05-11 11:23:37 +00:00
Jim Meyering
a46bcc4636 (usage): Warn about backups and mirrors. 2001-05-11 11:23:24 +00:00
Jim Meyering
e8256c3c7c s/POSIX/posix/ 2001-05-11 10:38:56 +00:00
Jim Meyering
22f4434076 remove trailing spaces 2001-05-11 10:38:23 +00:00
Jim Meyering
500f90eab5 fix typo: missing `r}' in this line:
@itemx --temporary-directory=@var{tempdir}
2001-05-11 10:38:13 +00:00
Jim Meyering
902a2a5d7a shift off the leading `_' 2001-05-11 09:14:22 +00:00
Jim Meyering
677cb6c6a9 Factor out the root-only test into this ...
Source ../root-only instead.
2001-05-11 09:10:09 +00:00
Jim Meyering
c08bfa1060 *** empty log message *** 2001-05-11 08:19:41 +00:00
Jim Meyering
f49ad025e6 (shred invocation): Warn about backups. From Nelson Beebe. 2001-05-11 08:18:18 +00:00
Jim Meyering
e57fb62f7f add a space after a period
(true invocation): fix a typo
2001-05-11 07:53:44 +00:00
Jim Meyering
0246568205 s/restriction deletion flag
/restricted deletion flag/
2001-05-11 07:36:22 +00:00
Jim Meyering
71477a1aa8 . 2001-05-11 07:22:53 +00:00
Jim Meyering
45cb2385d5 *** empty log message *** 2001-05-10 14:28:42 +00:00
Jim Meyering
dd4aedd1d3 (main): Fix thinko: s/argv[optind]/optarg/. 2001-05-10 14:25:48 +00:00
Jim Meyering
1bb999e519 *** empty log message *** 2001-05-09 09:16:08 +00:00
Jim Meyering
78c7e1f60b (jm_MACROS): Do not check for fseeko; no longer used. 2001-05-09 09:16:03 +00:00
Jim Meyering
30aa344399 *** empty log message *** 2001-05-07 20:21:18 +00:00
Jim Meyering
90ce79ff92 tweak diagnostic 2001-05-05 17:32:40 +00:00
Jim Meyering
b5063eb63b (decode_switches): Complain if the envvar, QUOTING_STYLE,
is set to an invalid value.
Move some declarations of locals into scopes where they're used.
2001-05-05 17:31:45 +00:00
Jim Meyering
e67563e822 *** empty log message *** 2001-05-05 14:29:38 +00:00
Jim Meyering
56a458164e (print_owner): New global variable.
(usage): Update the description of -g.
(decode_switches): Honor the -g option (omit owner information),
now that POSIX specifies it.
(print_long_format): Don't print owner name if -g was specified.
Move declaration of `user_name' into the scope where it's used.
(print_group): Rename global from `inhibit_group'.  Update all
uses accordingly.

(decode_switches): Make -n work just like -l, except
with numeric IDs, per POSIX.  Before, to have any effect, -n had
to be used with -l.  Reported by Dale Scheetz.
(usage): Update the description of -n.
Separate the descriptions of -n and --numeric-uid-gid.
Split string in --help output that had exceeded my limit of 2048 bytes.
2001-05-05 14:29:02 +00:00
Jim Meyering
fb87a6052f *** empty log message *** 2001-05-05 12:54:46 +00:00
Jim Meyering
204c08e9fa (usage): Correct description of -3. 2001-05-05 12:54:37 +00:00
Jim Meyering
69d4a38c4e *** empty log message *** 2001-05-05 12:54:16 +00:00
Jim Meyering
246d5a99d3 Update from master repository. 2001-05-02 09:52:32 +00:00
Jim Meyering
49313f9a74 (tgz-size, xd-size): Compute sizes.
(announcement): Include sizes of .tar.gz and .xdelta files
in the announcement.
2001-05-02 08:09:14 +00:00
Jim Meyering
29e3c2e97f *** empty log message *** 2001-04-29 21:22:52 +00:00
Jim Meyering
e2003b82ff *** empty log message *** 2001-04-29 20:50:48 +00:00
Jim Meyering
047056d4fb *** empty log message *** 2001-04-29 20:49:11 +00:00
Jim Meyering
bbcf9c36cf *** empty log message *** 2001-04-29 11:33:44 +00:00
Jim Meyering
c8de6584bb --help:
downcase bulleted items
remove some periods
2001-04-29 11:22:48 +00:00
Jim Meyering
d463885c24 *** empty log message *** 2001-04-29 08:36:21 +00:00
Jim Meyering
e54944039a *** empty log message *** 2001-04-29 07:02:17 +00:00
Jim Meyering
6b647033ce (usage): Include in --help output the warning about
some of the filesystem types on which shred is not effective.
2001-04-29 07:01:41 +00:00
Jim Meyering
c8576c4f8c (usage): Mention shred. 2001-04-29 07:01:22 +00:00
Jim Meyering
56ee0fa636 Refer to shred.
Remove the example showing how to remove `-foo', since that is now
in the --help output (and hence automatically included).
2001-04-29 07:01:12 +00:00
Jim Meyering
b8926b07cc *** empty log message *** 2001-04-25 12:30:56 +00:00
Jim Meyering
41971a1eaa (my-distcheck): Add a comment. 2001-04-25 12:30:52 +00:00
Jim Meyering
6438d68006 *** empty log message *** 2001-04-25 08:27:16 +00:00
Jim Meyering
1efb4218a7 *** empty log message *** 2001-04-24 07:21:14 +00:00
Jim Meyering
0af0ad2493 *** empty log message *** 2001-04-24 07:16:45 +00:00
Jim Meyering
d2e9866f3c Include wheel-size.h.
(WHEEL_START): Adjust definition.
(wheel_tab[]): Remove body of definition.
Include generated file, wheel.h, instead.
2001-04-24 07:16:28 +00:00
Jim Meyering
23cc993dad . 2001-04-24 07:07:29 +00:00
Jim Meyering
bf0d2aac15 *** empty log message *** 2001-04-23 07:38:44 +00:00
Jim Meyering
cc3ea7c99f (dd_copy): When using sync with either block or unblock,
pad with spaces.
2001-04-23 07:38:33 +00:00
Jim Meyering
2afd912ce5 *** empty log message *** 2001-04-23 07:33:37 +00:00
Jim Meyering
a8737499b5 (block-sync-1): new test, for just-fixed bug 2001-04-23 07:31:17 +00:00
Jim Meyering
5d133efc26 *** empty log message *** 2001-04-22 21:37:36 +00:00
Jim Meyering
fae5972a38 fix typo in comment 2001-04-22 21:35:11 +00:00
Jim Meyering
b17fce4fa4 (decode_switches): Ensure that -1 has no effect when it follows -l. 2001-04-22 21:34:20 +00:00
Jim Meyering
c582df59bf *** empty log message *** 2001-04-22 16:52:23 +00:00
Jim Meyering
4451bd8a9f . 2001-04-22 16:50:47 +00:00
Jim Meyering
493d736f7d fix typo in --help output 2001-04-22 11:44:56 +00:00
Jim Meyering
782f4e9842 *** empty log message *** 2001-04-22 10:14:20 +00:00
Jim Meyering
8fb784af90 *** empty log message *** 2001-04-22 10:12:59 +00:00
Jim Meyering
fa9d5f6445 *** empty log message *** 2001-04-22 10:12:25 +00:00
Jim Meyering
e55708d43c . 2001-04-22 10:09:21 +00:00
Jim Meyering
b628469832 *** empty log message *** 2001-04-22 09:16:14 +00:00
Jim Meyering
e222fda574 (main): Fix off-by-one error introduced with last change. 2001-04-22 09:15:17 +00:00
Jim Meyering
2e1f0f43f0 check -R, too 2001-04-22 09:14:14 +00:00
Jim Meyering
d9a0e2c715 *** empty log message *** 2001-04-22 09:11:08 +00:00
Jim Meyering
7394867950 *** empty log message *** 2001-04-22 09:10:29 +00:00
Jim Meyering
f27f72bd6d *** empty log message *** 2001-04-22 09:08:53 +00:00
Jim Meyering
2fb7f1e3c1 (TESTS): Add no-arg. 2001-04-22 09:08:45 +00:00
Jim Meyering
b9a9796da6 *** empty log message *** 2001-04-22 08:31:40 +00:00
Jim Meyering
519b707b4e Fix bugs when computing length of large files.
Add overflow and write error checks.  Use uint_fast32_t, not
unsigned long, to do checksum calculation, as C99 says
uint_fast32_t should be no slower and might be faster.

Include <stdio.h> and "system.h" even if CRCTAB is defined,
so that the code will compile if CRCTAB is defined.
Include "human.h" if CRCTAB is not defined.
(uint_fast32_t): Define if it appears that stdint.h didn't.
(BIT, remainder, main, crctab): Use uint_fast32_t, not unsigned long,
for checksums.
(fill_r, remainder, main): Use ANSI prototypes.
(fill_r, remainder, main): Omit duplicate code.
(main): Use uintmax_t, not unsigned long, for file lengths.
Use size_t, not long, for result of fread.
Check for overflow when computing file lengths.
Check for write error immediately after printing a line, so that
we don't write to stdout indefinitely after an error.
2001-04-22 08:31:24 +00:00
Jim Meyering
2d0f3f2e74 *** empty log message *** 2001-04-22 07:29:13 +00:00
Jim Meyering
f553273be8 (usage): Mention that sync makes dd pad with spaces (rather than NULs)
when used with block or unblock.
2001-04-22 07:28:58 +00:00
Jim Meyering
096c85ad5f *** empty log message *** 2001-04-22 07:28:11 +00:00
Jim Meyering
1743aa2657 *** empty log message *** 2001-04-21 18:26:19 +00:00
Jim Meyering
24e7d36a6a *** empty log message *** 2001-04-21 17:52:02 +00:00
Jim Meyering
9404b5a3fb Write to a new file, so that a restrictive umask doesn't interfere. 2001-04-21 17:51:46 +00:00
Jim Meyering
f6a99b1551 *** empty log message *** 2001-04-21 14:39:33 +00:00
Jim Meyering
5f8d1a3d0b *** empty log message *** 2001-04-21 14:39:14 +00:00
Jim Meyering
957b608418 *** empty log message *** 2001-04-21 14:36:32 +00:00
Jim Meyering
2fca663e2f Ensure that initial group id's are properly set for d' and d/f3'. 2001-04-21 14:36:20 +00:00
Jim Meyering
8c65bdf194 *** empty log message *** 2001-04-21 14:08:04 +00:00
Jim Meyering
9c52203523 Check for chsize.
Link with ftruncate.o unconditionally if ftruncate is missing.
This was required when cross-compiling to i586-mingw32msvc.
2001-04-21 14:08:00 +00:00
Jim Meyering
7f9d95c41d . 2001-04-21 10:22:34 +00:00
Jim Meyering
9074a69e21 *** empty log message *** 2001-04-21 10:04:15 +00:00
Jim Meyering
2768c3dfc4 *** empty log message *** 2001-04-21 10:01:29 +00:00
Jim Meyering
500ac13ddf *** empty log message *** 2001-04-21 09:49:09 +00:00
Jim Meyering
e1e14bdb38 (main): When given two or more arguments but the only one
that exists is a directory, don't treat it as if it were the only
argument.  Before, `mkdir d; ls no-dir d 2>/dev/null' would act like
`ls d' and produce no output.  Now, it prints `d:'.
2001-04-21 09:47:39 +00:00
Jim Meyering
9ea67a3c6f *** empty log message *** 2001-04-21 08:45:20 +00:00
Jim Meyering
30b3f9a1c1 tests for latest fix 2001-04-21 08:41:38 +00:00
Jim Meyering
48456d1d61 *** empty log message *** 2001-04-20 17:33:48 +00:00
Jim Meyering
45c6397848 (false invocation): Describe how --help and
--version are treated with and without POSIXLY_CORRECT.
(true invocation): Likewise.
2001-04-20 17:33:43 +00:00
Jim Meyering
50d41186a4 *** empty log message *** 2001-04-15 05:58:42 +00:00
Jim Meyering
4b9aaf267e (default_sort_size): Leave a 1/16 margin for RSS. 2001-04-15 05:58:33 +00:00
Jim Meyering
9d3cbe12bd *** empty log message *** 2001-04-14 06:43:30 +00:00
Jim Meyering
868e467701 (usage): Tweak --help output: s/line,/newline,/ 2001-04-14 06:43:24 +00:00
Jim Meyering
dfbabfe758 *** empty log message *** 2001-04-13 20:33:37 +00:00
Jim Meyering
21049673a0 (main): Add a comment justifying the use of
`multi-character' rather than `multibyte' in a diagnostic.
2001-04-13 20:33:32 +00:00
Jim Meyering
3de0ead1ef *** empty log message *** 2001-04-13 07:16:35 +00:00
Jim Meyering
66b1f79fb0 (RLIMIT_AS): Do not define; just use conditional
code, since RLIMIT_RSS is similar (and is not standardized).
(default_sort_size): Don't allocate more than the RSS limit,
if this host has such a limit.
2001-04-13 07:15:06 +00:00
Jim Meyering
f9b3e59ae5 *** empty log message *** 2001-04-08 20:00:14 +00:00
Jim Meyering
b7cd544ce5 that's necessary when the offset spans a DST transition. 2001-04-08 19:58:59 +00:00
Jim Meyering
8e94dcc2c6 *** empty log message *** 2001-04-08 17:16:39 +00:00
Jim Meyering
c73e54a8ad *** empty log message *** 2001-04-08 08:25:35 +00:00
Jim Meyering
5bd7ca3781 *** empty log message *** 2001-04-04 14:50:53 +00:00
Jim Meyering
f164f70523 Don't inspect MB_LEN_MAX. Paul Eggert says it's
not always defined correctly.
2001-04-04 14:50:47 +00:00
Jim Meyering
b22ba791cb *** empty log message *** 2001-04-02 12:38:49 +00:00
Jim Meyering
4435f69035 Skip nonexistent directories. 2001-04-02 12:37:38 +00:00
Jim Meyering
46e9ed6beb Include <getopt.h>.
(usage, main): Add support for long options, and check option
syntax as POSIX requires, though (as usual for GNU apps)
options can follow file names unless POSIXLY_CORRECT is set.
Many diagnostic revamped.
(long_options): New constant.
(badfieldspec): New arg MSGID.  Mark as noreturn.
(parse_field_count): New arg MSGID; if null, just return null on error.
(new_key): Renamed from key_init.  All callers changed.  Now allocates
the new key.
2001-04-02 09:02:23 +00:00
Jim Meyering
3c0e576c6d Update from GNU libc. 2001-04-02 08:31:28 +00:00
Jim Meyering
e1aa041f5e *** empty log message *** 2001-04-02 08:31:22 +00:00
Jim Meyering
924bbfab87 . 2001-04-01 21:28:27 +00:00
Jim Meyering
f9b5d8621a *** empty log message *** 2001-03-24 10:36:33 +00:00
Jim Meyering
7982727372 Require autoconf-2.49d. 2001-03-24 10:35:18 +00:00
Jim Meyering
29a8fa8694 Document --, -, sort long options, and sort -o after files. 2001-03-24 09:18:04 +00:00
Jim Meyering
d8f340e664 *** empty log message *** 2001-03-24 08:50:50 +00:00
Jim Meyering
bda130b531 (jm_ICONV): Recommend GNU libiconv. 2001-03-24 08:50:21 +00:00
Jim Meyering
8fae90bd5b *** empty log message *** 2001-03-23 22:25:02 +00:00
Jim Meyering
bec0525334 *** empty log message *** 2001-03-23 22:22:46 +00:00
Jim Meyering
ca2b5b72fd *** empty log message *** 2001-03-23 22:22:21 +00:00
Jim Meyering
e2b4a506f6 (check-copyright): New target and rule.
(alpha): Depend on it.
2001-03-23 22:22:14 +00:00
Jim Meyering
c9cab79e76 *** empty log message *** 2001-03-23 22:20:16 +00:00
Jim Meyering
b34fc0c6fc *** empty log message *** 2001-03-20 20:40:34 +00:00
Jim Meyering
3d1bf08703 *** empty log message *** 2001-03-19 11:59:55 +00:00
Jim Meyering
3aab98bf96 (version_etc_copyright): Update to 2001. 2001-03-19 11:52:29 +00:00
Jim Meyering
0e06c2e22e *** empty log message *** 2001-03-18 22:13:09 +00:00
Jim Meyering
6f634593ab *** empty log message *** 2001-03-18 16:55:12 +00:00
Jim Meyering
52e8da0bc2 *** empty log message *** 2001-03-18 16:54:25 +00:00
Jim Meyering
46c7196039 If the $DJDIR envvar is defined, set SHELL
to $DJDIR/bin/bash.exe.  Patch from Richard Dawe, based on a
suggestion from Eli Zaretskii.
2001-03-18 16:53:58 +00:00
Jim Meyering
b73e91b1d4 *** empty log message *** 2001-03-18 16:50:20 +00:00
Jim Meyering
c7007e30a5 *** empty log message *** 2001-03-18 07:54:48 +00:00
Jim Meyering
94713349b1 *** empty log message *** 2001-03-18 07:54:29 +00:00
Jim Meyering
236b06bc29 (usage): Warn that the +N form will be withdrawn. 2001-03-18 07:54:19 +00:00
Jim Meyering
426d1b07d1 (usage): Warn that the +N form will be withdrawn. 2001-03-18 07:53:14 +00:00
Jim Meyering
6b8cfeea5b Warn that the +N form will be withdrawn. 2001-03-18 07:51:15 +00:00
Jim Meyering
1c0ab47708 *** empty log message *** 2001-03-18 07:30:29 +00:00
Jim Meyering
b9154ca314 Add the standard $VERBOSE-handling hook.
This test currently fails for mips-dec-ultrix4.4.
2001-03-17 22:30:24 +00:00
Jim Meyering
543d2fa8ec *** empty log message *** 2001-03-17 22:30:15 +00:00
Jim Meyering
69df1f32a9 *** empty log message *** 2001-03-17 22:16:01 +00:00
Jim Meyering
10a6b91082 Use ../envvar-check rather than open-coding the same tests. 2001-03-17 22:15:54 +00:00
Jim Meyering
d6a685271c Set/use $as_unset, for those shells
(like Ultrix4's /bin/sh) that don't accept `unset'.
2001-03-17 22:12:03 +00:00
Jim Meyering
c5e168c034 *** empty log message *** 2001-03-17 10:14:52 +00:00
Jim Meyering
f12de0bcd8 (usage): Tweak the obsolescent usage line so that
help2man recognizes it as such.
2001-03-17 10:14:29 +00:00
Jim Meyering
b8f309cf14 *** empty log message *** 2001-03-17 10:10:06 +00:00
Jim Meyering
19f9ab1fdb Document pr changes. 2001-03-17 08:57:49 +00:00
Jim Meyering
726edc8172 Document pr changes. 2001-03-17 08:54:37 +00:00
Jim Meyering
7847d32de2 *** empty log message *** 2001-03-17 08:54:21 +00:00
Jim Meyering
24c9a6c7cd (install-data-yes): Install LC_TIME locale
for all packages, not just for fileutils.
(uninstall): Remove LC_TIME locale too.
2001-03-17 08:53:58 +00:00
Jim Meyering
9f9610d983 (INT_STRLEN_BOUND): New macro. 2001-03-17 08:50:51 +00:00
Jim Meyering
1499642b50 Adjust to minor spacing changes in pr headers. 2001-03-17 08:49:25 +00:00
Jim Meyering
ca0659ab9a Include mbswidth.h.
(standard_header, header, test_suite): Remove.
(date_format, date_text, file_text, header_width_available): New vars.
(long_options, main, init_header, usage):
Add new -D or --date-format option.
(CHARS_FOR_DATE_AND_PAGE, T_BUF_FMT, T_BUF_SIZE, NO_DATE): Remove.
(init_header): Allow arbitrary width for date format.  Change
"Page %5d" to "Page %d", since the code no longer assumes fixed width.
Do not assume that localtime succeeds.
(init_header, print_header, usage): Do not truncate headers.
(init_header, print_header): Defer width calculations until
page is printed, since "Page 100000" is wider than "Page 1".
Count columns, not bytes, in page headers.
Custom headers take up only the center, not the whole header.
(print_header): Use printf rather than fprintf(stdout).
2001-03-17 08:48:23 +00:00
Jim Meyering
6fa00f67da *** empty log message *** 2001-03-16 23:42:21 +00:00
Jim Meyering
285c128eab *** empty log message *** 2001-03-16 23:41:08 +00:00
Jim Meyering
06d3fd68cd Remove my copy of AC_FUNC_MEMCMP, now that
the version in autoconf has been updated.
(jm_FUNC_MEMCMP): Adjust.
2001-03-16 23:40:10 +00:00
Jim Meyering
be36cc026f *** empty log message *** 2001-03-16 17:01:17 +00:00
Jim Meyering
79b030e317 (jm_PREREQ_ERROR): Invoke AC_FUNC_STRERROR_R. 2001-03-16 17:01:11 +00:00
Jim Meyering
0a0306d149 (jm_PREREQ): Add jm_PREREQ_TEMPNAME.
(jm_PREREQ_TEMPNAME): New function.
2001-03-16 16:38:52 +00:00
Jim Meyering
fdc624ee8c *** empty log message *** 2001-03-16 12:02:29 +00:00
Jim Meyering
75b98a1845 (uint64_t): Define to uintmax_t if
not defined, and if UINT64_MAX is not defined.
Required at least for Vax Ultrix4.3, which doesn't define uint64_t.
Reported by John David Anglin.
2001-03-16 12:02:22 +00:00
Jim Meyering
46703b2bc4 *** empty log message *** 2001-03-16 08:40:42 +00:00
Jim Meyering
e72d2e5729 (wget-update): Also get `missing'.
Use for-loops.
2001-03-16 08:40:38 +00:00
Jim Meyering
b983106f60 *** empty log message *** 2001-03-16 08:37:07 +00:00
Jim Meyering
945ef37057 *** empty log message *** 2001-03-15 14:50:26 +00:00
Jim Meyering
7164873b95 (BeOS): Use wildcard syntax. 2001-03-15 14:50:16 +00:00
Jim Meyering
a5d6ae87e0 (locale_charset): Allow wildcard syntax. Also resolve
alias if codeset is empty.
2001-03-15 14:49:56 +00:00
Jim Meyering
1341235a1c *** empty log message *** 2001-03-13 15:57:21 +00:00
Jim Meyering
35e76078e7 (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]:
Don't insert a backslash when concatenating e.g., `C:' and `foo'.
From Bruno Haible.
2001-03-13 15:57:15 +00:00
Jim Meyering
4d44d31bd9 *** empty log message *** 2001-03-13 09:05:26 +00:00
Jim Meyering
be696e072e (die): New message arg, to describe failures
better.  All callers changed.
2001-03-13 09:05:21 +00:00
Jim Meyering
8da0422f17 *** empty log message *** 2001-03-13 09:02:37 +00:00
Jim Meyering
48440e9d01 Decrease buffer size when only merging or checking.
(sort_size): Now the user-specified sort size.
(MIN_MERGE_BUFFER_SIZE): New macro.
(MIN_SORT_SIZE): Use it.
(merge_buffer_size): New variable.
(fillbuf): Increase merge_buffer_size if a longer line is encountered.
(checkfp, mergefps): Do not allocate a buffer smaller than
merge_buffer_size.
(sort): Use the default_sort_size if sort_size is zero.
(main): Do not set sort_size to default_sort_size.
2001-03-13 09:02:27 +00:00
Jim Meyering
6a6ca8f365 *** empty log message *** 2001-03-13 08:50:32 +00:00
Jim Meyering
5fface8d3a . 2001-03-13 08:50:18 +00:00
Jim Meyering
7eaaae4ec0 (create-empty): New test. 2001-03-13 08:49:48 +00:00
Jim Meyering
811ade5514 (sort): If all the input files are empty, create an empty output file. 2001-03-13 08:48:57 +00:00
Jim Meyering
593d17ffe4 (merge): Move declarations of local variables into
the inner scope where they're used.
(sort): Likewise.
2001-03-13 08:34:38 +00:00
Jim Meyering
25a9e171a2 'sort F -o F' no longer needs to copy F. 2001-03-13 08:29:01 +00:00
Jim Meyering
86c5a50e86 Do not include closeout.h.
(xfopen): Use stdout if *how != 'r'.
(mergefps): Remove FPS arg.
Open all input files, and close all files when done.
If OFP is null, open the output file (but after opening input files).
All callers changed.
(first_same_file): New function.
(sort, merge): Remove arg OFP; we now open the output file as needed.
All callers changed.
(merge): New arg MAX_MERGE.  All callers changed.
(sort):	For "sort F -o F", close the input before opening the output.
(main): Do not use close_stdout; 'sort' and 'merge' now close stdout.
(This also fixes a close-stdout-twice bug.)
Remove test for overlapping input and output files, as 'sort' no longer
needs to worry about overlap, and 'merge' checks for overlap itself.
Use first_same_file to inform 'merge' about how much to merge at
the top level, to avoid overlap.
2001-03-13 08:28:09 +00:00
Jim Meyering
abb5c4e845 . 2001-03-13 04:17:57 +00:00
Jim Meyering
445de17323 . 2001-03-13 04:17:42 +00:00
Jim Meyering
861405b462 . 2001-03-13 04:17:07 +00:00
Jim Meyering
025b70bbb3 . 2001-03-12 21:23:29 +00:00
Jim Meyering
08ca0e9233 *** empty log message *** 2001-03-12 21:19:16 +00:00
Jim Meyering
71110e3f87 . 2001-03-12 21:17:39 +00:00
Jim Meyering
a11890b981 *** empty log message *** 2001-03-12 21:16:09 +00:00
Jim Meyering
c9fc879e89 `fmt --prefix=S' would not work properly for any string S containing
a byte with the high bit set.
(prefix): Declare to be of type unsigned char, not `char'.
(get_prefix): Likewise for local, `p'.
2001-03-12 21:16:05 +00:00
Jim Meyering
7cb4c9284d *** empty log message *** 2001-03-12 21:11:31 +00:00
Jim Meyering
d998775909 *** empty log message *** 2001-03-12 17:49:00 +00:00
Jim Meyering
1a728b8b0d *** empty log message *** 2001-03-12 10:52:26 +00:00
Jim Meyering
97bfe9b9dd (save_stdin): Use mkstemp to create temporary file. 2001-03-12 10:52:20 +00:00
Jim Meyering
a40c539ad1 . 2001-03-12 10:15:08 +00:00
Jim Meyering
5100b0b05f *** empty log message *** 2001-03-11 15:24:38 +00:00
Jim Meyering
30bc289991 Disable this test for now.
It would block when run in the background.
2001-03-11 15:24:28 +00:00
Jim Meyering
a68a480194 clean up wording in last change 2001-03-10 07:56:07 +00:00
Jim Meyering
c17e423533 *** empty log message *** 2001-03-10 07:53:47 +00:00
Jim Meyering
e489a18ead (date invocation): Correct the description of how
date works when given no format.  Reported by Ole Laursen.
2001-03-10 07:53:35 +00:00
Jim Meyering
7ee6f9593d *** empty log message *** 2001-03-10 07:52:40 +00:00
Jim Meyering
49648de23c . 2001-03-09 18:45:59 +00:00
Jim Meyering
43fa809135 *** empty log message *** 2001-03-09 18:42:11 +00:00
Jim Meyering
a3dc365194 (my_distdir): Define new variable, and use this
in place of most old uses of $(distdir).
2001-03-09 18:41:03 +00:00
Jim Meyering
9f2dcee21a . 2001-03-09 18:37:57 +00:00
Jim Meyering
325df18179 *** empty log message *** 2001-03-09 18:35:13 +00:00
Jim Meyering
27177c023a *** empty log message *** 2001-03-09 18:34:28 +00:00
Jim Meyering
7f07e4b250 (usage): Describe %C. 2001-03-09 18:28:33 +00:00
Jim Meyering
65c50ce72b (Date directives): Likewise. 2001-03-09 18:28:11 +00:00
Jim Meyering
53d1eedb1b . 2001-03-09 18:24:22 +00:00
Jim Meyering
00ef90d13b *** empty log message *** 2001-03-09 18:23:45 +00:00
Jim Meyering
5b0132826f Reflect change in location of input-tty. 2001-03-09 18:23:29 +00:00
Jim Meyering
197061600e moved from stty/~ 2001-03-09 18:21:56 +00:00
Jim Meyering
c21430123d moved from stty/~ 2001-03-09 18:21:29 +00:00
Jim Meyering
c19b40fd68 (EXTRA_DIST): Remove input-tty. 2001-03-09 18:20:28 +00:00
Jim Meyering
115c65d3f4 Ensure that /dev/full is a character device
(using test -c) as well as being writable, before trying to write to it.
Otherwise, the test could mistakenly append a newline to an existing,
regular, writable, /dev/full file.
Suggested by Ulrich Drepper.
2001-03-09 18:03:22 +00:00
Jim Meyering
3bb36380c3 *** empty log message *** 2001-03-08 07:48:19 +00:00
Jim Meyering
c2390af52f Insert the `--text' argument for each test. 2001-03-08 07:48:14 +00:00
Jim Meyering
6d28b40fce (locale_charset): Don't use setlocale(LC_CTYPE,NULL).
Don't return NULL.
2001-03-06 18:11:20 +00:00
Jim Meyering
e7dfa263f2 (print_unicode_char): Simplify accordingly. 2001-03-06 18:11:01 +00:00
Jim Meyering
6bbc8a8fef *** empty log message *** 2001-03-06 18:01:26 +00:00
Jim Meyering
458d1c2ee2 Update for FreeBSD 4.2 and OSF/1 5.1. Add support for DOS/DJGPP. 2001-03-06 18:00:47 +00:00
Jim Meyering
4813ddbf6b (S_TYPEISSHM): Rename parameter to reflect its type.
(main): Pass a `struct stat *', not stat.st_mode to S_TYPEISSHM.
2001-03-06 05:50:10 +00:00
Jim Meyering
358d534284 *** empty log message *** 2001-03-04 21:12:06 +00:00
Jim Meyering
d325a6bac2 (alpha): Use $(PACKAGE)-$(VERSION), not $(distdir),
since the latter now has a `$(top_distdir)/' prefix.
2001-03-04 21:11:50 +00:00
Jim Meyering
721691651f *** empty log message *** 2001-03-04 20:53:38 +00:00
Jim Meyering
fa653c0720 *** empty log message *** 2001-03-04 20:53:01 +00:00
Jim Meyering
ee7490797e . 2001-03-04 04:04:13 +00:00
Jim Meyering
8625974643 (output_char): Reformat so each statement is on a separate line. 2001-03-04 03:14:40 +00:00
Jim Meyering
be6df5151f . 2001-03-04 03:05:32 +00:00
Jim Meyering
d3aefd7569 . 2001-03-04 01:48:17 +00:00
Jim Meyering
70855c0876 *** empty log message *** 2001-03-03 19:31:47 +00:00
Jim Meyering
6d99caa5ee (die): New function.
(create_temp_file, xfopen, xfclose, write_bytes, sort_buffer_size,
fillbuf, main): Use it to regularize error messages.  The only change
in behavior is that write_bytes and the final close used to say "write
error" but now give just the output file name, which should be enough.
2001-03-03 19:31:37 +00:00
Jim Meyering
35c215bbba *** empty log message *** 2001-03-03 19:21:49 +00:00
Jim Meyering
410e28bd78 (xfclose): Add FILE arg, and report the file name
on error.  All callers changed.
2001-03-03 19:21:41 +00:00
Jim Meyering
8233ef4ca8 *** empty log message *** 2001-03-03 19:19:12 +00:00
Jim Meyering
91b9ff7935 (main): When fclose (stdin) fails, do not mention
the output file in the error message; mention "-" instead.
2001-03-03 19:19:06 +00:00
Jim Meyering
61829f0638 *** empty log message *** 2001-03-03 19:12:29 +00:00
Jim Meyering
5d34d8c327 (xfopen): Set have_read_stdin to 1 only if file is "-".
Use fopen_safer, not fopen, to avoid subtle bugs when fopen returns
stdin, stdout, or stderr.
(xfclose): stdout is no longer a special case.
(main): Close output file, don't just flush it; there might be
an error on the close.
2001-03-03 19:12:23 +00:00
Jim Meyering
57658678dd (libfetish_a_SOURCES): Add dup-safer.c, fopen-safer.c.
(noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
2001-03-03 19:06:54 +00:00
Jim Meyering
eb64d4a73b *** empty log message *** 2001-03-03 19:06:28 +00:00
Jim Meyering
62eab23e81 from Paul Eggert 2001-03-03 19:05:36 +00:00
Jim Meyering
4518931c29 *** empty log message *** 2001-03-03 18:53:53 +00:00
Jim Meyering
cac9a29ad8 (initbuf): If the desired size cannot be
allocated, repeatedly halve it until allocation succeeds.
2001-03-03 18:53:44 +00:00
Jim Meyering
f10bbe70a9 (parse_field_count): Comment fix. 2001-03-03 18:40:44 +00:00
Jim Meyering
3c1f856059 . 2001-03-03 18:38:22 +00:00
Jim Meyering
5514c4792b *** empty log message *** 2001-03-03 18:23:37 +00:00
Jim Meyering
25f95ca91e Tune allocation and comparison of nodes
representing temp files.  This improved CPU performance of
'sort -S 1 *.[ch]' by 17% on my host.

(struct tempnode): name member now uses struct hack.
(temphead): Now a pointer, not a structure.  All uses changed.
(create_temp_file): Allocate node using struct hack.
(zaptemp): Free node using struct hack.  Use pointer comparison, not
string comparison.
2001-03-03 18:23:29 +00:00
Jim Meyering
cfd53be2c8 (eolchar, trim_trailing_blanks): Now static. 2001-03-02 03:44:49 +00:00
Jim Meyering
e3093d28d9 *** empty log message *** 2001-03-02 03:41:50 +00:00
Jim Meyering
e0689425b8 *** empty log message *** 2001-03-02 03:14:38 +00:00
Jim Meyering
68de994bf1 (jm_MACROS): Use mkstemp replacement if the system
lacks mkstemp.  Compile our own tempname.c if we compile our own
mkstemp.c, as mkstemp relies on tempname.
2001-03-02 03:14:31 +00:00
Jim Meyering
b11665966d from GNU libc 2001-03-02 03:13:34 +00:00
Jim Meyering
01b7b402a3 from GNU libc 2001-03-02 03:12:47 +00:00
Jim Meyering
03285f9da5 *** empty log message *** 2001-03-02 03:10:42 +00:00
Jim Meyering
334ae8d83d . 2001-03-02 03:06:08 +00:00
Jim Meyering
871b2ea818 *** empty log message *** 2001-03-02 02:58:30 +00:00
Jim Meyering
2679dfb639 'sort' race condition fixes.
Defend against a DoS attack where someone else creates a
temporary file with the same name as ours.  Use mkstemp to do
this, supplying our own mkstemp if the system doesn't have one.

Also, fix a race condition during cleanup on hosts without
sigaction.


(NAME_MAX_IN_DIR): Remove.
(sigprocmask, sigset_t): New macros, defined only on older hosts.
(caught_signals): New var.
(xtmpfopen, tempname): Removed.
(create_temp_file): New function, combining the functions of the old
xtmpfopen and tempname.  All callers changed.
Use mkstemp to create the file.
(sighandler): On hosts without sigaction, ignore signals while
cleaning up, instead of letting them interrupt cleanup.
(main): Initialize caught_signals.  On hosts with sigaction, block all
caught signals while handling one.  Remove duplicate code.
2001-03-02 02:58:23 +00:00
Jim Meyering
3a960cb7e4 *** empty log message *** 2001-03-01 05:33:25 +00:00
Jim Meyering
f5cf8b6039 (jm_AC_DOS): Remove extra backslashes, now that
AH_VERBATIM really does output its argument verbatim.
2001-03-01 05:33:18 +00:00
Jim Meyering
675a66a029 *** empty log message *** 2001-02-25 07:55:33 +00:00
Jim Meyering
ffd0a44de4 Fix typo: '-d=1may' -> '-d 1may'.
Fix and clarify time zone usage in 'date' examples.
2001-02-25 07:55:27 +00:00
Jim Meyering
2a9477bd95 *** empty log message *** 2001-02-23 08:52:27 +00:00
Jim Meyering
5f001b35ed (keycompare): Move declarations of locals, lena and lenb,
into the inner scope where they are used.
2001-02-22 15:11:08 +00:00
Jim Meyering
241297f40e (main): Remove assignment-in-if-expression.
In fact, remove t_errno altogether.
2001-02-21 10:56:06 +00:00
Jim Meyering
df373089ee *** empty log message *** 2001-02-21 10:50:07 +00:00
Jim Meyering
2a08e10112 Add two tests of existing behavior -- both will
have to be changed (soon after release), once ls is fixed.
2001-02-21 10:49:58 +00:00
Jim Meyering
d015986221 . 2001-02-20 23:04:45 +00:00
Jim Meyering
4fda5e9381 test for existing behavior 2001-02-20 23:00:33 +00:00
Jim Meyering
6f1ffe444c . 2001-02-20 22:58:44 +00:00
Jim Meyering
9f0b79a1ba *** empty log message *** 2001-02-20 22:58:16 +00:00
Jim Meyering
cf4686a06a (FULL_TIME_OPTION): Renamed from FULL_TIME, for
consistency with the other enum values.
2001-02-20 22:53:38 +00:00
Jim Meyering
ccbe301659 (SI_OPTION): New enum value.
(long_options): Use it instead of 'H' for --si.
(decode_switches): Warn that -H will change soon.
(usage): Likewise.
2001-02-20 22:52:31 +00:00
Jim Meyering
6af107568c revert last change, until after release 2001-02-20 22:48:39 +00:00
Jim Meyering
890e2a5a58 *** empty log message *** 2001-02-20 22:48:18 +00:00
Jim Meyering
56bcd15a9c revert last change, until after the release 2001-02-20 22:48:00 +00:00
Jim Meyering
05c801ff0c ls -Fd symlink-to-directory' would print a trailing /'
Now it prints a trailing `@'.

(gobble_file): Don't clobber lstat stats of command line
arguments when using -d and -F (--directory and --classify) options.
2001-02-20 08:16:47 +00:00
Jim Meyering
c74553f398 *** empty log message *** 2001-02-19 08:53:37 +00:00
Jim Meyering
d4142ec88e (AUTHORS): Add Paul Eggert. 2001-02-19 08:53:24 +00:00
Jim Meyering
80016947b7 *** empty log message *** 2001-02-19 08:52:58 +00:00
Jim Meyering
5af9b0048f Fix a race condition: freed storage accessed during a signal handler.
(struct tempnode.next): Now volatile.
(zaptemp): Free the file name after removing it from the temp list,
not before, because a signal can arrive between the two actions
and cleanup () traverses the list.
2001-02-19 08:52:53 +00:00
Jim Meyering
9758a4d87a *** empty log message *** 2001-02-19 08:51:00 +00:00
Jim Meyering
3e593e8a31 (jm_CHECK_ALL_HEADERS): Check for sys/resource.h. 2001-02-19 08:50:54 +00:00
Jim Meyering
b0abc5579f *** empty log message *** 2001-02-19 08:50:18 +00:00
Jim Meyering
55d155dbbe Check for input size, and do not overallocate memory.
Also check for memory quotas.

Revamp storage management so that line tables and character data are
taken from the same buffer.  Line tables are now in reverse order,
since they grow down while the character data grow up.

(<sys/resource.h>): Include if HAVE_SYS_RESOURCE_H.
(struct rlimit, getrlimit): Define a replacement if RLIMIT_DATA
is not defined.
(RLIMIT_AS): Define to RLIMIT_DATA if not defined.
(struct lines): Remove.
(struct buffer): New members nlines, line_bytes, eof.
Remove member newline_free; no longer needed, since the code no longer
runs out of line table space.
(SORTALLOC_MIN, SORTALLOC_DEFAULT_MIN): Remove.
(sort_size): Renamed from sortalloc; now applies to the sum of the
character data and the line table, not just the character data.
(MIN_SORT_SIZE, INPUT_FILE_SIZE_GUESS): New macros.
(linelength): remove.
(specify_sort_size): Don't worry about the distinction between the
character data and the line table; that is now the caller's
responsibility.
(default_sort_size): Return the value, instead of being executed for
side effect.  Return half of available memory, or 1/16 of total memory,
whichever is greater; except do not exceed 1/2 of quota.
(sort_buffer_size): New function.
(initbuf): New arg LINE_BYTES.  Ensure that the line array is properly
aligned.  Initialize the new set of struct buffer members.
(buffer_linelim): New function.
(fillbuf): Return int, not size_t, since the callers merely care
whether the result is nonzero.  New arg FILE so that error messages
can report the file name.  Keep track of eof.  Initialize the line
table too, taking its memory from the input buffer's memory; this
subsumes the old findlines function and removes the need for worrying
about running out of line table entries.
(checkfp, mergefps, sortlines, merge, sort): Adjust to the new storage
management regime, in particular the fact that line tables are now
filled in by fillbuf and are in reverse order.
(checkfp): Now takes char *, not const char *, since subroutines
require that now.  Rewrite to avoid lint and duplicate code.
If line length alloc calculation overflows,
simply allocate enough memory to hold the line.
(mergefps): New arg FILES, used for buffer size calculation and error
messages.  Rewrite to avoid lint.  Do not loop if savealloc*2
overflows.
(mergefps, merge): Zap temporary files eagerly rather than lazily;
this is needed because we now pass FILES to mergefps.
(sortlines): Args now point at end of arrays, not at beginnings.
(sort): Do not allocate temporary line array for sortlines;
instead, take the space from the same buffer.
(main): Adjust to sort_size and default_sort_size changes.
2001-02-19 08:50:12 +00:00
Jim Meyering
9de8c30c25 *** empty log message *** 2001-02-19 08:46:00 +00:00
Jim Meyering
e4db8d3b54 (wc): Rename innermost `buf' to avoid shadowing warning.
(wc): Rename local `wc' to avoid shadowing function name.
2001-02-19 08:42:25 +00:00
Jim Meyering
ba74efc7c6 *** empty log message *** 2001-02-18 19:39:38 +00:00
Jim Meyering
2307570c3e (TESTS): Add isatty. 2001-02-18 19:39:33 +00:00
Jim Meyering
e9fd7152ff New test, for the bug fixed below. 2001-02-18 19:39:17 +00:00
288 changed files with 22293 additions and 14219 deletions

View File

@@ -15,6 +15,7 @@ have-Makefile := $(shell test -f Makefile && echo yes)
ifeq ($(have-Makefile),yes)
include Makefile
include $(srcdir)/Makefile.cfg
include $(srcdir)/Makefile.maint
else

21
Makefile.cfg Normal file
View File

@@ -0,0 +1,21 @@
## Customize Makefile.maint.
move_if_change = move-if-change
# List the hosts to which test releases are copied.
# `a' and `b' are merely placeholders, and correspond to the
# `a_' and `b_' prefixes of the following variables.
hosts = a b
a_host = alpha.gnu.org
b_host = freefriends.org
alpha_subdir = gnu/fetish
a_url_dir = $(alpha_subdir)
b_url_dir = $(alpha_subdir)
# Files that `make wget-update' should update.
wget_files = \
$(srcdir)/config.guess \
$(srcdir)/config.sub \
$(srcdir)/doc/texinfo.tex \
$(srcdir)/src/ansi2knr.c

View File

@@ -11,24 +11,27 @@ maintainer-check:
$(MAKE) distcheck
$(MAKE) my-distcheck
prev_version_file = .prev-version
prev_version_file ?= .prev-version
THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION))
PREV_VERSION := $(shell cat $(prev_version_file))
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
tag-package = $(shell echo "$(PACKAGE)" | tr a-z A-Z)
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
tag-prev-version = $(subst .,_,$(PREV_VERSION))
this-cvs-tag = $(tag-package)-$(tag-this-version)
prev-cvs-tag = $(tag-package)-$(tag-prev-version)
my_distdir = $(PACKAGE)-$(VERSION)
# Verify that all source files using _() are listed in po/POTFILES.in.
po-check:
grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1
grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2
diff -u $@-1 $@-2
rm -f $@-1 $@-2
if test -f po/POTFILES.in; then \
grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \
diff -u $@-1 $@-2 || exit 1; \
rm -f $@-1 $@-2; \
fi
# Do not save the original name or timestamp in the .tar.gz file.
GZIP_ENV = --no-name
@@ -55,21 +58,22 @@ null_AM_MAKEFLAGS = \
AUTOHEADER=false \
MAKEINFO=false
# Detect format-string/arg-list mismatches that would normally be obscured
# by the use of _(). The --disable-nls effectively defines away that macro,
# and building with CFLAGS='-Wformat -Werror' causes any format warning to be
# treated as a failure.
t=./=test
my-distcheck: writable-files po-check
-rm -rf $(t)
mkdir $(t)
GZIP=$(GZIP) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
# Removing $(DEPDIR) like this is a gross kludge to work around a bug
# in automake. Remove that line once it's fixed.
cd $(t)/$(distdir) \
&& ./configure --disable-nls \
&& $(MAKE) CFLAGS='-Wformat -Werror' \
AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(MAKE) check \
&& $(MAKE) distclean \
&& rm -rf $(DEPDIR)
&& $(MAKE) distclean
cd $(t) && mv $(distdir) $(distdir).old \
&& $(AMTAR) -zxf ../$(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
@@ -78,21 +82,16 @@ my-distcheck: writable-files po-check
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
a_host = alpha.gnu.org
b_host = freefriends.org
alpha_subdir = gnu/fetish
a_url_dir = $(alpha_subdir)
b_url_dir = $(alpha_subdir)
# This must be the same name on both hosts.
# Make it a symlink that points to the right place.
real_dir = fetish-ftp
url_dir_list = $(foreach x,a b,ftp://$($(x)_host)/$($(x)_url_dir))
url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir))
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
sha1 = $(shell sha1sum < $(distdir).tar.gz|sed 's/ -//')
md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//')
sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//')
tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/M.*/MB/')
xd-size = $(shell du --human $(xd-delta)|sed 's/M.*/MB/')
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
@@ -109,24 +108,24 @@ xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta
announcement: NEWS ChangeLog $(distdir).tar.gz
@( \
echo Subject: $(distdir) released; \
echo Subject: $(my_distdir) released; \
echo; \
echo FIXME: put comments here; \
echo; \
for url in $(url_dir_list); do \
echo " $$url/$(distdir).tar.gz"; \
echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \
done; \
echo; \
echo And here are xdelta-style diffs; \
echo; \
for url in $(url_dir_list); do \
echo " $$url/$(xd-delta)"; \
echo " $$url/$(xd-delta) ($(xd-size))"; \
done; \
echo; \
echo "Here are the MD5 and SHA1 signatures for the .tar.gz file"; \
echo; \
echo "$(md5) $(distdir).tar.gz"; \
echo "$(sha1) $(distdir).tar.gz"; \
echo "$(md5) $(my_distdir).tar.gz"; \
echo "$(sha1) $(my_distdir).tar.gz"; \
echo; \
echo NEWS:; \
sed -n "/$(THIS_VERSION_REGEXP)/,/^\[$(PREV_VERSION_REGEXP)/p" NEWS \
@@ -152,28 +151,66 @@ writable-files:
WGET = wget
ftp-gnu = ftp://ftp.gnu.org/gnu
# Use mv, if you don't have/want move-if-change.
move_if_change ?= move-if-change
# The following pseudo table associates a local directory and a URL
# with each of the files that belongs to some other package and is
# regularly updated from the specified URL.
wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
$(srcdir)/src/ansi2knr.c \
$(srcdir)/doc/texinfo.tex
get-targets = $(patsubst %, get-%, $(wget_files))
config.guess-url_prefix = $(ftp-gnu)/config/
config.sub-url_prefix = $(ftp-gnu)/config/
ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
target = $(patsubst get-%, %, $@)
url = $($(notdir $(target))-url_prefix)$(notdir $(target))
.PHONY: $(get-targets)
$(get-targets):
$(WGET) $(url) -O $(target).t \
&& $(move_if_change) $(target).t $(target)
automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
.PHONY: wget-update
wget-update:
$(WGET) $(ftp-gnu)/texinfo/texinfo.tex -O $(srcdir)/doc/texinfo.tex
$(WGET) $(ftp-gnu)/config/config.guess -O $(srcdir)/config.guess
$(WGET) $(ftp-gnu)/config/config.sub -O $(srcdir)/config.sub
cvs -d $(automake_repo) co -p automake/depcomp > depcomp
wget-update: $(get-targets)
for f in depcomp missing; do \
test -f $$f || continue; \
echo checking out $$f...; \
cvs -d $(automake_repo) co -p automake/lib/$$f > $$f.t \
&& $(move_if_change) $$f.t $$f; \
done
define emit-rsync-commands
echo =====================================
echo =====================================
echo 'for host in $(a_host) $(b_host); do \'
echo ' rsync -e ssh --pro -av $(xd-delta) $(distdir).tar.gz \'
echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.gz \'
echo ' $$host:$(real_dir); done'
echo '# send the /tmp/announcement e-mail'
echo =====================================
echo =====================================
endef
alpha: writable-files po-check
# Make sure that the copyright date in lib/version-etc.c is up to date.
check-copyright:
@if test -f lib/version-etc.c; then \
grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c > /dev/null \
|| { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \
fi
alpha: writable-files po-check check-copyright
$(MAKE) cvs-dist
$(MAKE) -s announcement > /tmp/announce-$(distdir)
$(MAKE) -s announcement > /tmp/announce-$(my_distdir)
ln $(distdir).tar.gz ../release
chmod a-w $(distdir).tar.gz
cd $(release-archive-dir) \

10
THANKS
View File

@@ -25,6 +25,7 @@ Andreas Stolcke stolcke@ICSI.Berkeley.EDU
Andres Soolo andres@soolo.matti.ee
Andrew Burgess aab@cichlid.com
Andrew Dalke dalke@bioreason.com
Andrew Pham andpha@us.ibm.com
Andrew Tridgell tridge@samba.org
Andries Brouwer Andries.Brouwer@cwi.nl
Andy Longton alongton@metamark.com
@@ -64,6 +65,7 @@ Chuck Hedrick hedrick@klinzhai.rutgers.edu
Clark Morgan cmorgan@aracnet.com
Colin Plumb colin@nyx.net
Collin Rogowski collin@rogowski.de
Dale Scheetz dwarf@polaris.net
Dan Hagerty hag@gnu.ai.it.edu
Dan Pascu dan@services.iiruc.ro
Daniel Bergstrom noa@melody.se
@@ -76,6 +78,7 @@ Derek Clegg dclegg@next.com
Dick Streefland dick_streefland@tasking.com
Dirk Lattermann dlatt@t-online.de
Dirk-Jan Faber djfaber@snow.nl
Dan Jacobson http://www.geocities.com/jidani
Don Parsons dparsons@synapse.kent.edu
Donni Erpel donald@appc11.gsi.de
Doug McLaren dougmc@comco.com
@@ -117,6 +120,7 @@ Hans Verkuil hans@wyst.hobby.nl
Harry Liu rliu@lek.ugcs.caltech.edu
Herbert Xu herbert@gondor.apana.org.au
Holger Berger hberger@ess.nec.de
Hon-Yin Kok hkok@yoda.unl.edu
Hugh Daniel hugh@xanadu.com
Ian Jackson ijackson@chiark.greenend.org.uk
Ian Lance Taylor ian@cygnus.com
@@ -169,6 +173,7 @@ Karl-Michael Schneider schneide@phil.uni-passau.de
Karsten Thygesen karthy@kom.auc.dk
Kaveh R. Ghazi ghazi@caip.rutgers.edu
Keith Owens kaos@audio.apana.org.au
Keith Thompson kst@sdsc.edu
Ken Pizzini kenp@halcyon.com
Kjetil Torgrim Homme kjetilho@ifi.uio.no
Kristoffer Rose kris@diku.dk
@@ -232,6 +237,7 @@ Niklas Edmundsson nikke@acc.umu.se
Noah Friedman friedman@splode.com
Noel Cragg noel@red-bean.com
Olav Morkrid olav@funcom.com
Ole Laursen olau@hardworking.dk
Oskar Liljeblad osk@hem.passagen.se
Ørn E. Hansen oehansen@daimi.aau.dk
Paul Eggert eggert@twinsun.com
@@ -255,6 +261,7 @@ Ralf W. Stephan stephan@tmt.de
Ralph Loader loader@maths.ox.ac.uk
Raul Miller moth@magenta.com
Richard Braakman dark@xs4all.nl
Richard Dawe richdawe@bigfoot.com
Richard J. Rauenzahn rrauenza@hairball.cup.hp.com
Richard Sharman rsharman@magmacom.com
Rick Sladkey jrs@world.std.com
@@ -272,6 +279,9 @@ Sander van Malssen svm@kozmix.ow.nl
Santiago Vila Doncel sanvila@unex.es
Savochkin Andrey Vladimirovich saw@msu.ru
Scott Lurndal slurn@griffin.engr.sgi.com
Soeren Sonnenburg sonnenburg@informatik.hu-berlin.de
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
Stephen Eglen eglen@pcg.wustl.edu
Stephen Gildea gildea@x.org
Stephen Smoogen ??????????
Steve McConnel steve@acadcomp.sil.org

View File

@@ -1,19 +1,19 @@
Makefile
fileutils.aux
fileutils.cm
fileutils.cp
fileutils.cps
fileutils.dvi
fileutils.fl
fileutils.fn
fileutils.info
fileutils.info*
fileutils.ky
fileutils.log
fileutils.op
fileutils.pg
fileutils.toc
fileutils.tp
fileutils.vr
coreutils.aux
coreutils.cm
coreutils.cp
coreutils.cps
coreutils.dvi
coreutils.fl
coreutils.fn
coreutils.info
coreutils.info*
coreutils.ky
coreutils.log
coreutils.op
coreutils.pg
coreutils.toc
coreutils.tp
coreutils.vr
stamp-vti
version.texi

26
doc/ChangeLog Normal file
View File

@@ -0,0 +1,26 @@
2001-06-16 Jim Meyering <meyering@lucent.com>
* Makefile.am (info_TEXINFOS): Reflect renaming: s/omni-/core/.
* coreutils.texi: Likewise.
* coreutils.texi: New, renamed from omni-utils.texi.
* omni-utils.texi: Removed, renamed to coreutils.texi.
* omni-utils.texi (ls invocation): Mention the effect of locale.
Reported by Keith Thompson.
2001-05-24 Jim Meyering <meyering@lucent.com>
* texinfo.tex: Update from master source.
* omni-utils.texi (ls invocation): Document more clearly what ls
does when given no arguments.
2001-05-21 Jim Meyering <meyering@lucent.com>
* textutils.texi: Remove file.
* Makefile.am ($(DVIS), $(INFO_DEPS)): Depend on $(EXTRA_DIST).
(DISABLED_constants.texi): New rule -- disabled for now.
This directory is now shared by fileutils, textutils, and sh-utils.

View File

@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
info_TEXINFOS = fileutils.texi
info_TEXINFOS = coreutils.texi
EXTRA_DIST = perm.texi getdate.texi
EXTRA_DIST = perm.texi getdate.texi constants.texi doclicense.texi
# 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,
@@ -12,3 +12,25 @@ EXTRA_DIST = perm.texi getdate.texi
# and those names all map to one 14-byte name (<package>.info-) on some crufty
# old systems.
MAKEINFO = makeinfo --no-split
# Remove `DISABLED_' when fileutils, textutils, and sh-utils have
# all been merged into one package.
DISABLED_constants.texi: $(top_srcdir)/src/tail.c
LC_ALL=C \
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c > t-$@
mv t-$@ $@
# Uncomment this when fileutils, textutils, and sh-utils have
# all been merged into one package.
# MAINTAINERCLEANFILES = constants.texi
$(DVIS): $(EXTRA_DIST)
$(INFO_DEPS): $(EXTRA_DIST)
# List words/regexps here that should not appear in the texinfo documentation.
check-texinfo:
grep timezone $(srcdir)/*.texi && exit 1 || :
grep -w POSIX $(srcdir)/*.texi && exit 1 || :
check: check-texinfo

View File

@@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Makefile.in generated automatically by automake 1.4g from Makefile.am.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -11,6 +11,8 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
@@ -31,11 +33,9 @@ infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
@@ -47,28 +47,22 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_FLAG =
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
@SET_MAKE@
host_alias = @host_alias@
host_triplet = @host@
AMDEP = @AMDEP@
AMTAR = @AMTAR@
AWK = @AWK@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DATADIRNAME = @DATADIRNAME@
DEPDIR = @DEPDIR@
DF_PROG = @DF_PROG@
@@ -82,6 +76,7 @@ GNU_PACKAGE = @GNU_PACKAGE@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
@@ -111,13 +106,14 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
_am_include = @_am_include@
_am_quote = @_am_quote@
install_sh = @install_sh@
l = @l@
info_TEXINFOS = coreutils.texi
info_TEXINFOS = fileutils.texi
EXTRA_DIST = perm.texi getdate.texi
EXTRA_DIST = perm.texi getdate.texi constants.texi doclicense.texi
# 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,
@@ -128,38 +124,34 @@ EXTRA_DIST = perm.texi getdate.texi
# and those names all map to one 14-byte name (<package>.info-) on some crufty
# old systems.
MAKEINFO = makeinfo --no-split
EXEEXT =
OBJEXT = o
subdir = doc
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
TEXI2DVI = texi2dvi
INFO_DEPS = fileutils.info
DVIS = fileutils.dvi
TEXINFOS = fileutils.texi
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
version.texi
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
INFO_DEPS = coreutils.info
DVIS = coreutils.dvi
TEXINFOS = coreutils.texi
DIST_COMMON = ChangeLog Makefile.am Makefile.in mdate-sh stamp-vti \
texinfo.tex version.texi
all: all-am
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits doc/Makefile
.SUFFIXES: .dvi .info .ps .texi
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnits doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(srcdir)/version.texi: $(srcdir)/stamp-vti
$(srcdir)/version.texi: $(srcdir)/stamp-vti
@:
$(srcdir)/stamp-vti: fileutils.texi $(top_srcdir)/configure.in
@(set `$(SHELL) $(srcdir)/mdate-sh $(srcdir)/fileutils.texi`; \
$(srcdir)/stamp-vti: coreutils.texi $(top_srcdir)/configure.in
@(set `$(SHELL) $(srcdir)/mdate-sh $(srcdir)/coreutils.texi`; \
echo "@set UPDATED $$1 $$2 $$3"; \
echo "@set UPDATED-MONTH $$2 $$3"; \
echo "@set EDITION $(VERSION)"; \
@@ -173,18 +165,11 @@ $(srcdir)/stamp-vti: fileutils.texi $(top_srcdir)/configure.in
mostlyclean-vti:
-rm -f vti.tmp
clean-vti:
distclean-vti:
maintainer-clean-vti:
-rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
fileutils.info: fileutils.texi $(srcdir)/version.texi
fileutils.dvi: fileutils.texi $(srcdir)/version.texi
DVIPS = dvips
coreutils.info: coreutils.texi $(srcdir)/version.texi
coreutils.dvi: coreutils.texi $(srcdir)/version.texi
.texi.info:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
@@ -199,62 +184,15 @@ DVIPS = dvips
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.texinfo.info:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.texinfo:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.texinfo.dvi:
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.txi.info:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.txi.dvi:
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.txi:
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
cd $(srcdir) \
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
TEXI2DVI = texi2dvi
DVIPS = dvips
.dvi.ps:
$(DVIPS) $< -o $@
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(INFO_DEPS)'; \
for file in $$list; do \
d=$(srcdir); \
for ifile in `CDPATH=: && cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
if test -f $$d/$$ifile; then \
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
else : ; fi; \
done; \
done
@$(POST_INSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
done; \
else : ; fi
uninstall-info:
uninstall-info-am:
$(PRE_UNINSTALL)
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
@if (install-info --version && \
install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \
@@ -281,19 +219,14 @@ dist-info: $(INFO_DEPS)
done
mostlyclean-aminfo:
-rm -f fileutils.aux fileutils.cp fileutils.cps fileutils.dvi \
fileutils.fn fileutils.fns fileutils.pgs 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.cm fileutils.ov
clean-aminfo:
distclean-aminfo:
-rm -f coreutils.aux coreutils.cp coreutils.cps coreutils.dvi coreutils.fl \
coreutils.fn coreutils.ky coreutils.log coreutils.op \
coreutils.pg coreutils.ps coreutils.toc coreutils.tp \
coreutils.vr
maintainer-clean-aminfo:
cd $(srcdir) && for i in $(INFO_DEPS); do \
cd $(srcdir) && \
for i in $(INFO_DEPS); do \
rm -f $$i; \
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
rm -f $$i-[0-9]*; \
@@ -303,11 +236,18 @@ tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pR $$d/$$file $(distdir) \
|| exit 1; \
@@ -317,73 +257,132 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
info-am: $(INFO_DEPS)
info: info-am
dvi-am: $(DVIS)
dvi: dvi-am
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="${top_distdir}" distdir="$(distdir)" \
dist-info
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
all-am: Makefile $(INFO_DEPS)
install-data-am: install-info-am
installdirs:
$(mkinstalldirs) $(DESTDIR)$(infodir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-info
uninstall: uninstall-am
all-am: Makefile $(INFO_DEPS)
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(infodir)
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-rm -f Makefile.in
mostlyclean-am: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-vti clean-aminfo clean-generic mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-vti distclean-aminfo distclean-generic clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-vti maintainer-clean-aminfo \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am: $(DVIS)
info: info-am
info-am: $(INFO_DEPS)
install-data-am: install-info-am
install-exec-am:
install-info: install-info-am
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(INFO_DEPS)'; \
for file in $$list; do \
d=$(srcdir); \
for ifile in `CDPATH=: && cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
if test -f $$d/$$ifile; then \
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
else : ; fi; \
done; \
done
@$(POST_INSTALL)
@if (install-info --version && \
install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
done; \
else : ; fi
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \
install-info-am uninstall-info mostlyclean-aminfo distclean-aminfo \
clean-aminfo maintainer-clean-aminfo tags distdir info-am info dvi-am \
dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all install-strip \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-aminfo \
maintainer-clean-generic maintainer-clean-vti
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic dist-info \
distclean distclean-generic distdir dvi dvi-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-aminfo \
maintainer-clean-generic maintainer-clean-vti mostlyclean \
mostlyclean-aminfo mostlyclean-generic mostlyclean-vti \
uninstall uninstall-am uninstall-info-am
# Remove `DISABLED_' when fileutils, textutils, and sh-utils have
# all been merged into one package.
DISABLED_constants.texi: $(top_srcdir)/src/tail.c
LC_ALL=C \
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c > t-$@
mv t-$@ $@
# Uncomment this when fileutils, textutils, and sh-utils have
# all been merged into one package.
# MAINTAINERCLEANFILES = constants.texi
$(DVIS): $(EXTRA_DIST)
$(INFO_DEPS): $(EXTRA_DIST)
# List words/regexps here that should not appear in the texinfo documentation.
check-texinfo:
grep timezone $(srcdir)/*.texi && exit 1 || :
grep -w POSIX $(srcdir)/*.texi && exit 1 || :
check: check-texinfo
# 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.
.NOEXPORT:

2
doc/constants.texi Normal file
View File

@@ -0,0 +1,2 @@
@set DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS 5
@set DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES 200

11308
doc/coreutils.texi Normal file

File diff suppressed because it is too large Load Diff

395
doc/doclicense.texi Normal file
View File

@@ -0,0 +1,395 @@
@c -*-texinfo-*-
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@center Version 1.1, March 2000
@ifnottex
@menu
* How to use this License for your documents::
@end menu
@end ifnottex
@display
Copyright (C) 2000 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@end display
@iftex
@sp1
@end iftex
@enumerate 0
@item
PREAMBLE
The purpose of this License is to make a manual, textbook, or other
written document ``free'' in the sense of freedom: to assure everyone
the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or noncommercially. Secondarily,
this License preserves for the author and publisher a way to get
credit for their work, while not being considered responsible for
modifications made by others.
This License is a kind of ``copyleft'', which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
@iftex
@sp1
@end iftex
@item
APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work that contains a
notice placed by the copyright holder saying it can be distributed
under the terms of this License. The ``Document'', below, refers to any
such manual or work. Any member of the public is a licensee, and is
addressed as ``you''.
A ``Modified Version'' of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A ``Secondary Section'' is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (For example, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The ``Invariant Sections'' are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License.
The ``Cover Texts'' are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License.
A ``Transparent'' copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, whose contents can be viewed and edited directly and
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup has been designed to thwart or discourage
subsequent modification by readers is not Transparent. A copy that is
not ``Transparent'' is called ``Opaque''.
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML designed for human modification. Opaque formats include
PostScript, PDF, proprietary formats that can be read and edited only
by proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML produced by some word processors for output
purposes only.
The ``Title Page'' means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, ``Title Page'' means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
@iftex
@sp1
@end iftex
@item
VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
@iftex
@sp1
@end iftex
@item
COPYING IN QUANTITY
If you publish printed copies of the Document numbering more than 100,
and the Document's license notice requires Cover Texts, you must enclose
the copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the
general network-using public has access to download anonymously at no
charge using public-standard network protocols. If you use the latter
option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this
Transparent copy will remain thus accessible at the stated location
until at least one year after the last time you distribute an Opaque
copy (directly or through your agents or retailers) of that edition to
the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
@iftex
@sp1
@end iftex
@item
MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.@*
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has less than five).@*
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.@*
D. Preserve all the copyright notices of the Document.@*
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.@*
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.@*
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.@*
H. Include an unaltered copy of this License.@*
I. Preserve the section entitled ``History'', and its title, and add to
it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section entitled ``History'' in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.@*
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the ``History'' section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.@*
K. In any section entitled ``Acknowledgements'' or ``Dedications'',
preserve the section's title, and preserve in the section all the
substance and tone of each of the contributor acknowledgements
and/or dedications given therein.@*
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.@*
M. Delete any section entitled ``Endorsements''. Such a section
may not be included in the Modified Version.@*
N. Do not retitle any existing section as ``Endorsements''
or to conflict in title with any Invariant Section.@*
@iftex
@sp1
@end iftex
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section entitled ``Endorsements'', provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
@iftex
@sp1
@end iftex
@item
COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections entitled ``History''
in the various original documents, forming one section entitled
``History''; likewise combine any sections entitled ``Acknowledgements'',
and any sections entitled ``Dedications''. You must delete all sections
entitled ``Endorsements.''
@iftex
@sp1
@end iftex
@item
COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
@iftex
@sp1
@end iftex
@item
AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, does not as a whole count as a Modified Version
of the Document, provided no compilation copyright is claimed for the
compilation. Such a compilation is called an ``aggregate'', and this
License does not apply to the other self-contained works thus compiled
with the Document, on account of their being thus compiled, if they
are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one quarter
of the entire aggregate, the Document's Cover Texts may be placed on
covers that surround only the Document within the aggregate.
Otherwise they must appear on covers around the whole aggregate.
@iftex
@sp1
@end iftex
@item
TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License provided that you also include the
original English version of this License. In case of a disagreement
between the translation and the original English version of this
License, the original English version will prevail.
@iftex
@sp1
@end iftex
@item
TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
@iftex
@sp1
@end iftex
@item
FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License ``or any later version'' applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
@end enumerate
@node How to use this License for your documents
@unnumberedsec ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
@smallexample
@group
Copyright (C) @var{year} @var{your name}.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with the Invariant Sections being @var{list their titles}, with the
Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end group
@end smallexample
If you have no Invariant Sections, write ``with no Invariant Sections''
instead of saying which ones are invariant. If you have no
Front-Cover Texts, write ``no Front-Cover Texts'' instead of
``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

View File

@@ -74,7 +74,7 @@ save the program's text image on the swap device so it will load more
quickly when run (called the @dfn{sticky bit}). For directories on some
systems, prevent users from removing or renaming a file in a directory
unless they own the file or the directory; this is called the
@dfn{restriction deletion flag} for the directory.
@dfn{restricted deletion flag} for the directory.
@end enumerate
@node Symbolic Modes

File diff suppressed because it is too large Load Diff

View File

@@ -3,10 +3,10 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2000-12-11.07}
\def\texinfoversion{2001-05-24.08}
%
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
% Free Software Foundation, Inc.
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
% 2000, 01 Free Software Foundation, Inc.
%
% This texinfo.tex file is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
@@ -170,6 +170,16 @@
}%
\fi
% add check for \lastpenalty to plain's definitions. If the last thing
% we did was a \nobreak, we don't want to insert more space.
%
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
\removelastskip\penalty-50\smallskip\fi\fi}
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
\removelastskip\penalty-100\medskip\fi\fi}
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
\removelastskip\penalty-200\bigskip\fi\fi}
% For @cropmarks command.
% Do @cropmarks to get crop marks.
%
@@ -730,9 +740,9 @@ where each line of input produces a line of output.}
\fi
%
\ifodd\pageno
\def\temp{\inleftmargin\lefttext}%
\def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
\else
\def\temp{\inrightmargin\righttext}%
\def\temp{\inleftmargin\lefttext}%
\fi
\temp
}
@@ -924,11 +934,15 @@ where each line of input produces a line of output.}
\fi
\ifx\empty\imagewidth\else width \imagewidth \fi
\ifx\empty\imageheight\else height \imageheight \fi
{#1.pdf}%
\ifnum\pdftexversion<13
#1.pdf%
\else
{#1.pdf}%
\fi
\ifnum\pdftexversion < 14 \else
\pdfrefximage \pdflastximage
\fi}
\def\pdfmkdest#1{\pdfdest name{#1@} xyz}
\def\pdfmkdest#1{\pdfdest name{#1} xyz}
\def\pdfmkpgn#1{#1@}
\let\linkcolor = \Blue % was Cyan, but that seems light?
\def\endlink{\Black\pdfendlink}
@@ -1026,6 +1040,7 @@ where each line of input produces a line of output.}
\def\pdfurl#1{%
\begingroup
\normalturnoffactive\def\@{@}%
\let\value=\expandablevalue
\leavevmode\Red
\startlink attr{/Border [0 0 0]}%
user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
@@ -2904,16 +2919,17 @@ width0pt\relax} \fi
% Now the real index entry with the fonts.
\toks0 = {#2}%
%
% If third (subentry) arg is present, add it to the index
% string. And include a space.
% If the third (subentry) arg is present, add it to the index
% line to write.
\ifx\thirdarg\emptymacro \else
\toks0 = \expandafter{\the\toks0 \space #3}%
\toks0 = \expandafter{\the\toks0{#3}}%
\fi
%
% Set up the complete index entry, with both the sort key
% and the original text, including any font commands. We write
% three arguments to \entry to the .?? file, texindex reduces to
% two when writing the .??s sorted result.
% Set up the complete index entry, with both the sort key and
% the original text, including any font commands. We write
% three arguments to \entry to the .?? file (four in the
% subentry case), texindex reduces to two when writing the .??s
% sorted result.
\edef\temp{%
\write\csname#1indfile\endcsname{%
\realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
@@ -3135,11 +3151,18 @@ width0pt\relax} \fi
\def\primary #1{\line{#1\hfil}}
\newskip\secondaryindent \secondaryindent=0.5cm
\def\secondary #1#2{
{\parfillskip=0in \parskip=0in
\hangindent =1in \hangafter=1
\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
\def\secondary#1#2{{%
\parfillskip=0in
\parskip=0in
\hangindent=1in
\hangafter=1
\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
\ifpdf
\pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
\else
#2
\fi
\par
}}
% Define two-column mode, which we use to typeset indexes.
@@ -4134,9 +4157,17 @@ width0pt\relax} \fi
% is reset to zero; thus the \afterenvbreak inserts no space -- but the
% start of the next paragraph will insert \parskip
%
\def\aboveenvbreak{{\advance\envskipamount by \parskip
\endgraf \ifdim\lastskip<\envskipamount
\removelastskip \penalty-50 \vskip\envskipamount \fi}}
\def\aboveenvbreak{{%
\ifnum\lastpenalty < 10000
\advance\envskipamount by \parskip
\endgraf
\ifdim\lastskip<\envskipamount
\removelastskip
\penalty-50
\vskip\envskipamount
\fi
\fi
}}
\let\afterenvbreak = \aboveenvbreak
@@ -5836,7 +5867,8 @@ width0pt\relax} \fi
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
\setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
\begingroup
\catcode`\^^M = 5 % in case we're inside an example
\catcode`\^^M = 5 % in case we're inside an example
\normalturnoffactive % allow _ et al. in names
% If the image is by itself, center it.
\ifvmode
\nobreak\bigskip
@@ -5948,6 +5980,15 @@ should work if nowhere else does.}
\setemergencystretch
}
% Use `small' versions.
%
\def\smallenvironments{%
\let\smalldisplay = \smalldisplayx
\let\smallexample = \smalllispx
\let\smallformat = \smallformatx
\let\smalllisp = \smalllispx
}
% @letterpaper (the default).
\def\letterpaper{{\globaldefs = 1
\parskip = 3pt plus 2pt minus 1pt
@@ -5970,11 +6011,7 @@ should work if nowhere else does.}
\contentsrightmargin = 0pt
\deftypemargin = 0pt
\defbodyindent = .5cm
%
\let\smalldisplay = \smalldisplayx
\let\smallexample = \smalllispx
\let\smallformat = \smallformatx
\let\smalllisp = \smalllispx
\smallenvironments
}}
% Use @afourpaper to print on European A4 paper.
@@ -5988,6 +6025,26 @@ should work if nowhere else does.}
\hfuzz = 1pt
}}
% Use @afivepaper to print on European A5 paper.
% From romildo@urano.iceb.ufop.br, 2 July 2000.
% He also recommends making @example and @lisp be small.
\def\afivepaper{{\globaldefs = 1
\setleading{12.5pt}%
\parskip = 2pt plus 1pt minus 0.1pt
%
\internalpagesizes{166mm}{120mm}{\voffset}{-8mm}{\bindingoffset}{8pt}%
%
\lispnarrowing = 0.2in
\tolerance = 800
\hfuzz = 1.2pt
\contentsrightmargin = 0mm
\deftypemargin = 0pt
\defbodyindent = 2mm
\tableindent = 12mm
%
\smallenvironments
}}
% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
\def\afourlatex{{\globaldefs = 1

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,188 @@
2001-06-11 Jim Meyering <meyering@lucent.com>
* regex.c: Update from GNU libc.
2001-05-27 Jim Meyering <meyering@lucent.com>
* readutmp.h (UT_TYPE): Define.
2001-05-24 Jim Meyering <meyering@lucent.com>
* argmatch.c: Include "quote.h".
(argmatch_invalid): Remove explicit `' quotes. Instead, use the
quote function. Reported by Göran Uddeborg.
2001-05-20 Alexandre Duret-Lutz <duret_g@epita.fr>
* dirname.c (dir_name): Compute append_dot using path, not newpath
which is not yet declared.
2001-05-11 Paul Eggert <eggert@twinsun.com>
* lib/Makefile.am (libfetish_a_SOURCES):
Add strftime.c, since we now compile it on all hosts.
* lib/strftime.c (my_strftime):
Define to nstrftime if emacs, but only if my_strftime is not defined.
(extra_args, extra_args_spec, extra_args_spec_iso): Rename from
ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively.
Add one more extra argument: a nanoseconds value.
All uses changed.
(ns): New macro.
(my_strftime function): Add %N format.
(emacs_strftimeu): Renamed from emacs_strftime,
with extra ut argument.
2001-05-11 Paul Eggert <eggert@twinsun.com>
dirname code cleanup. base_name now behaves more compatibly
with POSIX basename when given file names that have trailing
slashes, and similarly for dir_name. Add new primitives
base_len and dir_len. Put the directory-name-related decls
into dirname.h.
* addext.c (ISSLASH, base_name): Remove; now in dirname.h.
* backupfile.c (base_name): Likewise.
* basename.c (FILESYSTEM_PREFIX_LEN, PARAMS, ISSLASH): Likewise.
* dirname.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise.
* makepath.c (strip_trailing_slashes): Likewise.
* path-concat.c (DIRECTORY_SEPARATOR, FILESYSTEM_PREFIX_LEN, ISSLASH):
Likewise.
* rename.c (strip_trailing_slashes): Likewise.
* same.c (base_name): Likewise.
* stripslash.c (ISSLASH): Likewise.
* addext.c: Include <dirname.h> after size_t is defined.
* backupfile.c: Likewise.
* addext.c (addext): Use base_len to trim redundant
trailing slashes instead of doing it ourselves.
But do not trim the last slash if it is not redundant.
* backupfile.c (find_backup_file_name,
max_backup_version): Use base_len instead of rolling it ourselves.
Handle the case of "" and (on DOS) "C:" correctly.
* basename.c: Do not include <stdio.h>, <assert.h>; no longer needed.
Include <string.h>, <dirname.h>.
(base_name): Allow file names ending in slashes, other than names
that are all slashes. In this case, return the basename followed
by the slashes. This is more general, and can be used in places
where the original base_name purposely had an assertion failure.
(base_len): New function.
* dirname.c: Include <string.h> instead of <stdlib.h>.
Do not include <assert.h>; no longer needed.
Include xalloc.h.
(memrchr): Remove decl.
(dir_name_r): Remove.
(dir_len): Renamed from dirlen. All callers changed.
Rewrite in terms of base_name, for simplicity and consistency.
(dir_name): Never return NULL. All callers changed.
Do not include <stdlib.h> in test program; no longer needed.
return 0; is fine for test program.
* dirname.h (DIRECTORY_SEPARATOR, ISSLASH, FILESYSTEM_PREFIX_LEN):
New macros.
(base_name, base_len, dir_len, strip_trailing_slashes): New decls.
* path-concat.c (path_concat): Use base_len to compute
base length, not strlen; this means we cannot rely on memcpy
to null-terminate.
* same.c (STREQ): Remove.
(same_name): Handle the case where the basename ends in trailing '/'.
* stripslash.c (strip_trailing_slashes): Return nonzero if
a slash was stripped. Do not strip the last slash after a
file system prefix.
2001-04-08 Jim Meyering <meyering@lucent.com>
* getdate.y (get_date): Set tm_isdst to -1 to ensure that it is
recomputed; that's necessary when the offset spans a DST transition.
Patch by David J. MacKenzie. Reported by Hon-Yin Kok.
2001-04-02 Jim Meyering <meyering@lucent.com>
* regex.h, regex.c: Update from GNU libc.
2001-03-19 Paul Eggert <eggert@twinsun.com>
* version-etc.c (version_etc_copyright): Update to 2001.
2001-03-16 Paul Eggert <eggert@twinsun.com>
* tempname.c (uint64_t): Define to uintmax_t if
not defined, and if UINT64_MAX is not defined.
Required at least for Vax Ultrix4.3, which doesn't define uint64_t.
Reported by John David Anglin.
2001-03-10 Bruno Haible <haible@clisp.cons.org>
* localcharset.c (locale_charset): Allow wildcard syntax. Also resolve
alias if codeset is empty.
* config.charset (BeOS): Use wildcard syntax.
2001-03-13 Jim Meyering <meyering@lucent.com>
* path-concat.c (path_concat) [FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]:
Don't insert a backslash when concatenating e.g., `C:' and `foo'.
From Bruno Haible.
2001-03-06 Bruno Haible <haible@clisp.cons.org>
* localcharset.c (locale_charset): Don't use setlocale(LC_CTYPE,NULL).
Don't return NULL.
* unicodeio.c (print_unicode_char): Simplify accordingly.
2001-03-06 Bruno Haible <haible@clisp.cons.org>
* config.charset: Update for FreeBSD 4.2 and OSF/1 5.1. Add
support for DOS/DJGPP.
2001-02-28 Paul Eggert <eggert@twinsun.com>
* Makefile.am (libfetish_a_SOURCES):
Add dup-safer.c, fopen-safer.c.
(noinst_HEADERS): Add stdio-safer.h, unistd-safer.h.
* dup-safer.c, fopen-safer.c, stdio-safer.h,
lib/unistd-safer.h: New files.
2001-02-25 Paul Eggert <eggert@twinsun.com>
The mkstemp replacement is taken from glibc 2.2.2, with some
portability fixes for use outside glibc, as follows:
* tempname.c (struct_stat64): New macro.
(direxists, __gen_tempname): Use it.
This avoids a portability problem with Solaris 8.
* tempname.c (<config.h>): Include if HAVE_CONFIG_H.
(<stddef.h>, <stdint.h>, <string.h>):
Include only if STDC_HEADERS || _LIBC.
(<fcntl.h>): Include only if HAVE_FCNTL_H || _LIBC.
(<unistd.h>): Include only if HAVE_UNISTD_H || _LIBC.
(<sys/time.h>): Include only if HAVE_SYS_TIME_H || _LIBC.
(__set_errno): Define this macro if <errno.h> doesn't.
(P_tmpdir, TMP_MAX, __GT_FILE, __GT_BIGFILE, __GT_DIR, __GT_NOCREATE):
Define these macros if <stdio.h> doesn't.
(S_ISDIR, S_IRUSR, S_IWUSR, S_IXUSR):
Define these macros if <sys/stat.h>
doesn't. Ignore <sys/stat.h> S_ISDIR if STAT_MACROS_BROKEN.
(stat64, __getpid, __gettimeofday, __mkdir, __open, __open64, lxstat64,
__xstat64): Define if not _LIBC.
(__secure_getenv): Define if ! (HAVE___SECURE_GETENV || _LIBC).
(__gen_tempname): Invoke gettimeofday only if
HAVE_GETTIMEOFDAY || _LIBC;
otherwise, fall back on plain "time".
Use macros like S_IRUSR | S_IWUSR rather than octal values like 0600.
* mkstemp.c (__GT_FILE): Define to zero if not defined.
* mkstemp.c, tempname.c: New files, taken from glibc 2.2.2.
2001-02-17 Jim Meyering <meyering@lucent.com>
* strtoul.c: Sync from GNU libc. Use double quotes, not <...>
@@ -24,7 +209,7 @@
2001-02-16 Paul Eggert <eggert@twinsun.com>
* lib/alloca.c (malloc): Undef before defining, since stdlib.h
* alloca.c (malloc): Undef before defining, since stdlib.h
may have defined it. Needed for Encore Umax-3.0.9.16b systems.
Reported by Mark Hounschell via Paul Eggert.
@@ -61,7 +246,7 @@
2001-01-03 Paul Eggert <eggert@twinsun.com>
* lib/strftime.c: Sync with glibc time/strftime.c 1.81.
* strftime.c: Sync with glibc time/strftime.c 1.81.
2001-01-03 Jim Meyering <meyering@lucent.com>
@@ -70,7 +255,7 @@
2000-12-29 Paul Eggert <eggert@twinsun.com>
* lib/modechange.c: Do not assume that mode_t uses the
* modechange.c: Do not assume that mode_t uses the
traditional octal encoding. E.g. "chmod 1 FOO" should set
the other-execute bit of FOO even if S_IXOTH != 1.
@@ -170,11 +355,11 @@
2000-12-01 Paul Eggert <eggert@twinsun.com>
* lib/memrchr.c: Include <config.h> before any system include file.
* memrchr.c: Include <config.h> before any system include file.
2000-11-29 Paul Eggert <eggert@twinsun.com>
* lib/dirname.c (dir_name_r): Fix typo: int -> size_t.
* dirname.c (dir_name_r): Fix typo: int -> size_t.
2000-11-26 Jim Meyering <meyering@lucent.com>
@@ -182,12 +367,12 @@
2000-11-22 Paul Eggert <eggert@twinsun.com>
* lib/strftime.c (my_strftime): Do not invoke mbrlen with a
* strftime.c (my_strftime): Do not invoke mbrlen with a
size of (size_t) -1; it's not portable.
2000-11-17 Akim Demaille <akim@epita.fr>
* lib/obstack.h: Formatting changes.
* obstack.h: Formatting changes.
(obstack_grow, obstack_grow0): Don't cast WHERE at all: that would
prevent type checking.
(obstack_ptr_grow, obstack_ptr_grow_fast): When assigning, don't
@@ -567,7 +752,7 @@
* quotearg.h (enum quoting style): New enum clocale_quoting_style.
* quotearg.c: (quoting_style_args, quoting_style_vals,
* quotearg.c (quoting_style_args, quoting_style_vals,
quotearg_buffer_restyled): Add support for
clocale_quoting_style. Undo previous change to
locale_quoting_style behavior, and undo the "{LEFT QUOTATION MARK}"

View File

@@ -9,13 +9,15 @@ DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
libfetish_a_SOURCES = \
getdate.y posixtm.c addext.c argmatch.c backupfile.c basename.c \
canon-host.c closeout.c diacrit.c dirname.c exclude.c filemode.c \
canon-host.c closeout.c diacrit.c dirname.c dup-safer.c \
exclude.c filemode.c fopen-safer.c \
full-write.c getopt.c getopt1.c getstr.c getugroups.c hard-locale.c hash.c \
human.c idcache.c isdir.c linebuffer.c localcharset.c long-options.c \
makepath.c mbswidth.c md5.c memcasecmp.c memcoll.c modechange.c \
path-concat.c physmem.c \
quote.c quotearg.c readtokens.c safe-read.c same.c save-cwd.c \
savedir.c sha.c stripslash.c unicodeio.c userspec.c version-etc.c xgetcwd.c \
savedir.c sha.c strftime.c stripslash.c \
unicodeio.c userspec.c version-etc.c xgetcwd.c \
xgethostname.c xmalloc.c xstrdup.c xstrtod.c xstrtol.c xstrtoul.c \
xstrtoumax.c yesno.c
@@ -32,7 +34,8 @@ noinst_HEADERS = \
path-concat.h pathmax.h physmem.h posixtm.h \
quote.h quotearg.h readtokens.h \
readutmp.h regex.h safe-read.h same.h save-cwd.h savedir.h sha.h \
strverscmp.h unicodeio.h version-etc.h xalloc.h xstrtod.h xstrtol.h
stdio-safer.h strverscmp.h unicodeio.h unistd-safer.h version-etc.h \
xalloc.h xstrtod.h xstrtol.h
BUILT_SOURCES = getdate.c lstat.c stat.c
MAINTAINERCLEANFILES = $(BUILT_SOURCES)

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/* addext.c -- add an extension to a file name
Copyright (C) 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
Copyright 1990, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,8 +29,6 @@
# define HAVE_LONG_FILE_NAMES 0
#endif
#include <backupfile.h>
#if HAVE_LIMITS_H
# include <limits.h>
#endif
@@ -49,7 +47,8 @@
# include <unistd.h>
#endif
char *base_name PARAMS ((char const *));
#include "backupfile.h"
#include "dirname.h"
/* Append to FILENAME the extension EXT, unless the result would be too long,
in which case just append the character E. */
@@ -58,7 +57,7 @@ void
addext (char *filename, char const *ext, int e)
{
char *s = base_name (filename);
size_t slen = strlen (s), extlen = strlen (ext);
size_t slen = base_len (s), extlen = strlen (ext);
long slen_max = -1;
#if HAVE_PATHCONF && defined _PC_NAME_MAX
@@ -70,7 +69,8 @@ addext (char *filename, char const *ext, int e)
else
{
char c = *s;
*s = 0;
if (! ISSLASH (c))
*s = 0;
slen_max = pathconf (filename, _PC_NAME_MAX);
*s = c;
}

View File

@@ -1,5 +1,5 @@
/* argmatch.c -- find a match for a string in an array
Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1990, 1998, 1999, 2001 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
@@ -38,6 +38,7 @@
#include "error.h"
#include "quotearg.h"
#include "quote.h"
/* When reporting an invalid argument, show nonprinting characters
by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use
@@ -156,10 +157,11 @@ void
argmatch_invalid (const char *context, const char *value, int problem)
{
char const *format = (problem == -1
? _("invalid argument %s for `%s'")
: _("ambiguous argument %s for `%s'"));
? _("invalid argument %s for %s")
: _("ambiguous argument %s for %s"));
error (0, 0, format, quotearg_style (ARGMATCH_QUOTING_STYLE, value), context);
error (0, 0, format, quotearg_style (ARGMATCH_QUOTING_STYLE, value),
quote (context));
}
/* List the valid arguments for argmatch.

View File

@@ -1,5 +1,6 @@
/* backupfile.c -- make Emacs style backup file names
Copyright (C) 1990-1997, 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright 1990,91,92,93,94,95,96,97,98,99,2000, 2001 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,9 +24,6 @@
# include <config.h>
#endif
#include <argmatch.h>
#include <backupfile.h>
#include <stdio.h>
#include <sys/types.h>
#if HAVE_STRING_H
@@ -76,8 +74,6 @@ char *getenv ();
char *malloc ();
#endif
char *base_name PARAMS ((char const *));
#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H
# define HAVE_DIR 1
#else
@@ -111,6 +107,10 @@ char *base_name PARAMS ((char const *));
# define REAL_DIR_ENTRY(dp) 1
#endif
#include "argmatch.h"
#include "backupfile.h"
#include "dirname.h"
/* The extension added to file names to produce a simple (as opposed
to numbered) backup file name. */
const char *simple_backup_suffix = "~";
@@ -137,29 +137,31 @@ find_backup_file_name (const char *file, enum backup_type backup_type)
if (HAVE_DIR && backup_suffix_size_max < numbered_suffix_size_max)
backup_suffix_size_max = numbered_suffix_size_max;
s = malloc (file_len + backup_suffix_size_max + numbered_suffix_size_max);
s = malloc (file_len + 1
+ backup_suffix_size_max + numbered_suffix_size_max);
if (s)
{
strcpy (s, file);
#if HAVE_DIR
if (backup_type != simple)
{
int highest_backup;
size_t dir_len = base_name (s) - s;
size_t dirlen = dir_len (file);
strcpy (s + dir_len, ".");
highest_backup = max_backup_version (file + dir_len, s);
memcpy (s, file, dirlen);
if (dirlen == FILESYSTEM_PREFIX_LEN (file))
s[dirlen++] = '.';
s[dirlen] = '\0';
highest_backup = max_backup_version (base_name (file), s);
if (! (backup_type == numbered_existing && highest_backup == 0))
{
char *numbered_suffix = s + (file_len + backup_suffix_size_max);
sprintf (numbered_suffix, ".~%d~", highest_backup + 1);
suffix = numbered_suffix;
}
strcpy (s, file);
}
#endif /* HAVE_DIR */
strcpy (s, file);
addext (s, suffix, '~');
}
return s;
@@ -186,7 +188,7 @@ max_backup_version (const char *file, const char *dir)
return 0;
highest_version = 0;
file_name_length = strlen (file);
file_name_length = base_len (file);
while ((dp = readdir (dirp)) != 0)
{

View File

@@ -19,53 +19,61 @@
# include <config.h>
#endif
#include <stdio.h>
#include <assert.h>
#ifndef FILESYSTEM_PREFIX_LEN
# define FILESYSTEM_PREFIX_LEN(Filename) 0
#if STDC_HEADERS || HAVE_STRING_H
# include <string.h>
#endif
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
#ifndef ISSLASH
# define ISSLASH(C) ((C) == '/')
#endif
char *base_name PARAMS ((char const *name));
#include "dirname.h"
/* In general, we can't use the builtin `basename' function if available,
since it has different meanings in different environments.
In some environments the builtin `basename' modifies its argument.
If NAME is all slashes, be sure to return `/'. */
Return the address of the last file name component of NAME. If
NAME has no file name components because it is all slashes, return
NAME if it is empty, the address of its last slash otherwise. */
char *
base_name (char const *name)
{
char const *base = name += FILESYSTEM_PREFIX_LEN (name);
int all_slashes = 1;
char const *base = name + FILESYSTEM_PREFIX_LEN (name);
char const *p;
for (p = name; *p; p++)
for (p = base; *p; p++)
{
if (ISSLASH (*p))
base = p + 1;
else
all_slashes = 0;
{
/* Treat multiple adjacent slashes like a single slash. */
do p++;
while (ISSLASH (*p));
/* If the file name ends in slash, use the trailing slash as
the basename if no non-slashes have been found. */
if (! *p)
{
if (ISSLASH (*base))
base = p - 1;
break;
}
/* *P is a non-slash preceded by a slash. */
base = p;
}
}
/* If NAME is all slashes, arrange to return `/'. */
if (*base == '\0' && ISSLASH (*name) && all_slashes)
--base;
/* Make sure the last byte is not a slash. */
assert (all_slashes || !ISSLASH (*(p - 1)));
return (char *) base;
}
/* Return the length of of the basename NAME. Typically NAME is the
value returned by base_name. Act like strlen (NAME), except omit
redundant trailing slashes. */
size_t
base_len (char const *name)
{
size_t len;
for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--)
continue;
return len;
}

View File

@@ -33,27 +33,37 @@
# name used by which systems a MIME name?
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd
# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-2 glibc aix hpux irix solaris freebsd yes
# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-3 glibc yes
# ISO-8859-4 solaris yes
# ISO-8859-5 glibc aix hpux irix solaris yes
# ISO-8859-4 osf solaris freebsd yes
# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes
# ISO-8859-6 glibc aix hpux solaris yes
# ISO-8859-7 glibc aix hpux irix osf solaris yes
# ISO-8859-8 glibc aix hpux solaris yes
# ISO-8859-8 glibc aix hpux osf solaris yes
# ISO-8859-9 glibc aix hpux irix osf solaris yes
# ISO-8859-13 glibc
# ISO-8859-15 glibc aix solaris freebsd
# ISO-8859-15 glibc aix osf solaris freebsd
# KOI8-R glibc solaris freebsd yes
# KOI8-U glibc yes
# CP850 aix osf
# KOI8-U glibc freebsd yes
# CP437 dos
# CP775 dos
# CP850 aix osf dos
# CP852 dos
# CP855 dos
# CP856 aix
# CP866 freebsd
# CP874 win32
# CP857 dos
# CP861 dos
# CP862 dos
# CP864 dos
# CP865 dos
# CP866 freebsd dos
# CP869 dos
# CP874 win32 dos
# CP922 aix
# CP932 aix win32
# CP932 aix win32 dos
# CP943 aix
# CP949 win32
# CP950 win32
# CP949 osf win32 dos
# CP950 win32 dos
# CP1046 aix
# CP1124 aix
# CP1129 aix
@@ -65,17 +75,17 @@
# CP1255 win32
# CP1256 win32
# CP1257 win32
# GB2312 glibc aix hpux irix solaris yes
# EUC-JP glibc aix hpux irix solaris yes
# EUC-KR glibc aix hpux irix solaris yes
# EUC-TW glibc aix hpux irix solaris
# BIG5 glibc aix hpux solaris yes
# GB2312 glibc aix hpux irix solaris freebsd yes
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
# EUC-TW glibc aix hpux irix osf solaris
# BIG5 glibc aix hpux osf solaris freebsd yes
# BIG5HKSCS glibc
# GBK aix win32
# GBK aix osf win32 dos
# GB18030 glibc
# SJIS hpux solaris
# SJIS hpux osf solaris freebsd
# JOHAB glibc win32
# TIS-620 glibc aix hpux solaris
# TIS-620 glibc aix hpux osf solaris
# VISCII glibc yes
# HP-ROMAN8 hpux
# HP-ARABIC8 hpux
@@ -83,7 +93,9 @@
# HP-HEBREW8 hpux
# HP-TURKISH8 hpux
# HP-KANA8 hpux
# UTF-8 glibc aix hpux solaris yes
# DEC-KANJI osf
# DEC-HANYU osf
# UTF-8 glibc aix hpux osf solaris yes
#
# Note: Names which are not marked as being a MIME name should not be used in
# Internet protocols for information interchange (mail, news, etc.).
@@ -178,9 +190,28 @@ case "$os" in
;;
osf*)
echo "ISO8859-1 ISO-8859-1"
echo "ISO8859-2 ISO-8859-2"
echo "ISO8859-4 ISO-8859-4"
echo "ISO8859-5 ISO-8859-5"
echo "ISO8859-7 ISO-8859-7"
echo "ISO8859-8 ISO-8859-8"
echo "ISO8859-9 ISO-8859-9"
echo "ISO8859-15 ISO-8859-15"
echo "cp850 CP850"
echo "big5 BIG5"
echo "dechanyu DEC-HANYU"
echo "dechanzi GB2312"
echo "deckanji DEC-KANJI"
echo "deckorean EUC-KR"
echo "eucJP EUC-JP"
echo "eucKR EUC-KR"
echo "eucTW EUC-TW"
echo "GBK GBK"
echo "KSC5601 CP949"
echo "sdeckanji EUC-JP"
echo "SJIS SJIS"
echo "TACTIS TIS-620"
echo "UTF-8 UTF-8"
;;
solaris*)
echo "646 ASCII"
@@ -214,8 +245,8 @@ case "$os" in
echo "$l.ASCII ASCII"
done
for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \
lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do
echo "$l.ISO_8859-1 ISO-8859-1"
echo "$l.DIS_8859-15 ISO-8859-15"
done
@@ -241,6 +272,167 @@ case "$os" in
;;
beos*)
# BeOS has a single locale, and it has UTF-8 encoding.
echo "C UTF-8"
echo "* UTF-8"
;;
msdosdjgpp*)
# DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
echo "#"
echo "# The encodings given here may not all be correct."
echo "# If you find that the encoding given for your language and"
echo "# country is not the one your DOS machine actually uses, just"
echo "# correct it in this file, and send a mail to"
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
echo "# and Bruno Haible <haible@clisp.cons.org>."
echo "#"
echo "C ASCII"
# ISO-8859-1 languages
echo "ca CP850"
echo "ca_ES CP850"
echo "da CP865" # not CP850 ??
echo "da_DK CP865" # not CP850 ??
echo "de CP850"
echo "de_AT CP850"
echo "de_CH CP850"
echo "de_DE CP850"
echo "en CP850"
echo "en_AU CP850" # not CP437 ??
echo "en_CA CP850"
echo "en_GB CP850"
echo "en_NZ CP437"
echo "en_US CP437"
echo "en_ZA CP850" # not CP437 ??
echo "es CP850"
echo "es_AR CP850"
echo "es_BO CP850"
echo "es_CL CP850"
echo "es_CO CP850"
echo "es_CR CP850"
echo "es_CU CP850"
echo "es_DO CP850"
echo "es_EC CP850"
echo "es_ES CP850"
echo "es_GT CP850"
echo "es_HN CP850"
echo "es_MX CP850"
echo "es_NI CP850"
echo "es_PA CP850"
echo "es_PY CP850"
echo "es_PE CP850"
echo "es_SV CP850"
echo "es_UY CP850"
echo "es_VE CP850"
echo "et CP850"
echo "et_EE CP850"
echo "eu CP850"
echo "eu_ES CP850"
echo "fi CP850"
echo "fi_FI CP850"
echo "fr CP850"
echo "fr_BE CP850"
echo "fr_CA CP850"
echo "fr_CH CP850"
echo "fr_FR CP850"
echo "ga CP850"
echo "ga_IE CP850"
echo "gd CP850"
echo "gd_GB CP850"
echo "gl CP850"
echo "gl_ES CP850"
echo "id CP850" # not CP437 ??
echo "id_ID CP850" # not CP437 ??
echo "is CP861" # not CP850 ??
echo "is_IS CP861" # not CP850 ??
echo "it CP850"
echo "it_CH CP850"
echo "it_IT CP850"
echo "lt CP775"
echo "lt_LT CP775"
echo "lv CP775"
echo "lv_LV CP775"
echo "nb CP865" # not CP850 ??
echo "nb_NO CP865" # not CP850 ??
echo "nl CP850"
echo "nl_BE CP850"
echo "nl_NL CP850"
echo "nn CP865" # not CP850 ??
echo "nn_NO CP865" # not CP850 ??
echo "no CP865" # not CP850 ??
echo "no_NO CP865" # not CP850 ??
echo "pt CP850"
echo "pt_BR CP850"
echo "pt_PT CP850"
echo "sv CP850"
echo "sv_SE CP850"
# ISO-8859-2 languages
echo "cs CP852"
echo "cs_CZ CP852"
echo "hr CP852"
echo "hr_HR CP852"
echo "hu CP852"
echo "hu_HU CP852"
echo "pl CP852"
echo "pl_PL CP852"
echo "ro CP852"
echo "ro_RO CP852"
echo "sk CP852"
echo "sk_SK CP852"
echo "sl CP852"
echo "sl_SI CP852"
echo "sq CP852"
echo "sq_AL CP852"
echo "sr CP852" # CP852 or CP866 or CP855 ??
echo "sr_YU CP852" # CP852 or CP866 or CP855 ??
# ISO-8859-3 languages
echo "mt CP850"
echo "mt_MT CP850"
# ISO-8859-5 languages
echo "be CP866"
echo "be_BE CP866"
echo "bg CP866" # not CP855 ??
echo "bg_BG CP866" # not CP855 ??
echo "mk CP866" # not CP855 ??
echo "mk_MK CP866" # not CP855 ??
echo "ru KOI8-R" # not CP866 ??
echo "ru_RU KOI8-R" # not CP866 ??
# ISO-8859-6 languages
echo "ar CP864"
echo "ar_AE CP864"
echo "ar_DZ CP864"
echo "ar_EG CP864"
echo "ar_IQ CP864"
echo "ar_IR CP864"
echo "ar_JO CP864"
echo "ar_KW CP864"
echo "ar_MA CP864"
echo "ar_OM CP864"
echo "ar_QA CP864"
echo "ar_SA CP864"
echo "ar_SY CP864"
# ISO-8859-7 languages
echo "el CP869"
echo "el_GR CP869"
# ISO-8859-8 languages
echo "he CP862"
echo "he_IL CP862"
# ISO-8859-9 languages
echo "tr CP857"
echo "tr_TR CP857"
# Japanese
echo "ja CP932"
echo "ja_JP CP932"
# Chinese
echo "zh_CN GBK"
echo "zh_TW CP950" # not CP938 ??
# Korean
echo "kr CP949" # not CP934 ??
echo "kr_KR CP949" # not CP934 ??
# Thai
echo "th CP874"
echo "th_TH CP874"
# Other
echo "eo CP850"
echo "eo_EO CP850"
;;
esac

View File

@@ -1,5 +1,5 @@
/* dirname.c -- return all but the last element in a path
Copyright (C) 1990, 1998, 2000 Free Software Foundation, Inc.
Copyright 1990, 1998, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,126 +19,43 @@
# include <config.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
#else
char *malloc ();
#endif
#if defined STDC_HEADERS || defined HAVE_STRING_H
#if STDC_HEADERS || HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
# ifndef strrchr
# define strrchr rindex
# endif
#endif
#include <assert.h>
#ifndef HAVE_DECL_MEMRCHR
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_MEMRCHR
void *memrchr ();
#endif
#include "dirname.h"
#include "xalloc.h"
#ifndef FILESYSTEM_PREFIX_LEN
# define FILESYSTEM_PREFIX_LEN(Filename) 0
#endif
#ifndef ISSLASH
# define ISSLASH(C) ((C) == '/')
#endif
#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')
/* Return the length of `dirname (PATH)' and set *RESULT to point
to PATH or to `"."', as appropriate. Works properly even if
there are trailing slashes (by effectively ignoring them).
WARNING: This function doesn't work for cwd-relative names like
`a:foo' that are specified with a drive-letter prefix. That case
is handled in the caller. */
static size_t
dir_name_r (char const *path, char const **result)
/* Return the length of `dirname (PATH)', or zero if PATH is
in the working directory. Works properly even if
there are trailing slashes (by effectively ignoring them). */
size_t
dir_len (char const *path)
{
char const *slash;
size_t length; /* Length of result, not including NUL. */
size_t prefix_length = FILESYSTEM_PREFIX_LEN (path);
size_t length;
slash = strrchr (path, '/');
if (BACKSLASH_IS_PATH_SEPARATOR)
{
char const *b = strrchr (path, '\\');
if (b && slash < b)
slash = b;
}
/* Strip the basename and any redundant slashes before it. */
for (length = base_name (path) - path; prefix_length < length; length--)
if (! ISSLASH (path[length - 1]))
return length;
/* If the last byte of PATH is a slash, decrement SLASH until it's
pointing at the leftmost in a sequence of trailing slashes. */
if (slash && slash[1] == 0)
{
while (path < slash && ISSLASH (slash[-1]))
{
--slash;
}
if (path < slash)
{
size_t len = slash - path;
slash = memrchr (path, '/', len);
if (BACKSLASH_IS_PATH_SEPARATOR)
{
char const *b = memrchr (path, '\\', len);
if (b && slash < b)
slash = b;
}
}
}
if (slash == 0)
{
/* File is in the current directory. */
length = FILESYSTEM_PREFIX_LEN (path);
if (length == 0)
{
path = ".";
length = 1;
}
}
else
{
/* Remove any trailing slashes from the result. If we have a
canonicalized "d:/path", leave alone the root case "d:/". */
char const *lim = path + FILESYSTEM_PREFIX_LEN (path);
while (lim < slash && ISSLASH (*slash))
--slash;
length = slash - path + 1;
}
*result = path;
return length;
/* But don't strip the only slash from "/". */
return prefix_length + ISSLASH (path[prefix_length]);
}
/* Return the leading directories part of PATH,
allocated with malloc. If out of memory, return 0.
allocated with xmalloc.
Works properly even if there are trailing slashes
(by effectively ignoring them). */
char *
dir_name (char const *path)
{
char const *result;
size_t length = dir_name_r (path, &result);
int append_dot = (length && length == FILESYSTEM_PREFIX_LEN (newpath));
char *newpath = (char *) malloc (length + append_dot + 1);
if (newpath == 0)
return 0;
strncpy (newpath, result, length);
/* If PATH is "d:foo", return "d:.", the CWD on drive d: */
size_t length = dir_len (path);
int append_dot = (length == FILESYSTEM_PREFIX_LEN (path));
char *newpath = xmalloc (length + append_dot + 1);
memcpy (newpath, path, length);
if (append_dot)
newpath[length++] = '.';
newpath[length] = 0;
@@ -149,7 +66,8 @@ dir_name (char const *path)
/*
Run the test like this (expect no output):
gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall memrchr.c dirname.c
gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall \
basename.c dirname.c xmalloc.c
sed -n '/^BEGIN-DATA$/,/^END-DATA$/p' dirname.c|grep -v DATA|./a.out
BEGIN-DATA
@@ -165,7 +83,6 @@ END-DATA
# define MAX_BUFF_LEN 1024
# include <stdio.h>
# include <stdlib.h>
int
main ()
@@ -183,7 +100,6 @@ main ()
if (strcmp (result, expected_result))
printf ("%s: got %s, expected %s\n", path, result, expected_result);
}
exit (0);
return 0;
}
#endif

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,23 @@
# endif
# endif
char *
dir_name PARAMS ((const char *path));
# ifndef DIRECTORY_SEPARATOR
# define DIRECTORY_SEPARATOR '/'
# endif
# ifndef ISSLASH
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
# endif
# ifndef FILESYSTEM_PREFIX_LEN
# define FILESYSTEM_PREFIX_LEN(Filename) 0
# endif
char *base_name PARAMS ((char const *path));
char *dir_name PARAMS ((char const *path));
size_t base_len PARAMS ((char const *path));
size_t dir_len PARAMS ((char const *path));
int strip_trailing_slashes PARAMS ((char *path));
#endif /* not DIRNAME_H_ */

62
lib/dup-safer.c Normal file
View File

@@ -0,0 +1,62 @@
/* Invoke dup, but avoid some glitches.
Copyright (C) 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#if HAVE_FCNTL_H
# include <fcntl.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
#include <unistd-safer.h>
/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or
STDERR_FILENO. */
int
dup_safer (int fd)
{
#ifdef F_DUPFD
return fcntl (fd, F_DUPFD, STDERR_FILENO + 1);
#else
int f = dup (fd);
if (0 <= f && f <= STDERR_FILENO)
{
int f1 = dup_safer (f);
int e = errno;
close (f);
errno = e;
f = f1;
}
return f;
#endif
}

76
lib/fopen-safer.c Normal file
View File

@@ -0,0 +1,76 @@
/* Invoke fopen, but avoid some glitches.
Copyright (C) 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Paul Eggert. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <unistd-safer.h>
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#include <stdio.h>
#include <stdio-safer.h>
/* Like fopen, but do not return stdin, stdout, or stderr. */
FILE *
fopen_safer (char const *file, char const *mode)
{
FILE *fp = fopen (file, mode);
if (fp)
{
int fd = fileno (fp);
if (0 <= fd && fd <= STDERR_FILENO)
{
int f = dup_safer (fd);
if (f < 0)
{
int e = errno;
fclose (fp);
errno = e;
return NULL;
}
if (fclose (fp) != 0
|| ! (fp = fdopen (f, mode)))
{
int e = errno;
close (f);
errno = e;
return NULL;
}
}
}
return fp;
}

View File

@@ -990,7 +990,8 @@ get_date (const char *p, const time_t *now)
/* Let mktime deduce tm_isdst if we have an absolute time stamp,
or if the relative time stamp mentions days, months, or years. */
if (pc.dates_seen | pc.days_seen | pc.times_seen | pc.rel_day | pc.rel_month | pc.rel_year)
if (pc.dates_seen | pc.days_seen | pc.times_seen | pc.rel_day
| pc.rel_month | pc.rel_year)
tm.tm_isdst = -1;
/* But if the input explicitly specifies local time with or without
@@ -1037,6 +1038,7 @@ get_date (const char *p, const time_t *now)
{
tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
+ 7 * (pc.day_ordinal - (0 < pc.day_ordinal)));
tm.tm_isdst = -1;
Start = mktime (&tm);
if (Start == (time_t) -1)
return Start;

View File

@@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000 Free Software Foundation, Inc.
Copyright (C) 2000-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -191,7 +191,7 @@ get_charset_aliases ()
into one of the canonical names listed in config.charset.
The result must not be freed; it is statically allocated.
If the canonical name cannot be determined, the result is a non-canonical
name or NULL. */
name. */
#ifdef STATIC
STATIC
@@ -211,10 +211,14 @@ locale_charset ()
# else
/* On old systems which lack it, use setlocale and getenv. */
/* On old systems which lack it, use setlocale or getenv. */
const char *locale = NULL;
# if HAVE_SETLOCALE
/* But most old systems don't have a complete set of locales. Some
(like SunOS 4 or DJGPP) have only the C locale. Therefore we don't
use setlocale here; it would return "C" when it doesn't support the
locale name the user has set. */
# if HAVE_SETLOCALE && 0
locale = setlocale (LC_CTYPE, NULL);
# endif
if (locale == NULL || locale[0] == '\0')
@@ -245,18 +249,20 @@ locale_charset ()
#endif
if (codeset != NULL && codeset[0] != '\0')
{
/* Resolve alias. */
for (aliases = get_charset_aliases ();
*aliases != '\0';
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
if (!strcmp (codeset, aliases))
{
codeset = aliases + strlen (aliases) + 1;
break;
}
}
if (codeset == NULL)
/* The canonical name cannot be determined. */
codeset = "";
/* Resolve alias. */
for (aliases = get_charset_aliases ();
*aliases != '\0';
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
if (strcmp (codeset, aliases) == 0
|| (aliases[0] == '*' && aliases[1] == '\0'))
{
codeset = aliases + strlen (aliases) + 1;
break;
}
return codeset;
}

View File

@@ -115,11 +115,10 @@ extern int errno;
#endif
#include "save-cwd.h"
#include "dirname.h"
#include "error.h"
#include "quote.h"
void strip_trailing_slashes ();
#define CLEANUP_CWD \
do \
{ \
@@ -196,7 +195,6 @@ make_dir (const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
}
/* Ensure that the directory ARGPATH exists.
Remove any trailing slashes from ARGPATH before calling this function.
Create any leading directories that don't already exist, with
permissions PARENT_MODE.

37
lib/mkstemp.c Normal file
View File

@@ -0,0 +1,37 @@
/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
#ifndef __GT_FILE
# define __GT_FILE 0
#endif
int __gen_tempname ();
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the filename unique.
Then open the file and return a fd. */
int
mkstemp (template)
char *template;
{
return __gen_tempname (template, __GT_FILE);
}

View File

@@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988-1994,96,97,98,99,2000 Free Software Foundation, Inc.
Copyright (C) 1988-1994,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@@ -472,6 +472,7 @@ _obstack_memory_used (h)
# endif
static void
__attribute__ ((noreturn))
print_and_abort ()
{
fputs (_("memory exhausted"), stderr);

View File

@@ -1,5 +1,5 @@
/* path-concat.c -- concatenate two arbitrary pathnames
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 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
@@ -55,14 +55,7 @@ char *malloc ();
char *strdup ();
#endif
#ifndef DIRECTORY_SEPARATOR
# define DIRECTORY_SEPARATOR '/'
#endif
#ifndef ISSLASH
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
#endif
#include "dirname.h"
#include "xalloc.h"
#include "path-concat.h"
@@ -84,8 +77,8 @@ path_concat (const char *dir, const char *base, char **base_in_result)
{
char *p;
char *p_concat;
size_t base_len;
size_t dir_len;
size_t baselen;
size_t dirlen;
if (!dir)
{
@@ -96,27 +89,28 @@ path_concat (const char *dir, const char *base, char **base_in_result)
}
/* DIR is not empty. */
base_len = strlen (base);
dir_len = strlen (dir);
baselen = base_len (base);
dirlen = strlen (dir);
p_concat = malloc (dir_len + base_len + 2);
p_concat = malloc (dirlen + baselen + 2);
if (!p_concat)
return 0;
p = mempcpy (p_concat, dir, dir_len);
p = mempcpy (p_concat, dir, dirlen);
if (dir_len > 0)
if (FILESYSTEM_PREFIX_LEN (dir) < dirlen)
{
if (ISSLASH (*(p - 1)) && ISSLASH(*base))
if (ISSLASH (*(p - 1)) && ISSLASH (*base))
--p;
else if (!ISSLASH (*(p - 1)) && !ISSLASH(*base))
else if (!ISSLASH (*(p - 1)) && !ISSLASH (*base))
*p++ = DIRECTORY_SEPARATOR;
}
if (base_in_result)
*base_in_result = p;
memcpy (p, base, base_len + 1);
memcpy (p, base, baselen);
p[baselen] = '\0';
return p_concat;
}

View File

@@ -1,5 +1,5 @@
/* Declarations for GNU's read utmp module.
Copyright (C) 1992-2000 Free Software Foundation, Inc.
Copyright (C) 1992-2001 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
@@ -69,6 +69,9 @@
# undef UT_USER
# define UT_USER(Utmp) ((Utmp)->ut_name)
# endif
# if defined HAVE_STRUCT_UTMPX_UT_TYPE
# define UT_TYPE(Utmp) ((Utmp)->ut_type)
# endif
# else
@@ -79,6 +82,9 @@
# undef UT_USER
# define UT_USER(Utmp) Utmp->ut_name
# endif
# if defined HAVE_STRUCT_UTMP_UT_TYPE
# define UT_TYPE(Utmp) ((Utmp)->ut_type)
# endif
# endif

View File

@@ -65,7 +65,7 @@
# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_TYPE)+1)
# define PUT_CHAR(c) \
do { \
if (MC_CUR_MAX == 1) \
if (MB_CUR_MAX == 1) \
putchar (c); \
else \
printf ("%C", (wint_t) c); /* Should we use wide stream?? */ \
@@ -2137,21 +2137,21 @@ typedef struct
/* Get the next unsigned number in the uncompiled pattern. */
#define GET_UNSIGNED_NUMBER(num) \
{ if (p != pend) \
{ \
PATFETCH (c); \
while ('0' <= c && c <= '9') \
{ \
if (num < 0) \
num = 0; \
num = num * 10 + c - '0'; \
if (p == pend) \
break; \
PATFETCH (c); \
} \
} \
}
#define GET_UNSIGNED_NUMBER(num) \
{ \
while (p != pend) \
{ \
PATFETCH (c); \
if (c < '0' || c > '9') \
break; \
if (num <= RE_DUP_MAX) \
{ \
if (num < 0) \
num = 0; \
num = num * 10 + c - '0'; \
} \
} \
}
#if defined _LIBC || WIDE_CHAR_SUPPORT
/* The GNU C library provides support for user-defined character classes
@@ -2325,14 +2325,6 @@ regex_compile (pattern, size, syntax, bufp)
/* Address of beginning of regexp, or inside of last group. */
US_CHAR_TYPE *begalt;
/* Place in the uncompiled pattern (i.e., the {) to
which to go back if the interval is invalid. */
#ifdef MBS_SUPPORT
const US_CHAR_TYPE *beg_interval;
#else
const char *beg_interval;
#endif /* MBS_SUPPORT */
/* Address of the place where a forward jump should go to the end of
the containing expression. Each alternative of an `or' -- except the
last -- ends with a forward jump of this sort. */
@@ -2345,23 +2337,24 @@ regex_compile (pattern, size, syntax, bufp)
#ifdef MBS_SUPPORT
/* Initialize the wchar_t PATTERN and offset_buffer. */
p = pend = pattern = TALLOC(csize, CHAR_TYPE);
p = pend = pattern = TALLOC(csize + 1, CHAR_TYPE);
mbs_offset = TALLOC(csize + 1, int);
is_binary = TALLOC(csize + 1, char);
if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
{
if (pattern) free(pattern);
if (mbs_offset) free(mbs_offset);
if (is_binary) free(is_binary);
free(pattern);
free(mbs_offset);
free(is_binary);
return REG_ESPACE;
}
pattern[csize] = L'\0'; /* sentinel */
size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
pend = p + size;
if (size < 0)
{
if (pattern) free(pattern);
if (mbs_offset) free(mbs_offset);
if (is_binary) free(is_binary);
free(pattern);
free(mbs_offset);
free(is_binary);
return REG_BADPAT;
}
#endif
@@ -2383,9 +2376,9 @@ regex_compile (pattern, size, syntax, bufp)
if (compile_stack.stack == NULL)
{
#ifdef MBS_SUPPORT
if (pattern) free(pattern);
if (mbs_offset) free(mbs_offset);
if (is_binary) free(is_binary);
free(pattern);
free(mbs_offset);
free(is_binary);
#endif
return REG_ESPACE;
}
@@ -3826,25 +3819,19 @@ regex_compile (pattern, size, syntax, bufp)
/* At least (most) this many matches must be made. */
int lower_bound = -1, upper_bound = -1;
beg_interval = p - 1;
/* Place in the uncompiled pattern (i.e., just after
the '{') to go back to if the interval is invalid. */
const CHAR_TYPE *beg_interval = p;
if (p == pend)
{
if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
goto unfetch_interval;
else
FREE_STACK_RETURN (REG_EBRACE);
}
goto invalid_interval;
GET_UNSIGNED_NUMBER (lower_bound);
if (c == ',')
{
GET_UNSIGNED_NUMBER (upper_bound);
if ((!(syntax & RE_NO_BK_BRACES) && c != '\\')
|| ((syntax & RE_NO_BK_BRACES) && c != '}'))
FREE_STACK_RETURN (REG_BADBR);
if (upper_bound < 0)
upper_bound = RE_DUP_MAX;
}
@@ -3852,36 +3839,24 @@ regex_compile (pattern, size, syntax, bufp)
/* Interval such as `{1}' => match exactly once. */
upper_bound = lower_bound;
if (lower_bound < 0 || upper_bound > RE_DUP_MAX
|| lower_bound > upper_bound)
{
if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
goto unfetch_interval;
else
FREE_STACK_RETURN (REG_BADBR);
}
if (! (0 <= lower_bound && lower_bound <= upper_bound))
goto invalid_interval;
if (!(syntax & RE_NO_BK_BRACES))
{
if (c != '\\') FREE_STACK_RETURN (REG_EBRACE);
if (c != '\\' || p == pend)
goto invalid_interval;
PATFETCH (c);
}
if (c != '}')
{
if (!(syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES))
goto unfetch_interval;
else
FREE_STACK_RETURN (REG_BADBR);
}
/* We just parsed a valid interval. */
goto invalid_interval;
/* If it's invalid to have no preceding re. */
if (!laststart)
{
if (syntax & RE_CONTEXT_INVALID_OPS)
if (syntax & RE_CONTEXT_INVALID_OPS
&& !(syntax & RE_INVALID_INTERVAL_ORD))
FREE_STACK_RETURN (REG_BADRPT);
else if (syntax & RE_CONTEXT_INDEP_OPS)
laststart = b;
@@ -3889,6 +3864,11 @@ regex_compile (pattern, size, syntax, bufp)
goto unfetch_interval;
}
/* We just parsed a valid interval. */
if (RE_DUP_MAX < upper_bound)
FREE_STACK_RETURN (REG_BADBR);
/* If the upper bound is zero, don't want to succeed at
all; jump from `laststart' to `b + 3', which will be
the end of the buffer after we insert the jump. */
@@ -3974,25 +3954,20 @@ regex_compile (pattern, size, syntax, bufp)
}
}
pending_exact = 0;
beg_interval = NULL;
}
break;
break;
unfetch_interval:
/* If an invalid interval, match the characters as literals. */
assert (beg_interval);
p = beg_interval;
beg_interval = NULL;
/* normal_char and normal_backslash need `c'. */
PATFETCH (c);
if (!(syntax & RE_NO_BK_BRACES))
{
if (p > pattern && p[-1] == '\\')
goto normal_backslash;
}
goto normal_char;
invalid_interval:
if (!(syntax & RE_INVALID_INTERVAL_ORD))
FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR);
unfetch_interval:
/* Match the characters as literals. */
p = beg_interval;
c = '{';
if (syntax & RE_NO_BK_BRACES)
goto normal_char;
else
goto normal_backslash;
}
#ifdef emacs
/* There is no way to specify the before_dot and after_dot
@@ -5619,6 +5594,12 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
size2 = size1;
string1 = 0;
size1 = 0;
#ifdef MBS_SUPPORT
mbs_offset2 = mbs_offset1;
csize2 = csize1;
mbs_offset1 = NULL;
csize1 = 0;
#endif
}
end1 = string1 + size1;
end2 = string2 + size2;
@@ -5633,6 +5614,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
}
else
{
if (stop > csize1 + csize2)
stop = csize1 + csize2;
end_match_1 = end1;
mcnt = count_mbs_length(mbs_offset2, stop-csize1);
end_match_2 = string2 + mcnt;
@@ -7110,14 +7093,15 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
case wordbeg:
DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
if (!AT_STRINGS_END (d) && WORDCHAR_P (d)
&& (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
break;
goto fail;
case wordend:
DEBUG_PRINT1 ("EXECUTING wordend.\n");
if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
&& (!WORDCHAR_P (d) || AT_STRINGS_END (d)))
&& (AT_STRINGS_END (d) || !WORDCHAR_P (d)))
break;
goto fail;

View File

@@ -160,6 +160,11 @@ typedef unsigned long int reg_syntax_t;
this bit set, and it won't affect anything in the normal case. */
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
/* If this bit is set, a syntactically invalid interval is treated as
a string of ordinary characters. For example, the ERE 'a{1' is
treated as 'a\{1'. */
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
@@ -199,7 +204,8 @@ extern reg_syntax_t re_syntax_options;
| RE_NO_BK_VBAR)
#define RE_SYNTAX_POSIX_EGREP \
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
| RE_INVALID_INTERVAL_ORD)
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC

View File

@@ -30,7 +30,8 @@
# include <strings.h>
#endif
#include <xalloc.h>
#include "dirname.h"
#include "xalloc.h"
#ifndef HAVE_DECL_FREE
"this configure-time declaration test was not run"
@@ -39,8 +40,6 @@
void free ();
#endif
void strip_trailing_slashes ();
/* Rename the file SRC_PATH to DST_PATH, removing any trailing
slashes from SRC_PATH. Needed for SunOS 4.1.1_U1. */

View File

@@ -54,8 +54,6 @@ extern int errno;
# define _(Text) Text
#endif
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
#ifndef HAVE_DECL_FREE
"this configure-time declaration test was not run"
#endif
@@ -63,8 +61,6 @@ extern int errno;
void free ();
#endif
char *base_name PARAMS ((char const *));
#define SAME_INODE(Stat_buf_1, Stat_buf_2) \
((Stat_buf_1).st_ino == (Stat_buf_2).st_ino \
&& (Stat_buf_1).st_dev == (Stat_buf_2).st_dev)
@@ -78,11 +74,11 @@ same_name (const char *source, const char *dest)
struct stat source_dir_stats;
struct stat dest_dir_stats;
char *source_dirname, *dest_dirname;
char *source_basename, *dest_basename;
size_t source_baselen, dest_baselen;
source_dirname = dir_name (source);
dest_dirname = dir_name (dest);
if (source_dirname == NULL || dest_dirname == NULL)
xalloc_die ();
if (stat (source_dirname, &source_dir_stats))
{
@@ -99,6 +95,13 @@ same_name (const char *source, const char *dest)
free (source_dirname);
free (dest_dirname);
return (SAME_INODE (source_dir_stats, dest_dir_stats)
&& STREQ (base_name (source), base_name (dest)));
if (! SAME_INODE (source_dir_stats, dest_dir_stats))
return 0;
source_basename = base_name (source);
dest_basename = base_name (dest);
source_baselen = base_len (source_basename);
dest_baselen = base_len (dest_basename);
return (source_baselen == dest_baselen
&& memcmp (source_basename, dest_basename, dest_baselen) == 0);
}

9
lib/stdio-safer.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
FILE *fopen_safer PARAMS ((char const *, char const *));

View File

@@ -421,40 +421,49 @@ static CHAR_T const month_name[][10] =
#endif
#ifdef emacs
# define my_strftime emacs_strftimeu
# define ut_argument , ut
# define ut_argument_spec int ut;
# define ut_argument_spec_iso , int ut
/* When compiling this file, GNU applications can #define my_strftime
to a symbol (typically nstrftime) to get an extended strftime with
extra arguments UT and NS. Emacs is a special case for now, but
this Emacs-specific code can be removed once Emacs's config.h
defines my_strftime. */
#if defined emacs && !defined my_strftime
# define my_strftime nstrftime
#endif
#ifdef my_strftime
# define extra_args , ut, ns
# define extra_args_spec int ut; int ns;
# define extra_args_spec_iso , int ut, int ns
#else
# ifdef COMPILE_WIDE
# define my_strftime wcsftime
# else
# define my_strftime strftime
# endif
# define ut_argument
# define ut_argument_spec
# define ut_argument_spec_iso
# define extra_args
# define extra_args_spec
# define extra_args_spec_iso
/* We don't have this information in general. */
# define ut 0
# define ns 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 * ut_argument_spec_iso));
const struct tm * extra_args_spec_iso));
size_t
my_strftime (s, maxsize, format, tp ut_argument)
my_strftime (s, maxsize, format, tp extra_args)
CHAR_T *s;
size_t maxsize;
const CHAR_T *format;
const struct tm *tp;
ut_argument_spec
extra_args_spec
{
struct tm tmcopy;
tmcopy = *tp;
return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
return _strftime_copytm (s, maxsize, format, &tmcopy extra_args);
}
# undef my_strftime
# define my_strftime _strftime_copytm
@@ -468,12 +477,12 @@ static CHAR_T const month_name[][10] =
anywhere, so to determine how many characters would be
written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
size_t
my_strftime (s, maxsize, format, tp ut_argument)
my_strftime (s, maxsize, format, tp extra_args)
CHAR_T *s;
size_t maxsize;
const CHAR_T *format;
const struct tm *tp;
ut_argument_spec
extra_args_spec
{
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT
@@ -810,9 +819,9 @@ my_strftime (s, maxsize, format, tp ut_argument)
{
CHAR_T *old_start = p;
size_t len = my_strftime (NULL, (size_t) -1, subfmt,
tp ut_argument);
tp extra_args);
add (len, my_strftime (p, maxsize - i, subfmt,
tp ut_argument));
tp extra_args));
if (to_uppcase)
while (old_start < p)
@@ -1044,6 +1053,21 @@ my_strftime (s, maxsize, format, tp ut_argument)
DO_NUMBER (2, tp->tm_mon + 1);
case L_('N'): /* GNU extension. */
if (modifier == L_('E'))
goto bad_format;
number_value = ns;
if (width != -1)
{
/* Take an explicit width less than 9 as a precision. */
int j;
for (j = width; j < 9; j++)
number_value /= 10;
}
DO_NUMBER (9, number_value);
case L_('n'): /* POSIX.2 extension. */
add (1, *p = L_('\n'));
break;
@@ -1368,15 +1392,15 @@ my_strftime (s, maxsize, format, tp ut_argument)
#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. */
strftime function plus the ut argument, but without the ns argument. */
size_t
emacs_strftime (s, maxsize, format, tp)
emacs_strftimeu (s, maxsize, format, tp, ut)
char *s;
size_t maxsize;
const char *format;
const struct tm *tp;
int ut;
{
return my_strftime (s, maxsize, format, tp, 0);
return my_strftime (s, maxsize, format, tp, ut, 0);
}
#endif

View File

@@ -1,5 +1,5 @@
/* stripslash.c -- remove trailing slashes from a string
Copyright (C) 1990 Free Software Foundation, Inc.
/* stripslash.c -- remove redundant trailing slashes from a file name
Copyright (C) 1990, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,22 +25,21 @@
# include <strings.h>
#endif
#ifndef ISSLASH
# define ISSLASH(C) ((C) == '/')
#endif
#include "dirname.h"
/* Remove trailing slashes from PATH.
Return nonzero if a trailing slash was removed.
This is useful when using filename completion from a shell that
adds a "/" after directory names (such as tcsh and bash), because
the Unix rename and rmdir system calls return an "Invalid argument" error
when given a path that ends in "/" (except for the root directory). */
void
int
strip_trailing_slashes (char *path)
{
int last;
last = strlen (path) - 1;
while (0 < last && ISSLASH (path[last]))
path[last--] = '\0';
char *base = base_name (path);
char *base_lim = base + base_len (base);
int had_slash = *base_lim;
*base_lim = '\0';
return had_slash;
}

306
lib/tempname.c Normal file
View File

@@ -0,0 +1,306 @@
/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif
#include <stdio.h>
#ifndef P_tmpdir
# define P_tmpdir "/tmp"
#endif
#ifndef TMP_MAX
# define TMP_MAX 238328
#endif
#ifndef __GT_FILE
# define __GT_FILE 0
# define __GT_BIGFILE 1
# define __GT_DIR 2
# define __GT_NOCREATE 3
#endif
#if STDC_HEADERS || _LIBC
# include <stddef.h>
# include <stdlib.h>
# include <string.h>
#endif
#if HAVE_FCNTL_H || _LIBC
# include <fcntl.h>
#endif
#if HAVE_SYS_TIME_H || _LIBC
# include <sys/time.h>
#endif
#if HAVE_STDINT_H || _LIBC
# include <stdint.h>
#endif
#if HAVE_UNISTD_H || _LIBC
# include <unistd.h>
#endif
#include <sys/stat.h>
#if STAT_MACROS_BROKEN
# undef S_ISDIR
#endif
#if !defined S_ISDIR && defined S_IFDIR
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
#if !S_IRUSR && S_IREAD
# define S_IRUSR S_IREAD
#endif
#if !S_IRUSR
# define S_IRUSR 00400
#endif
#if !S_IWUSR && S_IWRITE
# define S_IWUSR S_IWRITE
#endif
#if !S_IWUSR
# define S_IWUSR 00200
#endif
#if !S_IXUSR && S_IEXEC
# define S_IXUSR S_IEXEC
#endif
#if !S_IXUSR
# define S_IXUSR 00100
#endif
#if _LIBC
# define struct_stat64 struct stat64
#else
# define struct_stat64 struct stat
# define __getpid getpid
# define __gettimeofday gettimeofday
# define __mkdir mkdir
# define __open open
# define __open64 open
# define __lxstat64(version, path, buf) lstat (path, buf)
# define __xstat64(version, path, buf) stat (path, buf)
#endif
#if ! (HAVE___SECURE_GETENV || _LIBC)
# define __secure_getenv getenv
#endif
/* Use the widest available unsigned type if uint64_t is not
available. The algorithm below extracts a number less than 62**6
(approximately 2**35.725) from uint64_t, so ancient hosts where
uintmax_t is only 32 bits lose about 3.725 bits of randomness,
which is better than not having mkstemp at all. */
#if !defined UINT64_MAX && !defined uint64_t
# define uint64_t uintmax_t
#endif
/* Return nonzero if DIR is an existent directory. */
static int
direxists (const char *dir)
{
struct_stat64 buf;
return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
}
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
doesn't exist, none of the searched dirs exists, or there's not
enough space in TMPL. */
int
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
int try_tmpdir)
{
const char *d;
size_t dlen, plen;
if (!pfx || !pfx[0])
{
pfx = "file";
plen = 4;
}
else
{
plen = strlen (pfx);
if (plen > 5)
plen = 5;
}
if (try_tmpdir)
{
d = __secure_getenv ("TMPDIR");
if (d != NULL && direxists (d))
dir = d;
else if (dir != NULL && direxists (dir))
/* nothing */ ;
else
dir = NULL;
}
if (dir == NULL)
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
dir = "/tmp";
else
{
__set_errno (ENOENT);
return -1;
}
}
dlen = strlen (dir);
while (dlen > 1 && dir[dlen - 1] == '/')
dlen--; /* remove trailing slashes */
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
if (tmpl_len < dlen + 1 + plen + 6 + 1)
{
__set_errno (EINVAL);
return -1;
}
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
/* These are the characters used in temporary filenames. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must match the
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
does not exist at the time of the call to __gen_tempname. TMPL is
overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
__GT_BIGFILE: same as __GT_FILE but use open64().
__GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
int
__gen_tempname (char *tmpl, int kind)
{
int len;
char *XXXXXX;
static uint64_t value;
uint64_t random_time_bits;
int count, fd = -1;
int save_errno = errno;
struct_stat64 st;
len = strlen (tmpl);
if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
{
__set_errno (EINVAL);
return -1;
}
/* This is where the Xs start. */
XXXXXX = &tmpl[len - 6];
/* Get some more or less random data. */
#if HAVE_GETTIMEOFDAY || _LIBC
{
struct timeval tv;
__gettimeofday (&tv, NULL);
random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
}
#else
random_time_bits = time (NULL);
#endif
value += random_time_bits ^ __getpid ();
for (count = 0; count < TMP_MAX; value += 7777, ++count)
{
uint64_t v = value;
/* Fill in the random bits. */
XXXXXX[0] = letters[v % 62];
v /= 62;
XXXXXX[1] = letters[v % 62];
v /= 62;
XXXXXX[2] = letters[v % 62];
v /= 62;
XXXXXX[3] = letters[v % 62];
v /= 62;
XXXXXX[4] = letters[v % 62];
v /= 62;
XXXXXX[5] = letters[v % 62];
switch (kind)
{
case __GT_FILE:
fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
case __GT_BIGFILE:
fd = __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
break;
case __GT_DIR:
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
break;
case __GT_NOCREATE:
/* This case is backward from the other three. __gen_tempname
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
__set_errno (save_errno);
return 0;
}
else
/* Give up now. */
return -1;
}
continue;
default:
assert (! "invalid KIND in __gen_tempname");
}
if (fd >= 0)
{
__set_errno (save_errno);
return fd;
}
else if (errno != EEXIST)
return -1;
}
/* We got out of the loop because we ran out of combinations to try. */
__set_errno (EEXIST);
return -1;
}

View File

@@ -1,6 +1,6 @@
/* Unicode character output to streams with locale dependent encoding.
Copyright (C) 2000 Free Software Foundation, Inc.
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
@@ -124,13 +124,11 @@ print_unicode_char (FILE *stream, unsigned int code)
extern const char *locale_charset PARAMS ((void));
const char *charset = locale_charset ();
is_utf8 = (charset != NULL && !strcmp (charset, UTF8_NAME));
is_utf8 = !strcmp (charset, UTF8_NAME);
#if HAVE_ICONV
if (!is_utf8)
{
utf8_to_local = (charset != NULL
? iconv_open (charset, UTF8_NAME)
: (iconv_t)(-1));
utf8_to_local = iconv_open (charset, UTF8_NAME);
if (utf8_to_local == (iconv_t)(-1))
{
/* For an unknown encoding, assume ASCII. */

9
lib/unistd-safer.h Normal file
View File

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

View File

@@ -1,5 +1,5 @@
/* Utility to help print --version output in a consistent format.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001 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,7 +35,7 @@
/* Default copyright goes to the FSF. */
char* version_etc_copyright =
N_("Copyright (C) 2000 Free Software Foundation, Inc.");
N_("Copyright (C) 2001 Free Software Foundation, Inc.");
/* Display the --version information the standard way.

View File

@@ -1,3 +1,89 @@
2001-05-27 Jim Meyering <meyering@lucent.com>
* prereq.m4 (jm_PREREQ_READUTMP): Check for ut_type in struct utmpx.
Check for ut_type in struct utmp.
2001-05-22 Jim Meyering <meyering@lucent.com>
* strftime.m4 (_jm_STRFTIME_PREREQS): Don't use AC_LIBOBJ(strftime),
now that we use the package-supplied version unconditionally.
(jm_FUNC_STRFTIME): Don't replace strftime, for the same reason.
2001-05-21 Jim Meyering <meyering@lucent.com>
* regex.m4: Change a couple backticks to single quotes to avoid shell
syntax errors.
2001-05-19 Alexandre Duret-Lutz <duret_g@epita.fr>
* dos.m4 (jm_AC_DOS): Check for _WIN32, __WIN32__, and __MSDOS__.
2001-05-11 Paul Eggert <eggert@twinsun.com>
* m4/strftime.m4 (jm_FUNC_GNU_STRFTIME):
Don't bother to check library strftime, since
we'll be using our own my_strftime function anyway.
Define my_strftime instead of strftime.
2001-05-15 Jim Meyering <meyering@lucent.com>
* regex.m4: Use proper quoting so brackets appear in the test program.
Reported by, and with help from, Bruno Haible.
2001-05-13 Jim Meyering <meyering@lucent.com>
* jm-macros.m4 (major_t, minor_t): Define to unsigned int if undefined.
2000-11-26 Paul Eggert <eggert@twinsun.com>
* jm-macros.m4 (jm_MACROS): Do not check for fseeko; no longer used.
2001-04-21 Jim Meyering <meyering@lucent.com>
* rmdir-errno.m4: Write to a new file, so that a restrictive umask
doesn't interfere.
2001-04-21 Alexandre Duret-Lutz <duret_g@epita.fr>
* ftruncate.m4: Check for chsize.
Link with ftruncate.o unconditionally if ftruncate is missing.
This was required when cross-compiling to i586-mingw32msvc.
2001-03-24 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: Require autoconf-2.49d.
2001-03-20 Bruno Haible <haible@clisp.cons.org>
* iconv.m4 (jm_ICONV): Recommend GNU libiconv.
2001-03-17 Jim Meyering <meyering@lucent.com>
* memcmp.m4 (jm_AC_FUNC_MEMCMP): Remove my copy of AC_FUNC_MEMCMP,
now that the version in autoconf is equivalent.
(jm_FUNC_MEMCMP): Adjust to use AC_FUNC_MEMCMP.
* error.m4 (jm_PREREQ_ERROR): Invoke AC_FUNC_STRERROR_R.
Suggestion from Akim Demaille.
* prereq.m4 (jm_PREREQ): Add jm_PREREQ_TEMPNAME.
(jm_PREREQ_TEMPNAME): New function.
2001-02-25 Paul Eggert <eggert@twinsun.com>
* jm-macros.m4 (jm_MACROS): Use mkstemp replacement if the system
lacks mkstemp. Compile our own tempname.c if we compile our own
mkstemp.c, as mkstemp relies on tempname.
2001-03-01 Jim Meyering <meyering@lucent.com>
* dos.m4 (jm_AC_DOS): Remove extra backslashes, now that
AH_VERBATIM really does output its argument verbatim.
2001-02-18 Paul Eggert <eggert@twinsun.com>
* jm-macros.m4 (jm_CHECK_ALL_HEADERS): Check for sys/resource.h.
2001-02-17 Jim Meyering <meyering@lucent.com>
* ls-mntd-fs.m4 (jm_LIST_MOUNTED_FILESYSTEMS): Don't check for
@@ -405,7 +491,7 @@
2000-05-26 Bruno Haible <haible@clisp.cons.org>
* glibc21.m4: New file.
* jm-macros.m4: (jm_MACROS): Call jm_GLIBC21.
* jm-macros.m4 (jm_MACROS): Call jm_GLIBC21.
2000-05-28 Jim Meyering <meyering@lucent.com>
@@ -456,7 +542,7 @@
* rmdir-errno.m4 (fetish_FUNC_RMDIR_NOTEMPTY): New macro and file.
* jm-macros.m4: Require fetish_FUNC_RMDIR_NOTEMPTY.
* nanosleep.m4: (jm_FUNC_NANOSLEEP): Save and restore LIBS around
* nanosleep.m4 (jm_FUNC_NANOSLEEP): Save and restore LIBS around
AC_SEARCH_LIBS call for nanosleep.
(LIB_NANOSLEEP): Set and AC_SUBST.
@@ -505,13 +591,13 @@
2000-04-17 Jim Meyering <meyering@lucent.com>
Get it right :-)
* jm-macros.m4: (jm_CHECK_ALL_TYPES) [_GNU_SOURCE]: Emit the
* jm-macros.m4 (jm_CHECK_ALL_TYPES) [_GNU_SOURCE]: Emit the
actual #define via AH_VERBATIM. Don't need separate AC_DEFINE.
Suggestion from Akim Demaille.
2000-04-14 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: (jm_CHECK_ALL_TYPES) [_GNU_SOURCE]: Use the one-arg form
* jm-macros.m4 (jm_CHECK_ALL_TYPES) [_GNU_SOURCE]: Use the one-arg form
of AC_DEFINE. Otherwise, the #ifndef in AH_VERBATIM gets clobbered.
2000-04-13 Jim Meyering <meyering@lucent.com>
@@ -640,7 +726,7 @@
2000-02-05 Jim Meyering <meyering@lucent.com>
* jm-macros.m4: (jm_CHECK_ALL_TYPES): Require most macros.
* jm-macros.m4 (jm_CHECK_ALL_TYPES): Require most macros.
Remove explicit use of AC_HEADER_TIME. It is required by
jm_CHECK_TYPE_STRUCT_TIMESPEC. Using AC_HEADER_TIME and
`AC_REQUIRE'ing jm_CHECK_TYPE_STRUCT_TIMESPEC provoked a but
@@ -701,10 +787,10 @@
(jm_FILE_SYSTEM_USAGE): Take two parameters.
* ftruncate.m4: New file (derived from part of fileutils/configure.in).
* jm-macros.m4: (jm_FUNC_FTRUNCATE): AC_REQUIRE it.
* jm-macros.m4 (jm_FUNC_FTRUNCATE): AC_REQUIRE it.
(jm_CHECK_ALL_TYPES): Require AC_HEADER_MAJOR and AC_HEADER_DIRENT.
* jm-macros.m4: (OPTIONAL_BIN_PROGS, OPTIONAL_BIN_ZCRIPTS, MAN):
* jm-macros.m4 (OPTIONAL_BIN_PROGS, OPTIONAL_BIN_ZCRIPTS, MAN):
AC_SUBST these here, rather than just in sh-util/configure.in, so
that the now-shared-by-fileutils-and-textutils lib/Makefile.am are
all the same.
@@ -794,7 +880,7 @@
* d-type.m4 (jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Rename from
jm_STRUCT_DIRENT_D_TYPE.
* d-ino.m4: (jm_CHECK_TYPE_STRUCT_DIRENT_D_INO): Rename from
* d-ino.m4 (jm_CHECK_TYPE_STRUCT_DIRENT_D_INO): Rename from
jm_STRUCT_DIRENT_D_INO.
* utimbuf.m4 (jm_CHECK_TYPE_STRUCT_UTIMBUF): Rename from
jm_STRUCT_UTIMBUF.
@@ -983,7 +1069,7 @@
1999-07-15 Jim Meyering <meyering@ascend.com>
* jm-macros.m4: (AC_CHECK_FUNCS): Check for getpagesize.
* jm-macros.m4 (AC_CHECK_FUNCS): Check for getpagesize.
1999-05-22 Jim Meyering <meyering@ascend.com>

View File

@@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4b from Makefile.am
# Makefile.in generated automatically by automake 1.4g from Makefile.am.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -11,6 +11,8 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
@@ -31,11 +33,9 @@ infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
@@ -47,28 +47,22 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_FLAG =
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
@SET_MAKE@
host_alias = @host_alias@
host_triplet = @host@
AMDEP = @AMDEP@
AMTAR = @AMTAR@
AWK = @AWK@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DATADIRNAME = @DATADIRNAME@
DEPDIR = @DEPDIR@
DF_PROG = @DF_PROG@
@@ -82,6 +76,7 @@ GNU_PACKAGE = @GNU_PACKAGE@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
@@ -92,7 +87,6 @@ LIBOBJS = @LIBOBJS@
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
LIB_CRYPT = @LIB_CRYPT@
LIB_NANOSLEEP = @LIB_NANOSLEEP@
MAKEINFO = @MAKEINFO@
MAN = @MAN@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -112,10 +106,11 @@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
_am_include = @_am_include@
_am_quote = @_am_quote@
install_sh = @install_sh@
l = @l@
EXTRA_DIST = README Makefile.am.in \
afs.m4 \
assert.m4 \
@@ -186,35 +181,41 @@ utime.m4 \
utimes.m4 \
xstrtoumax.m4
EXEEXT =
OBJEXT = o
subdir = m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = README ChangeLog Makefile.am Makefile.in
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = README ChangeLog Makefile.am Makefile.in
all: all-am
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits m4/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnits m4/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
uninstall-info-am:
tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pR $$d/$$file $(distdir) \
|| exit 1; \
@@ -224,66 +225,80 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
all-am: Makefile
install-data-am:
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile
all-redirect: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
installdirs:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-rm -f Makefile.in
mostlyclean-am: mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-generic mostlyclean-am
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
distclean-am: distclean-generic clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
.PHONY: tags distdir info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all install-strip installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am info info-am install \
install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic uninstall uninstall-am uninstall-info-am
Makefile.am: Makefile.am.in
@@ -296,7 +311,6 @@ Makefile.am: Makefile.am.in
sed -n '/^##m4-files-end/,$$p' $< >> $@t
chmod a-w $@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.
.NOEXPORT:

View File

@@ -1,4 +1,4 @@
# serial 2
# serial 4
# Define some macros required for proper operation of code in lib/*.c
# on MSDOS/Windows systems.
@@ -7,19 +7,32 @@
AC_DEFUN(jm_AC_DOS,
[
# FIXME: this is incomplete. Add a compile-test that does something
# like this:
#if defined _WIN32 || defined __WIN32__ || defined __MSDOS__
AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
[
AC_TRY_COMPILE([],
[#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__
neither MSDOS nor Windows
#endif],
[ac_cv_win_or_dos=yes],
[ac_cv_win_or_dos=no])
])
if test x"$ac_cv_win_or_dos" = xyes; then
ac_fs_accepts_drive_letter_prefix=1
ac_fs_backslash_is_file_name_separator=1
else
ac_fs_accepts_drive_letter_prefix=0
ac_fs_backslash_is_file_name_separator=0
fi
AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
[#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
# define FILESYSTEM_PREFIX_LEN(Filename) \
((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
else
#else
# define FILESYSTEM_PREFIX_LEN(Filename) 0
#endif])
ac_fs_accepts_drive_letter_prefix=0
AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
$ac_fs_accepts_drive_letter_prefix,
[Define on systems for which file names may have a so-called
@@ -28,12 +41,11 @@ else
AH_VERBATIM(ISSLASH,
[#if FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
# define ISSLASH(C) ((C) == '/' || (C) == '\\\\')
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#else
# define ISSLASH(C) ((C) == '/')
#endif])
ac_fs_backslash_is_file_name_separator=0
AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
$ac_fs_backslash_is_file_name_separator,
[Define if the backslash character may also serve as a file name

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
dnl FIXME: put these prerequisite-only *.m4 files in a separate
dnl directory -- otherwise, they'll conflict with existing files.
@@ -7,5 +7,6 @@ dnl These are the prerequisite macros for GNU's error.c file.
AC_DEFUN(jm_PREREQ_ERROR,
[
AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
AC_FUNC_STRERROR_R
AC_HEADER_STDC
])

View File

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

View File

@@ -1,13 +1,13 @@
#serial 2
#serial 3
dnl From Bruno Haible.
AC_DEFUN(jm_ICONV,
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable libiconv installed).
dnl those with the standalone portable GNU libiconv installed).
AC_CACHE_CHECK(for iconv, jm_cv_func_iconv, [
jm_cv_func_iconv="no, consider installing libiconv"
jm_cv_func_iconv="no, consider installing GNU libiconv"
jm_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],

View File

@@ -1,10 +1,10 @@
#serial 32 -*- autoconf -*-
#serial 37 -*- autoconf -*-
dnl Misc type-related macros for fileutils, sh-utils, textutils.
AC_DEFUN(jm_MACROS,
[
AC_PREREQ(2.14d)
AC_PREREQ(2.49d)
GNU_PACKAGE="GNU $PACKAGE"
AC_DEFINE_UNQUOTED(GNU_PACKAGE, "$GNU_PACKAGE",
@@ -83,6 +83,11 @@ AC_DEFUN(jm_MACROS,
AC_REPLACE_FUNCS(memchr memcpy memmove memrchr memset)
AC_CHECK_FUNCS(getpagesize)
AC_REPLACE_FUNCS(mkstemp)
if test $ac_cv_func_mkstemp != yes; then
AC_LIBOBJ(tempname)
fi
# By default, argmatch should fail calling usage (1).
AC_DEFINE(ARGMATCH_DIE, [usage (1)],
[Define to the function xargmatch calls on failures.])
@@ -119,7 +124,6 @@ AC_DEFUN(jm_MACROS,
endpwent \
fchdir \
fdatasync \
fseeko \
ftime \
ftruncate \
getcwd \
@@ -219,6 +223,7 @@ AC_DEFUN(jm_CHECK_ALL_HEADERS,
sys/mntent.h \
sys/mount.h \
sys/param.h \
sys/resource.h \
sys/socket.h \
sys/statfs.h \
sys/statvfs.h \
@@ -288,6 +293,8 @@ AC_DEFUN(jm_CHECK_ALL_TYPES,
dnl This relies on the fact that autoconf 2.14a's implementation of
dnl AC_CHECK_TYPE checks includes unistd.h.
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(major_t, unsigned int)
AC_CHECK_TYPE(minor_t, unsigned int)
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])

View File

@@ -1,47 +1,8 @@
#serial 5
dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
dnl the losing memcmp on some x86 Next systems.
AC_DEFUN(jm_AC_FUNC_MEMCMP,
[AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
[AC_TRY_RUN(
[int
main ()
{
/* Some versions of memcmp are not 8-bit clean. */
char c0 = 0x40, c1 = 0x80, c2 = 0x81;
if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
exit (1);
/* The Next x86 OpenStep bug shows up only when comparing 16 bytes
or more and with at least one buffer not starting on a 4-byte boundary.
William Lewis provided this test program. */
{
char foo[21];
char bar[21];
int i;
for (i = 0; i < 4; i++)
{
char *a = foo + i;
char *b = bar + i;
strcpy (a, "--------01111111");
strcpy (b, "--------10000000");
if (memcmp (a, b, 16) >= 0)
exit (1);
}
exit (0);
}
}],
jm_cv_func_memcmp_working=yes,
jm_cv_func_memcmp_working=no,
jm_cv_func_memcmp_working=no)])
test $jm_cv_func_memcmp_working = no \
&& AC_LIBOBJ(memcmp)
])
#serial 6
AC_DEFUN(jm_FUNC_MEMCMP,
[AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
if test $jm_cv_func_memcmp_working = no; then
[AC_REQUIRE([AC_FUNC_MEMCMP])dnl
if test $ac_cv_func_memcmp_working = no; then
AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp,
[Define to rpl_memcmp if the replacement function should be used.])
fi

View File

@@ -1,4 +1,4 @@
#serial 17
#serial 19
dnl These are the prerequisite macros for files in the lib/
dnl directories of the fileutils, sh-utils, and textutils packages.
@@ -17,6 +17,7 @@ AC_DEFUN(jm_PREREQ,
jm_PREREQ_QUOTEARG
jm_PREREQ_READUTMP
jm_PREREQ_REGEX
jm_PREREQ_TEMPNAME # called by mkstemp
])
AC_DEFUN(jm_PREREQ_ADDEXT,
@@ -108,6 +109,8 @@ $ac_includes_default
AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
AC_LIBOBJ(readutmp)
fi
])
@@ -122,3 +125,11 @@ AC_DEFUN(jm_PREREQ_REGEX,
AC_HEADER_STDC
AC_FUNC_ALLOCA
])
AC_DEFUN(jm_PREREQ_TEMPNAME,
[
AC_HEADER_STDC
AC_HEADER_STAT
AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
AC_CHECK_FUNCS(__secure_getenv gettimeofday)
])

View File

@@ -1,4 +1,4 @@
#serial 9
#serial 10
dnl Initially derived from code in GNU grep.
dnl Mostly written by Jim Meyering.
@@ -30,9 +30,10 @@ AC_DEFUN(jm_INCLUDED_REGEX,
const char *s;
struct re_registers regs;
re_set_syntax (RE_SYNTAX_POSIX_EGREP);
/* Add this third left square bracket, [, to balance the
three right ones below. Otherwise autoconf-2.14 chokes. */
/* These two brackets, '[[' and the one in the comment below serve
to quote the brackets (unbalanced) in the following line. */
s = re_compile_pattern ("a[[:]:]]b\n", 9, &regex);
/* This bracket ']' helps quote the unbalanced expression above. */
/* This should fail with _Invalid character class name_ error. */
if (!s)
exit (1);
@@ -45,7 +46,7 @@ AC_DEFUN(jm_INCLUDED_REGEX,
/* The following example is derived from a problem report
against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
s = re_compile_pattern ("[anù]*n", 7, &regex);
s = re_compile_pattern ("[[anù]]*n", 7, &regex);
if (s)
exit (1);

View File

@@ -1,4 +1,4 @@
#serial 1
#serial 2
# When rmdir fails because the specified directory is not empty, it sets
# errno to some value, usually ENOTEMPTY. However, on some AIX systems,
@@ -25,12 +25,12 @@ extern int errno;
int val;
rmdir ("confdir2");
val = errno;
s = fopen ("confdir2/file", "w");
s = fopen ("confdir2/errno", "w");
fprintf (s, "%d\n", val);
exit (0);
}
],
fetish_cv_func_rmdir_errno_not_empty=`cat confdir2/file`,
fetish_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
fetish_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4',
fetish_cv_func_rmdir_errno_not_empty=ENOTEMPTY
)

View File

@@ -1,4 +1,4 @@
#serial 15
#serial 16
dnl This macro is intended to be used solely in this file.
dnl These are the prerequisite macros for GNU's strftime.c replacement.
@@ -23,8 +23,6 @@ AC_DEFUN(_jm_STRFTIME_PREREQS,
[#include <time.h>])
])
dnl Determine if the strftime function has all the features of the GNU one.
dnl
dnl From Jim Meyering.
dnl
AC_DEFUN(jm_FUNC_GNU_STRFTIME,
@@ -35,125 +33,11 @@ AC_DEFUN(jm_FUNC_GNU_STRFTIME,
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_CHECK_HEADERS(sys/time.h)
AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
[AC_TRY_RUN(
[ /* Ulrich Drepper provided parts of the test program. */
#if STDC_HEADERS
# include <stdlib.h>
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
static int
compare (const char *fmt, const struct tm *tm, const char *expected)
{
char buf[99];
strftime (buf, 99, fmt, tm);
if (strcmp (buf, expected))
{
#ifdef SHOW_FAILURES
printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
fmt, expected, buf);
#endif
return 1;
}
return 0;
}
int
main ()
{
int n_fail = 0;
struct tm *tm;
time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
tm = gmtime (&t);
/* Undefine this in case the configure-time putenv test has defined it
to something else. The use we make of this function here doesn't
require the added functionality of the replacement one. */
#undef putenv
/* This is necessary to make strftime give consistent zone strings and
e.g., seconds since the epoch (%s). */
putenv ("TZ=GMT0");
#undef CMP
#define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
CMP ("%-m", "1"); /* GNU */
CMP ("%A", "Friday");
CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
CMP ("%B", "January");
CMP ("%^B", "JANUARY");
CMP ("%C", "19"); /* POSIX.2 */
CMP ("%D", "01/09/70"); /* POSIX.2 */
CMP ("%F", "1970-01-09");
CMP ("%G", "1970"); /* GNU */
CMP ("%H", "13");
CMP ("%I", "01");
CMP ("%M", "06");
CMP ("%M", "06");
CMP ("%R", "13:06"); /* POSIX.2 */
CMP ("%S", "07");
CMP ("%T", "13:06:07"); /* POSIX.2 */
CMP ("%U", "01");
CMP ("%V", "02");
CMP ("%W", "01");
CMP ("%X", "13:06:07");
CMP ("%Y", "1970");
CMP ("%Z", "GMT");
CMP ("%_m", " 1"); /* GNU */
CMP ("%a", "Fri");
CMP ("%^a", "FRI");
CMP ("%b", "Jan");
CMP ("%^b", "JAN");
CMP ("%c", "Fri Jan 9 13:06:07 1970");
CMP ("%^c", "FRI JAN 9 13:06:07 1970");
CMP ("%d", "09");
CMP ("%e", " 9"); /* POSIX.2 */
CMP ("%g", "70"); /* GNU */
CMP ("%h", "Jan"); /* POSIX.2 */
CMP ("%^h", "JAN");
CMP ("%j", "009");
CMP ("%k", "13"); /* GNU */
CMP ("%l", " 1"); /* GNU */
CMP ("%m", "01");
CMP ("%n", "\n"); /* POSIX.2 */
CMP ("%p", "PM");
CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
CMP ("%s", "738367"); /* GNU */
CMP ("%t", "\t"); /* POSIX.2 */
CMP ("%u", "5"); /* POSIX.2 */
CMP ("%w", "5");
CMP ("%x", "01/09/70");
CMP ("%y", "70");
CMP ("%z", "+0000"); /* GNU */
exit (n_fail ? 1 : 0);
}],
jm_cv_func_working_gnu_strftime=yes,
jm_cv_func_working_gnu_strftime=no,
dnl When crosscompiling, assume strftime is missing or broken.
jm_cv_func_working_gnu_strftime=no)
])
if test $jm_cv_func_working_gnu_strftime = no; then
AC_LIBOBJ(strftime)
AC_DEFINE_UNQUOTED(strftime, gnu_strftime,
[Define to gnu_strftime if the replacement function should be used.])
fi
AC_DEFINE([my_strftime], [nstrftime],
[Define to the name of the strftime replacement function.])
])
AC_DEFUN(jm_FUNC_STRFTIME,
[
_jm_STRFTIME_PREREQS
AC_REPLACE_FUNCS(strftime)
])

View File

@@ -13,24 +13,6 @@ the \fI\-f\fR or \fI\-\-force\fR option is not given,
.B rm
prompts the user for whether to remove the file. If the response
does not begin with `y' or `Y', the file is skipped.
.LP
GNU
.BR rm ,
like every program that uses the getopt function to parse its
arguments, lets you use the
.I \-\-
option to indicate that all following arguments are non-options. To
remove a file called `\-f' in the current directory, you could type
either
.RS
rm \-\- \-f
.RE
or
.RS
rm ./\-f
.RE
The Unix
.B rm
program's use of a single `\-' for this purpose predates the
development of the getopt standard syntax.
.SH OPTIONS
[SEE ALSO]
shred(1)

View File

@@ -1,5 +1,491 @@
2001-06-17 Jim Meyering <meyering@lucent.com>
* Makefile.maint: Factor out definitions specific to fileutils,
sh-utils, and textutils, so that other packages can use the framework.
Patch by Akim Demaille.
* Makefile.cfg: New file with package-specific definitions.
* GNUmakefile: Include Makefile.cfg.
* Makefile.am (EXTRA_DIST): Add Makefile.cfg.
2001-06-16 Jim Meyering <meyering@lucent.com>
* src/ls.c (main): Recheck global print_with_color after calling
parse_ls_color, since that function may have reset it.
Based on a patch from Richard Dawe.
2001-06-16 Jim Meyering <meyering@lucent.com>
* config.sub: Update from master repository.
* config.guess: Likewise.
2001-06-09 Jim Meyering <meyering@lucent.com>
* configure.in (ALL_LINGUAS): Add Turkish (tr).
2001-05-25 Jim Meyering <meyering@lucent.com>
* src/ls.c (print_long_format): Don't truncate user names
or group names that are longer than 8 characters.
Add definitions that let me factor the wget rule while still letting
me accommodate the fact that these files reside in several different
directories and come from different places.
* Makefile.maint (wget-files): Define.
(get-targets, *-local_dir, *-url_prefix): Likewise.
(target, url, local_file): Convenience variables.
($(get-targets)): The factored rule.
2001-05-24 Jim Meyering <meyering@lucent.com>
* src/ansi2knr.c: Update from master source.
* Makefile.maint (wget-update): Have wget write to a temporary file,
and replace the original only if wget succeeds.
Also get ansi2nkr.c.
(move-if-change): Define.
(wget-update): Use it in place of mv.
* src/ls.c: Use `#if D_TYPE_IN_DIRENT && defined DTTOIF' to
determine whether to enable the DT_INIT definition, not the less
portable `#if defined _DIRENT_HAVE_D_TYPE || defined DTTOIF'.
Reported by Eli Zaretskii.
* src/mkfifo.c (main): Remove quotes around %s.
The argument is already quoted via the quote function.
* src/mknod.c (main): Likewise.
Reported by Göran Uddeborg.
2001-05-21 Jim Meyering <meyering@lucent.com>
* Makefile.maint (wget-update): depcomp and missing are now in
automake's lib/ subdirectory.
2001-05-11 Paul Eggert <eggert@twinsun.com>
Add new --time-style option.
Change --full-time to be equivalent to --time-style=full-iso.
* NEWS, doc/omni-utils.texi: Describe this change.
* src/ls.c: Include "hard-locale.h".
(nstrftime): New decl.
(enum time_style): New enum.
(time_style_args, time_style_types): New constants.
(full_time): Remove.
(long_time_format): Initialize to POSIX defaults.
(TIME_STYLE_OPTION): New constant.
(long_options, decode_switches, usage): Add --time-style support.
(long_time_expected_width): Use nstrftime, not strftime.
(print_long_format): Likewise.
Increase initial size to match new full-iso time style.
* tests/ls/time-1: Unset QUOTING_STYLE and TIME_STYLE. Set TZ.
Adjust to change in full-time format.
Fix typo in failure messages (-a and -m were interchanged).
2001-05-20 Jim Meyering <meyering@lucent.com>
* doc/Makefile.am (EXTRA_DIST): Add constants.texi and doclicense.texi.
(info_TEXINFOS): s/fileutils/omni-utils/.
(check-texinfo): New rule.
(check): Depend on check-texinfo.
* doc/omni-utils.texi (uniq invocation): Document the new optional
arguments to the --all-repeated option.
Make all references to POSIX use @sc{posix}.
2001-05-19 Jim Meyering <meyering@lucent.com>
* doc/fileutils.texi: Remove.
* doc/omni-utils.texi: Change a few uses of `timezone' to `time zone'.
Reported by Stephen Eglen.
2001-05-16 Jim Meyering <meyering@lucent.com>
* Makefile.maint (my-distcheck): Remove work-around kludge and
associated comment, now that automake has ben fixed.
2001-05-12 Paul Eggert <eggert@twinsun.com>
Clean up some of the places where the code assumed that random
types like 'mode_t' fit into 'int', which POSIX doesn't guarantee.
* src/ls.c (struct fileinfo.linkmode): Now st_mode.
(print_color_indicator, print_name_with_quoting, print_type_indicator,
length_of_file_name_and_frills):
Use mode_t, not unsigned int, to store modes.
(dired_dump_obstack): Do not assume size fits in 'int'.
(get_link_name): readlink returns ssize_t, not int.
(make_link_path): Store buffer size as size_t, not int.
(print_long_format): Use unsigned long, not unsigned, to print
nlink_t, uid_t, gid_t, major_t, minor_t.
2001-05-13 Paul Eggert <eggert@sic.twinsun.com>
* src/mknod.c (main): Check for NODEV device only if NODEV is defined.
* src/system.h (NODEV): Remove, undoing previous change.
2001-05-13 Jim Meyering <meyering@lucent.com>
* src/remove.c (dir_name, dir_len): Define to different names
to avoid shadowing warnings due to new declarations from dirname.h.
* tests/Fetish.pm (run_tests): Fail if any test name is longer
than 12 bytes.
* tests/ls-2/tests: Shorten test names so the length of a
resulting file name doesn't exceed 14.
2001-05-12 Paul Eggert <eggert@twinsun.com>
* src/system.h (NODEV): New macro, if not already defined.
* src/mknod.c (main): Check for overflow when converting out
of uintmax_t. Do not assume that major_t and minor_t are no
wider than int. Check for makedev failures. Convert device
numbers via uintmax_t, not unsigned long, just in case.
Coalesce duplicate code in the block and character device
cases.
2001-05-11 Paul Eggert <eggert@twinsun.com>
Add new --dereference-command-line option.
-H now means this instead of meaning --si, as POSIX requires.
* NEWS, doc/omni-utils.texi: Document this.
* src/ls.c (enum Dereference_symlink): New type.
(dereference): New var, replacing trace_links, which was removed.
(long_options, main, decode_switches, gobble_file, usage):
Implement the changes.
* tests/ls-2/tests:
Rename slink-dir test to slink-dir-dF. Add new tests
slink-dir-F, slink-dir-dFH, slink-dir-dFL.
2001-05-11 Paul Eggert <eggert@twinsun.com>
dirname code cleanup. base_name now behaves more compatibly
with POSIX basename when given file names that have trailing
slashes, and similarly for dir_name. Add new primitives
base_len and dir_len. Put the directory-name-related decls
into dirname.h.
* src/chmod.c (strip_trailing_slashes): Remove; now in dirname.h.
* src/chown.c (strip_trailing_slashes): Likewise.
* src/cp.c (strip_trailing_slashes): Likewise.
* src/df.c (strip_trailing_slashes): Likewise.
* src/ln.c (strip_trailing_slashes): Likewise.
* src/mkdir.c (strip_trailing_slashes): Likewise.
* src/rm.c (strip_trailing_slashes): Likewise.
* src/rmdir.c (strip_trailing_slashes): Likewise.
* src/dircolors.c, src/ls.c, src/remove.c:
Include "dirname.h", to get base_name.
* src/cp.c (make_path_private): Use dir_len instead of
dir_name, and avoid an extra mealloc call.
* src/df.c (find_mount_point): No need to strip trailing
slashes before invoking new dir_name.
* src/mv.c: Include "dirname.h".
(strip_trailing_slashes_2): Remove; now done by
strip_trailing_slashes. All callers changed.
* src/sys2.h (base_name): Remove decl; now in dirname.h.
* src/copy.c (copy_internal): Remove the code that tested for NULL
dir_name return value. That can't happen.
2001-05-12 Jim Meyering <meyering@lucent.com>
* src/ls.c (usage): Wording changes related to -o, -n, and -g.
* doc/omni-utils.texi: Likewise.
From Paul Eggert.
2001-05-11 Paul Eggert <eggert@twinsun.com>
* src/chmod.c (mode_changed, change_file_mode):
There's no need to invoke both lstat and stat here, so call just
one of the two functions.
2001-05-11 Jim Meyering <meyering@lucent.com>
* doc/omni-utils.texi: New file. The union of fileutils.texi,
sh-utils.texi, and textutils.texi. Merged by Brian Youmans.
* src/shred.c (usage): Warn about backups and mirrors.
* doc/omni-utils.texi (shred invocation): Likewise.
From Nelson Beebe.
2001-05-09 Jim Meyering <meyering@lucent.com>
* src/ls.c (main): Don't set `format_needs_stat' for --recursive (-R),
because that would make `ls -RF dir' stat unnecessarily all of the
files in dir/ on some systems.
Similarly, don't set `format_needs_stat' for --dereference (-L),
because that would make `ls -RLF dir' stat unnecessarily all non-symlink
files in dir/ on some systems.
Instead, ...
(gobble_file): ... also stat a file if `trace_dirs' (-R) is set and its
type is unknown.
... also stat a file if `trace_links' (-L) is set and the file is a
symlink or its type is unknown.
(print_dir): Also recognize DT_REG and DT_LNK.
2001-05-07 Jim Meyering <meyering@lucent.com>
* src/chown.c (main): Fix thinko that made --from=... fail:
s/argv[optind]/optarg/. Reported by Andrew Pham.
* tests/chown: New directory.
* tests/chown/basic: New (root-only) test for the above.
* tests/cp/special-bits: Factor out the root-only test into this ...
* tests/root-only: ... new file.
* tests/Makefile.am (EXTRA_DIST): Add root-only.
(SUBDIRS): Add chown.
* tests/chown/Makefile.am: New file.
* configure.in (AC_OUTPUT): Add tests/chown/Makefile.
2001-05-05 Jim Meyering <meyering@lucent.com>
* src/ls.c (decode_switches): Complain if the envvar, QUOTING_STYLE,
is set to an invalid value.
Move some declarations of locals into scopes where they're used.
2001-05-02 Jim Meyering <meyering@lucent.com>
* doc/texinfo.tex: Update from master repository.
* config.sub: Likewise.
* config.guess: Likewise.
2001-05-01 Jim Meyering <meyering@lucent.com>
* Makefile.maint (tgz-size, xd-size): Compute sizes.
(announcement): Include sizes of .tar.gz and .xdelta files
in the announcement.
* src/ls.c (print_owner): New global variable.
(usage): Update the descriptions of -g.
(decode_switches): Honor the -g option (omit owner information),
now that POSIX specifies it.
(print_long_format): Don't print owner name if -g was specified.
Move declaration of `user_name' into the scope where it's used.
(print_group): Rename global from `inhibit_group'. Update all
uses accordingly.
* doc/fileutils.texi (What information is listed): Describe -g.
* TODO: Remove item for ls -g.
* src/ls.c (decode_switches): Make -n work just like -l, except
with numeric IDs, per POSIX. Before, to have any effect, -n had
to be used with -l. Reported by Dale Scheetz.
(usage): Update the description of -n.
Separate the descriptions of -n and --numeric-uid-gid.
Split string in --help output that had exceeded my limit of
2048 bytes.
2001-04-29 Jim Meyering <meyering@lucent.com>
* Version 4.1.
* configure: Regenerate using a further-patched copy of autoconf-2.49e
to work around a bug in its test for ranlib. This is the change to
autoconf's acgeneral.m4 that was made on 2001-04-24.
* README: Don't mention mvdir. It is no longer provided.
Don't mention HP/UX vs. du blocksize problem. It's long gone.
Remove note about how cp, mv, and ln couldn't make backups
of files with names of maximum length. Now they can do that.
Thank the people who have provided access to their systems
for portability testing.
Warn about and describe autoconf/automake version requirements.
Use a better URL for the GNU Coding Standards.
* man/rm.x: Refer to shred.
Remove the example showing how to remove `-foo', since that is now
in the --help output (and hence automatically included).
* src/rm.c (usage): Mention shred.
* src/shred.c (usage): Include in --help output the warning about
some of the filesystem types on which shred is not effective.
2001-04-25 Jim Meyering <meyering@lucent.com>
* Makefile.maint (my-distcheck): Add a comment.
2001-04-23 Jim Meyering <meyering@lucent.com>
* Version 4.0.45.
2001-04-22 Jim Meyering <meyering@lucent.com>
* src/ls.c (decode_switches): Ensure that -1 has no effect when it
follows -l, per POSIX. Reported by Ulrich Drepper.
* src/dd.c (usage): Mention that sync makes dd pad with spaces (rather
than NULs) when used with block or unblock.
(dd_copy): When using sync with either block or unblock,
pad with spaces. Reported by Dale Scheetz.
* tests/dd/skip-seek (block-sync-1): New test, for this. Based on
a report from Dale Scheetz.
* doc/fileutils.texi (dd invocation): Document it here, too.
* configure: Regenerate using a patched copy of autoconf-2.49e to
work around a bug in its test for a working memcmp function.
This is the change to autoconf's acfunctions.m4 that was made
on 2001-04-22.
* tests/ls/no-arg: New file.
* tests/ls/Makefile.am (TESTS): Add no-arg.
* src/ls.c (main): Fix off-by-one error introduced with last change.
2001-04-21 Jim Meyering <meyering@lucent.com>
* Version 4.0.44.
* configure, aclocal.m4, etc.: Regenerate using autoconf-2.49e.
* doc/fileutils.texi (touch invocation): Discuss ctime.
Based on suggestions and contributions from Aharon Robbins
and Dan Jacobson.
* src/ls.c (main): When given two or more arguments but the only one
that exists is a directory, don't treat it as if it were the only
argument. Before, `mkdir d; ls no-dir d 2>/dev/null' would act like
`ls d' and produce no output. Now, it prints `d:'.
Report and patch from Stéphane Chazelas.
* tests/ls-2/tests: New tests, for the above fix.
2001-04-08 Jim Meyering <meyering@lucent.com>
* depcomp: New version, from automake.
2000-10-31 Bruno Haible <haible@clisp.cons.org>
* ls.c: Don't inspect MB_LEN_MAX. Paul Eggert says it's
not always defined correctly.
2001-04-03 John David Anglin <dave@hiauly1.hia.nrc.ca>
* tests/chgrp/basic: Ensure that initial group id's are properly set
for `d' and `d/f3'.
2001-04-02 Jim Meyering <meyering@lucent.com>
* tests/mv/setup: Skip nonexistent directories so we don't get
diagnostics from df about e.g., `/usr/tmp not found'.
2001-03-24 Jim Meyering <meyering@lucent.com>
* configure.in: Don't require autoconf version here -- it's done in m4/.
2001-03-23 Jim Meyering <meyering@lucent.com>
* Version 4.0.43.
* configure, aclocal.m4, etc.: Regenerate using autoconf-2.49d.
* Makefile.maint (check-copyright): New target and rule.
(alpha): Depend on it.
* missing: Handle shell built-ins (only `:' and `cd' for now) to work
around brain damage in Ultrix's /bin/sh.
2001-03-18 Jim Meyering <meyering@lucent.com>
* Version 4.0.42.
* tests/Fetish.pm: If the $DJDIR envvar is defined, set SHELL
to $DJDIR/bin/bash.exe. Patch from Richard Dawe, based on a
suggestion from Eli Zaretskii.
2001-03-17 Paul Eggert <eggert@twinsun.com>
* doc/fileutils.texi: Warn that touch DATE FILE will be withdrawn.
2001-03-17 Jim Meyering <meyering@lucent.com>
* tests/install/basic-1: Add the standard $VERBOSE-handling hook.
This test currently fails for mips-dec-ultrix4.4.
* tests/install/create-leading: Use ../envvar-check rather than
open-coding the same tests.
* tests/envvar-check: Set/use $as_unset, for those shells
(like Ultrix4's /bin/sh) that don't accept `unset'.
* missing (--run): Use `eval' to run `"$@"'. Otherwise, Ultrix4.4's
/bin/sh fails and outputs garbage.
* src/touch.c (usage): Tweak the obsolescent usage line so that
help2man recognizes it as such. Reported by Dan Jacobson.
2001-03-16 Jim Meyering <meyering@lucent.com>
* Makefile.maint (wget-update): Also get `missing'.
Use for-loops.
* missing: Update from automake.
2001-03-11 Jim Meyering <meyering@lucent.com>
* tests/rm/isatty: Disable this test, for now.
It would block when run in the background.
2001-03-09 Jim Meyering <meyering@lucent.com>
* config.guess: Update from master repository.
* Makefile.maint (my_distdir): Define new variable, and use this
in place of most old uses of $(distdir).
* src/Makefile.am (Makefile): Don't depend on $(BUILT_SOURCES).
Reported by Akim Demaille.
* tests/help-version: Ensure that /dev/full is a character device
(using test -c) as well as being writable, before trying to write to it.
Otherwise, the test could mistakenly append a newline to an existing,
regular, writable, /dev/full file.
Suggested by Ulrich Drepper.
2001-03-06 Jim Meyering <meyering@lucent.com>
* src/dd.c (S_TYPEISSHM): Rename parameter to reflect its type.
(main): Pass a `struct stat *', not stat.st_mode to S_TYPEISSHM.
Patch by Alain Magloire.
2001-03-04 Jim Meyering <meyering@lucent.com>
* src/dd.c (output_char): Reformat so each statement is on a
separate line.
2001-02-21 Jim Meyering <meyering@lucent.com>
* src/mkdir.c (main): Remove assignment-in-if-expression.
In fact, remove t_errno altogether. Reported by Nelson Beebe.
* tests/ls-2/tests: Add two tests of existing behavior -- both will
have to be changed (soon after release), once ls is fixed.
2001-02-20 Paul Eggert <eggert@twinsun.com>
* src/ls.c (FULL_TIME_OPTION): Renamed from FULL_TIME, for
consistency with the other enum values.
2001-02-20 Paul Eggert <eggert@twinsun.com>
* NEWS, doc/fileutils.texi: ls -H is now obsolescent.
* src/ls.c (SI_OPTION): New enum value.
(long_options): Use it instead of 'H' for --si.
(decode_switches): Warn that -H will change soon.
(usage): Likewise.
2001-02-18 Jim Meyering <meyering@lucent.com>
* tests/rm/Makefile.am (TESTS): Add isatty.
* tests/rm/isatty: New test, for the bug fixed below.
* Version 4.0.41.
* depcomp: New version, from automake.
@@ -1648,7 +2134,7 @@
Round negative numbers correctly.
(show_dev): Round disk usage up and disk free space down.
* src/ls.c: (print_dir, gobble_file, print_long_format,
* src/ls.c (print_dir, gobble_file, print_long_format,
print_file_name_and_frills): Round disk usage up.
* src/du.c (print_size): Likewise.
@@ -1968,7 +2454,7 @@
2000-03-12 Jim Meyering <meyering@lucent.com>
Merge from textutils.
* src/system.h: (O_BINARY, O_TEXT): Define if necessary.
* src/system.h (O_BINARY, O_TEXT): Define if necessary.
(SET_BINARY, SET_BINARY2): Define.
(DEV_BSIZE): Define to BBSIZE if appropriate.
@@ -2259,7 +2745,7 @@
* lib/euidaccess.c: Sync with the GNU C library.
* tests/dir/Makefile.am: (TESTS_ENVIRONMENT): Add `pwd`/ prefix
* tests/dir/Makefile.am (TESTS_ENVIRONMENT): Add `pwd`/ prefix
to exported PATH value (though not strictly necessary, here).
* tests/dd/Makefile.am: Likewise.
* tests/dircolors/Makefile.am: Likewise.
@@ -3162,7 +3648,7 @@
create directory' rather than `cannot make directory'. The former
also matches the one in makepath.c.
* src/dd.c: (apply_translations): Use TOUPPER and TOLOWER,
* src/dd.c (apply_translations): Use TOUPPER and TOLOWER,
not toupper and tolower.
1999-05-05 Jim Meyering <meyering@ascend.com>
@@ -4196,7 +4682,7 @@
(base_name): Declare.
Mostly from Akim Demaille.
* lib/addext.c: (base_name): Declare.
* lib/addext.c (base_name): Declare.
* src/sys2.h: Add prototype for base_name.
* lib/argmatch.c: s/argmatch_exit_failure/argmatch_die/
@@ -4842,7 +5328,7 @@
* configure.in (AC_STRUCT_ST_MTIM_NSEC): Renamed from AC_STRUCT_ST_MTIM.
* acconfig.h (ST_MTIM_NSEC): New #undef.
* src/system.h: (ST_TIME_CMP_NS, ATIME_CMP, CTIME_CMP, MTIME_CMP):
* src/system.h (ST_TIME_CMP_NS, ATIME_CMP, CTIME_CMP, MTIME_CMP):
Use new ST_MTIM_NSEC macro.
1998-08-16 Jim Meyering <meyering@ascend.com>
@@ -4927,7 +5413,7 @@
rev_cmp_mtime, compare_atime, rev_cmp_atime): Compare time
stamps with subsecond resolution if available.
* src/system.h: (ST_TIME_CMP_NS, ST_TIME_CMP, ATIME_CMP,
* src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP, ATIME_CMP,
CTIME_CMP, MTIME_CMP): New macros.
1998-08-01 Jim Meyering <meyering@ascend.com>
@@ -5102,7 +5588,7 @@
1998-06-30 Paul Eggert <eggert@shade.twinsun.com>
* lib/mountlist.c: (read_filesystem_list):
* lib/mountlist.c (read_filesystem_list):
Don't leak memory on failure.
Don't create a dummy struct mount_entry entry;
use the address-of-the-tail-address method instead.
@@ -5168,7 +5654,7 @@
1998-06-29 Paul Eggert <eggert@twinsun.com>
* lib/mountlist.c: (read_filesystem_list): If SVR4, lock
* lib/mountlist.c (read_filesystem_list): If SVR4, lock
/etc/.mnttab.lock if available, to avoid race conditions
(e.g. with the automounter on Solaris 2.6).
@@ -5825,7 +6311,7 @@
* src/copy.c (copy_internal): Use x->backup_type, not the global.
(valid_options): Use VALID_BACKUP_TYPE and VALID_SPARSE_MODE.
* src/copy.h: (VALID_SPARSE_MODE): Define.
* src/copy.h (VALID_SPARSE_MODE): Define.
[struct cp_options] (backup_type): New member.
* src/cp.c [NDEBUG]: Comment out definition.

View File

@@ -1,4 +1,55 @@
Changes in release 4.01:
[4.1.1]
* ls no longer truncates user names or group names that are longer
than 8 characters.
* ls's new --dereference-command-line option causes it to dereference
symbolic links on the command-line only.
* ls -H now means the same as ls --dereference-command-line, as per POSIX.
* ls -g now acts like ls -l, except it does not display owner, as per POSIX.
* ls -n now implies -l, as per POSIX.
* ls can now display dates and times in one of four time styles:
- The `full-iso' time style gives full ISO-style time stamps like
`2001-05-14 23:45:56.477817180 -0700'.
- The 'iso' time style gives ISO-style time stamps like '2001-05-14 '
and '05-14 23:45'.
- The 'locale' time style gives locale-dependent time stamps like
'touko 14 2001' and 'touko 14 23:45' (in a Finnish locale).
- The 'posix-iso' time style gives traditional POSIX-locale
time stamps like 'May 14 2001' and 'May 14 23:45' unless the user
specifies a non-POSIX locale, in which case it uses ISO-style dates.
This is the default.
You can specify a time style with an option like --time-style='iso'
or with an environment variable like TIME_STYLE='iso'. GNU Emacs 21
and later can parse ISO dates, but older Emacs versions cannot, so
if you are using an older version of Emacs outside the default POSIX
locale, you may need to set TIME_STYLE="locale".
* --full-time is now an alias for "-l --time-style=full-iso".
Changes in release 4.1:
[4.0.45]
* dd conv=sync,block now pads only with spaces
* ls's -1 option no longer cancels the effect of a preceding -l
* regenerate configure using a patched version of autoconf-2.49e to work
around a bug in its test for a working memcmp function
* ls: fix off-by-one error introduced with the previous change
[4.0.44]
* ls: When given two or more arguments but the only one that exists is a
directory, don't treat it as if it were the only argument. Before,
`mkdir d; ls no-dir d 2>/dev/null' would act like `ls d' and produce
no output. Now, it prints `d:'.
* touch -d 'last friday' would use a time stamp that was one hour off
(e.g., 23:00 on *thursday* rather than 00:00 of the preceding friday)
when run such that the current time and the target date/time fall on
opposite sides of a daylight savings time transition.
This problem arises only with relative date strings like `last monday'.
It is not a problem with strings that include absolute dates.
[4.0.43]
* regenerate configure-related files using autoconf-2.49d
[4.0.42]
* Using ls's short-named `-H' option evokes the warning that the
meaning of `-H' will soon change. Use `--si' instead.
[4.0.41]
* fix bug in rm introduced in 4.0.38: `chmod 0 f; rm f' would no longer prompt
before removal.
@@ -67,7 +118,7 @@ Changes in release 4.01:
* ls is much more efficient on systems (e.g., linux-2.4.*) that store file
type information in directory entries.
* shred now automatically determines the size of each block device argument
* ls's date/time format strings are now local dependent
* ls's date/time format strings are now locale dependent
* mkdir, mknod, mkfifo, and chmod work better in conjunction with ACLs
* `cp --parents dir1/ dir2' no longer gets a failed assertion
* shred now determines the size of block devices like /dev/fd0

View File

@@ -1,3 +1,115 @@
2001-06-09 Jim Meyering <meyering@lucent.com>
(PIDSTR_DECL_AND_INIT): Define.
2001-06-05 Jim Meyering <meyering@lucent.com>
* configure.in (ALL_LINGUAS): Add Turkish (tr).
2001-05-27 Jim Meyering <meyering@lucent.com>
* src/dirname.c (main): Add `const' to declaration of local, `result'.
2001-04-01 Jim Meyering <meyering@lucent.com>
Add options to make `who' more POSIX compliant.
* who.c: Accept new options: --all (-a), --boot (-b), --dead (-d),
--login, --process (-p), --runlevel (-r), --short (-s), --time (-t),
--users (-u).
The -u option now produces POSIX-specified results and is the same as
the long option `--users'. --idle is no longer the same as -u.
(time_string, print_line, print_boottime, print_deadprocs, print_login,
print_initspawn, print_clockchange, print_runlevel): New functions.
(print_user): Renamed from print_entry and reworked.
(search_entries): Remove function.
(who_am_i): Likewise.
(usage): Describe new options.
(main): Handle new options.
Mostly from Michael Stone.
FIXME (remove this, later): This probably doesn't compile on any
type of system except Linux, due to the unprotected uses of e.g.,
utmp_ent->ut_exit.e_termination.
2001-05-11 Paul Eggert <eggert@twinsun.com>
dirname code cleanup. base_name now behaves more compatibly
with POSIX basename when given file names that have trailing
slashes, and similarly for dir_name. Add new primitives
base_len and dir_len. Put the directory-name-related decls
into dirname.h.
* basename.c: Include "dirname.h".
(base_name, strip_trailing_slashes): Remove decls; now in dirname.h.
(main): Use base_len instead of strip_trailing_slashes to strip
trailing slashes.
* dirname.c (strip_trailing_slashes): Remove decl;
now in dirname.h.
(main): Use dir_len rather than dir_name_r.
* su.c: Include "dirname.h".
(base_name): Remove decl; now in dirname.h.
2001-04-20 Jim Meyering <meyering@lucent.com>
* doc/sh-utils.texi (false invocation): Describe how --help and
--version are treated with and without POSIXLY_CORRECT.
(true invocation): Likewise. Forwarded by Michael Stone.
2001-03-18 Jim Meyering <meyering@lucent.com>
* tests/Fetish.pm: If the $DJDIR envvar is defined, set SHELL
to $DJDIR/bin/bash.exe. Patch from Richard Dawe, based on a
suggestion from Eli Zaretskii.
2001-03-10 Jim Meyering <meyering@lucent.com>
* doc/sh-utils.texi (date invocation): Correct the description of how
date works when given no format. Reported by Ole Laursen.
* src/factor.c: Include wheel-size.h.
(WHEEL_START): Adjust definition.
(wheel_tab[]): Remove body of definition.
Include generated file, wheel.h, instead.
* src/wheel-gen.pl: New file.
* src/Makefile.am (noinst_HEADERS): Add wheel.h wheel-size.h.
(EXTRA_DIST): Add wheel-gen.pl.
(PERL): Define.
(wheel-size.h, wheel.h): New rules.
(BUILT_SOURCES): Add wheel.h and wheel-size.h.
(MAINTAINERCLEANFILES): Define.
2001-03-09 Jim Meyering <meyering@lucent.com>
* Makefile.maint (my_distdir): Define new variable, and use this
in place of most old uses of $(distdir).
* src/date.c (usage): Describe %C.
* doc/sh-utils.texi (Date directives): Likewise.
* tests/help-version: Ensure that /dev/full is a character device
(using test -c) as well as being writable, before trying to write to it.
Otherwise, the test could mistakenly append a newline to an existing,
regular, writable, /dev/full file.
Suggested by Ulrich Drepper.
2001-03-07 Jim Meyering <meyering@lucent.com>
* tests/stty/Makefile.am (EXTRA_DIST): Remove input-tty.
* tests/Makefile.am (EXTRA_DIST): Add input-tty.
* tests/stty/basic-1: Reflect change in location of input-tty.
* tests/stty/row-col: Likewise.
* tests/stty/input-tty: Move this file...
* tests/input-tty: ... to here.
2001-02-24 Paul Eggert <eggert@twinsun.com>
* doc/sh-utils.texi: Fix typo: '-d=1may' -> '-d 1may'.
Fix and clarify time zone usage in 'date' examples.
2001-02-04 Jim Meyering <meyering@lucent.com>
* src/factor.c (usage): Tweak --help output: it prints the _prime_
@@ -448,7 +560,7 @@
2000-03-12 Jim Meyering <meyering@lucent.com>
Merge from textutils.
* src/system.h: (O_BINARY, O_TEXT): Define if necessary.
* src/system.h (O_BINARY, O_TEXT): Define if necessary.
(SET_BINARY, SET_BINARY2): Define.
(DEV_BSIZE): Define to BBSIZE if appropriate.
@@ -959,7 +1071,7 @@
* src/false.c: New file.
* src/true.sh: Removed.
* src/false.sh: Removed.
* src/Makefile.am: (bin_PROGRAMS): Add true and false.
* src/Makefile.am (bin_PROGRAMS): Add true and false.
(bin_SCRIPTS): Remove true and false.
(EXTRA_DIST): Remove false.sh and true.sh.
* man/true.1in: New file.
@@ -1254,7 +1366,7 @@
Running `id USER' doesn't report any groups if there is no entry
for USER in /etc/group. Always include the one from /etc/passwd.
* src/id.c: (xgetgroups): Take new parameter, gid, and pass
* src/id.c (xgetgroups): Take new parameter, gid, and pass
it to getugroups.
(print_group_list): Call getpwuid and adjust calls to xgetgroups
to include new parameter.
@@ -1590,7 +1702,7 @@
* configure.in (jm_MACROS): New wrapper macro.
Remove uses of most jm_* macros.
* acconfig.h: (chown): Add undef.
* acconfig.h (chown): Add undef.
(D_INO_IN_DIRENT): Likewise.
(D_TYPE_IN_DIRENT): Likewise.
(ssize_t): Likewise.
@@ -2168,7 +2280,7 @@ Thu May 1 00:10:11 1997 Jim Meyering <meyering@na-net.ornl.gov>
Sun Apr 27 18:30:53 1997 Jim Meyering <meyering@na-net.ornl.gov>
* src/printf.c: (cfcc_msg): File-scope constant.
* src/printf.c (cfcc_msg): File-scope constant.
(STRTOX): Use new constant as error message format string in macro.
Suggestion from Andreas Schwab.
(STRTOX): Don't fail because of extra character(s) following a
@@ -2182,7 +2294,7 @@ Sun Apr 6 14:29:14 1997 Jim Meyering <meyering@na-net.ornl.gov>
(xstrtod, xstrtol, xstrtoul): Remove functions.
Use the STRTOX instead.
* src/printf.c: (STRTOX): Interpret arguments like 'a and "a
* src/printf.c (STRTOX): Interpret arguments like 'a and "a
as POSIX requires. Derived from a patch by Dennis Henriksen.
Sun Mar 23 15:20:17 1997 Jim Meyering <meyering@na-net.ornl.gov>
@@ -2234,7 +2346,7 @@ Tue Mar 18 06:46:54 1997 Jim Meyering <meyering@na-net.ornl.gov>
Thu Mar 13 21:27:36 1997 Jim Meyering <meyering@na-net.ornl.gov>
* lib/mktime.c: (TIME_T_MIN): Work around a bug in Cray C 5.0.3.0.
* lib/mktime.c (TIME_T_MIN): Work around a bug in Cray C 5.0.3.0.
Wed Feb 19 23:06:46 1997 Jim Meyering <meyering@na-net.ornl.gov>
@@ -2326,7 +2438,7 @@ Wed Jan 22 20:12:31 1997 Jim Meyering <meyering@na-net.ornl.gov>
* lib/strftime.c (_strftime_copytm):
New function, to work around Solaris 2.5 tzset bug.
* m4/mktime.m4: (AM_FUNC_MKTIME): Fix bug in mktime test -- don't
* m4/mktime.m4 (AM_FUNC_MKTIME): Fix bug in mktime test -- don't
test now, test a couple of thousand times.
* m4/strftime.m4 (main): Use TZ=GMT0, not TZ=GMT, since only GMT0 is
@@ -3845,7 +3957,7 @@ Mon Aug 7 23:27:54 1995 Jim Meyering (meyering@comco.com)
Fri Jun 23 23:04 1995 Jim Meyering (meyering@comco.com)
* configure.in: (AC_REPLACE_FUNCS): Add memcpy and memset.
* configure.in (AC_REPLACE_FUNCS): Add memcpy and memset.
Add checks for floor, modf, and rint -- all used by seq.c.
Mon Jun 12 00:26:54 1995 Jim Meyering (meyering@comco.com)
@@ -3895,7 +4007,7 @@ Fri May 12 21:25:50 1995 Jim Meyering (meyering@comco.com)
Tue Apr 18 22:57:43 1995 Jim Meyering (meyering@comco.com)
* configure.in: (AC_OUTPUT): Use echo, not date, to avoid creating
* configure.in (AC_OUTPUT): Use echo, not date, to avoid creating
unnecessary conflicts for people using version control software
like RCS and CVS.
(AC_ARG_PROGRAM): Use it.

View File

@@ -1,4 +1,11 @@
Changes in release 2.1
[2.0.12]
* date -d 'last friday' would print a date/time that was one hour off
(e.g., 23:00 on *thursday* rather than 00:00 of the preceding friday)
when run such that the current time and the target date/time fall on
opposite sides of a daylight savings time transition.
This problem arose only with relative date strings like `last monday'.
It was not a problem with strings that include absolute dates.
[2.0.11]
* setting the date now works properly, even when using -u
* `date -f - < /dev/null' no longer dumps core

View File

@@ -1,3 +1,458 @@
2001-06-10 Jim Meyering <meyering@lucent.com>
* tests/sort/Test.pm: Add a test based on a report from Herbert Xu.
2001-05-20 Jim Meyering <meyering@lucent.com>
* src/uniq.c: Rename new option values: s/all/precede/ and
s/minimum/separate/.
* tests/uniq/Test.pm: Reflect the above renamings.
2001-05-12 Bruno Haible <haible@clisp.cons.org>
* src/tail.c (parse_obsolescent_option): Accept a b suffix.
2001-05-19 Jim Meyering <meyering@lucent.com>
msgmerge-0.10.37 complains about some `invalid multibyte sequences.'
* po/el.po: Remove the offending entries.
* po/ko.po: Likewise.
* po/zh.po: Likewise.
2001-05-19 Jim Meyering <meyering@lucent.com>
Support new modes for uniq's --all-repeated option.
The default behavior is unchanged.
* src/uniq.c: Include argmatch.h.
(usage): Update.
(check_file): Implement it.
(main): Handle new, optional arguments.
* tests/uniq/Test.pm: New tests for the above.
Patch by Padraig Brady.
2001-05-12 Bruno Haible <haible@clisp.cons.org>
* src/tail.c (parse_obsolescent_option): Use t_count_lines, not
count_lines, in error message.
2001-05-05 Jim Meyering <meyering@lucent.com>
* src/comm.c (usage): Correct description of -3.
Reported by Soeren Sonnenburg.
2001-04-22 Jim Meyering <meyering@lucent.com>
* Version 2.0.14.
* configure: Regenerate using a patched copy of autoconf-2.49e to
work around a bug in its test for a working memcmp function.
2001-03-28 Paul Eggert <eggert@twinsun.com>
* src/cksum.c: Fix bugs when computing length of large files.
Add overflow and write error checks. Use uint_fast32_t, not
unsigned long, to do checksum calculation, as C99 says
uint_fast32_t should be no slower and might be faster.
Include <stdio.h> and "system.h" even if CRCTAB is defined,
so that the code will compile if CRCTAB is defined.
Include "human.h" if CRCTAB is not defined.
(uint_fast32_t): Define if it appears that stdint.h didn't.
(BIT, remainder, main, crctab): Use uint_fast32_t, not unsigned long,
for checksums.
(fill_r, remainder, main): Use ANSI prototypes.
(fill_r, remainder, main): Omit duplicate code.
(main): Use uintmax_t, not unsigned long, for file lengths.
Use size_t, not long, for result of fread.
Check for overflow when computing file lengths.
Check for write error immediately after printing a line, so that
we don't write to stdout indefinitely after an error.
2001-04-14 Paul Eggert <eggert@twinsun.com>
* src/sort.c (default_sort_size): Leave a 1/16 margin for RSS.
Suggestion from Solar Designer.
2001-04-14 Jim Meyering <meyering@lucent.com>
* src/wc.c (usage): Tweak --help output: s/line,/newline,/
2001-04-13 Jim Meyering <meyering@lucent.com>
* src/sort.c (main): Add a comment justifying the use of
`multi-character' rather than `multibyte' in a diagnostic.
From Paul Eggert.
2001-04-12 Paul Eggert <eggert@twinsun.com>
* src/sort.c (RLIMIT_AS): Do not define; just use conditional
code, since RLIMIT_RSS is similar (and is not standardized).
(default_sort_size): Don't allocate more than the RSS limit,
if this host has such a limit.
2001-03-20 Paul Eggert <eggert@twinsun.com>
* NEWS, doc/textutils.texi: sort now accepts long options and
checks POSIX option syntax.
* doc/textutils.texi: Document --, -, sort long options, and
sort -o after files.
* src/sort.c: Include <getopt.h>.
(usage, main): Add support for long options, and check option
syntax as POSIX requires, though (as usual for GNU apps)
options can follow file names unless POSIXLY_CORRECT is set.
Many diagnostic revamped.
(long_options): New constant.
(badfieldspec): New arg MSGID. Mark as noreturn.
(parse_field_count): New arg MSGID; if null, just return null on error.
(new_key): Renamed from key_init. All callers changed. Now allocates
the new key.
2001-03-18 Jim Meyering <meyering@lucent.com>
* Version 2.0.13.
* tests/Fetish.pm: If the $DJDIR envvar is defined, set SHELL
to $DJDIR/bin/bash.exe. Patch from Richard Dawe, based on a
suggestion from Eli Zaretskii.
2001-03-17 Paul Eggert <eggert@twinsun.com>
* src/sort.c, src/tail.c, src/uniq.c (usage):
Warn that the +N form will be withdrawn.
* doc/textutils.texi: Likewise.
2001-03-08 Paul Eggert <eggert@twinsun.com>
* NEWS, doc/textutils.texi: Document pr changes.
* src/pr.c: Include mbswidth.h.
(standard_header, header, test_suite): Remove.
(date_format, date_text, file_text, header_width_available): New vars.
(long_options, main, init_header, usage):
Add new -D or --date-format option.
(CHARS_FOR_DATE_AND_PAGE, T_BUF_FMT, T_BUF_SIZE, NO_DATE): Remove.
(init_header): Allow arbitrary width for date format. Change
"Page %5d" to "Page %d", since the code no longer assumes fixed width.
Do not assume that localtime succeeds.
(init_header, print_header, usage): Do not truncate headers.
(init_header, print_header): Defer width calculations until
page is printed, since "Page 100000" is wider than "Page 1".
Count columns, not bytes, in page headers.
Custom headers take up only the center, not the whole header.
(print_header): Use printf rather than fprintf(stdout).
* po/Makefile.in.in (install-data-yes): Install LC_TIME locale
for all packages, not just for fileutils.
(uninstall): Remove LC_TIME locale too.
* src/sys2.h (INT_STRLEN_BOUND): New macro.
* tests/pr/0F, tests/pr/0FF, tests/pr/2-S_f-t_notab,
tests/pr/2-Sf-t_notab, tests/pr/2f-t_notab,
tests/pr/2s_f-t_notab, tests/pr/2s_w60f-t_nota,
tests/pr/2sf-t_notab, tests/pr/2sw60f-t_notab,
tests/pr/2w60f-t_notab, tests/pr/3-0F, tests/pr/3-5l17f-t,
tests/pr/3-FF, tests/pr/3a2l17-FF, tests/pr/3a3f-0F,
tests/pr/3a3l15-t, tests/pr/3a3l8f-t, tests/pr/3b2l17-FF,
tests/pr/3b3f-0F, tests/pr/3b3f-0FF, tests/pr/3b3f-FF,
tests/pr/3b3l15-t, tests/pr/3b3l8f-t, tests/pr/3f-0F,
tests/pr/3f-FF, tests/pr/3l17f-t, tests/pr/3l24-t,
tests/pr/3ml17f-t, tests/pr/3ml24-FF, tests/pr/3ml24-t,
tests/pr/3ml24-t-FF, tests/pr/4-7l24-FF, tests/pr/4l24-FF,
tests/pr/a2l15-FF, tests/pr/a2l17-FF, tests/pr/a3-0F,
tests/pr/a3f-0F, tests/pr/a3f-0FF, tests/pr/a3f-FF,
tests/pr/a3l15-t, tests/pr/a3l17f-lm, tests/pr/a3l8f-t,
tests/pr/b2l15-FF, tests/pr/b2l17-FF, tests/pr/b3-0F,
tests/pr/b3f-0F, tests/pr/b3f-0FF, tests/pr/b3f-FF,
tests/pr/b3l15-t, tests/pr/b3l17f-lm, tests/pr/b3l8f-t,
tests/pr/FF, tests/pr/Ja3l17f-lm, tests/pr/Jb3l17f-lm,
tests/pr/Jml17f-lm-lo, tests/pr/l17f-t, tests/pr/l24-FF,
tests/pr/l24-t, tests/pr/ml17f-0F, tests/pr/ml17f-lm-lo,
tests/pr/ml17f-t, tests/pr/ml17f-t-0F, tests/pr/ml20-FF-t,
tests/pr/ml24-FF, tests/pr/ml24-t, tests/pr/ml24-t-FF,
tests/pr/n+2-5l17f-0FF, tests/pr/n+2l17f-0FF,
tests/pr/n+2l17f-bl, tests/pr/n+3-7l24-FF,
tests/pr/n+3l17f-0FF, tests/pr/n+3l17f-bl,
tests/pr/n+3ml13f-bl-FF, tests/pr/n+3ml17f-bl-tn,
tests/pr/n+3ml17f-tn-bl, tests/pr/n+4-8a2l17-FF,
tests/pr/n+4b2l10f-0FF, tests/pr/n+5-8b3l10f-FF,
tests/pr/n+5a3l6f-0FF, tests/pr/n+6a2l17-FF,
tests/pr/n+6b3l6f-FF, tests/pr/n+7l24-FF,
tests/pr/n+8l20-FF, tests/pr/nJml17f-lmlmlo,
tests/pr/nJml17f-lmlolm, tests/pr/nl17f-bl,
tests/pr/nN1+3l17f-bl, tests/pr/nN15l17f-bl,
tests/pr/nSml13-bl-FF, tests/pr/nSml13-t-t-FF,
tests/pr/nSml13-t-tFFFF, tests/pr/nSml17-bl-FF,
tests/pr/nSml17-t-t-FF, tests/pr/nSml17-t-tFFFF,
tests/pr/o3a3l17f-tn, tests/pr/o3a3Sl17f-tn,
tests/pr/o3a3Snl17f-tn, tests/pr/o3b3l17f-tn,
tests/pr/o3b3Sl17f-tn, tests/pr/o3b3Snl17f-tn,
tests/pr/o3Jml17f-lm-lo, tests/pr/o3ml17f-bl-tn,
tests/pr/o3mSl17f-bl-tn, tests/pr/o3mSnl17fbltn,
tests/pr/Test.pm, tests/pr/W-72l17f-ll, tests/pr/W20l17f-ll,
tests/pr/W26l17f-ll, tests/pr/W27l17f-ll,
tests/pr/W28l17f-ll, tests/pr/W35a3l17f-lm,
tests/pr/W35b3l17f-lm, tests/pr/W35Ja3l17f-lm,
tests/pr/W35Jb3l17f-lm, tests/pr/W35Jml17f-lmlo,
tests/pr/W35ml17f-lm-lo, tests/pr/W72Jl17f-ll,
tests/pr/w72l17f-ll:
Adjust to minor spacing changes in pr headers.
2001-03-11 Paul Eggert <eggert@twinsun.com>
* src/sort.c (die): New message arg, to describe failures
better. All callers changed.
2001-03-11 Paul Eggert <eggert@twinsun.com>
* src/sort.c: Decrease buffer size when only merging or checking.
(sort_size): Now the user-specified sort size.
(MIN_MERGE_BUFFER_SIZE): New macro.
(MIN_SORT_SIZE): Use it.
(merge_buffer_size): New variable.
(fillbuf): Increase merge_buffer_size if a longer line is encountered.
(checkfp, mergefps): Do not allocate a buffer smaller than
merge_buffer_size.
(sort): Use the default_sort_size if sort_size is zero.
(main): Do not set sort_size to default_sort_size.
2001-03-06 Paul Eggert <eggert@twinsun.com>
* src/sort.c (sort): If all the input files are empty, create
an empty output file.
* tests/sort/Test.pm: Test for this.
2001-03-13 Jim Meyering <meyering@lucent.com>
* src/sort.c (merge): Move declarations of local variables into
the inner scope where they're used.
(sort): Likewise.
2001-03-06 Paul Eggert <eggert@sic.twinsun.com>
Avoid the need for a copy of the input file when the input and
output overlap, e.g. 'sort F -o F'. With -m, though, a copy
is still needed sometimes.
* doc/textutils.texi: 'sort F -o F' no longer needs to copy F.
* src/sort.c: Do not include closeout.h.
(xfopen): Use stdout if *how != 'r'.
(mergefps): Remove FPS arg.
Open all input files, and close all files when done.
If OFP is null, open the output file (but after opening input files).
All callers changed.
(first_same_file): New function.
(sort, merge): Remove arg OFP; we now open the output file as needed.
All callers changed.
(merge): New arg MAX_MERGE. All callers changed.
(sort): For "sort F -o F", close the input before opening the output.
(main): Do not use close_stdout; 'sort' and 'merge' now close stdout.
(This also fixes a close-stdout-twice bug.)
Remove test for overlapping input and output files, as 'sort' no longer
needs to worry about overlap, and 'merge' checks for overlap itself.
Use first_same_file to inform 'merge' about how much to merge at
the top level, to avoid overlap.
2001-03-12 Jim Meyering <meyering@lucent.com>
`fmt --prefix=S' would not work properly for any string S containing
a byte with the high bit set.
* src/fmt.c (prefix): Declare to be of type unsigned char, not `char'.
(get_prefix): Likewise for local, `p'.
Reported by François Pinard.
Add a test for the above-fixed problem.
* tests/fmt: New directory/files.
* configure.in (AC_OUTPUT): Add tests/fmt/Makefile.
* tests/Makefile.am (SUBDIRS): Add fmt.
2001-03-05 Andreas Schwab <schwab@suse.de>
* src/tac.c (save_stdin): Use mkstemp to create temporary file.
2001-03-09 Jim Meyering <meyering@lucent.com>
* Makefile.maint (my_distdir): Define new variable, and use this
in place of most old uses of $(distdir).
* tests/help-version: Ensure that /dev/full is a character device
(using test -c) as well as being writable, before trying to write to it.
Otherwise, the test could mistakenly append a newline to an existing,
regular, writable, /dev/full file.
Suggested by Ulrich Drepper.
2001-03-08 Jim Meyering <meyering@lucent.com>
* tests/sha1sum/sample-vec: Insert the `--text' argument for each test.
Reported by Matthew Smith.
2001-03-04 Jim Meyering <meyering@lucent.com>
* Makefile.maint (my_distdir): Define.
Use it in place of $(distdir) almost everywhere.
* Version 2.0.12.
* Makefile.maint (alpha): Use $(PACKAGE)-$(VERSION), not $(distdir),
since the latter now has a `$(top_distdir)/' prefix.
2001-03-01 Paul Eggert <eggert@twinsun.com>
* src/sort.c (die): New function.
(create_temp_file, xfopen, xfclose, write_bytes, sort_buffer_size,
fillbuf, main): Use it to regularize error messages. The only change
in behavior is that write_bytes and the final close used to say "write
error" but now give just the output file name, which should be enough.
2001-03-01 Paul Eggert <eggert@twinsun.com>
* src/sort.c (xfclose): Add FILE arg, and report the file name
on error. All callers changed.
2001-03-01 Paul Eggert <eggert@twinsun.com>
* src/sort.c (main): When fclose (stdin) fails, do not mention
the output file in the error message; mention "-" instead.
2001-02-28 Paul Eggert <eggert@twinsun.com>
* src/sort.c (xfopen): Set have_read_stdin to 1 only if file is "-".
Use fopen_safer, not fopen, to avoid subtle bugs when fopen returns
stdin, stdout, or stderr.
(xfclose): stdout is no longer a special case.
(main): Close output file, don't just flush it; there might be
an error on the close.
2001-02-27 Paul Eggert <eggert@twinsun.com>
* src/sort.c (initbuf): If the desired size cannot be
allocated, repeatedly halve it until allocation succeeds.
Reported by Solar Designer.
2001-02-26 Paul Eggert <eggert@twinsun.com>
* src/sort.c (parse_field_count): Comment fix.
2001-02-25 Paul Eggert <eggert@twinsun.com>
* src/sort.c: Tune allocation and comparison of nodes
representing temp files. This improved CPU performance of
'sort -S 1 *.[ch]' by 17% on my host.
(struct tempnode): name member now uses struct hack.
(temphead): Now a pointer, not a structure. All uses changed.
(create_temp_file): Allocate node using struct hack.
(zaptemp): Free node using struct hack. Use pointer comparison, not
string comparison.
2001-02-25 Paul Eggert <eggert@twinsun.com>
* src/sort.c (eolchar, trim_trailing_blanks): Now static.
2001-02-25 Paul Eggert <eggert@twinsun.com>
'sort' race condition fixes.
Defend against a DoS attack where someone else creates a
temporary file with the same name as ours. Use mkstemp to do
this, supplying our own mkstemp if the system doesn't have one.
Also, fix a race condition during cleanup on hosts without
sigaction.
* src/sort.c (NAME_MAX_IN_DIR): Remove.
(sigprocmask, sigset_t): New macros, defined only on older hosts.
(caught_signals): New var.
(xtmpfopen, tempname): Removed.
(create_temp_file): New function, combining the functions of the old
xtmpfopen and tempname. All callers changed.
Use mkstemp to create the file.
(sighandler): On hosts without sigaction, ignore signals while
cleaning up, instead of letting them interrupt cleanup.
(main): Initialize caught_signals. On hosts with sigaction, block all
caught signals while handling one. Remove duplicate code.
2001-02-22 Jim Meyering <meyering@lucent.com>
* src/sort.c (keycompare): Move declarations of locals, lena and lenb,
into the inner scope where they are used.
2001-02-19 Jim Meyering <meyering@lucent.com>
* src/sort.c (AUTHORS): Add Paul Eggert.
* src/wc.c (wc): Rename innermost `buf' to avoid shadowing warning.
(wc): Rename local `wc' to avoid shadowing function name.
2001-02-18 Paul Eggert <eggert@twinsun.com>
Fix a race condition: freed storage accessed during a signal handler.
* src/sort.c (struct tempnode.next): Now volatile.
(zaptemp): Free the file name after removing it from the temp list,
not before, because a signal can arrive between the two actions
and cleanup () traverses the list.
2001-02-18 Paul Eggert <eggert@twinsun.com>
Check for input size, and do not overallocate memory.
Also check for memory quotas.
Revamp storage management so that line tables and character data are
taken from the same buffer. Line tables are now in reverse order,
since they grow down while the character data grow up.
* src/sort.c:
(<sys/resource.h>): Include if HAVE_SYS_RESOURCE_H.
(struct rlimit, getrlimit): Define a replacement if RLIMIT_DATA
is not defined.
(RLIMIT_AS): Define to RLIMIT_DATA if not defined.
(struct lines): Remove.
(struct buffer): New members nlines, line_bytes, eof.
Remove member newline_free; no longer needed, since the code no longer
runs out of line table space.
(SORTALLOC_MIN, SORTALLOC_DEFAULT_MIN): Remove.
(sort_size): Renamed from sortalloc; now applies to the sum of the
character data and the line table, not just the character data.
(MIN_SORT_SIZE, INPUT_FILE_SIZE_GUESS): New macros.
(linelength): remove.
(specify_sort_size): Don't worry about the distinction between the
character data and the line table; that is now the caller's
responsibility.
(default_sort_size): Return the value, instead of being executed for
side effect. Return half of available memory, or 1/16 of total memory,
whichever is greater; except do not exceed 1/2 of quota.
(sort_buffer_size): New function.
(initbuf): New arg LINE_BYTES. Ensure that the line array is properly
aligned. Initialize the new set of struct buffer members.
(buffer_linelim): New function.
(fillbuf): Return int, not size_t, since the callers merely care
whether the result is nonzero. New arg FILE so that error messages
can report the file name. Keep track of eof. Initialize the line
table too, taking its memory from the input buffer's memory; this
subsumes the old findlines function and removes the need for worrying
about running out of line table entries.
(checkfp, mergefps, sortlines, merge, sort): Adjust to the new storage
management regime, in particular the fact that line tables are now
filled in by fillbuf and are in reverse order.
(checkfp): Now takes char *, not const char *, since subroutines
require that now. Rewrite to avoid lint and duplicate code.
If line length alloc calculation overflows,
simply allocate enough memory to hold the line.
(mergefps): New arg FILES, used for buffer size calculation and error
messages. Rewrite to avoid lint. Do not loop if savealloc*2
overflows.
(mergefps, merge): Zap temporary files eagerly rather than lazily;
this is needed because we now pass FILES to mergefps.
(sortlines): Args now point at end of arrays, not at beginnings.
(sort): Do not allocate temporary line array for sortlines;
instead, take the space from the same buffer.
(main): Adjust to sort_size and default_sort_size changes.
2001-02-18 Jim Meyering <meyering@lucent.com>
Rename test input files to avoid conflicts on case-insensitive
@@ -824,7 +1279,7 @@
(squeeze_filter, set_initialize, main): Use size_t and ssize_t in
place of long and int in several decls.
(read_and_delete, read_and_xlate): Likewise, and remove assertion.
* tests/tr/Test.pm: (o-rep-1, o-rep-2): New tests.
* tests/tr/Test.pm (o-rep-1, o-rep-2): New tests.
* src/cut.c: Correct copying notice to use GPL, per author's request.
* src/paste.c: Likewise.
@@ -1021,7 +1476,7 @@
* lib/linebuffer.c (readline): Do not leave room for an extra
byte after the newline; it's no longer needed.
* src/sort.c: (sortalloc, mergealloc, fillbuf, checkfp, mergefps):
* src/sort.c (sortalloc, mergealloc, fillbuf, checkfp, mergefps):
Likewise.
* lib/memcoll.c (memcoll): The two arguments cannot be
@@ -1624,7 +2079,7 @@
* src/sys2.h (TOLOWER): Define.
(TOUPPER): Define.
* src/join.c (TOLOWER): Remove definition.
* src/md5sum.c: (TOLOWER): Remove definition.
* src/md5sum.c (TOLOWER): Remove definition.
1999-04-30 Jim Meyering <meyering@ascend.com>
@@ -1776,7 +2231,7 @@
1999-03-13 Jim Meyering <meyering@ascend.com>
* src/tac.c: (tac_mem): `#if-0'-out this unused function.
* src/tac.c (tac_mem): `#if-0'-out this unused function.
(tac_stdin_to_mem): Likewise.
* doc/textutils.texi (cut invocation): Describe --output-delimiter.
@@ -2606,7 +3061,7 @@
1998-01-16 Jim Meyering <meyering@na-net.ornl.gov>
* src/sort.c: (mergefps): Add braces to avoid ambiguous `else' stmt.
* src/sort.c (mergefps): Add braces to avoid ambiguous `else' stmt.
(nls_set_fraction): Likewise.
* src/sort.c: Guard inclusion of langinfo.h also with HAVE_LANGINFO_H,
@@ -2898,7 +3353,7 @@
1997-10-14 Jim Meyering <meyering@na-net.ornl.gov>
* src/sort.c: (_NL_ITEM) [!defined]: Define.
* src/sort.c (_NL_ITEM) [!defined]: Define.
From from Ørn E. Hansen.
* src/sort.c: Use STREQ in place of most uses of strcmp.
@@ -4337,7 +4792,7 @@ Wed Feb 28 20:32:48 1996 Jim Meyering (meyering@na-net.ornl.gov)
(noinst_HEADERS): Rename from HEADERS.
(INCLUDES): Remove -I.. and -I$(srcdir). automake-0.30 adds these
to DEFS automatically.
* lib/Makefile.am: (noinst_HEADERS): Rename from HEADERS.
* lib/Makefile.am (noinst_HEADERS): Rename from HEADERS.
Wed Feb 21 18:56:27 1996 Jim Meyering (meyering@na-net.ornl.gov)
@@ -4606,7 +5061,7 @@ Tue Nov 14 23:10:54 1995 Jim Meyering (meyering@comco.com)
(cleanup_fatal): Renamed from cleanup. Call cleanup, then exit.
Update callers.
* tac.c: (cleanup): Don't exit.
* tac.c (cleanup): Don't exit.
(cleanup_fatal): New function. Call cleanup, then exit.
(sighandler): New function.
(cleanup_fatal): Renamed from cleanup. Call cleanup, then exit.
@@ -4866,7 +5321,7 @@ Sat Sep 23 15:43:46 1995 Jim Meyering (meyering@comco.com)
* Makefile.in (DISTFILES): Add README.alpha.
* lib/Makfile.in: (GETOPT, MEMCHR, REGEX): New variables.
* lib/Makfile.in (GETOPT, MEMCHR, REGEX): New variables.
(OBJECTS): Use them instead of hardcoding object file names.
Suggested by Ulrich Drepper.
@@ -4943,7 +5398,7 @@ Sun Jul 30 00:01:58 1995 Jim Meyering (meyering@comco.com)
* md5sum.c (md5_check): Use getline instead of fgets.
* lib/Makefile.in: (SOURCES): Add getline.c.
* lib/Makefile.in (SOURCES): Add getline.c.
(OBJECTS): Add getline.o.
(DISTFILES): Add getline.h.
(getline.o): Depend on getline.h.
@@ -5016,7 +5471,7 @@ Fri Jul 21 01:21:49 1995 Jim Meyering (meyering@comco.com)
(split_3): No longer parse the `new format.' There is only one
valid format now: the compatible one.
* lib/Makefile.in: (SOURCES): Add md5.c.
* lib/Makefile.in (SOURCES): Add md5.c.
(OBJECTS): Add md5.o.
(DISTFILES): Add md5.h.
(md5.o): Depend on md5.h.
@@ -5216,10 +5671,10 @@ Sun Jun 11 00:39:50 1995 Jim Meyering (meyering@comco.com)
* md5sum.c: New file. From Ulrich Drepper.
* md5-test.rfc: New file.
* Makefile.in: (PROGS): Add md5sum.
* Makefile.in (PROGS): Add md5sum.
(check): Run a recursive make in each subdirectory.
* man/Makefile.in: (MANFILES): Add md5sum.1.
* src/Makefile.in: (SOURCES): Add md5sum.c.
* man/Makefile.in (MANFILES): Add md5sum.1.
* src/Makefile.in (SOURCES): Add md5sum.c.
(OBJECTS): Add md5sum.o.
(PROGS): Add md5sum.
(check): Add basic checks for md5sum.
@@ -5340,7 +5795,7 @@ Thu Apr 20 23:09:33 1995 Jim Meyering (meyering@comco.com)
Tue Apr 18 22:57:43 1995 Jim Meyering (meyering@comco.com)
* configure.in: (AC_OUTPUT): Use echo, not date, to avoid creating
* configure.in (AC_OUTPUT): Use echo, not date, to avoid creating
unnecessary conflicts for people using version control software
like RCS and CVS.
(AC_ARG_PROGRAM): Use it.

View File

@@ -1,4 +1,32 @@
Changes in release 2.1
[2.0.15]
* uniq's --all-repeated option has new modes to delimit groups
of duplicate lines: --all-repeated={precede,separate,none(default)}
[2.0.14]
* sort now accepts long options like "--reverse" and "--".
* sort now checks option syntax as POSIX requires, except that (as usual
for GNU) options can follow file names unless POSIXLY_CORRECT is set.
For example, invalid positional combinations like "sort +1 -r -2" are
now rejected as per POSIX.
* The next POSIX standard will require that obsolescent 'sort'
positional options like +1 be treated as file names, not options.
Please use 'sort -k' instead.
[2.0.13]
* pr accepts new -D or --date option, to specify date format.
* The following changes are required by POSIX:
- If POSIXLY_CORRECT is set, dates in pr headers now look something like
'Dec 4 23:59 2001', with the exact appearance affected by LC_TIME.
- pr -h now affects only the center header string, not the entire header.
- pr no longer truncates headers.
* Spacing in pr headers has been adjusted slightly.
* `fmt --prefix=S' now works when S contains a byte with the high bit set
[2.0.12]
* sort has improved performance when using very little main memory
* sort has improved memory management
* sort is no longer susceptible to certain denial of service attacks
* sort no longer suffers from a race condition whereby an interrupt received
during cleanup could cause it to fail to remove temporary files.
This problem could arise only on hosts without sigaction.
[2.0.11]
* sort accepts new -S SIZE option, to specify main-memory usage.
[2.0.10]

View File

@@ -150,13 +150,11 @@ install-data-yes: all
true; \
fi; \
fi; \
if test "$(PACKAGE)" = "fileutils"; then \
timedir=$$destdir/$$lang/LC_TIME; \
rm -fr $$timedir; \
ln -s LC_MESSAGES $$timedir \
|| (mkdir $$timedir && ln $$dir/* $$timedir); \
echo "installing $$timedir as an alias for $$dir"; \
fi; \
timedir=$$destdir/$$lang/LC_TIME; \
rm -fr $$timedir; \
ln -s LC_MESSAGES $$timedir \
|| (mkdir $$timedir && ln $$dir/* $$timedir); \
echo "installing $$timedir as an alias for $$dir"; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -x "$(MKINSTALLDIRS)"; then \
@@ -178,10 +176,13 @@ uninstall:
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
for dir in $(localedir) $(gnulocaledir); do \
for lc in LC_MESSAGES LC_TIME; do \
for x in '' .m; do \
rm -f $(DESTDIR)$$dir/$$lang/$$lc/$(PACKAGE)$(INSTOBJEXT)$$x; \
done; \
done; \
done; \
done
check: all

View File

@@ -1,6 +1,6 @@
/* Copyright (C) 1989, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved. */
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
/*$Id: ansi2knr.c,v 1.14 1999/04/13 14:44:33 meyering Exp $*/
/*$Id: ansi2knr.c,v 1.15 2001/05/24 21:58:56 meyering Exp $*/
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
/*
@@ -37,21 +37,21 @@ program under the GPL.
* There are no error messages.
*
* ansi2knr recognizes function definitions by seeing a non-keyword
* identifier at the left margin, followed by a left parenthesis,
* with a right parenthesis as the last character on the line,
* and with a left brace as the first token on the following line
* (ignoring possible intervening comments), except that a line
* identifier at the left margin, followed by a left parenthesis, with a
* right parenthesis as the last character on the line, and with a left
* brace as the first token on the following line (ignoring possible
* intervening comments and/or preprocessor directives), except that a line
* consisting of only
* identifier1(identifier2)
* will not be considered a function definition unless identifier2 is
* the word "void", and a line consisting of
* identifier1(identifier2, <<arbitrary>>)
* will not be considered a function definition.
* ansi2knr will recognize a multi-line header provided
* that no intervening line ends with a left or right brace or a semicolon.
* These algorithms ignore whitespace and comments, except that
* the function name must be the first thing on the line.
* The following constructs will confuse it:
* ansi2knr will recognize a multi-line header provided that no intervening
* line ends with a left or right brace or a semicolon. These algorithms
* ignore whitespace, comments, and preprocessor directives, except that
* the function name must be the first thing on the line. The following
* constructs will confuse it:
* - Any other construct that starts at the left margin and
* follows the above syntax (such as a macro or function call).
* - Some macros that tinker with the syntax of function headers.
@@ -61,6 +61,27 @@ program under the GPL.
* The original and principal author of ansi2knr is L. Peter Deutsch
* <ghost@aladdin.com>. Other authors are noted in the change history
* that follows (in reverse chronological order):
lpd 2000-04-12 backs out Eggert's changes because of bugs:
- concatlits didn't declare the type of its bufend argument;
- concatlits didn't't recognize when it was inside a comment;
- scanstring could scan backward past the beginning of the string; when
- the check for \ + newline in scanstring was unnecessary.
2000-03-05 Paul Eggert <eggert@twinsun.com>
Add support for concatenated string literals.
* ansi2knr.c (concatlits): New decl.
(main): Invoke concatlits to concatenate string literals.
(scanstring): Handle backslash-newline correctly. Work with
character constants. Fix bug when scanning backwards through
backslash-quote. Check for unterminated strings.
(convert1): Parse character constants, too.
(appendline, concatlits): New functions.
* ansi2knr.1: Document this.
lpd 1999-08-17 added code to allow preprocessor directives
wherever comments are allowed
lpd 1999-04-12 added minor fixes from Pavel Roskin
<pavel_roskin@geocities.com> for clean compilation with
gcc -W -Wall
@@ -196,6 +217,8 @@ program under the GPL.
#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
/* Forward references */
char *ppdirforward();
char *ppdirbackward();
char *skipspace();
char *scanstring();
int writeblanks();
@@ -298,7 +321,7 @@ f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
goto wl;
if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
goto wl;
switch ( *skipspace(more, 1) )
switch ( *skipspace(ppdirforward(more), 1) )
{
case '{':
/* Definitely a function header. */
@@ -349,32 +372,70 @@ wl: fputs(buf, out);
return 0;
}
/* Skip over whitespace and comments, in either direction. */
/*
* Skip forward or backward over one or more preprocessor directives.
*/
char *
ppdirforward(p)
char *p;
{
for (; *p == '#'; ++p) {
for (; *p != '\r' && *p != '\n'; ++p)
if (*p == 0)
return p;
if (*p == '\r' && p[1] == '\n')
++p;
}
return p;
}
char *
ppdirbackward(p, limit)
char *p;
char *limit;
{
char *np = p;
for (;; p = --np) {
if (*np == '\n' && np[-1] == '\r')
--np;
for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
if (np[-1] == 0)
return np;
if (*np != '#')
return p;
}
}
/*
* Skip over whitespace, comments, and preprocessor directives,
* in either direction.
*/
char *
skipspace(p, dir)
register char *p;
register int dir; /* 1 for forward, -1 for backward */
{ for ( ; ; )
{ while ( is_space(*p) )
p += dir;
if ( !(*p == '/' && p[dir] == '*') )
break;
p += dir; p += dir;
while ( !(*p == '*' && p[dir] == '/') )
{ if ( *p == 0 )
return p; /* multi-line comment?? */
p += dir;
}
p += dir; p += dir;
}
return p;
char *p;
int dir; /* 1 for forward, -1 for backward */
{
for ( ; ; ) {
while ( is_space(*p) )
p += dir;
if ( !(*p == '/' && p[dir] == '*') )
break;
p += dir; p += dir;
while ( !(*p == '*' && p[dir] == '/') ) {
if ( *p == 0 )
return p; /* multi-line comment?? */
p += dir;
}
p += dir; p += dir;
}
return p;
}
/* Scan over a quoted string, in either direction. */
char *
scanstring(p, dir)
register char *p;
register int dir;
char *p;
int dir;
{
for (p += dir; ; p += dir)
if (*p == '"' && p[-dir] != '\\')
@@ -412,14 +473,14 @@ writeblanks(start, end)
int
test1(buf)
char *buf;
{ register char *p = buf;
{ char *p = buf;
char *bend;
char *endfn;
int contin;
if ( !isidfirstchar(*p) )
return 0; /* no name at left margin */
bend = skipspace(buf + strlen(buf) - 1, -1);
bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
switch ( *bend )
{
case ';': contin = 0 /*2*/; break;
@@ -498,7 +559,7 @@ convert1(buf, out, header, convert_varargs)
int header; /* Boolean */
int convert_varargs; /* Boolean */
{ char *endfn;
register char *p;
char *p;
/*
* The breaks table contains pointers to the beginning and end
* of each argument.

View File

@@ -1,5 +1,5 @@
/* basename -- strip directory and suffix from filenames
Copyright (C) 1990-1997, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1990-1997, 1999, 2000, 2001 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
@@ -31,6 +31,7 @@
#include "system.h"
#include "long-options.h"
#include "dirname.h"
#include "error.h"
#include "closeout.h"
@@ -39,9 +40,6 @@
#define AUTHORS "FIXME unknown"
char *base_name ();
void strip_trailing_slashes ();
/* The name this program was run with. */
char *program_name;
@@ -118,9 +116,8 @@ main (int argc, char **argv)
usage (1);
}
strip_trailing_slashes (argv[1]);
name = base_name (argv[1]);
name[base_len (name)] = '\0';
if (argc == 3)
remove_suffix (name, argv[2]);

View File

@@ -23,6 +23,7 @@
#include <sys/types.h>
#include "system.h"
#include "dirname.h"
#include "error.h"
#include "filemode.h"
#include "modechange.h"
@@ -53,8 +54,6 @@ enum Verbosity
V_off
};
void strip_trailing_slashes ();
static int change_dir_mode PARAMS ((const char *dir,
const struct mode_change *changes,
const struct stat *statp));
@@ -100,23 +99,13 @@ mode_changed (const char *file, mode_t old_mode)
{
struct stat new_stats;
if (lstat (file, &new_stats))
if (stat (file, &new_stats))
{
if (force_silent == 0)
error (0, errno, _("getting new attributes of %s"), quote (file));
return 0;
}
#ifdef S_ISLNK
if (S_ISLNK (new_stats.st_mode)
&& stat (file, &new_stats))
{
if (force_silent == 0)
error (0, errno, _("getting new attributes of %s"), quote (file));
return 0;
}
#endif
return old_mode != new_stats.st_mode;
}
@@ -165,25 +154,16 @@ change_file_mode (const char *file, const struct mode_change *changes,
int fail;
int saved_errno;
if (lstat (file, &file_stats))
if (deref_symlink ? stat (file, &file_stats) : lstat (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
#ifdef S_ISLNK
if (S_ISLNK (file_stats.st_mode))
{
if (! deref_symlink)
return 0;
else
if (stat (file, &file_stats))
{
if (force_silent == 0)
error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
}
return 0;
#endif
newmode = mode_adjust (file_stats.st_mode, changes);

View File

@@ -34,6 +34,7 @@
#include <getopt.h>
#include "system.h"
#include "dirname.h"
#include "error.h"
#include "lchown.h"
#include "quote.h"
@@ -56,7 +57,6 @@ struct group *getgrgid ();
#endif
char *parse_user_spec ();
void strip_trailing_slashes ();
/* The name the program was run with. */
char *program_name;
@@ -173,11 +173,11 @@ main (int argc, char **argv)
case FROM_OPTION:
{
char *u_dummy, *g_dummy;
const char *e = parse_user_spec (argv[optind],
const char *e = parse_user_spec (optarg,
&old_uid, &old_gid,
&u_dummy, &g_dummy);
if (e)
error (1, 0, "%s: %s", quote (argv[optind]), e);
error (1, 0, "%s: %s", quote (optarg), e);
break;
}
case 'R':

View File

@@ -47,12 +47,17 @@
#define AUTHORS "Q. Frank Xia"
#include <stdio.h>
#include "system.h"
#if !defined UINT_FAST32_MAX && !defined uint_fast32_t
# define uint_fast32_t unsigned int
#endif
#ifdef CRCTAB
# include <stdio.h>
# define BIT(x) ( (unsigned long)1 << (x) )
# define SBIT BIT(31)
# define BIT(x) ((uint_fast32_t) 1 << (x))
# define SBIT BIT (31)
/* The generating polynomial is
@@ -61,47 +66,48 @@
The i bit in GEN is set if X^i is a summand of G(X) except X^32. */
# define GEN (BIT(26)|BIT(23)|BIT(22)|BIT(16)|BIT(12)|BIT(11)|BIT(10)\
|BIT(8) |BIT(7) |BIT(5) |BIT(4) |BIT(2) |BIT(1) |BIT(0));
# define GEN (BIT (26) | BIT (23) | BIT (22) | BIT (16) | BIT (12) \
| BIT (11) | BIT (10) | BIT (8) | BIT (7) | BIT (5) \
| BIT (4) | BIT (2) | BIT (1) | BIT (0))
static unsigned long r[8];
static uint_fast32_t r[8];
static void
fill_r ()
fill_r (void)
{
int i;
r[0] = GEN;
for (i = 1; i < 8; i++)
r[i] = (r[i - 1] & SBIT) ? (r[i - 1] << 1) ^ r[0] : r[i - 1] << 1;
r[i] = (r[i - 1] << 1) ^ ((r[i - 1] & SBIT) ? GEN : 0);
}
static unsigned long
remainder (m)
int m;
static uint_fast32_t
remainder (int m)
{
unsigned long rem = 0;
uint_fast32_t rem = 0;
int i;
for (i = 0; i < 8; i++)
if (BIT (i) & m)
rem = rem ^ r[i];
rem ^= r[i];
return rem & 0xFFFFFFFF; /* Make it run on 64-bit machine. */
}
int
main ()
main (void)
{
int i;
fill_r ();
printf ("unsigned long crctab[256] = {\n 0x0");
printf ("static uint_fast32_t crctab[256] =\n{\n 0x0");
for (i = 0; i < 51; i++)
{
printf (",\n 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X",
remainder (i * 5 + 1), remainder (i * 5 + 2), remainder (i * 5 + 3),
remainder (i * 5 + 4), remainder (i * 5 + 5));
remainder (i * 5 + 1), remainder (i * 5 + 2),
remainder (i * 5 + 3), remainder (i * 5 + 4),
remainder (i * 5 + 5));
}
printf ("\n};\n");
exit (EXIT_SUCCESS);
@@ -109,13 +115,12 @@ main ()
#else /* !CRCTAB */
# include <stdio.h>
# include <getopt.h>
# include <sys/types.h>
# include "system.h"
# include "closeout.h"
# include "long-options.h"
# include "error.h"
# include "human.h"
/* Number of bytes to read at once. */
# define BUFLEN (1 << 16)
@@ -128,7 +133,7 @@ static struct option const long_options[] =
{0, 0, 0, 0}
};
static unsigned long const crctab[256] =
static uint_fast32_t crctab[256] =
{
0x0,
0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B,
@@ -196,10 +201,12 @@ static int
cksum (const char *file, int print_name)
{
unsigned char buf[BUFLEN];
unsigned long crc = 0;
long length = 0;
long bytes_read;
uint_fast32_t crc = 0;
uintmax_t length = 0;
size_t bytes_read;
register FILE *fp;
char hbuf[LONGEST_HUMAN_READABLE + 1];
char *hp;
if (STREQ (file, "-"))
{
@@ -223,9 +230,11 @@ cksum (const char *file, int print_name)
{
unsigned char *cp = buf;
if (length + bytes_read < length)
error (EXIT_FAILURE, 0, _("%s: file too long"), file);
length += bytes_read;
while (bytes_read--)
crc = (crc << 8) ^ crctab[((crc >> 24) ^ *(cp++)) & 0xFF];
crc = (crc << 8) ^ crctab[((crc >> 24) ^ *cp++) & 0xFF];
}
if (ferror (fp))
@@ -242,19 +251,20 @@ cksum (const char *file, int print_name)
return -1;
}
bytes_read = length;
while (bytes_read > 0)
{
crc = (crc << 8) ^ crctab[((crc >> 24) ^ bytes_read) & 0xFF];
bytes_read >>= 8;
}
hp = human_readable (length, hbuf, 1, 1);
for (; length; length >>= 8)
crc = (crc << 8) ^ crctab[((crc >> 24) ^ length) & 0xFF];
crc = ~crc & 0xFFFFFFFF;
printf ("%lu %ld", crc, length);
if (print_name)
printf (" %s", file);
putchar ('\n');
printf ("%u %s %s\n", (unsigned) crc, hp, file);
else
printf ("%u %s\n", (unsigned) crc, hp);
if (ferror (stdout))
error (EXIT_FAILURE, errno, "-: %s", _("write error"));
return 0;
}
@@ -313,16 +323,12 @@ main (int argc, char **argv)
}
}
if (optind >= argc)
{
if (cksum ("-", 0) < 0)
errors = 1;
}
if (optind == argc)
errors |= cksum ("-", 0);
else
{
for (i = optind; i < argc; i++)
if (cksum (argv[i], 1) < 0)
errors = 1;
errors |= cksum (argv[i], 1);
}
if (have_read_stdin && fclose (stdin) == EOF)

View File

@@ -1,5 +1,5 @@
/* comm -- compare two sorted files line by line.
Copyright (C) 86, 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 86, 90, 91, 1995-2001 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,7 +81,7 @@ Compare sorted files LEFT_FILE and RIGHT_FILE line by line.\n\
\n\
-1 suppress lines unique to left file\n\
-2 suppress lines unique to right file\n\
-3 suppress lines unique to both files\n\
-3 suppress lines that appear in both files\n\
--help display this help and exit\n\
--version output version information and exit\n\
"));

View File

@@ -937,8 +937,6 @@ copy_internal (const char *src_path, const char *dst_path,
int in_current_dir;
dst_parent = dir_name (dst_path);
if (dst_parent == NULL)
xalloc_die ();
in_current_dir = (STREQ (".", dst_parent)
/* If either stat call fails, it's ok not to report

View File

@@ -77,8 +77,6 @@ enum
UNLINK_DEST_BEFORE_OPENING
};
void strip_trailing_slashes ();
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
@@ -342,18 +340,18 @@ make_path_private (const char *const_dirpath, int src_offset, int mode,
struct stat stats;
char *dirpath; /* A copy of CONST_DIRPATH we can change. */
char *src; /* Source name in `dirpath'. */
char *tmp_dst_dirname; /* Leading path of `dirpath', malloc. */
char *dst_dirname; /* Leading path of `dirpath', alloca. */
char *dst_dirname; /* Leading path of `dirpath'. */
size_t dirlen; /* Length of leading path of `dirpath'. */
dirpath = (char *) alloca (strlen (const_dirpath) + 1);
strcpy (dirpath, const_dirpath);
src = dirpath + src_offset;
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);
dirlen = dir_len (dirpath);
dst_dirname = (char *) alloca (dirlen + 1);
memcpy (dst_dirname, dirpath, dirlen);
dst_dirname[dirlen] = '\0';
*attr_list = NULL;

View File

@@ -147,6 +147,7 @@ specifies Coordinated Universal Time. Interpreted sequences are:\n\
%%b locale's abbreviated month name (Jan..Dec)\n\
%%B locale's full month name, variable length (January..December)\n\
%%c locale's date and time (Sat Nov 04 12:02:33 EST 1989)\n\
%%C century (year divided by 100 and truncated to an integer) [00-99]\n\
%%d day of month (01..31)\n\
%%D date (mm/dd/yy)\n\
%%e day of month, blank padded ( 1..31)\n\

View File

@@ -49,7 +49,7 @@
#endif
#ifndef S_TYPEISSHM
# define S_TYPEISSHM(Mode) 0
# define S_TYPEISSHM(Stat_ptr) 0
#endif
#define ROUND_UP_OFFSET(X, M) ((M) - 1 - (((X) + (M) - 1) % (M)))
@@ -57,10 +57,14 @@
+ ROUND_UP_OFFSET ((char *)(Ptr) - (char *)0, (M)))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define output_char(c) \
do { \
obuf[oc++] = (c); if (oc >= output_blocksize) write_output (); \
} while (0)
#define output_char(c) \
do \
{ \
obuf[oc++] = (c); \
if (oc >= output_blocksize) \
write_output (); \
} \
while (0)
/* Default input and output blocksize. */
#define DEFAULT_BLOCKSIZE 512
@@ -317,7 +321,8 @@ Each KEYWORD may be:\n\
ucase change lower case to upper case\n\
swab swap every pair of input bytes\n\
noerror continue after read errors\n\
sync pad every input block with NULs to ibs-size\n\
sync pad every input block with NULs to ibs-size; when used\n\
with block or unblock, pad with spaces rather than NULs\n\
"));
puts (_("\nReport bugs to <bug-fileutils@gnu.org>."));
}
@@ -941,7 +946,7 @@ dd_copy (void)
{
/* FIXME: this loses for
% ./dd if=dd seek=1 |:
./dd: standard output: Bad file number
./dd: standard output: Bad file descriptor
0+0 records in
0+0 records out
*/
@@ -961,7 +966,9 @@ dd_copy (void)
whatever data we are able to read is followed by zeros.
This minimizes data loss. */
if ((conversions_mask & C_SYNC) && (conversions_mask & C_NOERROR))
memset ((char *) ibuf, 0, input_blocksize);
memset ((char *) ibuf,
(conversions_mask & (C_BLOCK | C_UNBLOCK)) ? ' ' : '\0',
input_blocksize);
nread = safe_read (STDIN_FILENO, ibuf, input_blocksize);
@@ -1000,7 +1007,8 @@ dd_copy (void)
{
if (!(conversions_mask & C_NOERROR))
/* If C_NOERROR, we zeroed the block before reading. */
memset ((char *) (ibuf + n_bytes_read), 0,
memset ((char *) (ibuf + n_bytes_read),
(conversions_mask & (C_BLOCK | C_UNBLOCK)) ? ' ' : '\0',
input_blocksize - n_bytes_read);
n_bytes_read = input_blocksize;
}
@@ -1168,7 +1176,7 @@ main (int argc, char **argv)
if (ftruncate (STDOUT_FILENO, o) != 0
&& (S_ISREG (stdout_stat.st_mode)
|| S_ISDIR (stdout_stat.st_mode)
|| S_TYPEISSHM (stdout_stat.st_mode)))
|| S_TYPEISSHM (&stdout_stat)))
{
char buf[LONGEST_HUMAN_READABLE + 1];
error (1, errno, _("advancing past %s bytes in output file %s"),

View File

@@ -48,7 +48,6 @@
#define AUTHORS \
"Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert"
void strip_trailing_slashes ();
char *xgetcwd ();
/* Name this program was run with. */
@@ -454,14 +453,8 @@ find_mount_point (const char *file, const struct stat *file_stat)
else
/* FILE is some other kind of file, we need to use its directory. */
{
int rv;
char *tmp = xstrdup (file);
char *dir;
strip_trailing_slashes (tmp);
dir = dir_name (tmp);
free (tmp);
rv = chdir (dir);
char *dir = dir_name (file);
int rv = chdir (dir);
free (dir);
if (rv < 0)

View File

@@ -27,6 +27,7 @@
#include "system.h"
#include "dircolors.h"
#include "dirname.h"
#include "error.h"
#include "getline.h"
#include "obstack.h"

View File

@@ -33,8 +33,6 @@
#define AUTHORS "David MacKenzie and Jim Meyering"
void strip_trailing_slashes ();
/* The name this program was run with. */
char *program_name;
@@ -66,7 +64,9 @@ output `.' (meaning the current directory).\n\
int
main (int argc, char **argv)
{
char *result;
static char const dot = '.';
char const *result;
size_t len;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -92,11 +92,17 @@ main (int argc, char **argv)
usage (1);
}
result = dir_name (argv[1]);
if (result == NULL)
xalloc_die ();
puts (result);
free (result);
result = argv[1];
len = dir_len (result);
if (! len)
{
result = &dot;
len = 1;
}
fwrite (result, 1, len, stdout);
putchar ('\n');
exit (0);
}

View File

@@ -51,33 +51,13 @@
for those primes and to jump onto the wheel. For more information, see
http://www.utm.edu/research/primes/glossary/WheelFactorization.html */
static const unsigned int wheel_tab[] = {
/* lead in: */ 1, 2, 2, 4, 2, /* and the periodic tail: */
4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4,
2, 4, 2, 4,14, 4, 6, 2,10, 2, 6, 6, 4, 2, 4, 6, 2,10, 2, 4,
2,12,10, 2, 4, 2, 4, 6, 2, 6, 4, 6, 6, 6, 2, 6, 4, 2, 6, 4,
6, 8, 4, 2, 4, 6, 8, 6,10, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2,
6, 4, 2, 6,10, 2,10, 2, 4, 2, 4, 6, 8, 4, 2, 4,12, 2, 6, 4,
2, 6, 4, 6,12, 2, 4, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6,10, 2,
4, 6, 2, 6, 4, 2, 4, 2,10, 2,10, 2, 4, 6, 6, 2, 6, 6, 4, 6,
6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 6, 4, 8, 6, 4, 6, 2, 4, 6,
8, 6, 4, 2,10, 2, 6, 4, 2, 4, 2,10, 2,10, 2, 4, 2, 4, 8, 6,
4, 2, 4, 6, 6, 2, 6, 4, 8, 4, 6, 8, 4, 2, 4, 2, 4, 8, 6, 4,
6, 6, 6, 2, 6, 6, 4, 2, 4, 6, 2, 6, 4, 2, 4, 2,10, 2,10, 2,
6, 4, 6, 2, 6, 4, 2, 4, 6, 6, 8, 4, 2, 6,10, 8, 4, 2, 4, 2,
4, 8,10, 6, 2, 4, 8, 6, 6, 4, 2, 4, 6, 2, 6, 4, 6, 2,10, 2,
10, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 6, 6, 4, 6, 8,
4, 2, 4, 2, 4, 8, 6, 4, 8, 4, 6, 2, 6, 6, 4, 2, 4, 6, 8, 4,
2, 4, 2,10, 2,10, 2, 4, 2, 4, 6, 2,10, 2, 4, 6, 8, 6, 4, 2,
6, 4, 6, 8, 4, 6, 2, 4, 8, 6, 4, 6, 2, 4, 6, 2, 6, 6, 4, 6,
6, 2, 6, 6, 4, 2,10, 2,10, 2, 4, 2, 4, 6, 2, 6, 4, 2,10, 6,
2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2,12, 6, 4, 6, 2, 4, 6, 2,
12, 4, 2, 4, 8, 6, 4, 2, 4, 2,10, 2,10, 6, 2, 4, 6, 2, 6, 4,
2, 4, 6, 6, 2, 6, 4, 2,10, 6, 8, 6, 4, 2, 4, 8, 6, 4, 6, 2,
4, 6, 2, 6, 6, 6, 4, 6, 2, 6, 4, 2, 4, 2,10,12, 2, 4, 2,10,
2, 6, 4, 2, 4, 6, 6, 2,10, 2, 6, 4,14, 4, 2, 4, 2, 4, 8, 6,
4, 6, 2, 4, 6, 2, 6, 6, 4, 2, 4, 6, 2, 6, 4, 2, 4,12, 2,12};
#define WHEEL_START (wheel_tab + 5)
#include "wheel-size.h" /* For the definition of WHEEL_SIZE. */
static const unsigned int wheel_tab[] =
{
#include "wheel.h"
};
#define WHEEL_START (wheel_tab + WHEEL_SIZE)
#define WHEEL_END (wheel_tab + (sizeof wheel_tab / sizeof wheel_tab[0]))
/* The name this program was run with. */

View File

@@ -1,5 +1,5 @@
/* GNU fmt -- simple text formatter.
Copyright (C) 1994-2000 Free Software Foundation, Inc.
Copyright (C) 1994-2001 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
@@ -185,7 +185,7 @@ static bool split;
static bool uniform;
/* Prefix minus leading and trailing spaces (default ""). */
static const char *prefix;
static const unsigned char *prefix;
/* User-supplied maximum line width (default WIDTH). The only output
lines
@@ -652,7 +652,7 @@ static int
get_prefix (FILE *f)
{
register int c;
register const char *p;
register const unsigned char *p;
in_column = 0;
c = get_space (f, getc (f));

View File

@@ -29,6 +29,7 @@
#include "system.h"
#include "same.h"
#include "backupfile.h"
#include "dirname.h"
#include "error.h"
#include "quote.h"
@@ -86,7 +87,6 @@ int symlink ();
int isdir ();
int yesno ();
void strip_trailing_slashes ();
/* The name by which the program was run, for error messages. */
char *program_name;

435
src/ls.c
View File

@@ -70,11 +70,6 @@
#include <pwd.h>
#include <getopt.h>
/* Get MB_LEN_MAX. */
#if HAVE_LIMITS_H
# include <limits.h>
#endif
/* Get MB_CUR_MAX. */
#if HAVE_STDLIB_H
# include <stdlib.h>
@@ -112,7 +107,9 @@ int wcwidth ();
#include <fnmatch.h>
#include "argmatch.h"
#include "dirname.h"
#include "error.h"
#include "hard-locale.h"
#include "human.h"
#include "filemode.h"
#include "ls.h"
@@ -191,7 +188,7 @@ int rpl_lstat PARAMS((const char *, struct stat *));
# define lstat(Name, Stat_buf) rpl_lstat(Name, Stat_buf)
#endif
#if defined _DIRENT_HAVE_D_TYPE || defined DTTOIF
#if D_TYPE_IN_DIRENT && defined DTTOIF
# define HAVE_STRUCT_DIRENT_D_TYPE 1
# define DT_INIT(Val) = Val
#else
@@ -231,7 +228,7 @@ struct fileinfo
/* For symbolic link and long listing, st_mode of file linked to, otherwise
zero. */
unsigned int linkmode;
mode_t linkmode;
/* For symbolic link and color printing, 1 if linked-to file
exists, otherwise 0. */
@@ -268,6 +265,8 @@ struct bin_str
time_t time ();
#endif
size_t nstrftime PARAMS ((char *, size_t, char const *,
struct tm const *, int, int));
char *getgroup ();
char *getuser ();
@@ -306,7 +305,7 @@ 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, enum filetype type,
int explicit_arg, const char *dirname));
static void print_color_indicator PARAMS ((const char *name, unsigned int mode,
static void print_color_indicator PARAMS ((const char *name, mode_t mode,
int linkok));
static void put_indicator PARAMS ((const struct bin_str *ind));
static int length_of_file_name_and_frills PARAMS ((const struct fileinfo *f));
@@ -324,11 +323,11 @@ static void print_file_name_and_frills PARAMS ((const struct fileinfo *f));
static void print_horizontal PARAMS ((void));
static void print_long_format PARAMS ((const struct fileinfo *f));
static void print_many_per_line PARAMS ((void));
static void print_name_with_quoting PARAMS ((const char *p, unsigned int mode,
static void print_name_with_quoting PARAMS ((const char *p, mode_t mode,
int linkok,
struct obstack *stack));
static void prep_non_filename_text PARAMS ((void));
static void print_type_indicator PARAMS ((unsigned int mode));
static void print_type_indicator PARAMS ((mode_t mode));
static void print_with_commas PARAMS ((void));
static void queue_directory PARAMS ((const char *name, const char *realname));
static void sort_files PARAMS ((void));
@@ -345,16 +344,13 @@ char *program_name;
`files_index' is the number actually in use. */
/* Address of block containing the files that are described. */
static struct fileinfo *files;
static struct fileinfo *files; /* FIXME: rename this to e.g. cwd_file */
/* Length of block that `files' points to, measured in files. */
static int nfiles;
static int nfiles; /* FIXME: rename this to e.g. cwd_n_alloc */
/* Index of first unused in `files'. */
static int files_index;
static int files_index; /* FIXME: rename this to e.g. cwd_n_used */
/* When nonzero, in a color listing, color each symlink name according to the
type of file it points to. Otherwise, color them according to the `ln'
@@ -402,11 +398,12 @@ static int block_size_size;
horizontal for just names, many per line, sorted horizontally.
with_commas for just names, many per line, separated by commas.
-l, -1, -C, -x and -m control this parameter. */
-l (and other options that imply -l), -1, -C, -x and -m control
this parameter. */
enum format
{
long_format, /* -l */
long_format, /* -l and other options that imply -l */
one_per_line, /* -1 */
many_per_line, /* -C */
horizontal, /* -x */
@@ -415,6 +412,29 @@ enum format
static enum format format;
/* `full-iso' uses full ISO-style dates and times. `iso' uses shorter
ISO-style time stamps. `locale' uses locale-dependent time stamps.
`posix-iso' uses traditional POSIX-locale-style dates where
POSIX requires it, ISO-style dates otherwise. */
enum time_style
{
full_iso_time_style, /* --time-style=full-iso */
iso_time_style, /* --time-style=iso */
locale_time_style, /* --time-style=locale */
posix_iso_time_style /* --time-style=posix-iso (default) */
};
static char const *const time_style_args[] =
{
"full-iso", "iso", "locale", "posix-iso", 0
};
static enum time_style const time_style_types[] =
{
full_iso_time_style, iso_time_style,
locale_time_style, posix_iso_time_style, 0
};
/* Type of time to print or sort by. Controlled by -c and -u. */
enum time_type
@@ -426,10 +446,6 @@ enum time_type
static enum time_type time_type;
/* print the full time, otherwise the standard unix heuristics. */
static int full_time;
/* The file characteristic to sort by. Controlled by -t, -S, -U, -X, -v. */
enum sort_type
@@ -452,9 +468,13 @@ static enum sort_type sort_type;
static int sort_reverse;
/* Nonzero means to NOT display group information. -G */
/* Nonzero means to display owner information. -g turns this off. */
static int inhibit_group;
static int print_owner = 1;
/* Nonzero means to display group information. -G and -o turn this off. */
static int print_group = 1;
/* Nonzero means print the user and group id's as numbers rather
than as names. -n */
@@ -515,6 +535,14 @@ enum color_type
color_if_tty /* 2: --color=tty */
};
enum Dereference_symlink
{
DEREF_UNDEFINED = 1,
DEREF_NEVER,
DEREF_COMMAND_LINE_ARGUMENTS, /* -H */
DEREF_ALWAYS /* -L */
};
enum indicator_no
{
C_LEFT, C_RIGHT, C_END, C_NORM, C_FILE, C_DIR, C_LINK, C_FIFO, C_SOCK,
@@ -568,10 +596,10 @@ static int check_symlink_color;
static int print_inode;
/* Nonzero means when a symbolic link is found, display info on
the file linked to. -L */
/* What to do with symbolic links. Affected by -d, -F, -H, -l (and
other options that imply -l), and -L. */
static int trace_links;
static enum Dereference_symlink dereference;
/* Nonzero means when a directory is found, display info on its
contents. -R */
@@ -652,7 +680,8 @@ static int format_needs_type;
/* strftime formats for non-recent and recent files, respectively, in
-l output. */
static char const *long_time_format[2];
static char const *long_time_format[2] = { N_("%b %e %Y"),
N_("%b %e %H:%M") };
/* The exit status to use if we don't get any fatal errors. */
@@ -665,12 +694,14 @@ enum
BLOCK_SIZE_OPTION = CHAR_MAX + 1,
COLOR_OPTION,
FORMAT_OPTION,
FULL_TIME,
FULL_TIME_OPTION,
INDICATOR_STYLE_OPTION,
QUOTING_STYLE_OPTION,
SHOW_CONTROL_CHARS_OPTION,
SI_OPTION,
SORT_OPTION,
TIME_OPTION
TIME_OPTION,
TIME_STYLE_OPTION
};
static struct option const long_options[] =
@@ -679,7 +710,7 @@ static struct option const long_options[] =
{"escape", no_argument, 0, 'b'},
{"directory", no_argument, 0, 'd'},
{"dired", no_argument, 0, 'D'},
{"full-time", no_argument, 0, FULL_TIME},
{"full-time", no_argument, 0, FULL_TIME_OPTION},
{"human-readable", no_argument, 0, 'h'},
{"inode", no_argument, 0, 'i'},
{"kilobytes", no_argument, 0, 'k'},
@@ -693,7 +724,8 @@ static struct option const long_options[] =
{"ignore-backups", no_argument, 0, 'B'},
{"classify", no_argument, 0, 'F'},
{"file-type", no_argument, 0, 'p'},
{"si", no_argument, 0, 'H'},
{"si", no_argument, 0, SI_OPTION},
{"dereference-command-line", no_argument, 0, 'H'},
{"ignore", required_argument, 0, 'I'},
{"indicator-style", required_argument, 0, INDICATOR_STYLE_OPTION},
{"dereference", no_argument, 0, 'L'},
@@ -706,6 +738,7 @@ static struct option const long_options[] =
{"sort", required_argument, 0, SORT_OPTION},
{"tabsize", required_argument, 0, 'T'},
{"time", required_argument, 0, TIME_OPTION},
{"time-style", required_argument, 0, TIME_STYLE_OPTION},
{"color", optional_argument, 0, COLOR_OPTION},
{"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
{GETOPT_HELP_OPTION_DECL},
@@ -843,7 +876,7 @@ dired_dump_obstack (const char *prefix, struct obstack *os)
pos = (size_t *) obstack_finish (os);
fputs (prefix, stdout);
for (i = 0; i < n_pos; i++)
printf (" %d", (int) pos[i]);
printf (" %lu", (unsigned long) pos[i]);
fputs ("\n", stdout);
}
}
@@ -853,6 +886,7 @@ main (int argc, char **argv)
{
register int i;
register struct pending *thispend;
unsigned int n_files;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -871,9 +905,13 @@ main (int argc, char **argv)
i = decode_switches (argc, argv);
if (print_with_color)
parse_ls_color ();
/* Test print_with_color again, because the call to parse_ls_color
may have just reset it -- e.g., if LS_COLORS is invalid. */
if (print_with_color)
{
parse_ls_color ();
prep_non_filename_text ();
/* Avoid following symbolic links when possible. */
if (color_indicator[C_ORPHAN].string != NULL
@@ -882,9 +920,17 @@ main (int argc, char **argv)
check_symlink_color = 1;
}
if (dereference == DEREF_UNDEFINED)
dereference = ((immediate_dirs
|| indicator_style == classify
|| format == long_format)
? DEREF_NEVER
: DEREF_COMMAND_LINE_ARGUMENTS);
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|| format == long_format
|| trace_links || trace_dirs || print_block_size || print_inode;
|| dereference == DEREF_ALWAYS
|| trace_dirs || print_block_size || print_inode;
format_needs_type = (format_needs_stat == 0
&& (print_with_color || indicator_style != none));
@@ -900,8 +946,10 @@ main (int argc, char **argv)
clear_files ();
if (i < argc)
n_files = argc - i;
if (0 < n_files)
dir_defaulted = 0;
for (; i < argc; i++)
{
gobble_file (argv[i], unknown, 1, "");
@@ -928,7 +976,7 @@ main (int argc, char **argv)
if (pending_dirs)
DIRED_PUTCHAR ('\n');
}
else if (pending_dirs && pending_dirs->next == 0)
else if (n_files <= 1 && pending_dirs && pending_dirs->next == 0)
print_dir_name = 0;
while (pending_dirs)
@@ -969,10 +1017,8 @@ main (int argc, char **argv)
static int
decode_switches (int argc, char **argv)
{
register char const *p;
int c;
int i;
long int tmp_long;
char const *time_style_option = 0;
/* Record whether there is an option specifying sort type. */
int sort_type_specified = 0;
@@ -1015,42 +1061,55 @@ decode_switches (int argc, char **argv)
}
time_type = time_mtime;
full_time = 0;
sort_type = sort_name;
sort_reverse = 0;
numeric_ids = 0;
print_block_size = 0;
indicator_style = none;
print_inode = 0;
trace_links = 0;
dereference = DEREF_UNDEFINED;
trace_dirs = 0;
immediate_dirs = 0;
all_files = 0;
really_all_files = 0;
ignore_patterns = 0;
/* FIXME: Shouldn't we complain on wrong values? */
if ((p = getenv ("QUOTING_STYLE"))
&& 0 <= (i = ARGCASEMATCH (p, quoting_style_args, quoting_style_vals)))
set_quoting_style (NULL, quoting_style_vals[i]);
/* FIXME: put this in a function. */
{
char const *q_style = getenv ("QUOTING_STYLE");
if (q_style)
{
int i = ARGCASEMATCH (q_style, quoting_style_args, quoting_style_vals);
if (0 <= i)
set_quoting_style (NULL, quoting_style_vals[i]);
else
error (0, 0,
_("ignoring invalid value of environment variable QUOTING_STYLE: %s"),
quotearg (q_style));
}
}
human_block_size (getenv ("LS_BLOCK_SIZE"), 0, &output_block_size);
line_length = 80;
if ((p = getenv ("COLUMNS")) && *p)
{
if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK
&& 0 < tmp_long && tmp_long <= INT_MAX)
{
line_length = (int) tmp_long;
}
else
{
error (0, 0,
{
char const *p = getenv ("COLUMNS");
if (p && *p)
{
long int tmp_long;
if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK
&& 0 < tmp_long && tmp_long <= INT_MAX)
{
line_length = (int) tmp_long;
}
else
{
error (0, 0,
_("ignoring invalid width in environment variable COLUMNS: %s"),
quotearg (p));
}
}
quotearg (p));
}
}
}
#ifdef TIOCGWINSZ
{
@@ -1063,21 +1122,25 @@ decode_switches (int argc, char **argv)
/* Using the TABSIZE environment variable is not POSIX-approved.
Ignore it when POSIXLY_CORRECT is set. */
tabsize = 8;
if (!getenv ("POSIXLY_CORRECT") && (p = getenv ("TABSIZE")))
{
if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK
&& 0 <= tmp_long && tmp_long <= INT_MAX)
{
tabsize = (int) tmp_long;
}
else
{
error (0, 0,
_("ignoring invalid tab size in environment variable TABSIZE: %s"),
quotearg (p));
}
}
{
char const *p;
tabsize = 8;
if (!getenv ("POSIXLY_CORRECT") && (p = getenv ("TABSIZE")))
{
long int tmp_long;
if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK
&& 0 <= tmp_long && tmp_long <= INT_MAX)
{
tabsize = (int) tmp_long;
}
else
{
error (0, 0,
_("ignoring invalid tab size in environment variable TABSIZE: %s"),
quotearg (p));
}
}
}
while ((c = getopt_long (argc, argv,
"abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UX1",
@@ -1119,17 +1182,14 @@ decode_switches (int argc, char **argv)
break;
case 'g':
/* No effect. For BSD compatibility. */
format = long_format;
print_owner = 0;
break;
case 'h':
output_block_size = -1024;
break;
case 'H':
output_block_size = -1000;
break;
case 'i':
print_inode = 1;
break;
@@ -1148,11 +1208,12 @@ decode_switches (int argc, char **argv)
case 'n':
numeric_ids = 1;
format = long_format;
break;
case 'o': /* Just like -l, but don't display group info. */
format = long_format;
inhibit_group = 1;
print_group = 0;
break;
case 'p':
@@ -1186,12 +1247,15 @@ decode_switches (int argc, char **argv)
break;
case 'w':
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
error (EXIT_FAILURE, 0, _("invalid line width: %s"),
quotearg (optarg));
line_length = (int) tmp_long;
break;
{
long int tmp_long;
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
error (EXIT_FAILURE, 0, _("invalid line width: %s"),
quotearg (optarg));
line_length = (int) tmp_long;
break;
}
case 'x':
format = horizontal;
@@ -1220,7 +1284,11 @@ decode_switches (int argc, char **argv)
break;
case 'G': /* inhibit display of group info */
inhibit_group = 1;
print_group = 0;
break;
case 'H':
dereference = DEREF_COMMAND_LINE_ARGUMENTS;
break;
case 'I':
@@ -1228,7 +1296,7 @@ decode_switches (int argc, char **argv)
break;
case 'L':
trace_links = 1;
dereference = DEREF_ALWAYS;
break;
case 'N':
@@ -1249,12 +1317,15 @@ decode_switches (int argc, char **argv)
break;
case 'T':
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
error (EXIT_FAILURE, 0, _("invalid tab size: %s"),
quotearg (optarg));
tabsize = (int) tmp_long;
break;
{
long int tmp_long;
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
error (EXIT_FAILURE, 0, _("invalid tab size: %s"),
quotearg (optarg));
tabsize = (int) tmp_long;
break;
}
case 'U':
sort_type = sort_none;
@@ -1267,7 +1338,9 @@ decode_switches (int argc, char **argv)
break;
case '1':
format = one_per_line;
/* -1 has no effect after -l. */
if (format != long_format)
format = one_per_line;
break;
case SORT_OPTION:
@@ -1283,31 +1356,34 @@ decode_switches (int argc, char **argv)
format = XARGMATCH ("--format", optarg, format_args, format_types);
break;
case FULL_TIME:
case FULL_TIME_OPTION:
format = long_format;
full_time = 1;
time_style_option = "full-iso";
break;
case COLOR_OPTION:
if (optarg)
i = XARGMATCH ("--color", optarg, color_args, color_types);
else
/* Using --color with no argument is equivalent to using
--color=always. */
i = color_always;
{
int i;
if (optarg)
i = XARGMATCH ("--color", optarg, color_args, color_types);
else
/* Using --color with no argument is equivalent to using
--color=always. */
i = color_always;
print_with_color = (i == color_always
|| (i == color_if_tty
&& isatty (STDOUT_FILENO)));
print_with_color = (i == color_always
|| (i == color_if_tty
&& isatty (STDOUT_FILENO)));
if (print_with_color)
{
/* Don't use TAB characters in output. Some terminal
emulators can't handle the combination of tabs and
color codes on the same line. */
tabsize = 0;
}
break;
if (print_with_color)
{
/* Don't use TAB characters in output. Some terminal
emulators can't handle the combination of tabs and
color codes on the same line. */
tabsize = 0;
}
break;
}
case INDICATOR_STYLE_OPTION:
indicator_style = XARGMATCH ("--indicator-style", optarg,
@@ -1322,6 +1398,10 @@ decode_switches (int argc, char **argv)
quoting_style_vals));
break;
case TIME_STYLE_OPTION:
time_style_option = optarg;
break;
case SHOW_CONTROL_CHARS_OPTION:
qmark_funny_chars = 0;
break;
@@ -1330,6 +1410,10 @@ decode_switches (int argc, char **argv)
human_block_size (optarg, 1, &output_block_size);
break;
case SI_OPTION:
output_block_size = -1000;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -1343,8 +1427,11 @@ decode_switches (int argc, char **argv)
if (get_quoting_style (filename_quoting_options) == escape_quoting_style)
set_char_quoting (filename_quoting_options, ' ', 1);
if (indicator_style != none)
for (p = "*=@|" + (int) indicator_style - 1; *p; p++)
set_char_quoting (filename_quoting_options, *p, 1);
{
char const *p;
for (p = "*=@|" + (int) indicator_style - 1; *p; p++)
set_char_quoting (filename_quoting_options, *p, 1);
}
dirname_quoting_options = clone_quoting_options (NULL);
set_char_quoting (dirname_quoting_options, ':', 1);
@@ -1365,13 +1452,37 @@ decode_switches (int argc, char **argv)
if (format == long_format)
{
if (full_time)
long_time_format[0] = long_time_format[1] =
dcgettext (NULL, "%a %b %d %H:%M:%S %Y", LC_TIME);
else
if (! time_style_option)
time_style_option = getenv ("TIME_STYLE");
switch (time_style_option
? XARGMATCH ("time style", time_style_option,
time_style_args,
time_style_types)
: posix_iso_time_style)
{
long_time_format[0] = dcgettext (NULL, "%b %e %Y", LC_TIME);
long_time_format[1] = dcgettext (NULL, "%b %e %H:%M", LC_TIME);
case full_iso_time_style:
long_time_format[0] = long_time_format[1] =
"%Y-%m-%d %H:%M:%S.%N %z";
break;
case posix_iso_time_style:
if (! hard_locale (LC_TIME))
break;
/* Fall through. */
case iso_time_style:
long_time_format[0] = "%Y-%m-%d ";
long_time_format[1] = "%m-%d %H:%M";
break;
case locale_time_style:
if (hard_locale (LC_TIME))
{
unsigned int i;
for (i = 0; i < 2; i++)
long_time_format[i] =
dcgettext (NULL, long_time_format[i], LC_TIME);
}
}
}
@@ -1914,7 +2025,7 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
attach (path, dirname, name);
}
val = (trace_links
val = (DEREF_ALWAYS <= dereference + explicit_arg
? stat (path, &files[files_index].stat)
: lstat (path, &files[files_index].stat));
@@ -1933,7 +2044,7 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
#endif
if (S_ISLNK (files[files_index].stat.st_mode)
&& (explicit_arg || format == long_format || check_symlink_color))
&& (format == long_format || check_symlink_color))
{
char *linkpath;
struct stat linkstats;
@@ -1944,9 +2055,7 @@ gobble_file (const char *name, enum filetype type, int explicit_arg,
/* Avoid following symbolic links when possible, ie, when
they won't be traced and when no indicator is needed. */
if (linkpath
&& ((explicit_arg && format != long_format)
|| indicator_style != none
|| check_symlink_color)
&& (indicator_style != none || check_symlink_color)
&& stat (linkpath, &linkstats) == 0)
{
files[files_index].linkok = 1;
@@ -2026,7 +2135,7 @@ static void
get_link_name (const char *filename, struct fileinfo *f)
{
char *linkbuf;
register int linksize;
register ssize_t linksize;
linkbuf = (char *) alloca (PATH_MAX + 2);
/* Some automounters give incorrect st_size for mount points.
@@ -2053,7 +2162,7 @@ static char *
make_link_path (const char *path, const char *linkname)
{
char *linkbuf;
int bufsiz;
size_t bufsiz;
if (linkname == 0)
return 0;
@@ -2375,7 +2484,7 @@ long_time_expected_width (void)
for (;;)
{
*buf = '\1';
len = strftime (buf, bufsize, fmt, tm);
len = nstrftime (buf, bufsize, fmt, tm, 0, 0);
if (len || ! *buf)
break;
buf = alloca (bufsize *= 2);
@@ -2435,12 +2544,12 @@ print_long_format (const struct fileinfo *f)
/* 7 fields that may require LONGEST_HUMAN_READABLE bytes,
1 10-byte mode string,
1 24-byte time string (may be longer in some locales -- see below)
1 35-byte time string (may be longer in some locales -- see below)
or LONGEST_HUMAN_READABLE integer,
9 spaces, one following each of these fields, and
1 trailing NUL byte. */
char init_bigbuf[7 * LONGEST_HUMAN_READABLE + 10
+ (LONGEST_HUMAN_READABLE < 24 ? 24 : LONGEST_HUMAN_READABLE)
+ MAX (35, LONGEST_HUMAN_READABLE)
+ 9 + 1];
char *buf = init_bigbuf;
size_t bufsize = sizeof (init_bigbuf);
@@ -2449,7 +2558,6 @@ print_long_format (const struct fileinfo *f)
time_t when;
int when_ns IF_LINT (= 0);
struct tm *when_local;
char *user_name;
#if HAVE_ST_DM_MODE
/* Cray DMF: look at the file's migrated, not real, status */
@@ -2499,29 +2607,33 @@ print_long_format (const struct fileinfo *f)
/* The last byte of the mode string is the POSIX
"optional alternate access method flag". */
sprintf (p, "%s %3u ", modebuf, (unsigned int) f->stat.st_nlink);
sprintf (p, "%s %3lu ", modebuf, (unsigned long) f->stat.st_nlink);
p += strlen (p);
user_name = (numeric_ids ? NULL : getuser (f->stat.st_uid));
if (user_name)
sprintf (p, "%-8.8s ", user_name);
else
sprintf (p, "%-8u ", (unsigned int) f->stat.st_uid);
p += strlen (p);
if (print_owner)
{
char *user_name = (numeric_ids ? NULL : getuser (f->stat.st_uid));
if (user_name)
sprintf (p, "%-8s ", user_name);
else
sprintf (p, "%-8lu ", (unsigned long) f->stat.st_uid);
p += strlen (p);
}
if (!inhibit_group)
if (print_group)
{
char *group_name = (numeric_ids ? NULL : getgroup (f->stat.st_gid));
if (group_name)
sprintf (p, "%-8.8s ", group_name);
sprintf (p, "%-8s ", group_name);
else
sprintf (p, "%-8u ", (unsigned int) f->stat.st_gid);
sprintf (p, "%-8lu ", (unsigned long) f->stat.st_gid);
p += strlen (p);
}
if (S_ISCHR (f->stat.st_mode) || S_ISBLK (f->stat.st_mode))
sprintf (p, "%3u, %3u ", (unsigned) major (f->stat.st_rdev),
(unsigned) minor (f->stat.st_rdev));
sprintf (p, "%3lu, %3lu ",
(unsigned long) major (f->stat.st_rdev),
(unsigned long) minor (f->stat.st_rdev));
else
{
char hbuf[LONGEST_HUMAN_READABLE + 1];
@@ -2559,7 +2671,8 @@ print_long_format (const struct fileinfo *f)
{
char *newbuf;
*p = '\1';
s = strftime (p, buf + bufsize - p - 1, fmt, when_local);
s = nstrftime (p, buf + bufsize - p - 1, fmt,
when_local, 0, when_ns);
if (s || ! *p)
break;
newbuf = alloca (bufsize *= 2);
@@ -2637,7 +2750,7 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options)
if (qmark_funny_chars)
{
#if HAVE_MBRTOWC && (MB_LEN_MAX > 1)
#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
const char *p = buf;
@@ -2758,7 +2871,7 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options)
else
{
/* Assume unprintable characters have a displayed_width of 1. */
#if HAVE_MBRTOWC && (MB_LEN_MAX > 1)
#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
displayed_width = mbsnwidth (buf, len,
(MBSW_ACCEPT_INVALID
@@ -2774,7 +2887,7 @@ quote_name (FILE *out, const char *name, struct quoting_options const *options)
}
static void
print_name_with_quoting (const char *p, unsigned int mode, int linkok,
print_name_with_quoting (const char *p, mode_t mode, int linkok,
struct obstack *stack)
{
if (print_with_color)
@@ -2831,7 +2944,7 @@ print_file_name_and_frills (const struct fileinfo *f)
}
static void
print_type_indicator (unsigned int mode)
print_type_indicator (mode_t mode)
{
int c;
@@ -2863,7 +2976,7 @@ print_type_indicator (unsigned int mode)
}
static void
print_color_indicator (const char *name, unsigned int mode, int linkok)
print_color_indicator (const char *name, mode_t mode, int linkok)
{
int type = C_FILE;
struct color_ext_type *ext; /* Color extension */
@@ -2948,7 +3061,7 @@ length_of_file_name_and_frills (const struct fileinfo *f)
if (indicator_style != none)
{
unsigned filetype = f->stat.st_mode;
mode_t filetype = f->stat.st_mode;
if (S_ISREG (filetype))
{
@@ -3268,13 +3381,15 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
-F, --classify append indicator (one of */=@|) to entries\n\
--format=WORD across -x, commas -m, horizontal -x, long -l,\n\
single-column -1, verbose -l, vertical -C\n\
--full-time list both full date and full time\n"));
--full-time like -l --time-style=full-iso\n"));
printf (_("\
-g (ignored)\n\
-g -like -l, but do not list owner\n\
-G, --no-group inhibit display of group information\n\
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\n\
-H, --si likewise, but use powers of 1000 not 1024\n\
--si likewise, but use powers of 1000 not 1024\n\
-H same as `--si' for now; soon to change\n\
to conform to POSIX\n\
--indicator-style=WORD append indicator with style WORD to entry names:\n\
none (default), classify (-F), file-type (-p)\n\
-i, --inode print index number of each file\n\
@@ -3282,11 +3397,13 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
-k, --kilobytes like --block-size=1024\n\
-l use a long listing format\n\
-L, --dereference list entries pointed to by symbolic links\n\
-m fill width with a comma separated list of entries\n\
-n, --numeric-uid-gid list numeric UIDs and GIDs instead of names\n\
-m fill width with a comma separated list of entries\n"));
printf (_("\
-n, --numeric-uid-gid like -l, but list numeric UIDs and GIDs\n\
-N, --literal print raw entry names (don't treat e.g. control\n\
characters specially)\n\
-o use long listing format without group info\n\
-o like -l, but do not list group information\n\
-p, --file-type append indicator (one of /=@|) to entries\n\
-q, --hide-control-chars print ? instead of non graphic characters\n\
--show-control-chars show non graphic characters as-is (default\n\
@@ -3306,6 +3423,8 @@ Sort entries alphabetically if none of -cftuSUX nor --sort.\n\
--time=WORD show time as WORD instead of modification time:\n\
atime, access, use, ctime or status; use\n\
specified time as sort key if --sort=time\n\
--time-style=WORD show times using style WORD:\n\
full-iso, iso, locale, posix-iso\n\
-t sort by modification time\n\
-T, --tabsize=COLS assume tab stops at each COLS instead of 8\n\
-u with -lt: sort by, and show, access time\n\

View File

@@ -1,5 +1,5 @@
/* mkdir -- make directories
Copyright (C) 90, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 90, 1995-2001 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
@@ -34,8 +34,6 @@
#define AUTHORS "David MacKenzie"
void strip_trailing_slashes ();
/* The name this program was run with. */
char *program_name;
@@ -162,19 +160,17 @@ main (int argc, char **argv)
{
const char *dir = argv[optind];
int dir_created;
int t_errno;
fail = make_dir (dir, dir, newmode, &dir_created);
t_errno = errno;
if (fail)
{
/* make_dir already gave a diagnostic. */
}
else if (!create_parents && !dir_created && (t_errno = EEXIST))
else if (!create_parents && !dir_created)
{
/* make_dir `succeeds' when DIR already exists.
In that case, mkdir must fail, unless --parents (-p)
was specified. */
error (0, t_errno, _("cannot create directory %s"),
error (0, EEXIST, _("cannot create directory %s"),
quote (dir));
fail = 1;
}

View File

@@ -1,5 +1,5 @@
/* mkfifo -- make fifo's (named pipes)
Copyright (C) 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 90, 91, 1995-2001 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
@@ -125,7 +125,7 @@ main (int argc, char **argv)
{
int fail = mkfifo (argv[optind], newmode);
if (fail)
error (0, errno, _("cannot create fifo `%s'"), quote (argv[optind]));
error (0, errno, _("cannot create fifo %s"), quote (argv[optind]));
/* If the containing directory happens to have a default ACL, chmod
ensures the file mode permission bits are still set as desired. */
@@ -134,7 +134,7 @@ main (int argc, char **argv)
{
fail = chmod (argv[optind], newmode);
if (fail)
error (0, errno, _("cannot set permissions of fifo `%s'"),
error (0, errno, _("cannot set permissions of fifo %s"),
quote (argv[optind]));
}

View File

@@ -1,5 +1,5 @@
/* mknod -- make special files
Copyright (C) 90, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 90, 91, 1995-2001 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
@@ -88,9 +88,7 @@ main (int argc, char **argv)
struct mode_change *change;
const char *specified_mode;
int optc;
int i_major, i_minor;
long int tmp_major, tmp_minor;
char *s;
mode_t node_type;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -151,57 +149,51 @@ main (int argc, char **argv)
#ifndef S_IFBLK
error (4, 0, _("block special files not supported"));
#else
if (argc - optind != 4)
{
error (0, 0, _("\
when creating block special files, major and minor device\n\
numbers must be specified"));
usage (1);
}
s = argv[optind + 2];
if (xstrtol (s, NULL, 0, &tmp_major, NULL) != LONGINT_OK)
error (1, 0, _("invalid major device number %s"), quote (s));
s = argv[optind + 3];
if (xstrtol (s, NULL, 0, &tmp_minor, NULL) != LONGINT_OK)
error (1, 0, _("invalid minor device number %s"), quote (s));
i_major = (int) tmp_major;
i_minor = (int) tmp_minor;
if (mknod (argv[optind], newmode | S_IFBLK, makedev (i_major, i_minor)))
error (1, errno, "%s", quote (argv[optind]));
node_type = S_IFBLK;
#endif
break;
goto block_or_character;
case 'c': /* `character' */
case 'u': /* `unbuffered' */
#ifndef S_IFCHR
error (4, 0, _("character special files not supported"));
#else
node_type = S_IFCHR;
#endif
goto block_or_character;
block_or_character:
if (argc - optind != 4)
{
error (0, 0, _("\
when creating character special files, major and minor device\n\
when creating special files, major and minor device\n\
numbers must be specified"));
usage (1);
}
s = argv[optind + 2];
if (xstrtol (s, NULL, 0, &tmp_major, NULL) != LONGINT_OK)
error (1, 0, _("invalid major device number %s"), quote (s));
{
char const *s_major = argv[optind + 2];
char const *s_minor = argv[optind + 3];
uintmax_t i_major, i_minor;
dev_t device;
s = argv[optind + 3];
if (xstrtol (s, NULL, 0, &tmp_minor, NULL) != LONGINT_OK)
error (1, 0, _("invalid minor device number %s"), quote (s));
if (xstrtoumax (s_major, NULL, 0, &i_major, NULL) != LONGINT_OK
|| i_major != (major_t) i_major)
error (1, 0, _("invalid major device number %s"), quote (s_major));
i_major = (int) tmp_major;
i_minor = (int) tmp_minor;
if (xstrtoumax (s_minor, NULL, 0, &i_minor, NULL) != LONGINT_OK
|| i_minor != (minor_t) i_minor)
error (1, 0, _("invalid minor device number %s"), quote (s_minor));
if (mknod (argv[optind], newmode | S_IFCHR, makedev (i_major, i_minor)))
error (1, errno, "%s", quote (argv[optind]));
device = makedev (i_major, i_minor);
#ifdef NODEV
if (device == NODEV)
error (1, 0, _("invalid device %s %s"), s_major, s_minor);
#endif
if (mknod (argv[optind], newmode | node_type, device) != 0)
error (1, errno, "%s", quote (argv[optind]));
}
break;
case 'p': /* `pipe' */
@@ -230,7 +222,7 @@ major and minor device numbers may not be specified for fifo files"));
if (specified_mode)
{
if (chmod (argv[optind], newmode))
error (0, errno, _("cannot set permissions of `%s'"),
error (0, errno, _("cannot set permissions of %s"),
quote (argv[optind]));
}

View File

@@ -31,6 +31,7 @@
#include "backupfile.h"
#include "copy.h"
#include "cp-hash.h"
#include "dirname.h"
#include "error.h"
#include "path-concat.h"
#include "quote.h"
@@ -144,18 +145,6 @@ is_real_dir (const char *path)
return lstat (path, &stats) == 0 && S_ISDIR (stats.st_mode);
}
static int
strip_trailing_slashes_2 (char *path)
{
char *end_p = path + strlen (path) - 1;
char *slash = end_p;
while (slash > path && *slash == '/')
*slash-- = '\0';
return slash < end_p;
}
/* Move SOURCE onto DEST. Handles cross-filesystem moves.
If SOURCE is a directory, DEST must not exist.
Return 0 if successful, non-zero if an error occurred. */
@@ -245,7 +234,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
/* Remove any trailing slashes. This is necessary if we
took the else branch of movefile. */
strip_trailing_slashes_2 (fs.filename);
strip_trailing_slashes (fs.filename);
status = rm (&fs, 1, &rm_options);
assert (VALID_STATUS (status));
@@ -271,7 +260,7 @@ static int
movefile (char *source, char *dest, int dest_is_dir,
const struct cp_options *x)
{
int dest_had_trailing_slash = strip_trailing_slashes_2 (dest);
int dest_had_trailing_slash = strip_trailing_slashes (dest);
int fail;
/* This code was introduced to handle the ambiguity in the semantics
@@ -282,7 +271,7 @@ movefile (char *source, char *dest, int dest_is_dir,
rename semantics are POSIX and susv2 compliant. */
if (remove_trailing_slashes)
strip_trailing_slashes_2 (source);
strip_trailing_slashes (source);
/* In addition to when DEST is a directory, if DEST has a trailing
slash and neither SOURCE nor DEST is a directory, presume the target
@@ -297,10 +286,7 @@ movefile (char *source, char *dest, int dest_is_dir,
char *src_basename;
char *new_dest;
/* Remove trailing slashes before taking base_name.
Otherwise, base_name ("a/") returns "". */
strip_trailing_slashes_2 (source);
strip_trailing_slashes (source);
src_basename = base_name (source);
new_dest = path_concat (dest, src_basename, NULL);
if (new_dest == NULL)

169
src/pr.c
View File

@@ -1,5 +1,5 @@
/* pr -- convert text files for printing.
Copyright (C) 88, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 88, 91, 1995-2001 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
@@ -150,6 +150,8 @@
-d, --double-space Double space the output.
-D FORMAT, --date-format=FORMAT Use FORMAT for the header date.
-e[CHAR[WIDTH]], --expand-tabs[=CHAR[WIDTH]]
Expand tabs to spaces on input. Optional argument CHAR
is the input TAB character. (Default is TAB). Optional
@@ -162,12 +164,7 @@
-h HEADER, --header=HEADER
Replace the filename in the header with the string HEADER.
Checking and left-hand-side truncation of the length of the
standard and custom header string. A centered header is used.
The format of date and time has been shortened
to yyyy-mm-dd HH:MM to give place to a maximal filename
information.
-h "" now prints a blank line header. -h"" shows an error.
A centered header is used.
-i[CHAR[WIDTH]], --output-tabs[=CHAR[WIDTH]]
Replace spaces with tabs on output. Optional argument
@@ -320,6 +317,7 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "mbswidth.h"
#include "xstrtol.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -506,10 +504,6 @@ static int print_a_FF = FALSE;
to print after it. */
static int print_a_header;
/* (-h) True means we're using the standard header rather than a
customized one specified by the -h flag. */
static int standard_header = TRUE;
/* (-f) True means use formfeeds instead of newlines to separate pages. */
static int use_form_feed = FALSE;
@@ -711,8 +705,15 @@ static int pad_vertically;
/* (-h) String of characters used in place of the filename in the header. */
static char *custom_header;
/* String containing the date, filename or custom header, and "Page ". */
static char *header;
/* (-D) Date format for the header. */
static char const *date_format;
/* Date and file name for the header. */
static char *date_text;
static char const *file_text;
/* Output columns available, not counting the date and file name. */
static int header_width_available;
static int *clump_buff;
@@ -722,10 +723,6 @@ static int *clump_buff;
structure COLUMN. */
static int last_line = FALSE;
/* If nonzero, print a non-variable date and time with the header
-h HEADER using pr test-suite */
static int test_suite;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
@@ -736,12 +733,12 @@ enum
static struct option const long_options[] =
{
{"test", no_argument, &test_suite, 1},
{"pages", required_argument, NULL, PAGES_OPTION},
{"columns", required_argument, NULL, COLUMNS_OPTION},
{"across", no_argument, NULL, 'a'},
{"show-control-chars", no_argument, NULL, 'c'},
{"double-space", no_argument, NULL, 'd'},
{"date-format", required_argument, NULL, 'D'},
{"expand-tabs", optional_argument, NULL, 'e'},
{"form-feed", no_argument, NULL, 'f'},
{"header", required_argument, NULL, 'h'},
@@ -862,7 +859,7 @@ main (int argc, char **argv)
: NULL);
while ((c = getopt_long (argc, argv,
"-0123456789abcde::fFh:i::Jl:mn::N:o:rs::S::tTvw:W:",
"-0123456789abcdD:e::fFh:i::Jl:mn::N:o:rs::S::tTvw:W:",
long_options, NULL))
!= -1)
{
@@ -932,6 +929,9 @@ main (int argc, char **argv)
case 'd':
double_space = TRUE;
break;
case 'D':
date_format = optarg;
break;
case 'e':
if (optarg)
getoptarg (optarg, 'e', &input_tab_char,
@@ -945,7 +945,6 @@ main (int argc, char **argv)
break;
case 'h':
custom_header = optarg;
standard_header = FALSE;
break;
case 'i':
if (optarg)
@@ -1065,6 +1064,11 @@ main (int argc, char **argv)
}
}
if (! date_format)
date_format = (getenv ("POSIXLY_CORRECT")
? dcgettext (NULL, "%b %e %H:%M %Y", LC_TIME)
: "%Y-%m-%d %H:%M");
/* Now we can set a reasonable initial value: */
if (first_page_number == 0)
first_page_number = 1;
@@ -1624,90 +1628,47 @@ print_files (int number_of_files, char **av)
;
}
/* Estimate the number of characters taken up by a short format date and
time: "yy-mm-dd HH:MM" and: "Page NNNN". */
#define CHARS_FOR_DATE_AND_PAGE 25
#define T_BUF_FMT "%Y-%m-%d %H:%M" /* date/time short format */
/* Add `2' because the expansion of %Y occupies 4 bytes, which is two more
than the length of `%Y'. Each of the other formats expand to two bytes. */
#define T_BUF_SIZE (2 + sizeof T_BUF_FMT)
/* This string is exactly the same length as the expansion of T_BUF_FMT. */
#define NO_DATE "-- Date/Time -- "
/* Initialize header information.
If DESC is non-negative, it is a file descriptor open to
FILENAME for reading.
Allocate space for a header string,
Determine the time, insert file name or user-specified string.
Make use of a centered header with left-hand-side truncation marked by
a '*` in front, if necessary. */
FILENAME for reading. */
static void
init_header (char *filename, int desc)
{
char *f = filename;
char *buf;
char initbuf[MAX (256, INT_STRLEN_BOUND (long) + 1)];
struct stat st;
size_t header_buf_size;
struct tm *tm;
if (filename == NULL)
f = "";
/* If parallel files or standard input, use current date. */
if (STREQ (filename, "-"))
desc = -1;
if (desc < 0 || fstat (desc, &st) != 0)
st.st_mtime = time (NULL);
if (header != NULL)
free (header);
/* Allow a space on each side of the the filename-or-header. */
header_buf_size = MAX (chars_per_line, CHARS_FOR_DATE_AND_PAGE + 2) + 1;
header = (char *) xmalloc (header_buf_size);
if (!standard_header && *custom_header == '\0')
*header = '\0'; /* blank line header */
buf = initbuf;
tm = localtime (&st.st_mtime);
if (! tm)
sprintf (buf, "%ld", (long) st.st_mtime);
else
{
int chars_per_middle, lhs_blanks, rhs_blanks;
struct tm *tmptr;
char t_buf[T_BUF_SIZE];
char *header_text;
/* If parallel files or standard input, use current time. */
if (desc < 0 || STREQ (filename, "-") || fstat (desc, &st))
st.st_mtime = time (NULL);
tmptr = localtime (&st.st_mtime);
strftime (t_buf, T_BUF_SIZE, T_BUF_FMT, tmptr);
chars_per_middle = header_buf_size - 1 - CHARS_FOR_DATE_AND_PAGE;
if (chars_per_middle < 3)
size_t bufsize = sizeof initbuf;
for (;;)
{
header_text = ""; /* Nothing free for a heading */
lhs_blanks = 1;
rhs_blanks = 1;
*buf = '\1';
if (strftime (buf, bufsize, date_format, tm) || ! *buf)
break;
buf = alloca (bufsize *= 2);
}
else
{
int chars_free;
header_text = standard_header ? f : custom_header;
chars_free = chars_per_middle - (int) strlen (header_text);
if (chars_free > 1)
{
lhs_blanks = chars_free / 2; /* text not truncated */
rhs_blanks = chars_free - lhs_blanks;
}
else
{ /* lhs truncation */
header_text = header_text - chars_free + 2;
*header_text = '*';
lhs_blanks = 1;
rhs_blanks = 1;
}
}
sprintf (header, _("%s%*s%s%*sPage"), (test_suite ? NO_DATE : t_buf),
lhs_blanks, " ", header_text, rhs_blanks, " ");
}
if (date_text)
free (date_text);
date_text = xstrdup (buf);
file_text = custom_header ? custom_header : desc < 0 ? "" : filename;
header_width_available = (chars_per_line
- mbswidth (date_text, 0)
- mbswidth (file_text, 0));
}
/* Set things up for printing a page
@@ -2404,20 +2365,29 @@ skip_to_page (int page)
static void
print_header (void)
{
char page_text[256 + INT_STRLEN_BOUND (int)];
int available_width;
int lhs_spaces;
int rhs_spaces;
if (!use_form_feed)
fprintf (stdout, "\n\n");
printf ("\n\n");
output_position = 0;
pad_across_to (chars_per_margin);
print_white_space ();
if (!standard_header && *custom_header == '\0')
{
fprintf (stdout, "%s\n\n\n", header);
page_number++;
}
else
fprintf (stdout, "%s%5d\n\n\n", header, page_number++);
/* The translator must ensure that formatting the translation of
"Page %d" does not generate more than (sizeof page_text - 1)
bytes. */
sprintf (page_text, _("Page %d"), page_number++);
available_width = header_width_available - mbswidth (page_text, 0);
available_width = MAX (0, available_width);
lhs_spaces = available_width >> 1;
rhs_spaces = available_width - lhs_spaces;
printf ("%s%*s%s%*s%s\n\n\n",
date_text, lhs_spaces, " ", file_text, rhs_spaces, " ", page_text);
print_a_header = FALSE;
output_position = 0;
@@ -2791,6 +2761,8 @@ Paginate or columnate FILE(s) for printing.\n\
use hat notation (^G) and octal backslash notation\n\
-d, --double-space\n\
double space the output\n\
-D, --date-format=FORMAT\n\
use FORMAT for the header date\n\
-e[CHAR[WIDTH]], --expand-tabs[=CHAR[WIDTH]]\n\
expand input CHARs (TABs) to tab WIDTH (8)\n\
-F, -f, --form-feed\n\
@@ -2801,7 +2773,6 @@ Paginate or columnate FILE(s) for printing.\n\
printf (_("\
-h HEADER, --header=HEADER\n\
use a centered HEADER instead of filename in page header,\n\
with long headers left-hand-side truncation may occur,\n\
-h \"\" prints a blank line, don't use -h\"\"\n\
-i[CHAR[WIDTH]], --output-tabs[=CHAR[WIDTH]]\n\
replace spaces with CHARs (TABs) to tab WIDTH (8)\n\

View File

@@ -34,12 +34,18 @@ typedef enum {false = 0, true = 1} bool;
#include "save-cwd.h"
#include "system.h"
#include "dirname.h"
#include "error.h"
#include "obstack.h"
#include "hash.h"
#include "quote.h"
#include "remove.h"
/* Avoid shadowing warnings because these are functions declared
in dirname.h as well as locals used below. */
#define dir_name rm_dir_name
#define dir_len rm_dir_len
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free

View File

@@ -1,5 +1,5 @@
/* `rm' file deletion utility for GNU.
Copyright (C) 88, 90, 91, 1994-2000 Free Software Foundation, Inc.
Copyright (C) 88, 90, 91, 1994-2001 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
@@ -50,6 +50,7 @@
#include <assert.h>
#include "system.h"
#include "dirname.h"
#include "error.h"
#include "remove.h"
#include "save-cwd.h"
@@ -60,8 +61,6 @@
#define AUTHORS \
"Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering"
void strip_trailing_slashes ();
/* Name this program was run with. */
char *program_name;
@@ -100,7 +99,12 @@ Remove (unlink) the FILE(s).\n\
To remove a file whose name starts with a `-', for example `-foo',\n\
use one of these commands:\n\
%s -- -foo\n\
\n\
%s ./-foo\n\
\n\
Note that if you use rm to remove a file, it is usually possible to recover\n\
the contents of that file. If you want more assurance that the contents are\n\
truly unrecoverable, consider using shred.\n\
"),
program_name, program_name);
puts (_("\nReport bugs to <bug-fileutils@gnu.org>."));

View File

@@ -28,6 +28,7 @@
#include <sys/types.h>
#include "system.h"
#include "dirname.h"
#include "error.h"
#include "quote.h"
@@ -44,8 +45,6 @@
# define ENOTEMPTY 0
#endif
void strip_trailing_slashes ();
/* The name this program was run with. */
char *program_name;

View File

@@ -482,6 +482,29 @@ Delete FILE(s) if --remove (-u) is specified. The default is not to remove\n\
the files because it is common to operate on device files like /dev/hda,\n\
and those files usually should not be removed. When operating on regular\n\
files, most people use the --remove option.\n\
\n\
CAUTION: Note that shred relies on a very important assumption:\n\
that the filesystem overwrites data in place. This is the traditional\n\
way to do things, but many modern filesystem designs do not satisfy this\n\
assumption. The following are examples of filesystems on which shred is\n\
not effective:\n\
\n\
* log-structured or journaled filesystems, such as those supplied with\n\
AIX and Solaris (and JFS, ReiserFS, XFS, etc.)\n\
\n\
* filesystems that write redundant data and carry on even if some writes\n\
fail, such as RAID-based filesystems\n\
\n\
* filesystems that make snapshots, such as Network Appliance's NFS server\n\
\n\
* filesystems that cache in temporary locations, such as NFS\n\
version 3 clients\n\
\n\
* compressed filesystems\n\
\n\
In addition, file system backups and remote mirrors may contain copies\n\
of the file that cannot be removed, and that will allow a shredded file\n\
to be recovered later.\n\
"), DEFAULT_PASSES);
puts (_("\nReport bugs to <bug-fileutils@gnu.org>."));
}

1763
src/sort.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/* su for GNU. Run a shell with substitute user and group IDs.
Copyright (C) 1992-2000 Free Software Foundation, Inc.
Copyright (C) 1992-2000, 2001 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
@@ -83,6 +83,7 @@
#include "system.h"
#include "closeout.h"
#include "dirname.h"
#undef getusershell
@@ -147,8 +148,6 @@ char *getusershell ();
void endusershell ();
void setusershell ();
char *base_name ();
extern char **environ;
static void run_shell (const char *, const char *, char **)

View File

@@ -436,8 +436,6 @@ uid_t getuid ();
setvbuf (Stream, Buffer, Type, Size)
#endif
char *base_name PARAMS ((char const *));
/* Factor out some of the common --help and --version processing code. */
/* These enum values cannot possibly conflict with the option values
@@ -488,6 +486,11 @@ enum
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
/* Upper bound on the string length of an integer converted to string.
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
add 1 for integer division truncation; add 1 more for a minus sign. */
#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)
#ifndef CHAR_MIN
# define CHAR_MIN TYPE_MINIMUM (char)
#endif

View File

@@ -1,5 +1,5 @@
/* tac - concatenate and print files in reverse
Copyright (C) 1988-1991, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 1988-1991, 1995-2001 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
@@ -72,8 +72,6 @@ tac -r -s '.\|
/* The number of bytes per atomic write. */
#define WRITESIZE 8192
char *mktemp ();
/* The name this program was run with. */
char *program_name;
@@ -414,7 +412,7 @@ save_stdin (FILE **g_tmp, char **g_tempfile)
{
static char *template = NULL;
static char *tempdir;
static char *tempfile;
char *tempfile;
FILE *tmp;
ssize_t bytes_read;
int fd;
@@ -427,11 +425,8 @@ save_stdin (FILE **g_tmp, char **g_tempfile)
template = xmalloc (strlen (tempdir) + 11);
}
sprintf (template, "%s/tacXXXXXX", tempdir);
tempfile = mktemp (template);
/* Open temporary file exclusively, to foil a common
denial-of-service attack. */
fd = open (tempfile, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
tempfile = template;
fd = mkstemp (template);
if (fd == -1)
error (EXIT_FAILURE, errno, "%s", tempfile);

View File

@@ -274,7 +274,8 @@ print the last N items in the file. N may have a multiplier suffix:\n\
b for 512, k for 1024, m for 1048576 (1 Meg). A first OPTION of -VALUE\n\
or +VALUE is treated like -n VALUE or -n +VALUE unless VALUE has one of\n\
the [bkm] suffix multipliers, in which case it is treated like -c VALUE\n\
or -c +VALUE.\n\
or -c +VALUE. Warning: a first option of +VALUE is obsolescent, and support\n\
for it will be withdrawn.\n\
\n\
With --follow (-f), tail defaults to following the file descriptor, which\n\
means that even if a tail'ed file is renamed, tail will continue to track\n\
@@ -1252,7 +1253,7 @@ parse_obsolescent_option (int argc, const char *const *argv,
n_string_end = p;
t_count_lines = 1;
if (*p == 'c')
if (*p == 'c' || *p == 'b')
{
t_count_lines = 0;
++p;
@@ -1295,7 +1296,9 @@ parse_obsolescent_option (int argc, const char *const *argv,
strtol_error s_err;
unsigned long int tmp_ulong;
char *end;
s_err = xstrtoul (n_string, &end, 10, &tmp_ulong, NULL);
s_err = xstrtoul (n_string, &end, 10, &tmp_ulong,
*n_string_end == 'b' ? "b" : NULL);
if (s_err == LONGINT_OK && tmp_ulong <= OFF_T_MAX)
*n_units = (off_t) tmp_ulong;
else
@@ -1309,7 +1312,7 @@ parse_obsolescent_option (int argc, const char *const *argv,
error (0, 0,
_("%s: %s is so large that it is not representable"),
n_string_tmp, (count_lines
n_string_tmp, (t_count_lines
? _("number of lines")
: _("number of bytes")));
free (n_string_tmp);

View File

@@ -1,5 +1,5 @@
/* touch -- change modification and access times of files
Copyright (C) 87, 1989-1991, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 87, 1989-1991, 1995-2001 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,7 +217,7 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);
printf (_(" or : %s [-acm] MMDDhhmm[YY] FILE... (obsolescent)\n"),
printf (_(" or: %s [-acm] MMDDhhmm[YY] FILE... (obsolescent)\n"),
program_name);
printf (_("\
Update the access and modification times of each FILE to the current time.\n\

View File

@@ -1,5 +1,5 @@
/* uniq -- remove duplicate lines from a sorted file
Copyright (C) 86, 91, 1995-1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 86, 91, 1995-2001, Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
#include "system.h"
#include "closeout.h"
#include "argmatch.h"
#include "linebuffer.h"
#include "error.h"
#include "xstrtol.h"
@@ -81,11 +82,36 @@ static enum output_mode mode;
/* If nonzero, ignore case when comparing. */
static int ignore_case;
enum delimit_method
{
/* No delimiters output. --all-repeated[=none] */
DM_NONE,
/* Delimiter precedes all groups. --all-repeated=precede */
DM_PRECEDE,
/* Delimit all groups. --all-repeated=separate */
DM_SEPARATE
};
static char const *const delimit_method_string[] =
{
"none", "precede", "separate", 0
};
static enum delimit_method const delimit_method_map[] =
{
DM_NONE, DM_PRECEDE, DM_SEPARATE
};
/* Select whether/how to delimit groups of duplicate lines. */
static enum delimit_method delimit_groups;
static struct option const longopts[] =
{
{"count", no_argument, NULL, 'c'},
{"repeated", no_argument, NULL, 'd'},
{"all-repeated", no_argument, NULL, 'D'},
{"all-repeated", optional_argument, NULL, 'D'},
{"ignore-case", no_argument, NULL, 'i'},
{"unique", no_argument, NULL, 'u'},
{"skip-fields", required_argument, NULL, 'f'},
@@ -114,14 +140,16 @@ standard input), writing to OUTPUT (or standard output).\n\
\n\
-c, --count prefix lines by the number of occurrences\n\
-d, --repeated only print duplicate lines\n\
-D, --all-repeated print all duplicate lines\n\
-D, --all-repeated[=delimit-method] print all duplicate lines\n\
delimit-method={all,minimum,none(default)}\n\
Delimiting is done with blank lines.\n\
-f, --skip-fields=N avoid comparing the first N fields\n\
-i, --ignore-case ignore differences in case when comparing\n\
-s, --skip-chars=N avoid comparing the first N characters\n\
-u, --unique only print unique lines\n\
-w, --check-chars=N compare no more than N characters in lines\n\
-N same as -f N\n\
+N same as -s N\n\
+N same as -s N (obsolescent; will be withdrawn)\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
@@ -276,6 +304,7 @@ check_file (const char *infile, const char *outfile)
char *prevfield;
size_t prevlen;
int match_count = 0;
int first_delimiter = 1;
if (readline (prevline, istream) == 0)
goto closefiles;
@@ -296,6 +325,22 @@ check_file (const char *infile, const char *outfile)
if (match)
++match_count;
if (mode == output_all_repeated && delimit_groups != DM_NONE)
{
if (!match)
{
if (match_count) /* a previous match */
first_delimiter = 0; /* Only used when DM_SEPARATE */
}
else if (match_count == 1)
{
if ((delimit_groups == DM_PRECEDE)
|| (delimit_groups == DM_SEPARATE
&& !first_delimiter))
putc ('\n', ostream);
}
}
if (!match || mode == output_all_repeated)
{
writeline (prevline, ostream, match_count);
@@ -341,6 +386,7 @@ main (int argc, char **argv)
check_chars = 0;
mode = output_all;
countmode = count_none;
delimit_groups = DM_NONE;
while ((optc = getopt_long (argc, argv, "0123456789cdDf:is:uw:", longopts,
NULL)) != -1)
@@ -373,6 +419,12 @@ main (int argc, char **argv)
case 'D':
mode = output_all_repeated;
if (optarg == NULL)
delimit_groups = DM_NONE;
else
delimit_groups = XARGMATCH ("--all-repeated", optarg,
delimit_method_string,
delimit_method_map);
break;
case 'f': /* Like '-#'. */

View File

@@ -1,5 +1,5 @@
/* wc - print the number of bytes, words, and lines in files
Copyright (C) 85, 91, 1995-2000 Free Software Foundation, Inc.
Copyright (C) 85, 91, 1995-2001 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
@@ -126,7 +126,7 @@ Usage: %s [OPTION]... [FILE]...\n\
"),
program_name);
printf (_("\
Print line, word, and byte counts for each FILE, and a total line if\n\
Print newline, word, and byte counts for each FILE, and a total line if\n\
more than one FILE is specified. With no FILE, or when FILE is -,\n\
read standard input.\n\
-c, --bytes print the byte counts\n\
@@ -306,13 +306,13 @@ wc (int fd, const char *file)
bytes_read += prev;
do
{
wchar_t wc;
wchar_t wide_char;
size_t n;
# if SUPPORT_OLD_MBRTOWC
backup_state = state;
# endif
n = mbrtowc (&wc, p, bytes_read, &state);
n = mbrtowc (&wide_char, p, bytes_read, &state);
if (n == (size_t) -2)
{
# if SUPPORT_OLD_MBRTOWC
@@ -326,11 +326,11 @@ wc (int fd, const char *file)
if (!(lines + 1 == last_error_line
&& errno == last_error_errno))
{
char buf[LONGEST_HUMAN_READABLE + 1];
char hr_buf[LONGEST_HUMAN_READABLE + 1];
last_error_line = lines + 1;
last_error_errno = errno;
error (0, errno, "%s:%s", file,
human_readable (lines + 1, buf, 1, 1));
human_readable (lines + 1, hr_buf, 1, 1));
}
p++;
bytes_read--;
@@ -339,13 +339,13 @@ wc (int fd, const char *file)
{
if (n == 0)
{
wc = 0;
wide_char = 0;
n = 1;
}
p += n;
bytes_read -= n;
chars++;
switch (wc)
switch (wide_char)
{
case '\n':
lines++;
@@ -371,9 +371,9 @@ wc (int fd, const char *file)
}
break;
default:
if (iswprint (wc))
if (iswprint (wide_char))
{
int width = wcwidth (wc);
int width = wcwidth (wide_char);
if (width > 0)
linepos += width;
in_word = 1;

582
src/who.c
View File

@@ -1,5 +1,5 @@
/* GNU's who.
Copyright (C) 1992-2000 Free Software Foundation, Inc.
Copyright (C) 1992-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,10 +15,10 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by jla; revised by djm */
/* Written by jla; revised by djm; revised again by mstone */
/* Output format:
name [state] line time [idle] host
name [state] line time [activity] [pid] [comment] [exit]
state: -T
name, line, time: not -q
idle: -u
@@ -38,7 +38,7 @@
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "who"
#define AUTHORS "Joseph Arceneaux and David MacKenzie"
#define AUTHORS "Joseph Arceneaux, David MacKenzie, and Michael Stone"
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 64
@@ -48,6 +48,32 @@
# define S_IWGRP 020
#endif
#ifndef USER_PROCESS
# define USER_PROCESS INT_MAX
#endif
#ifndef RUN_LVL
# define RUN_LVL INT_MAX
#endif
#ifndef INIT_PROCESS
# define INIT_PROCESS INT_MAX
#endif
#ifndef LOGIN_PROCESS
# define LOGIN_PROCESS INT_MAX
#endif
#ifndef DEAD_PROCESS
# define DEAD_PROCESS INT_MAX
#endif
#ifndef NEW_TIME
# define NEW_TIME INT_MAX
#endif
#define IDLESTR_LEN 6
int gethostname ();
char *ttyname ();
char *canon_host ();
@@ -63,6 +89,9 @@ static int do_lookup;
Ignored for `who am i'. */
static int short_list;
/* If nonzero, display only name, line, and time fields */
static int short_output;
/* If nonzero, display the hours:minutes since each user has touched
the keyboard, or "." if within the last minute, or "old" if
not within the last day. */
@@ -75,14 +104,56 @@ static int include_heading;
or a `?' if their tty cannot be statted. */
static int include_mesg;
static struct option const longopts[] =
/* If nonzero, display process termination & exit status */
static int include_exit;
/* If nonzero, display the last boot time */
static int need_boottime;
/* If nonzero, display dead processes */
static int need_deadprocs;
/* If nonzero, display processes waiting for user login */
static int need_login;
/* If nonzero, display processes started by init */
static int need_initspawn;
/* If nonzero, display the last clock change */
static int need_clockchange;
/* If nonzero, display the current runlevel */
static int need_runlevel;
/* If nonzero, display user processes */
static int need_users;
/* If nonzero, display info only for the controlling tty */
static int my_line_only;
/* for long options with no corresponding short option, use enum */
enum
{
LOOKUP_OPTION = CHAR_MAX + 1,
LOGIN_OPTION
};
static struct option const longopts[] = {
{"all", no_argument, NULL, 'a'},
{"boot", no_argument, NULL, 'b'},
{"count", no_argument, NULL, 'q'},
{"idle", no_argument, NULL, 'u'},
{"dead", no_argument, NULL, 'd'},
{"heading", no_argument, NULL, 'H'},
{"lookup", no_argument, NULL, 'l'},
{"idle", no_argument, NULL, 'i'},
{"login", no_argument, NULL, LOGIN_OPTION},
{"lookup", no_argument, NULL, LOOKUP_OPTION},
{"message", no_argument, NULL, 'T'},
{"mesg", no_argument, NULL, 'T'},
{"process", no_argument, NULL, 'p'},
{"runlevel", no_argument, NULL, 'r'},
{"short", no_argument, NULL, 's'},
{"time", no_argument, NULL, 't'},
{"users", no_argument, NULL, 'u'},
{"writable", no_argument, NULL, 'T'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
@@ -90,13 +161,13 @@ static struct option const longopts[] =
};
/* Return a string representing the time between WHEN and the time
that this function is first run. */
that this function is first run.
FIXME: locale? */
static const char *
idle_string (time_t when)
{
static time_t now = 0;
static char idle_hhmm[10];
static char idle_hhmm[IDLESTR_LEN];
time_t seconds_idle;
if (now == 0)
@@ -105,7 +176,7 @@ idle_string (time_t when)
seconds_idle = now - when;
if (seconds_idle < 60) /* One minute. */
return " . ";
if (seconds_idle < (24 * 60 * 60)) /* One day. */
if (seconds_idle < (24 * 60 * 60)) /* One day. */
{
sprintf (idle_hhmm, "%02d:%02d",
(int) (seconds_idle / (60 * 60)),
@@ -115,20 +186,75 @@ idle_string (time_t when)
return _(" old ");
}
/* Display a line of information about UTMP_ENT. */
/* Return a standard time string, "mon dd hh:mm"
FIXME: handle localization */
static const char *
time_string (const STRUCT_UTMP *utmp_ent)
{
/* Don't take the address of UT_TIME_MEMBER directly.
Ulrich Drepper wrote:
``... GNU libc (and perhaps other libcs as well) have extended
utmp file formats which do not use a simple time_t ut_time field.
In glibc, ut_time is a macro which selects for backward compatibility
the tv_sec member of a struct timeval value.'' */
time_t tm = UT_TIME_MEMBER (utmp_ent);
char *ptr = ctime (&tm) + 4;
ptr[12] = '\0';
return ptr;
}
/* Print formatted output line. Uses mostly arbitrary field sizes, probably
will need tweaking if any of the localization stuff is done, or for 64 bit
pids, etc. */
static void
print_entry (const STRUCT_UTMP *utmp_ent)
print_line (const char *user, const char state, const char *line,
const char *time_str, const char *idle, const char *pid,
const char *comment, const char *exitstr)
{
printf ("%-8s", user ? user : " .");
if (include_mesg)
printf (" %c", state);
printf (" %-12s", line);
printf (" %-12s", time_str);
if (include_idle && !short_output)
printf (" %-6s", idle);
if (!short_output)
printf (" %10s", pid);
/* FIXME: it's not really clear whether the following should be in short_output.
a strict reading of SUSv2 would suggest not, but I haven't seen any
implementations that actually work that way... */
printf (" %-8s", comment);
if (include_exit && exitstr && *exitstr)
printf (" %-12s", exitstr);
putchar ('\n');
}
#if HAVE_STRUCT_XTMP_UT_PID
# define PIDSTR_DECL_AND_INIT(Var) \
char Var[INT_STRLEN_BOUND (utmp_ent->ut_pid) + 1]; \
sprintf (Var, "%d", utmp_ent->ut_pid)
#else
# define PIDSTR_DECL_AND_INIT(Var) \
const char *Var = ""
#endif
/* Send properly parsed USER_PROCESS info to print_line */
static void
print_user (const STRUCT_UTMP *utmp_ent)
{
struct stat stats;
time_t last_change;
char mesg;
char idlestr[IDLESTR_LEN];
static char *hoststr;
static int hostlen;
#define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
#define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)
char line[sizeof (utmp_ent->ut_line) + DEV_DIR_LEN + 1];
time_t tm;
PIDSTR_DECL_AND_INIT (pidstr);
/* Copy ut_line into LINE, prepending `/dev/' if ut_line is not
already an absolute pathname. Some system may put the full,
@@ -141,7 +267,8 @@ print_entry (const STRUCT_UTMP *utmp_ent)
else
{
strcpy (line, DEV_DIR_WITH_TRAILING_SLASH);
strncpy (line + DEV_DIR_LEN, utmp_ent->ut_line, sizeof (utmp_ent->ut_line));
strncpy (line + DEV_DIR_LEN, utmp_ent->ut_line,
sizeof (utmp_ent->ut_line));
line[DEV_DIR_LEN + sizeof (utmp_ent->ut_line)] = '\0';
}
@@ -156,27 +283,11 @@ print_entry (const STRUCT_UTMP *utmp_ent)
last_change = 0;
}
printf ("%-8.*s", (int) sizeof (UT_USER (utmp_ent)), UT_USER (utmp_ent));
if (include_mesg)
printf (" %c ", mesg);
printf (" %-8.*s", (int) sizeof (utmp_ent->ut_line), utmp_ent->ut_line);
if (last_change)
sprintf (idlestr, "%.6s", idle_string (last_change));
else
sprintf (idlestr, " ?");
/* Don't take the address of UT_TIME_MEMBER directly.
Ulrich Drepper wrote:
``... GNU libc (and perhaps other libcs as well) have extended
utmp file formats which do not use a simple time_t ut_time field.
In glibc, ut_time is a macro which selects for backward compatibility
the tv_sec member of a struct timeval value.'' */
tm = UT_TIME_MEMBER (utmp_ent);
printf (" %-12.12s", ctime (&tm) + 4);
if (include_idle)
{
if (last_change)
printf (" %s", idle_string (last_change));
else
printf (" . ");
}
#if HAVE_UT_HOST
if (utmp_ent->ut_host[0])
{
@@ -202,31 +313,149 @@ print_entry (const STRUCT_UTMP *utmp_ent)
host = ut_host;
if (display)
printf (" (%s:%s)", host, display);
{
if (hostlen < strlen (host) + strlen (display) + 4)
{
hostlen = strlen (host) + strlen (display) + 4;
hoststr = (char *) realloc (hoststr, hostlen);
}
sprintf (hoststr, "(%s:%s)", host, display);
}
else
printf (" (%s)", host);
{
if (hostlen < strlen (host) + 3)
{
hostlen = strlen (host) + 3;
hoststr = (char *) realloc (hoststr, hostlen);
}
sprintf (hoststr, "(%s)", host);
}
}
else
{
if (hostlen < 1)
{
hostlen = 1;
hoststr = (char *) realloc (hoststr, hostlen);
}
stpcpy (hoststr, "");
}
#endif
putchar ('\n');
print_line (UT_USER (utmp_ent), mesg, utmp_ent->ut_line,
time_string (utmp_ent), idlestr, pidstr,
hoststr ? hoststr : "", "");
}
static void
print_boottime (const STRUCT_UTMP *utmp_ent)
{
print_line ("", ' ', "system boot", time_string (utmp_ent), "", "", "", "");
}
static void
print_deadprocs (const STRUCT_UTMP *utmp_ent)
{
static char *comment, *exitstr;
PIDSTR_DECL_AND_INIT (pidstr);
if (!comment)
comment =
(char *) malloc (sizeof (_("id=")) + sizeof (utmp_ent->ut_id) + 1);
sprintf (comment, "%s%.*s", _("id="), sizeof utmp_ent->ut_id,
utmp_ent->ut_id);
if (!exitstr)
exitstr = (char *) malloc (sizeof (_("term="))
+ INT_STRLEN_BOUND (utmp_ent->ut_exit.e_termination) + 1
+ sizeof (_("exit="))
+ INT_STRLEN_BOUND (utmp_ent->ut_exit.e_exit)
+ 1);
sprintf (exitstr, "%s%d %s%d", _("term="), utmp_ent->ut_exit.e_termination,
_("exit="), utmp_ent->ut_exit.e_exit);
/* FIXME: add idle time? */
print_line ("", ' ', utmp_ent->ut_line,
time_string (utmp_ent), "", pidstr, comment, exitstr);
}
static void
print_login (const STRUCT_UTMP *utmp_ent)
{
static char *comment;
PIDSTR_DECL_AND_INIT (pidstr);
if (!comment)
comment =
(char *) malloc (sizeof (_("id=")) + sizeof (utmp_ent->ut_id) + 1);
sprintf (comment, "%s%s", _("id="), utmp_ent->ut_id);
/* FIXME: add idle time? */
print_line ("LOGIN", ' ', utmp_ent->ut_line,
time_string (utmp_ent), "", pidstr, comment, "");
}
static void
print_initspawn (const STRUCT_UTMP *utmp_ent)
{
static char *comment;
PIDSTR_DECL_AND_INIT (pidstr);
if (!comment)
comment =
(char *) malloc (sizeof (_("id=")) + sizeof (utmp_ent->ut_id) + 1);
sprintf (comment, "%s%s", _("id="), utmp_ent->ut_id);
print_line ("", ' ', utmp_ent->ut_line,
time_string (utmp_ent), "", pidstr, comment, "");
}
static void
print_clockchange (const STRUCT_UTMP *utmp_ent)
{
/* FIXME: handle NEW_TIME & OLD_TIME both */
print_line ("", ' ', _("clock change"),
time_string (utmp_ent), "", "", "", "");
}
static void
print_runlevel (const STRUCT_UTMP *utmp_ent)
{
static char *runlevline, *comment;
/* FIXME: The following is correct for linux, may need help
on other platforms */
#if 1 || HAVE_STRUCT_XTMP_UT_PID
int last = utmp_ent->ut_pid / 256;
int curr = utmp_ent->ut_pid % 256;
#endif
if (!runlevline)
runlevline = (char *) malloc (sizeof (_("run-level")) + 3);
sprintf (runlevline, "%s %c", _("run-level"), curr);
if (!comment)
comment = (char *) malloc (sizeof (_("last=")) + 2);
sprintf (comment, "%s%c", _("last="), (last == 'N') ? 'S' : last);
print_line ("", ' ', runlevline, time_string (utmp_ent),
"", "", comment, "");
return;
}
/* Print the username of each valid entry and the number of valid entries
in UTMP_BUF, which should have N elements. */
static void
list_entries_who (int n, const STRUCT_UTMP *utmp_buf)
{
int entries;
int entries = 0;
entries = 0;
while (n--)
{
if (UT_USER (utmp_buf)[0]
#ifdef USER_PROCESS
&& utmp_buf->ut_type == USER_PROCESS
#endif
)
if (UT_USER (utmp_buf)[0] && UT_TYPE (utmp_buf) == USER_PROCESS)
{
char *trimmed_name;
@@ -244,38 +473,59 @@ list_entries_who (int n, const STRUCT_UTMP *utmp_buf)
static void
print_heading (void)
{
printf ("%-8s ", _("USER"));
if (include_mesg)
printf (_("MESG "));
printf ("%-8s ", _("LINE"));
printf (_("LOGIN-TIME "));
if (include_idle)
printf (_("IDLE "));
printf (_("FROM\n"));
print_line (_("NAME"), ' ', _("LINE"), _("TIME"), _("IDLE"), _("PID"),
_("COMMENT"), _("EXIT"));
}
/* Display UTMP_BUF, which should have N entries. */
static void
scan_entries (int n, const STRUCT_UTMP *utmp_buf)
{
char *ttyname_b IF_LINT ( = NULL);
if (include_heading)
print_heading ();
if (my_line_only)
{
ttyname_b = ttyname (0);
if (!ttyname_b)
return;
if (strncmp (ttyname_b, DEV_DIR_WITH_TRAILING_SLASH, DEV_DIR_LEN) == 0)
ttyname_b += DEV_DIR_LEN; /* Discard /dev/ prefix. */
}
while (n--)
{
if (UT_USER (utmp_buf)[0]
#ifdef USER_PROCESS
&& utmp_buf->ut_type == USER_PROCESS
#endif
)
print_entry (utmp_buf);
if (!my_line_only ||
strncmp (ttyname_b, utmp_buf->ut_line,
sizeof (utmp_buf->ut_line)) == 0)
{
if (need_users && UT_USER (utmp_buf)[0]
&& UT_TYPE (utmp_buf) == USER_PROCESS)
print_user (utmp_buf);
else if (need_runlevel && UT_TYPE (utmp_buf) == RUN_LVL)
print_runlevel (utmp_buf);
else if (need_boottime && UT_TYPE (utmp_buf) == BOOT_TIME)
print_boottime (utmp_buf);
/* I've never seen one of these, so I don't know what it should
look like :^)
FIXME: handle OLD_TIME also, perhaps show the delta? */
else if (need_clockchange && UT_TYPE (utmp_buf) == NEW_TIME)
print_clockchange (utmp_buf);
else if (need_initspawn && UT_TYPE (utmp_buf) == INIT_PROCESS)
print_initspawn (utmp_buf);
else if (need_login && UT_TYPE (utmp_buf) == LOGIN_PROCESS)
print_login (utmp_buf);
else if (need_deadprocs && UT_TYPE (utmp_buf) == DEAD_PROCESS)
print_deadprocs (utmp_buf);
}
utmp_buf++;
}
}
/* Display a list of who is on the system, according to utmp file FILENAME. */
/* Display a list of who is on the system, according to utmp file filename. */
static void
who (const char *filename)
{
@@ -292,67 +542,6 @@ who (const char *filename)
scan_entries (n_users, utmp_buf);
}
/* Search UTMP_CONTENTS, which should have N entries, for
an entry with a `ut_line' field identical to LINE.
Return the first matching entry found, or NULL if there
is no matching entry. */
static const STRUCT_UTMP *
search_entries (int n, const STRUCT_UTMP *utmp_buf, const char *line)
{
while (n--)
{
if (UT_USER (utmp_buf)[0]
#ifdef USER_PROCESS
&& utmp_buf->ut_type == USER_PROCESS
#endif
&& !strncmp (line, utmp_buf->ut_line, sizeof (utmp_buf->ut_line)))
return utmp_buf;
utmp_buf++;
}
return NULL;
}
/* Display the entry in utmp file FILENAME for this tty on standard input,
or nothing if there is no entry for it. */
static void
who_am_i (const char *filename)
{
const STRUCT_UTMP *utmp_entry;
STRUCT_UTMP *utmp_buf;
char hostname[MAXHOSTNAMELEN + 1];
char *tty;
int fail;
int n_users;
if (gethostname (hostname, MAXHOSTNAMELEN + 1))
*hostname = 0;
if (include_heading)
{
printf ("%*s ", (int) strlen (hostname), " ");
print_heading ();
}
tty = ttyname (0);
if (tty == NULL)
return;
tty += 5; /* Remove "/dev/". */
fail = read_utmp (filename, &n_users, &utmp_buf);
if (fail)
error (1, errno, "%s", filename);
utmp_entry = search_entries (n_users, utmp_buf, tty);
if (utmp_entry == NULL)
return;
printf ("%s!", hostname);
print_entry (utmp_entry);
}
void
usage (int status)
{
@@ -364,13 +553,24 @@ usage (int status)
printf (_("Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n"), program_name);
printf (_("\
\n\
-a, --all same as -b -d --login -p -r -t -T -u\n\
-b, --boot time of last system boot\n\
-d, --dead print dead processes\n\
-H, --heading print line of column headings\n\
-i, -u, --idle add user idle time as HOURS:MINUTES, . or old\n\
-i, --idle add idle time as HOURS:MINUTES, . or old\n\
(deprecated, use -u)\n\
--login print system login processes\n\
(equivalent to SUS -l)\n\
-l, --lookup attempt to canonicalize hostnames via DNS\n\
(-l is deprecated, use --lookup)\n\
-m only hostname and user associated with stdin\n\
-p, --process print active processes spawned by init\n\
-q, --count all login names and number of users logged on\n\
-s (ignored)\n\
-r, --runlevel print current runlevel\n\
-s, --short print only name, line, and time (default)\n\
-t, --time print last system clock change\n\
-T, -w, --mesg add user's message status as +, - or ?\n\
-u, --users lists users logged in\n\
--message same as -T\n\
--writable same as -T\n\
--help display this help and exit\n\
@@ -388,7 +588,7 @@ int
main (int argc, char **argv)
{
int optc, longind;
int my_line_only = 0;
int assumptions = 1;
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -397,70 +597,136 @@ main (int argc, char **argv)
atexit (close_stdout);
while ((optc = getopt_long (argc, argv, "ilmqsuwHT", longopts, &longind))
!= -1)
while ((optc = getopt_long (argc, argv, "abdilmpqrstuwHT", longopts,
&longind)) != -1)
{
switch (optc)
{
case 0:
break;
case 'm':
my_line_only = 1;
break;
case 'l':
do_lookup = 1;
break;
case 'q':
short_list = 1;
break;
case 's':
break;
case 'i':
case 'u':
case 'a':
need_boottime = 1;
need_deadprocs = 1;
need_login = 1;
need_initspawn = 1;
need_runlevel = 1;
need_clockchange = 1;
need_users = 1;
include_mesg = 1;
include_idle = 1;
include_exit = 1;
assumptions = 0;
break;
case 'b':
need_boottime = 1;
assumptions = 0;
break;
case 'd':
need_deadprocs = 1;
include_idle = 1;
include_exit = 1;
assumptions = 0;
break;
case 'H':
include_heading = 1;
break;
case 'w':
/* FIXME: This should be -l in a future version */
case LOGIN_OPTION:
need_login = 1;
include_idle = 1;
assumptions = 0;
break;
case 'm':
my_line_only = 1;
break;
case 'p':
need_initspawn = 1;
assumptions = 0;
break;
case 'q':
short_list = 1;
break;
case 'r':
need_runlevel = 1;
include_idle = 1;
assumptions = 0;
break;
case 's':
short_output = 1;
break;
case 't':
need_clockchange = 1;
assumptions = 0;
break;
case 'T':
case 'w':
include_mesg = 1;
break;
case_GETOPT_HELP_CHAR;
case 'i':
error (0, 0,
_("Warning: -i will be removed in a future release; \
use -u instead"));
/* Fall through. */
case 'u':
need_users = 1;
include_idle = 1;
assumptions = 0;
break;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
case 'l':
error (0, 0,
_("Warning: the meaning of '-l' will change in a future\
release to conform to POSIX"));
case LOOKUP_OPTION:
do_lookup = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}
}
if (assumptions)
{
need_users = 1;
short_output = 1;
}
if (include_exit)
{
short_output = 0;
}
switch (argc - optind)
{
case 0: /* who */
if (my_line_only)
who_am_i (UTMP_FILE);
else
who (UTMP_FILE);
who (UTMP_FILE);
break;
case 1: /* who <utmp file> */
if (my_line_only)
who_am_i (argv[optind]);
else
who (argv[optind]);
who (argv[optind]);
break;
case 2: /* who <blurf> <glop> */
who_am_i (UTMP_FILE);
my_line_only = 1;
who (UTMP_FILE);
break;
default: /* lose */

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