Compare commits

...

170 Commits

Author SHA1 Message Date
Jim Meyering
b73a1b844f *** empty log message *** 1998-09-13 14:34:07 +00:00
Jim Meyering
59f3e7dfea . 1998-09-13 00:06:18 +00:00
Jim Meyering
78df00cae0 (remove_cwd_entries): Declare to be static. 1998-09-12 20:27:45 +00:00
Jim Meyering
745cee714a . 1998-09-12 20:20:30 +00:00
Jim Meyering
6d16699fff . 1998-09-12 20:12:55 +00:00
Jim Meyering
ea44cc33ca (oatoi): declare arg to be const 1998-09-09 15:39:13 +00:00
Jim Meyering
4db847ce3c Protoize. 1998-09-09 14:21:16 +00:00
Jim Meyering
231813e179 *** empty log message *** 1998-09-09 13:47:43 +00:00
Jim Meyering
1c3a5c6ff8 *** empty log message *** 1998-09-09 13:44:52 +00:00
Jim Meyering
72e1d14aec . 1998-09-07 18:08:31 +00:00
Jim Meyering
584f4d85cf (show_dev) [!posix_format]: When using --print-type,
let the device path and the file system type share a single (wider)
field if their combined lengths allow it.  From Andries Brouwer.
1998-09-07 18:08:09 +00:00
Jim Meyering
9096ee8e42 . 1998-09-07 17:03:50 +00:00
Jim Meyering
f7c0efdba2 *** empty log message *** 1998-09-07 15:13:59 +00:00
Jim Meyering
a3c0837bc3 Upon failure, suggest how to rerun the test
with longer delay, in case NFS clock skew was the cause of the failure.
Reported by Kaveh Ghazi.
1998-09-07 15:13:48 +00:00
Jim Meyering
834b042b93 *** empty log message *** 1998-09-07 14:13:26 +00:00
Jim Meyering
f0e77e8722 . 1998-09-07 14:11:00 +00:00
Jim Meyering
5c094d2ab2 *** empty log message *** 1998-09-07 14:10:53 +00:00
Jim Meyering
1eb146483f (_create_file): Don't include $$ in temp file name.
(run_tests): Use shorter suffixes for temp file names.
1998-09-07 14:07:23 +00:00
Jim Meyering
1b3c2bbb06 *** empty log message *** 1998-09-07 14:03:09 +00:00
Jim Meyering
edbbc8335c (run_tests): Add simple PRE/POST hooks. 1998-09-07 13:59:43 +00:00
Jim Meyering
48405e4b9c *** empty log message *** 1998-09-07 13:58:26 +00:00
Jim Meyering
f9ae8064f2 (print_dir_name): Put back.
(print_dir): Also print directory name header if print_dir_name is true.
1998-09-07 13:02:46 +00:00
Jim Meyering
9ce9d75ddb add test harness 1998-09-07 03:23:30 +00:00
Jim Meyering
d59ce5651c *** empty log message *** 1998-09-07 02:38:28 +00:00
Jim Meyering
981c203fab *** empty log message *** 1998-09-07 02:36:36 +00:00
Jim Meyering
c0385fb129 Include posixtm.h.
(usage): Correct the description of the format of the
date string argument to -t option.
(main): Update to use rewritten posixtime function.
Reported by Andries Brouwer.
1998-09-07 02:35:31 +00:00
Jim Meyering
ac88b78ef3 *** empty log message *** 1998-09-07 02:24:39 +00:00
Jim Meyering
e01fce9e16 (libfu_a_SOURCES): Change posixtm.y to posixtm.c.
(noinst_HEADERS): Add posixtm.h.
1998-09-07 02:21:19 +00:00
Jim Meyering
164bff8dc0 *** empty log message *** 1998-09-07 02:18:43 +00:00
Jim Meyering
7b7b9007db . 1998-09-07 02:17:55 +00:00
Jim Meyering
c0ad97a781 rewrite from yacc-based version 1998-09-06 22:57:00 +00:00
Jim Meyering
c5a9a5f563 . 1998-09-06 22:55:47 +00:00
Jim Meyering
b363124be4 *** empty log message *** 1998-09-06 22:53:59 +00:00
Jim Meyering
d06d2de67c remove --help-style comment near top 1998-09-06 04:54:39 +00:00
Jim Meyering
82f324a6fd *** empty log message *** 1998-08-30 03:22:07 +00:00
Jim Meyering
84f0e8fc80 . 1998-08-30 03:21:13 +00:00
Jim Meyering
9a27c21fbf (ST_TIME_CMP_NS, ATIME_CMP, CTIME_CMP, MTIME_CMP): Use new ST_MTIM_NSEC macro. 1998-08-30 03:21:02 +00:00
Jim Meyering
1fff978392 . 1998-08-30 03:20:13 +00:00
Jim Meyering
4d87b9a10e (AC_STRUCT_ST_MTIM_NSEC): Renamed from AC_STRUCT_ST_MTIM.
(AC_STRUCT_ST_MTIM_NSEC): Generate name of ns member, instead of just 1 or undef.
Allow for UnixWare 2.1.2 and Solaris 2.6 if in pedantic mode.
1998-08-30 03:16:57 +00:00
Jim Meyering
8fd24dfea9 . 1998-08-30 03:13:01 +00:00
Jim Meyering
9355314687 *** empty log message *** 1998-08-30 03:12:48 +00:00
Jim Meyering
5c6991f93d (longopts): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-30 03:12:22 +00:00
Jim Meyering
9e9d7be706 Don't assume ASCII. 1998-08-30 03:08:21 +00:00
Jim Meyering
49b81671fd (longopts): Don't assume ASCII. 1998-08-30 03:07:52 +00:00
Jim Meyering
38429fe661 (long_options): Replace 12 with CHAR_MAX + 1. 1998-08-30 03:02:53 +00:00
Jim Meyering
ce0ba9e9d9 (long_options): Replace 12 with CHAR_MAX + 1. 1998-08-30 03:02:21 +00:00
Jim Meyering
5b3b5af5b8 (longopts): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-30 03:00:13 +00:00
Jim Meyering
6a2cf8a297 (longopts): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-30 02:58:50 +00:00
Jim Meyering
22fd1ff303 Replace 12 and 13 with CHAR_MAX + 1 and CHAR_MAX + 2 respectively. 1998-08-30 02:57:17 +00:00
Jim Meyering
cb1386ec32 (long_options): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-30 02:55:12 +00:00
Jim Meyering
da2761cc1a (long_options): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-30 02:52:45 +00:00
Jim Meyering
1fc1a65968 (long_options): Use corresponding short-option character
in place of `1', and `NULL' in place of opt_* pointer in initialization.
1998-08-30 02:50:28 +00:00
Jim Meyering
b6f403c606 Don't assume ASCII in getopt arg handling. 1998-08-30 02:33:45 +00:00
Jim Meyering
fa59cde3fe Don't assume ASCII. 1998-08-30 02:33:25 +00:00
Jim Meyering
6f7507be50 (CHAR_MIN, CHAR_MAX):
Renamed from SCHAR_MIN, SCHAR_MAX, since these
macros apply to char, not signed char.
1998-08-30 02:29:35 +00:00
Jim Meyering
33df2fe237 (EXTRA_DIST): Remove Fetish.pm.
TESTS_ENVIRONMENT: Set PROG, not LS.
1998-08-29 18:08:33 +00:00
Jim Meyering
87c3c9c7c6 . 1998-08-29 18:07:01 +00:00
Jim Meyering
e622324cbe *** empty log message *** 1998-08-29 18:06:27 +00:00
Jim Meyering
99114dd25a . 1998-08-29 18:06:10 +00:00
Jim Meyering
e29225aa01 use ENV{PROG}, not ENV{LS} 1998-08-29 18:05:53 +00:00
Jim Meyering
8bfd3a7d70 *** empty log message *** 1998-08-29 18:00:11 +00:00
Jim Meyering
f9abdd4a47 (print_dir_name): Remove global variable.
(print_dir): When trace_dirs is set, always print the directory
name header.
1998-08-29 17:57:34 +00:00
Jim Meyering
c7f7a81276 . 1998-08-26 15:21:00 +00:00
Jim Meyering
f721219e91 *** empty log message *** 1998-08-26 15:18:51 +00:00
Jim Meyering
ded46c159b . 1998-08-26 15:17:59 +00:00
Jim Meyering
9cc2f64ff3 . 1998-08-26 15:17:37 +00:00
Jim Meyering
ae3a2c75ff *** empty log message *** 1998-08-26 15:17:21 +00:00
Jim Meyering
24fa66e128 . 1998-08-26 15:16:47 +00:00
Jim Meyering
b6a0fe5ab0 *** empty log message *** 1998-08-26 15:15:34 +00:00
Jim Meyering
da190d7c06 . 1998-08-26 15:13:56 +00:00
Jim Meyering
ddd448d549 *** empty log message *** 1998-08-26 14:49:41 +00:00
Jim Meyering
71bd321379 . 1998-08-26 14:49:16 +00:00
Jim Meyering
93449adfa4 (dc_parse_stream): Don't segfault when a line
contains only one token.  Reported by Olav Morkrid.
1998-08-26 14:45:16 +00:00
Jim Meyering
21041064bd *** empty log message *** 1998-08-26 14:44:52 +00:00
Jim Meyering
f5443ca875 ptx documentation from Francois 1998-08-25 18:27:58 +00:00
Jim Meyering
eb771bb870 *** empty log message *** 1998-08-16 22:04:19 +00:00
Jim Meyering
43589db615 *** empty log message *** 1998-08-16 15:26:45 +00:00
Jim Meyering
04a86ff23a (PARAMS): Define and use. 1998-08-16 15:26:20 +00:00
Jim Meyering
b32c1f0696 *** empty log message *** 1998-08-16 04:24:38 +00:00
Jim Meyering
94d7c5b58c *** empty log message *** 1998-08-16 04:23:22 +00:00
Jim Meyering
0cb7d9a409 . 1998-08-16 04:22:49 +00:00
Jim Meyering
81bb7f1df3 . 1998-08-16 03:56:27 +00:00
Jim Meyering
7fc3b4cf7d *** empty log message *** 1998-08-16 03:56:15 +00:00
Jim Meyering
cef050f076 Use the new AC_CHECK_TYPE(ssize_t, int) instead of jm_TYPE_SSIZE_T. 1998-08-16 03:55:49 +00:00
Jim Meyering
919b805380 . 1998-08-16 03:55:36 +00:00
Jim Meyering
0e48a577b5 . 1998-08-16 03:53:30 +00:00
Jim Meyering
b0ead8f2d6 *** empty log message *** 1998-08-16 03:20:13 +00:00
Jim Meyering
5614a7d282 (do_move): Fail upon attempt to move a directory into itself.
With prodding from Franois Pinard :-)
1998-08-16 03:09:56 +00:00
Jim Meyering
9c5fb99864 Update for changed behavior of mv. 1998-08-16 03:05:01 +00:00
Jim Meyering
1145211d6b fix typos 1998-08-16 01:44:40 +00:00
Jim Meyering
0c35411a4f *** empty log message *** 1998-08-16 01:38:38 +00:00
Jim Meyering
8bd9ea509e *** empty log message *** 1998-08-16 01:37:02 +00:00
Jim Meyering
bddb246b90 *** empty log message *** 1998-08-16 01:28:55 +00:00
Jim Meyering
e646635206 *** empty log message *** 1998-08-16 00:03:06 +00:00
Jim Meyering
ea9e600f58 *** empty log message *** 1998-08-15 23:59:12 +00:00
Jim Meyering
78c34dee50 *** empty log message *** 1998-08-15 23:58:05 +00:00
Jim Meyering
56949aaebd . 1998-08-15 23:55:00 +00:00
Jim Meyering
18d7d6b082 . 1998-08-15 23:53:59 +00:00
Jim Meyering
0cb75a1a07 *** empty log message *** 1998-08-15 23:53:07 +00:00
Jim Meyering
cc271ce8f3 *** empty log message *** 1998-08-15 23:52:39 +00:00
Jim Meyering
bf73df9811 *** empty log message *** 1998-08-15 23:51:58 +00:00
Jim Meyering
b07a5a108e *** empty log message *** 1998-08-15 23:43:37 +00:00
Jim Meyering
2db8ef7c55 . 1998-08-15 23:29:09 +00:00
Jim Meyering
634ff11428 *** empty log message *** 1998-08-15 22:00:47 +00:00
Jim Meyering
c3b1ab8af1 *** empty log message *** 1998-08-15 21:57:55 +00:00
Jim Meyering
327a21114a *** empty log message *** 1998-08-15 21:57:17 +00:00
Jim Meyering
df91781926 *** empty log message *** 1998-08-15 21:54:10 +00:00
Jim Meyering
4431579378 *** empty log message *** 1998-08-15 21:52:09 +00:00
Jim Meyering
19afd110b3 *** empty log message *** 1998-08-15 21:51:44 +00:00
Jim Meyering
5b02046b20 *** empty log message *** 1998-08-15 21:41:49 +00:00
Jim Meyering
97a44fbdf0 *** empty log message *** 1998-08-15 21:40:06 +00:00
Jim Meyering
49d59ad66b *** empty log message *** 1998-08-15 21:39:17 +00:00
Jim Meyering
c2bbdeab6d *** empty log message *** 1998-08-15 21:38:08 +00:00
Jim Meyering
0d33861999 (copy_internal) [one-file-system]: Do copy mount point
directories (but none of their entries).  This makes
`cp --one-file-system' work the same way tar does.
From Marty Leisner.
1998-08-15 21:16:34 +00:00
Jim Meyering
9c38d004ec *** empty log message *** 1998-08-15 21:09:20 +00:00
Jim Meyering
a302182ac8 *** empty log message *** 1998-08-15 20:33:18 +00:00
Jim Meyering
6b0411ab47 *** empty log message *** 1998-08-15 20:23:33 +00:00
Jim Meyering
65ce4687f5 *** empty log message *** 1998-08-15 20:05:59 +00:00
Jim Meyering
363847ca74 *** empty log message *** 1998-08-15 19:55:35 +00:00
Jim Meyering
d223f01b43 *** empty log message *** 1998-08-15 19:50:54 +00:00
Jim Meyering
3a2b528573 *** empty log message *** 1998-08-15 19:30:32 +00:00
Jim Meyering
14717b8618 *** empty log message *** 1998-08-15 19:23:40 +00:00
Jim Meyering
dc8cd6e39a . 1998-08-15 18:40:41 +00:00
Jim Meyering
6db0107e71 *** empty log message *** 1998-08-15 18:39:45 +00:00
Jim Meyering
a6f74451d3 . 1998-08-15 18:39:38 +00:00
Jim Meyering
8d2302724c . 1998-08-15 18:38:04 +00:00
Jim Meyering
8fa35e89ca . 1998-08-15 18:37:55 +00:00
Jim Meyering
baad4b697c . 1998-08-15 18:37:36 +00:00
Jim Meyering
79d411ceba (qmark_funny_chars): Add comment from Paul eggert. 1998-08-15 16:43:13 +00:00
Jim Meyering
52070d3e4a *** empty log message *** 1998-08-15 14:48:36 +00:00
Jim Meyering
85cc6dedf8 *** empty log message *** 1998-08-15 14:47:50 +00:00
Jim Meyering
e3869f58ad (usage): Reformat a little. 1998-08-15 14:45:19 +00:00
Jim Meyering
c34fd6b4a7 (long_options): Add long names for all options.
(usage): Update help string.
(main): Handle the special options --pages and --columns.
1998-08-15 14:22:01 +00:00
Jim Meyering
63d64851b1 Add braces to suppress warning about ambiguous `else'. 1998-08-15 14:21:00 +00:00
Jim Meyering
d68269bb55 Add braces to suppress warning about ambiguous `else'. 1998-08-15 14:20:16 +00:00
Jim Meyering
2aa62088a3 Work around another bug in Ultrix4.3a's /bin/sh.
Reported by Christian von Roques.
1998-08-15 03:24:56 +00:00
Jim Meyering
f2d4fc8016 Avoid bug in Ultrix4.3a /bin/sh,
not initializing output redirection of : command.
1998-08-15 03:04:06 +00:00
Jim Meyering
bf57f4af46 Avoid bug in Ultrix4.3a /bin/sh,
not initializing output redirection of : command.
1998-08-15 03:03:44 +00:00
Jim Meyering
dc43a7bb60 *** empty log message *** 1998-08-15 03:01:44 +00:00
Jim Meyering
9d7c2d4f7d (read_filesystem_list) [MOUNTED_GETMNT]: Don't infloop on getmnt(2) returning 0.
Christian von Roques
1998-08-15 03:01:13 +00:00
Jim Meyering
888da5c359 *** empty log message *** 1998-08-14 14:14:07 +00:00
Jim Meyering
7b0caffd31 . 1998-08-14 14:09:05 +00:00
Jim Meyering
ed2a7b4e53 . 1998-08-13 18:08:14 +00:00
Jim Meyering
2a6a20ae20 . 1998-08-13 15:25:02 +00:00
Jim Meyering
1dce9a3295 . 1998-08-13 04:54:41 +00:00
Jim Meyering
f6da9983e4 *** empty log message *** 1998-08-13 04:12:33 +00:00
Jim Meyering
e6bc93f49a (DISTFILES): Remove ChangeLog. 1998-08-13 04:06:52 +00:00
Jim Meyering
88c0b8d630 Provide automake-style DESTDIR support.
From Johan Danielsson.
1998-08-13 04:01:46 +00:00
Jim Meyering
669ff7331b . 1998-08-13 02:11:10 +00:00
Jim Meyering
54667de765 . 1998-08-13 02:09:24 +00:00
Jim Meyering
736ea546d9 (noinst_HEADERS): Add filemode.h. 1998-08-13 02:07:54 +00:00
Jim Meyering
461aea548a Include filemode.h. 1998-08-13 02:06:41 +00:00
Jim Meyering
e31691fc1d Protoize. Tsort function definitions and remove prototypes of
static functions.
(mode_string): Remove prototype.
1998-08-13 02:05:56 +00:00
Jim Meyering
8e576e0036 . 1998-08-13 02:05:29 +00:00
Jim Meyering
b9fa91a205 (ftypelet): Add comments for Cray DMF support.
From Johan Danielsson.
1998-08-13 01:52:01 +00:00
Jim Meyering
ff438ee87f *** empty log message *** 1998-08-13 01:48:05 +00:00
Jim Meyering
34cd17408c . 1998-08-13 01:41:38 +00:00
Jim Meyering
138bad1512 add commented `diff -u' command 1998-08-12 17:14:34 +00:00
Jim Meyering
f0604f17d6 *** empty log message *** 1998-08-11 19:10:43 +00:00
Jim Meyering
3fce6c3270 . 1998-08-11 18:53:19 +00:00
Jim Meyering
ba36aa0602 *** empty log message *** 1998-08-11 18:40:21 +00:00
Jim Meyering
58a54666a7 *** empty log message *** 1998-08-11 18:17:01 +00:00
Jim Meyering
40178d3a77 *** empty log message *** 1998-08-11 17:35:57 +00:00
Jim Meyering
b9ca4fe720 . 1998-08-11 17:30:46 +00:00
Jim Meyering
c6afbb198c (rel-check): New rule. 1998-08-11 15:53:55 +00:00
Jim Meyering
c267424d7b automatically generate template for test release announcement 1998-08-11 15:23:01 +00:00
Jim Meyering
053a0e3a8e *** empty log message *** 1998-08-11 13:21:31 +00:00
Jim Meyering
39b1c602aa (usage): Correct description. Reported by John Murphy. 1998-08-11 13:16:24 +00:00
Jim Meyering
2df9108f70 *** empty log message *** 1998-08-11 13:16:11 +00:00
Jim Meyering
a2d2353f0d add comment from glibc version 1998-08-11 01:52:38 +00:00
101 changed files with 5622 additions and 1445 deletions

View File

@@ -42,3 +42,39 @@ my-distcheck: dist
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
THIS_VERSION_REGEXP := $(shell echo $(VERSION)|sed 's/\./\\./g')
# FIXME: this works only for test releases.
PREV_VERSION := $(shell echo $(VERSION)|tr a-z Xa-y)
PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g')
v = Version
url = ftp://alpha.gnu.org/gnu/$(distdir).tar.gz
md5 = $(shell md5sum < $(distdir).tar.gz|sed 's/ -//')
rel-check:
tarz=/tmp/rel-check-tarz-$$$$; \
md5_tmp=/tmp/rel-check-md5-$$$$; \
set -e; \
trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
wget -q --output-document=$$tarz $(url); \
echo "$(md5) -" > $$md5_tmp; \
md5sum -c $$md5_tmp < $$tarz
announcement: NEWS ChangeLog $(distdir).tar.gz
@( \
echo Subject: $(distdir) released; \
echo; \
echo FIXME: put comments here; \
echo; \
echo " $(url)"; \
echo; \
echo "$(md5) $(distdir).tar.gz"; \
echo; \
echo NEWS:; \
sed -n "/$(THIS_VERSION_REGEXP)/,/$(PREV_VERSION_REGEXP)/p" NEWS \
| grep -v '^\['; \
echo; \
echo ChangeLog entries:; \
sed -n "/$v $(THIS_VERSION_REGEXP)/,/$v $(PREV_VERSION_REGEXP)/p" \
ChangeLog | grep -v '\* $v'; \
)

3
THANKS
View File

@@ -3,11 +3,13 @@ The rest of the addresses are still in the ChangeLog.
Achim Blumensath: blume@corona.oche.de
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
Andries Brouwer: Andries.Brouwer@cwi.nl
Arne Henrik Juul: arnej@imf.unit.no
Bauke Jan Douma: bjdouma@xs4all.nl
Bengt Martensson: bengt@mathematik.uni-Bremen.de
Bjorn Helgaas: helgaas@rsn.hp.com
Charles Karney: karney@pppl.gov
Christian von Roques: roques@pond.sub.org
Dirk Lattermann: dlatt@t-online.de
Don Parsons: dparsons@synapse.kent.edu
Eirik Fuller: eirik@netcom.com
@@ -34,6 +36,7 @@ Masami Takikawa: takikawm@CS.ORST.EDU
Matthew S. Levine: mslevine@theory.lcs.mit.edu
Miles Bader: miles@gnu.ai.mit.edu
Noel Cragg: noel@red-bean.com
Olav Morkrid: olav@funcom.com
Peter Eriksson: peter@ifm.liu.se
Paul Eggert: eggert@twinsun.com
Philippe De Muyter: phdm@macqel.be

View File

@@ -35,6 +35,7 @@ START-INFO-DIR-ENTRY
* od: (textutils)od invocation. Dump files in octal, etc.
* paste: (textutils)paste invocation. Merge lines of files.
* pr: (textutils)pr invocation. Paginate or columnate files.
* ptx: (textutils)ptx invocation. Produce permuted indexes.
* sort: (textutils)sort invocation. Sort text files.
* split: (textutils)split invocation. Split into fixed-size pieces.
* sum: (textutils)sum invocation. Print traditional checksum.
@@ -117,12 +118,89 @@ This manual documents version @value{VERSION} of the GNU text utilities.
* Formatting file contents:: fmt pr fold
* Output of parts of files:: head tail split csplit
* Summarizing files:: wc sum cksum md5sum
* Operating on sorted files:: sort uniq comm
* Operating on sorted files:: sort uniq comm ptx
* Operating on fields within a line:: cut paste join
* Operating on characters:: tr expand unexpand
* Opening the software toolbox:: The software tools philosophy.
* Index:: General index.
@detailmenu
--- The Detailed Node Listing ---
Output of entire files
* cat invocation:: Concatenate and write files.
* tac invocation:: Concatenate and write files in reverse.
* nl invocation:: Number lines and write files.
* od invocation:: Write files in octal or other formats.
Formatting file contents
* fmt invocation:: Reformat paragraph text.
* pr invocation:: Paginate or columnate files for printing.
* fold invocation:: Wrap input lines to fit in specified width.
Output of parts of files
* head invocation:: Output the first part of files.
* tail invocation:: Output the last part of files.
* split invocation:: Split a file into fixed-size pieces.
* csplit invocation:: Split a file into context-determined pieces.
Summarizing files
* wc invocation:: Print byte, word, and line counts.
* sum invocation:: Print checksum and block counts.
* cksum invocation:: Print CRC checksum and byte counts.
* md5sum invocation:: Print or check message-digests.
Operating on sorted files
* sort invocation:: Sort text files.
* uniq invocation:: Uniqify files.
* comm invocation:: Compare two sorted files line by line.
* ptx invocation:: Produce a permuted index of file contents.
@code{ptx}: Produce permuted indexes
* General options in ptx:: Options which affect general program behaviour.
* Charset selection in ptx:: Underlying character set considerations.
* Input processing in ptx:: Input fields, contexts, and keyword selection.
* Output formatting in ptx:: Types of output format, and sizing the fields.
* Compatibility in ptx:: The GNU extensions to @code{ptx}
Operating on fields within a line
* cut invocation:: Print selected parts of lines.
* paste invocation:: Merge lines of files.
* join invocation:: Join lines on a common field.
Operating on characters
* tr invocation:: Translate, squeeze, and/or delete characters.
* expand invocation:: Convert tabs to spaces.
* unexpand invocation:: Convert spaces to tabs.
@code{tr}: Translate, squeeze, and/or delete characters
* Character sets:: Specifying sets of characters.
* Translating:: Changing one characters to another.
* Squeezing:: Squeezing repeats and deleting.
* Warnings in tr:: Warning messages.
Opening the software toolbox
* Toolbox introduction:: Toolbox introduction
* I/O redirection:: I/O redirection
* The who command:: The @code{who} command
* The cut command:: The @code{cut} command
* The sort command:: The @code{sort} command
* The uniq command:: The @code{uniq} command
* Putting the tools together:: Putting the tools together
@end detailmenu
@end menu
@end ifinfo
@@ -872,10 +950,12 @@ The program accepts the following options. Also see @ref{Common options}.
@table @samp
@item +@var{first_page}[@var{:last_page}]
@opindex +@var{first_page}[@var{:last_page}]
@item +@var{first_page}[:@var{last_page}]
@itemx --pages=@var{first_page}[:@var{last_page}]
@opindex +@var{first_page}[:@var{last_page}]
@opindex --pages
Begin printing with page @var{first_page} and stop with
@var{last_page}. Missing @samp{:LAST_PAGE} implies end of file. While
@var{last_page}. Missing @samp{:@var{last_page}} implies end of file. While
estimating the number of skipped pages each form feed in the input file
results in a new page. Page counting with and without
@samp{+@var{first_page}} is identical. By default, it starts with the
@@ -883,7 +963,9 @@ first page of input file (not first page printed). Page numbering may be
altered by @samp{-N} option.
@item -@var{column}
@itemx --columns=@var{column}
@opindex -@var{column}
@opindex --columns
@cindex down columns
With each single @var{file}, produce @var{column}-column output and
print columns down. The column width is automatically estimated from
@@ -892,24 +974,32 @@ truncated. The number of lines in the columns on each page will be
balanced. @samp{-@var{column}} may not be used with @samp{-m} option.
@item -a
@itemx --across
@opindex -a
@opindex --across
@cindex across columns
With each single @var{file}, print columns across rather than down.
@var{column} must be greater than one.
@item -c
@itemx --show-control-chars
@opindex -c
@opindex --show-control-chars
Print control characters using hat notation (e.g., @samp{^G}); print
other unprintable characters in octal backslash notation. By default,
unprintable characters are not changed.
@item -d
@itemx --double-space
@opindex -d
@opindex --double-space
@cindex double spacing
Double space the output.
@item -e[@var{in-tabchar}[@var{in-tabwidth}]]
@itemx --expand-tabs[=@var{in-tabchar}[@var{in-tabwidth}]]
@opindex -e
@opindex --expand-tabs
@cindex input tabs
Expand tabs to spaces on input. Optional argument @var{in-tabchar} is
the input tab character (default is @key{TAB}). Second optional
@@ -918,15 +1008,19 @@ is 8).
@item -f
@itemx -F
@itemx --form-feed
@opindex -F
@opindex -f
@opindex --form-feed
Use a form feed instead of newlines to separate output pages. Default
page length of 66 lines is not altered. But the number of lines of text
per page changes from 56 to 63 lines.
@item -h @var{HEADER}
@itemx --header=@var{HEADER}
@opindex -h
@opindex --header
Replace the file name in the header with the centered string
@var{header}. Left-hand-side truncation (marked by a @samp{*}) may occur
if the total header line @samp{yy-mm-dd HH:MM HEADER Page nnnn}
@@ -935,7 +1029,9 @@ header. Don't use @samp{-h""}. A space between the -h option and the
argument is always peremptory.
@item -i[@var{out-tabchar}[@var{out-tabwidth}]]
@itemx --output-tabs[=@var{out-tabchar}[@var{out-tabwidth}]]
@opindex -i
@opindex --output-tabs
@cindex output tabs
Replace spaces with tabs on output. Optional argument @var{out-tabchar}
is the output tab character (default is @key{TAB}). Second optional
@@ -943,7 +1039,9 @@ argument @var{out-tabwidth} is the output tab character's width (default
is 8).
@item -j
@itemx --join-lines
@opindex -j
@opindex --join-lines
Merge lines of full length. Used together with the column options
@samp{-@var{column}}, @samp{-a -@var{column}} or @samp{-m}. Turns off
@samp{-w} line truncation; no column alignment used; may be used with
@@ -951,14 +1049,18 @@ Merge lines of full length. Used together with the column options
@item -l @var{page_length}
@itemx --length=@var{page_length}
@opindex -l
@opindex --length
Set the page length to @var{page_length} (default 66) lines. If
@var{page_length} is less than or equal 10 (and <= 3 with @samp{-f}),
the headers and footers are omitted, and all form feeds set in input
files are eliminated, as if the @samp{-T} option had been given.
@item -m
@itemx --merge
@opindex -m
@opindex --merge
Merge and print all @var{file}s in parallel, one in each column. If a
line is too long to fit in a column, it is truncated (but see
@samp{-j}). @samp{-s[@var{separator}]} may be used. Empty pages in some
@@ -970,7 +1072,9 @@ line numbers. The default header becomes
@item -n[@var{number-separator}[@var{digits}]]
@itemx --number-lines[=@var{number-separator}[@var{digits}]]
@opindex -n
@opindex --number-lines
Precede each column with a line number; with parallel @var{file}s
(@samp{-m}), precede only each line with a line number. Optional argument
@var{number-separator} is the character to print after each number
@@ -980,12 +1084,16 @@ first line of the input file (not with the first line printed, see
@samp{-N}).
@item -N @var{line_number}
@itemx --first-line-number=@var{line_number}
@opindex -N
@opindex --first-line-number
Start line counting with no. @var{line_number} at first line of first
page printed.
@item -o @var{n}
@itemx --indent=@var{n}
@opindex -o
@opindex --indent
@cindex indenting lines
@cindex left margin
Indent each line with @var{n} (default is zero) spaces wide, i.e., set
@@ -993,12 +1101,16 @@ the left margin. The total page width is @var{n} plus the width set
with the @samp{-w} option.
@item -r
@itemx --no-file-warnings
@opindex -r
@opindex --no-file-warnings
Do not print a warning message when an argument @var{file} cannot be
opened. (The exit status will still be nonzero, however.)
@item -s[@var{separator}]
@itemx --separator[=@var{separator}]
@opindex -s
@opindex --separator
Separate columns by a string @var{separator}. Don't use
@samp{-s @var{separator}}, no space between flag and argument. If this
option is omitted altogether, the default is @key{TAB} together with
@@ -1007,7 +1119,9 @@ option is omitted altogether, the default is @key{TAB} together with
does not affect line truncation or column alignment.
@item -t
@itemx --omit-header
@opindex -t
@opindex --omit-header
Do not print the usual header [and footer] on each page, and do not fill
out the bottoms of pages (with blank lines or a form feed). No page
structure is produced, but retain form feeds set in the input files. The
@@ -1017,16 +1131,22 @@ useful together with other options; e.g.: @samp{-t -e4}, expand
Use of @samp{-t} overrides @samp{-h}.
@item -T
@itemx --omit-pagination
@opindex -T
@opindex --omit-pagination
Do not print header [and footer]. In addition eliminate all form feeds
set in the input files.
@item -v
@itemx --show-nonprinting
@opindex -v
@opindex --show-nonprinting
Print unprintable characters in octal backslash notation.
@item -w @var{page_width}
@itemx --width=@var{page_width}
@opindex -w
@opindex --width
Set the page width to @var{page_width} (default 72) characters.
With/without @samp{-w}, header lines are always truncated to
@var{page_width} characters. With @samp{-w}, text lines are truncated,
@@ -1738,6 +1858,7 @@ These commands work with (or produce) sorted files.
* sort invocation:: Sort text files.
* uniq invocation:: Uniqify files.
* comm invocation:: Compare two sorted files line by line.
* ptx invocation::
@end menu
@@ -2188,6 +2309,469 @@ Upon normal completion @code{comm} produces an exit code of zero.
If there is an error it exits with nonzero status.
@node ptx invocation
@section @code{ptx}: Produce permuted indexes
@pindex ptx
@code{ptx} reads a text file and essentially produces a permuted index, with
each keyword in its context. The calling sketch is either one of:
@example
ptx [@var{option} @dots{}] [@var{file} @dots{}]
ptx -G [@var{option} @dots{}] [@var{input} [@var{output}]]
@end example
The @samp{-G} (or its equivalent: @samp{--traditional}) option disables
all GNU extensions and revert to traditional mode, thus introducing some
limitations, and changes several of the program's default option values.
When @samp{-G} is not specified, GNU extensions are always enabled. GNU
extensions to @code{ptx} are documented wherever appropriate in this
document. See @xref{Compatibility in ptx} for an explicit list of them.
Individual options are explained in incoming sections.
When GNU extensions are enabled, there may be zero, one or several
@var{file} after the options. If there is no @var{file}, the program
reads the standard input. If there is one or several @var{file}, they
give the name of input files which are all read in turn, as if all the
input files were concatenated. However, there is a full contextual
break between each file and, when automatic referencing is requested,
file names and line numbers refer to individual text input files. In
all cases, the program produces the permuted index onto the standard
output.
When GNU extensions are @emph{not} enabled, that is, when the program
operates in traditional mode, there may be zero, one or two parameters
besides the options. If there is no parameters, the program reads the
standard input and produces the permuted index onto the standard output.
If there is only one parameter, it names the text @var{input} to be read
instead of the standard input. If two parameters are given, they give
respectively the name of the @var{input} file to read and the name of
the @var{output} file to produce. @emph{Be very careful} to note that,
in this case, the contents of file given by the second parameter is
destroyed. This behaviour is dictated only by System V @code{ptx}
compatibility, because GNU Standards discourage output parameters not
introduced by an option.
Note that for @emph{any} file named as the value of an option or as an
input text file, a single dash @kbd{-} may be used, in which case
standard input is assumed. However, it would not make sense to use this
convention more than once per program invocation.
@menu
* General options in ptx:: Options which affect general program behaviour.
* Charset selection in ptx:: Underlying character set considerations.
* Input processing in ptx:: Input fields, contexts, and keyword selection.
* Output formatting in ptx:: Types of output format, and sizing the fields.
* Compatibility in ptx::
@end menu
@node General options in ptx
@subsection General options
@table @code
@item -C
@itemx --copyright
Prints a short note about the Copyright and copying conditions, then
exit without further processing.
@item -G
@itemx --traditional
As already explained, this option disables all GNU extensions to
@code{ptx} and switch to traditional mode.
@item --help
Prints a short help on standard output, then exit without further
processing.
@item --version
Prints the program verison on standard output, then exit without further
processing.
@end table
@node Charset selection in ptx
@subsection Charset selection
As it is setup now, the program assumes that the input file is coded
using 8-bit ISO 8859-1 code, also known as Latin-1 character set,
@emph{unless} if it is compiled for MS-DOS, in which case it uses the
character set of the IBM-PC. (GNU @code{ptx} is not known to work on
smaller MS-DOS machines anymore.) Compared to 7-bit ASCII, the set of
characters which are letters is then different, this fact alters the
behaviour of regular expression matching. Thus, the default regular
expression for a keyword allows foreign or diacriticized letters.
Keyword sorting, however, is still crude; it obeys the underlying
character set ordering quite blindly.
@table @code
@item -f
@itemx --ignore-case
Fold lower case letters to upper case for sorting.
@end table
@node Input processing in ptx
@subsection Word selection and input processing
@table @code
@item -b @var{file}
@item --break-file=@var{file}
This option is an alternative way to option @code{-W} for describing
which characters make up words. This option introduces the name of a
file which contains a list of characters which can@emph{not} be part of
one word, this file is called the @dfn{Break file}. Any character which
is not part of the Break file is a word constituent. If both options
@code{-b} and @code{-W} are specified, then @code{-W} has precedence and
@code{-b} is ignored.
When GNU extensions are enabled, the only way to avoid newline as a
break character is to write all the break characters in the file with no
newline at all, not even at the end of the file. When GNU extensions
are disabled, spaces, tabs and newlines are always considered as break
characters even if not included in the Break file.
@item -i @var{file}
@itemx --ignore-file=@var{file}
The file associated with this option contains a list of words which will
never be taken as keywords in concordance output. It is called the
@dfn{Ignore file}. The file contains exactly one word in each line; the
end of line separation of words is not subject to the value of the
@code{-S} option.
There is a default Ignore file used by @code{ptx} when this option is
not specified, usually found in @file{/usr/local/lib/eign} if this has
not been changed at installation time. If you want to deactivate the
default Ignore file, specify @code{/dev/null} instead.
@item -o @var{file}
@itemx --only-file=@var{file}
The file associated with this option contains a list of words which will
be retained in concordance output, any word not mentioned in this file
is ignored. The file is called the @dfn{Only file}. The file contains
exactly one word in each line; the end of line separation of words is
not subject to the value of the @code{-S} option.
There is no default for the Only file. In the case there are both an
Only file and an Ignore file, a word will be subject to be a keyword
only if it is given in the Only file and not given in the Ignore file.
@item -r
@itemx --references
On each input line, the leading sequence of non white characters will be
taken to be a reference that has the purpose of identifying this input
line on the produced permuted index. See @xref{Output formatting in ptx} for
more information about reference production. Using this option change
the default value for option @code{-S}.
Using this option, the program does not try very hard to remove
references from contexts in output, but it succeeds in doing so
@emph{when} the context ends exactly at the newline. If option
@code{-r} is used with @code{-S} default value, or when GNU extensions
are disabled, this condition is always met and references are completely
excluded from the output contexts.
@item -S @var{regexp}
@itemx --sentence-regexp=@var{regexp}
This option selects which regular expression will describe the end of a
line or the end of a sentence. In fact, there is other distinction
between end of lines or end of sentences than the effect of this regular
expression, and input line boundaries have no special significance
outside this option. By default, when GNU extensions are enabled and if
@code{-r} option is not used, end of sentences are used. In this
case, the precise @var{regex} is imported from GNU emacs:
@example
[.?!][]\"')@}]*\\($\\|\t\\| \\)[ \t\n]*
@end example
Whenever GNU extensions are disabled or if @code{-r} option is used, end
of lines are used; in this case, the default @var{regexp} is just:
@example
\n
@end example
Using an empty REGEXP is equivalent to completely disabling end of line or end
of sentence recognition. In this case, the whole file is considered to
be a single big line or sentence. The user might want to disallow all
truncation flag generation as well, through option @code{-F ""}.
@xref{Regexps, , Syntax of Regular Expressions, emacs, The GNU Emacs
Manual}.
When the keywords happen to be near the beginning of the input line or
sentence, this often creates an unused area at the beginning of the
output context line; when the keywords happen to be near the end of the
input line or sentence, this often creates an unused area at the end of
the output context line. The program tries to fill those unused areas
by wrapping around context in them; the tail of the input line or
sentence is used to fill the unused area on the left of the output line;
the head of the input line or sentence is used to fill the unused area
on the right of the output line.
As a matter of convenience to the user, many usual backslashed escape
sequences, as found in the C language, are recognized and converted to
the corresponding characters by @code{ptx} itself.
@item -W @var{regexp}
@itemx --word-regexp=@var{regexp}
This option selects which regular expression will describe each keyword.
By default, if GNU extensions are enabled, a word is a sequence of
letters; the @var{regexp} used is @code{\w+}. When GNU extensions are
disabled, a word is by default anything which ends with a space, a tab
or a newline; the @var{regexp} used is @code{[^ \t\n]+}.
An empty REGEXP is equivalent to not using this option, letting the
default dive in. @xref{Regexps, , Syntax of Regular Expressions, emacs,
The GNU Emacs Manual}.
As a matter of convenience to the user, many usual backslashed escape
sequences, as found in the C language, are recognized and converted to
the corresponding characters by @code{ptx} itself.
@end table
@node Output formatting in ptx
@subsection Output formatting
Output format is mainly controlled by @code{-O} and @code{-T} options,
described in the table below. When neither @code{-O} nor @code{-T} is
selected, and if GNU extensions are enabled, the program choose an
output format suited for a dumb terminal. Each keyword occurrence is
output to the center of one line, surrounded by its left and right
contexts. Each field is properly justified, so the concordance output
could readily be observed. As a special feature, if automatic
references are selected by option @code{-A} and are output before the
left context, that is, if option @code{-R} is @emph{not} selected, then
a colon is added after the reference; this nicely interfaces with GNU
Emacs @code{next-error} processing. In this default output format, each
white space character, like newline and tab, is merely changed to
exactly one space, with no special attempt to compress consecutive
spaces. This might change in the future. Except for those white space
characters, every other character of the underlying set of 256
characters is transmitted verbatim.
Output format is further controlled by the following options.
@table @code
@item -g @var{number}
@itemx --gap-size=@var{number}
Select the size of the minimum white gap between the fields on the output
line.
@item -w @var{number}
@itemx --width=@var{number}
Select the output maximum width of each final line. If references are
used, they are included or excluded from the output maximum width
depending on the value of option @code{-R}. If this option is not
selected, that is, when references are output before the left context,
the output maximum width takes into account the maximum length of all
references. If this options is selected, that is, when references are
output after the right context, the output maximum width does not take
into account the space taken by references, nor the gap that precedes
them.
@item -A
@itemx --auto-reference
Select automatic references. Each input line will have an automatic
reference made up of the file name and the line ordinal, with a single
colon between them. However, the file name will be empty when standard
input is being read. If both @code{-A} and @code{-r} are selected, then
the input reference is still read and skipped, but the automatic
reference is used at output time, overriding the input reference.
@item -R
@itemx --right-side-refs
In default output format, when option @code{-R} is not used, any
reference produced by the effect of options @code{-r} or @code{-A} are
given to the far right of output lines, after the right context. In
default output format, when option @code{-R} is specified, references
are rather given to the beginning of each output line, before the left
context. For any other output format, option @code{-R} is almost
ignored, except for the fact that the width of references is @emph{not}
taken into account in total output width given by @code{-w} whenever
@code{-R} is selected.
This option is automatically selected whenever GNU extensions are
disabled.
@item -F @var{string}
@itemx --flac-truncation=@var{string}
This option will request that any truncation in the output be reported
using the string @var{string}. Most output fields theoretically extend
towards the beginning or the end of the current line, or current
sentence, as selected with option @code{-S}. But there is a maximum
allowed output line width, changeable through option @code{-w}, which is
further divided into space for various output fields. When a field has
to be truncated because cannot extend until the beginning or the end of
the current line to fit in the, then a truncation occurs. By default,
the string used is a single slash, as in @code{-F /}.
@var{string} may have more than one character, as in @code{-F ...}.
Also, in the particular case @var{string} is empty (@code{-F ""}),
truncation flagging is disabled, and no truncation marks are appended in
this case.
As a matter of convenience to the user, many usual backslashed escape
sequences, as found in the C language, are recognized and converted to
the corresponding characters by @code{ptx} itself.
@item -M @var{string}
@itemx --macro-name=@var{string}
Select another @var{string} to be used instead of @samp{xx}, while
generating output suitable for @code{nroff}, @code{troff} or @TeX{}.
@item -O
@itemx --format=roff
Choose an output format suitable for @code{nroff} or @code{troff}
processing. Each output line will look like:
@example
.xx "@var{tail}" "@var{before}" "@var{keyword_and_after}" "@var{head}" "@var{ref}"
@end example
so it will be possible to write an @samp{.xx} roff macro to take care of
the output typesetting. This is the default output format when GNU
extensions are disabled. Option @samp{-M} might be used to change
@samp{xx} to another macro name.
In this output format, each non-graphical character, like newline and
tab, is merely changed to exactly one space, with no special attempt to
compress consecutive spaces. Each quote character: @kbd{"} is doubled
so it will be correctly processed by @code{nroff} or @code{troff}.
@item -T
@itemx --format=tex
Choose an output format suitable for @TeX{} processing. Each output
line will look like:
@example
\xx @{@var{tail}@}@{@var{before}@}@{@var{keyword}@}@{@var{after}@}@{@var{head}@}@{@var{ref}@}
@end example
@noindent
so it will be possible to write write a @code{\xx} definition to take
care of the output typesetting. Note that when references are not being
produced, that is, neither option @code{-A} nor option @code{-r} is
selected, the last parameter of each @code{\xx} call is inhibited.
Option @samp{-M} might be used to change @samp{xx} to another macro
name.
In this output format, some special characters, like @kbd{$}, @kbd{%},
@kbd{&}, @kbd{#} and @kbd{_} are automatically protected with a
backslash. Curly brackets @kbd{@{}, @kbd{@}} are also protected with a
backslash, but also enclosed in a pair of dollar signs to force
mathematical mode. The backslash itself produces the sequence
@code{\backslash@{@}}. Circumflex and tilde diacritics produce the
sequence @code{^\@{ @}} and @code{~\@{ @}} respectively. Other
diacriticized characters of the underlying character set produce an
appropriate @TeX{} sequence as far as possible. The other non-graphical
characters, like newline and tab, and all others characters which are
not part of ASCII, are merely changed to exactly one space, with no
special attempt to compress consecutive spaces. Let me know how to
improve this special character processing for @TeX{}.
@end table
@node Compatibility in ptx
@subsection The GNU extensions to @code{ptx}
This version of @code{ptx} contains a few features which do not exist in
System V @code{ptx}. These extra features are suppressed by using the
@samp{-G} command line option, unless overridden by other command line
options. Some GNU extensions cannot be recovered by overriding, so the
simple rule is to avoid @samp{-G} if you care about GNU extensions.
Here are the differences between this program and System V @code{ptx}.
@itemize @bullet
@item
This program can read many input files at once, it always writes the
resulting concordance on standard output. On the other end, System V
@code{ptx} reads only one file and produce the result on standard output
or, if a second @var{file} parameter is given on the command, to that
@var{file}.
Having output parameters not introduced by options is a quite dangerous
practice which GNU avoids as far as possible. So, for using @code{ptx}
portably between GNU and System V, you should pay attention to always
use it with a single input file, and always expect the result on
standard output. You might also want to automatically configure in a
@samp{-G} option to @code{ptx} calls in products using @code{ptx}, if
the configurator finds that the installed @code{ptx} accepts @samp{-G}.
@item
The only options available in System V @code{ptx} are options @samp{-b},
@samp{-f}, @samp{-g}, @samp{-i}, @samp{-o}, @samp{-r}, @samp{-t} and
@samp{-w}. All other options are GNU extensions and are not repeated in
this enumeration. Moreover, some options have a slightly different
meaning when GNU extensions are enabled, as explained below.
@item
By default, concordance output is not formatted for @code{troff} or
@code{nroff}. It is rather formatted for a dumb terminal. @code{troff}
or @code{nroff} output may still be selected through option @code{-O}.
@item
Unless @code{-R} option is used, the maximum reference width is
subtracted from the total output line width. With GNU extensions
disabled, width of references is not taken into account in the output
line width computations.
@item
All 256 characters, even @kbd{NUL}s, are always read and processed from
input file with no adverse effect, even if GNU extensions are disabled.
However, System V @code{ptx} does not accept 8-bit characters, a few
control characters are rejected, and the tilda @kbd{~} is condemned.
@item
Input line length is only limited by available memory, even if GNU
extensions are disabled. However, System V @code{ptx} processes only
the first 200 characters in each line.
@item
The break (non-word) characters default to be every character except all
letters of the underlying character set, diacriticized or not. When GNU
extensions are disabled, the break characters default to space, tab and
newline only.
@item
The program makes better use of output line width. If GNU extensions
are disabled, the program rather tries to imitate System V @code{ptx},
but still, there are some slight disposition glitches this program does
not completely reproduce.
@item
The user can specify both an Ignore file and an Only file. This is not
allowed with System V @code{ptx}.
@end itemize
@node Operating on fields within a line
@chapter Operating on fields within a line
@@ -2845,7 +3429,6 @@ ones, to tabs.
@end table
@c What's GNU?
@c Arnold Robbins
@node Opening the software toolbox
@@ -2856,13 +3439,13 @@ number 2, in the @cite{What's GNU?} column. It was written by Arnold
Robbins.
@menu
* Toolbox introduction::
* I/O redirection::
* The who command::
* The cut command::
* The sort command::
* The uniq command::
* Putting the tools together::
* Toolbox introduction:: Toolbox introduction
* I/O redirection:: I/O redirection
* The who command:: The @code{who} command
* The cut command:: The @code{cut} command
* The sort command:: The @code{sort} command
* The uniq command:: The @code{uniq} command
* Putting the tools together:: Putting the tools together
@end menu

View File

@@ -1,6 +1,5 @@
Makefile
getdate.c
posixtm.c
safe-stat.h
safe-stat.c
safe-lstat.c

View File

@@ -6,7 +6,7 @@ noinst_LIBRARIES = libfu.a
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
@@ -18,10 +18,10 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h fnmatch.h fsusage.h \
error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
BUILT_SOURCES = getdate.c

View File

@@ -95,7 +95,7 @@ noinst_LIBRARIES = libfu.a
INCLUDES = -I.. -I$(srcdir) -I../intl
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
addext.c argmatch.c backupfile.c basename.c \
closeout.c dirname.c exclude.c filemode.c \
full-write.c human.c idcache.c \
@@ -107,13 +107,13 @@ libfu_a_LIBADD = @LIBOBJS@ @ALLOCA@
libfu_a_DEPENDENCIES = $(libfu_a_LIBADD)
noinst_HEADERS = argmatch.h backupfile.h closeout.h \
error.h exclude.h fnmatch.h fsusage.h \
error.h exclude.h filemode.h fnmatch.h fsusage.h \
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
xalloc.h xstrtol.h xstrtoul.h
BUILT_SOURCES = getdate.c posixtm.c
BUILT_SOURCES = getdate.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
@@ -133,7 +133,6 @@ hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o save-cwd$U.o \
savedir$U.o stripslash$U.o userspec$U.o xgetcwd$U.o xmalloc$U.o \
xstrdup$U.o xstrtol$U.o xstrtoul$U.o yesno$U.o
AR = ar
YLWRAP = $(srcdir)/ylwrap
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
@@ -143,9 +142,9 @@ DIST_COMMON = Makefile.am Makefile.in TODO alloca.c chown.c error.c \
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getgroups.c getline.c group-member.c lchown.c lstat.c \
malloc.c memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
obstack.c obstack.h posixtm.c realloc.c regex.c rename.c rmdir.c \
rpmatch.c stat.c stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c \
strstr.c strtol.c strtoul.c strverscmp.c utime.c ylwrap
obstack.c obstack.h realloc.c regex.c rename.c rmdir.c rpmatch.c stat.c \
stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c \
strtoul.c strverscmp.c utime.c ylwrap
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -162,15 +161,14 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm \
.deps/posixtm.P .deps/quotearg.P .deps/realloc.P .deps/regex.P \
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P \
.deps/save-cwd.P .deps/savedir.P .deps/stat.P .deps/stpcpy.P \
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
.deps/strverscmp.P .deps/userspec.P .deps/utime.P .deps/xgetcwd.P \
.deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P \
.deps/yesno.P
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
.deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P .deps/save-cwd.P \
.deps/savedir.P .deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P \
.deps/strdup.P .deps/strftime.P .deps/stripslash.P .deps/strndup.P \
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/strverscmp.P \
.deps/userspec.P .deps/utime.P .deps/xgetcwd.P .deps/xmalloc.P \
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(libfu_a_OBJECTS)
@@ -231,8 +229,10 @@ libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
$(RANLIB) libfu.a
.y.c:
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
posixtm.h: posixtm.c
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
getdate.h: getdate.c
addext_.c: addext.c $(ANSI2KNR)

63
lib/bumpalloc.h Normal file
View File

@@ -0,0 +1,63 @@
/* BUMP_ALLOC macro - increase table allocation by one element.
Copyright (C) 1990, 1991, 1993, 1998 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1990.
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. */
/*-------------------------------------------------------------------------.
| Bump the allocation of the array pointed to by TABLE whenever required. |
| The table already has already COUNT elements in it, this macro ensure it |
| has enough space to accommodate at least one more element. Space is |
| allocated (2 ^ EXPONENT) elements at a time. Each element of the array |
| is of type TYPE. |
`-------------------------------------------------------------------------*/
/* Routines `xmalloc' and `xrealloc' are called to do the actual memory
management. This implies that the program will abort with an `Memory
exhausted!' error if any problem arise.
To work correctly, at least EXPONENT and TYPE should always be the
same for all uses of this macro for any given TABLE. A secure way to
achieve this is to never use this macro directly, but use it to define
other macros, which would then be TABLE-specific.
The first time through, COUNT is usually zero. Note that COUNT is not
updated by this macro, but it should be update elsewhere, later. This
is convenient, because it allows TABLE[COUNT] to refer to the new
element at the end. Once its construction is completed, COUNT++ will
record it in the table. Calling this macro several times in a row
without updating COUNT is a bad thing to do. */
#define BUMP_ALLOC(Table, Count, Exponent, Type) \
BUMP_ALLOC_WITH_SIZE ((Table), (Count), (Exponent), Type, sizeof (Type))
/* In cases `sizeof TYPE' would not always yield the correct value for
the size of each element entry, this macro accepts a supplementary
SIZE argument. The EXPONENT, TYPE and SIZE parameters should still
have the same value for all macro calls related to a specific TABLE. */
#define BUMP_ALLOC_WITH_SIZE(Table, Count, Exponent, Type, Size) \
do \
{ \
if (((Count) & (~(~0 << (Exponent)))) == 0) \
{ \
if ((Count) == 0) \
(Table) = (Type *) xmalloc ((1 << (Exponent)) * (Size)); \
else \
(Table) = (Type *) \
xrealloc ((Table), ((Count) + (1 << (Exponent))) * (Size)); \
} \
} \
while (0)

148
lib/diacrit.c Normal file
View File

@@ -0,0 +1,148 @@
/* Diacritics processing for a few character codes.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
All this file is a temporary hack, waiting for locales in GNU.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "diacrit.h"
/* ISO 8859-1 Latin-1 code is used as the underlying character set. If
MSDOS is defined, IBM-PC's character set code is used instead. */
/*--------------------------------------------------------------------.
| For each alphabetic character, returns what it would be without its |
| possible diacritic symbol. |
`--------------------------------------------------------------------*/
const char diacrit_base[256] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', 0, 0, 0, 0, 0,
0, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', 0, 0, 0, 0, 0,
#ifdef MSDOS
'C', 'u', 'e', 'a', 'a', 'a', 'a', 'c',
'e', 'e', 'e', 'i', 'i', 'i', 'A', 'A',
'E', 'e', 'E', 'o', 'o', 'o', 'u', 'u',
'y', 'O', 'U', 0, 0, 0, 0, 0,
'a', 'i', 'o', 'u', 'n', 'N', 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
#else /* not MSDOS */
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
'A', 'A', 'A', 'A', 'A', 'A', 'A', 'C',
'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I',
0, 'N', 'O', 'O', 'O', 'O', 'O', 0,
'O', 'U', 'U', 'U', 'U', 'Y', 0, 0,
'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c',
'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
0, 'n', 'o', 'o', 'o', 'o', 'o', 0,
'o', 'u', 'u', 'u', 'u', 'y', 0, 'y',
#endif /* not MSDOS */
};
/*------------------------------------------------------------------------.
| For each alphabetic character, returns a code of what its diacritic is, |
| according to the following codes: 1 (eE) over aA for latin diphtongs; 2 |
| (') acute accent; 3 (`) grave accent; 4 (^) circumflex accent; 5 (") |
| umlaut or diaraesis; 6 (~) tilda; 7 (,) cedilla; 8 (o) covering degree |
| symbol; 9 (|) slashed character. |
`------------------------------------------------------------------------*/
const char diacrit_diac[256] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 0,
3, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 6, 0,
#ifdef MSDOS
7, 5, 2, 4, 5, 3, 8, 7,
4, 5, 3, 5, 4, 3, 5, 8,
2, 1, 1, 4, 5, 3, 4, 3,
5, 5, 5, 0, 0, 0, 0, 0,
2, 2, 2, 2, 6, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
#else /* not MSDOS */
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
3, 2, 4, 6, 5, 8, 1, 7,
3, 2, 4, 5, 3, 2, 4, 5,
0, 6, 3, 2, 4, 6, 5, 0,
9, 3, 2, 4, 5, 2, 0, 0,
3, 2, 4, 6, 5, 8, 1, 7,
3, 2, 4, 5, 3, 2, 4, 5,
0, 6, 3, 2, 4, 6, 5, 0,
9, 3, 2, 4, 5, 2, 0, 0,
#endif /* not MSDOS */
};

16
lib/diacrit.h Normal file
View File

@@ -0,0 +1,16 @@
/* Diacritics processing for a few character codes.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
All this file is a temporary hack, waiting for locales in GNU.
*/
extern const char diacrit_base[]; /* characters without diacritics */
extern const char diacrit_diac[]; /* diacritic code for each character */
/* Returns CHAR without its diacritic. CHAR is known to be alphabetic. */
#define tobase(Char) (diacrit_base[(unsigned char) (Char)])
/* Returns a diacritic code for CHAR. CHAR is known to be alphabetic. */
#define todiac(Char) (diacrit_diac[(unsigned char) (Char)])

View File

@@ -22,6 +22,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "filemode.h"
#if !S_IRUSR
# if S_IREAD
# define S_IRUSR S_IREAD
@@ -88,10 +90,132 @@
# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
void mode_string ();
static char ftypelet ();
static void rwx ();
static void setst ();
/* Look at read, write, and execute bits in BITS and set
flags in CHARS accordingly. */
static void
rwx (short unsigned int bits, char *chars)
{
chars[0] = (bits & S_IRUSR) ? 'r' : '-';
chars[1] = (bits & S_IWUSR) ? 'w' : '-';
chars[2] = (bits & S_IXUSR) ? 'x' : '-';
}
/* Set the 's' and 't' flags in file attributes string CHARS,
according to the file mode BITS. */
static void
setst (short unsigned int bits, char *chars)
{
#ifdef S_ISUID
if (bits & S_ISUID)
{
if (chars[3] != 'x')
/* Set-uid, but not executable by owner. */
chars[3] = 'S';
else
chars[3] = 's';
}
#endif
#ifdef S_ISGID
if (bits & S_ISGID)
{
if (chars[6] != 'x')
/* Set-gid, but not executable by group. */
chars[6] = 'S';
else
chars[6] = 's';
}
#endif
#ifdef S_ISVTX
if (bits & S_ISVTX)
{
if (chars[9] != 'x')
/* Sticky, but not executable by others. */
chars[9] = 'T';
else
chars[9] = 't';
}
#endif
}
/* Return a character indicating the type of file described by
file mode BITS:
'd' for directories
'b' for block special files
'c' for character special files
'm' for multiplexor files
'M' for an off-line (regular) file
'l' for symbolic links
's' for sockets
'p' for fifos
'-' for regular files
'?' for any other file type. */
static char
ftypelet (long int bits)
{
#ifdef S_ISBLK
if (S_ISBLK (bits))
return 'b';
#endif
if (S_ISCHR (bits))
return 'c';
if (S_ISDIR (bits))
return 'd';
if (S_ISREG (bits))
return '-';
#ifdef S_ISFIFO
if (S_ISFIFO (bits))
return 'p';
#endif
#ifdef S_ISLNK
if (S_ISLNK (bits))
return 'l';
#endif
#ifdef S_ISSOCK
if (S_ISSOCK (bits))
return 's';
#endif
#ifdef S_ISMPC
if (S_ISMPC (bits))
return 'm';
#endif
#ifdef S_ISNWK
if (S_ISNWK (bits))
return 'n';
#endif
/* The following two tests are for Cray DMF (Data Migration
Facility), which is a HSM file system. A migrated file has a
`st_dm_mode' that is different from the normal `st_mode', so any
tests for migrated files should use the former. */
#ifdef S_ISOFD
if (S_ISOFD (bits))
/* off line, with data */
return 'M';
#endif
#ifdef S_ISOFL
/* off line, with no data */
if (S_ISOFL (bits))
return 'M';
#endif
return '?';
}
/* Like filemodestring, but only the relevant part of the `struct stat'
is given as an argument. */
void
mode_string (short unsigned int mode, char *str)
{
str[0] = ftypelet ((long) mode);
rwx ((mode & 0700) << 0, &str[1]);
rwx ((mode & 0070) << 3, &str[4]);
rwx ((mode & 0007) << 6, &str[7]);
setst (mode, str);
}
/* filemodestring - fill in string STR with an ls-style ASCII
representation of the st_mode field of file stats block STATP.
@@ -130,137 +254,7 @@ static void setst ();
'T' if the file is sticky but not executable. */
void
filemodestring (statp, str)
struct stat *statp;
char *str;
filemodestring (struct stat *statp, char *str)
{
mode_string (statp->st_mode, str);
}
/* Like filemodestring, but only the relevant part of the `struct stat'
is given as an argument. */
void
mode_string (mode, str)
unsigned short mode;
char *str;
{
str[0] = ftypelet ((long) mode);
rwx ((mode & 0700) << 0, &str[1]);
rwx ((mode & 0070) << 3, &str[4]);
rwx ((mode & 0007) << 6, &str[7]);
setst (mode, str);
}
/* Return a character indicating the type of file described by
file mode BITS:
'd' for directories
'b' for block special files
'c' for character special files
'm' for multiplexor files
'l' for symbolic links
's' for sockets
'p' for fifos
'-' for regular files
'?' for any other file type. */
static char
ftypelet (bits)
long bits;
{
#ifdef S_ISBLK
if (S_ISBLK (bits))
return 'b';
#endif
if (S_ISCHR (bits))
return 'c';
if (S_ISDIR (bits))
return 'd';
if (S_ISREG (bits))
return '-';
#ifdef S_ISFIFO
if (S_ISFIFO (bits))
return 'p';
#endif
#ifdef S_ISLNK
if (S_ISLNK (bits))
return 'l';
#endif
#ifdef S_ISSOCK
if (S_ISSOCK (bits))
return 's';
#endif
#ifdef S_ISMPC
if (S_ISMPC (bits))
return 'm';
#endif
#ifdef S_ISNWK
if (S_ISNWK (bits))
return 'n';
#endif
#ifdef S_ISOFD
/* Cray migrated dmf file. */
if (S_ISOFD (bits))
return 'M';
#endif
#ifdef S_ISOFL
/* Cray migrated dmf file. */
if (S_ISOFL (bits))
return 'M';
#endif
return '?';
}
/* Look at read, write, and execute bits in BITS and set
flags in CHARS accordingly. */
static void
rwx (bits, chars)
unsigned short bits;
char *chars;
{
chars[0] = (bits & S_IRUSR) ? 'r' : '-';
chars[1] = (bits & S_IWUSR) ? 'w' : '-';
chars[2] = (bits & S_IXUSR) ? 'x' : '-';
}
/* Set the 's' and 't' flags in file attributes string CHARS,
according to the file mode BITS. */
static void
setst (bits, chars)
unsigned short bits;
char *chars;
{
#ifdef S_ISUID
if (bits & S_ISUID)
{
if (chars[3] != 'x')
/* Set-uid, but not executable by owner. */
chars[3] = 'S';
else
chars[3] = 's';
}
#endif
#ifdef S_ISGID
if (bits & S_ISGID)
{
if (chars[6] != 'x')
/* Set-gid, but not executable by group. */
chars[6] = 'S';
else
chars[6] = 's';
}
#endif
#ifdef S_ISVTX
if (bits & S_ISVTX)
{
if (chars[9] != 'x')
/* Sticky, but not executable by others. */
chars[9] = 'T';
else
chars[9] = 't';
}
#endif
}

9
lib/filemode.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
void mode_string PARAMS ((short unsigned int mode, char *str));

View File

@@ -1,5 +1,5 @@
/* modechange.c -- file mode manipulation
Copyright (C) 1989, 1990, 1997 Free Software Foundation, Inc.
Copyright (C) 1989, 1990, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@
#if STDC_HEADERS
# include <stdlib.h>
#else
char *malloc ();
char *malloc;
#endif
#ifndef NULL
@@ -55,7 +55,22 @@ char *malloc ();
#define isodigit(c) ((c) >= '0' && (c) <= '7')
static int oatoi ();
/* Return a positive integer containing the value of the ASCII
octal number S. If S is not an octal number, return -1. */
static int
oatoi (const char *s)
{
register int i;
if (*s == 0)
return -1;
for (i = 0; isodigit (*s); ++s)
i = i * 8 + *s - '0';
if (*s)
return -1;
return i;
}
/* Return a linked list of file mode change operations created from
MODE_STRING, an ASCII string that contains either an octal number
@@ -71,9 +86,7 @@ static int oatoi ();
return MODE_MEMORY_EXHAUSTED if there is insufficient memory. */
struct mode_change *
mode_compile (mode_string, masked_ops)
const char *mode_string;
unsigned masked_ops;
mode_compile (const char *mode_string, unsigned int masked_ops)
{
struct mode_change *head; /* First element of the linked list. */
struct mode_change *change; /* An element of the linked list. */
@@ -240,8 +253,7 @@ invalid:
of REF_FILE. Return MODE_BAD_REFERENCE if REF_FILE can't be accessed. */
struct mode_change *
mode_create_from_ref (ref_file)
const char *ref_file;
mode_create_from_ref (const char *ref_file)
{
struct mode_change *change; /* the only change element */
struct stat ref_stats;
@@ -269,9 +281,7 @@ mode_create_from_ref (ref_file)
The returned value has the S_IFMT bits cleared. */
unsigned short
mode_adjust (oldmode, changes)
unsigned oldmode;
const struct mode_change *changes;
mode_adjust (unsigned int oldmode, const struct mode_change *changes)
{
unsigned short newmode; /* The adjusted mode and one operand. */
unsigned short value; /* The other operand. */
@@ -336,8 +346,7 @@ mode_adjust (oldmode, changes)
CHANGES. */
void
mode_free (changes)
register struct mode_change *changes;
mode_free (register struct mode_change *changes)
{
register struct mode_change *next;
@@ -348,21 +357,3 @@ mode_free (changes)
changes = next;
}
}
/* Return a positive integer containing the value of the ASCII
octal number S. If S is not an octal number, return -1. */
static int
oatoi (s)
char *s;
{
register int i;
if (*s == 0)
return -1;
for (i = 0; isodigit (*s); ++s)
i = i * 8 + *s - '0';
if (*s)
return -1;
return i;
}

View File

@@ -393,8 +393,8 @@ read_filesystem_list (int need_fs_type)
struct fs_data fsd;
while (errno = 0,
0 <= (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
(char *) 0)))
0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
(char *) 0)))
{
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
me->me_devname = xstrdup (fsd.fd_req.devname);

File diff suppressed because it is too large Load Diff

16
lib/posixtm.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef POSIXTM_H_
# define POSIXTM_H_
/* POSIX Date Syntax flags. */
# define PDS_LEADING_YEAR 1
# define PDS_TRAILING_YEAR 2
# define PDS_CENTURY 4
# define PDS_SECONDS 8
time_t
posixtime (const char *s, unsigned int syntax_bits);
struct tm *
posixtm (const char *s, unsigned int syntax_bits);
#endif

View File

@@ -55,6 +55,7 @@
/* For platform which support the ISO C amendement 1 functionality we
support user defined character classes. */
#if WIDE_CHAR_SUPPORT
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
# include <wchar.h>
# include <wctype.h>
#endif

View File

@@ -1,3 +1,25 @@
1998-08-18 Paul Eggert <eggert@twinsun.com>
Port nanosecond-resolution times to UnixWare 2.1.2 and
pedantic Solaris 2.6.
* st_mtim.m4 (AC_STRUCT_ST_MTIM_NSEC): Renamed from
AC_STRUCT_ST_MTIM.
* st_mtim.m4 (AC_STRUCT_ST_MTIM_NSEC):
Generate name of ns member, instead of just 1 or undef.
Allow for UnixWare 2.1.2 and Solaris 2.6 if in pedantic mode.
1998-08-15 Jim Meyering <meyering@ascend.com>
* ssize_t.m4 (jm_TYPE_SSIZE_T): Remove file.
* check-type.m4: New file. Replacement for AC_CHECK_TYPE.
* jm-macros.m4: Use the new AC_CHECK_TYPE(ssize_t, int)
instead of jm_TYPE_SSIZE_T.
1998-08-12 Jim Meyering <meyering@ascend.com>
* st_dm_mode.m4: New file. From Johan Danielsson.
1998-08-02 Jim Meyering <meyering@ascend.com>
* st_mtim.m4: Use hack to avoid having to put #undef HAVE_ST_MTIM

View File

@@ -1,14 +1,14 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
##m4-files-begin
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 chown.m4 \
const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fstypename.m4 getgroups.m4 \
getline.m4 getloadavg.m4 gettext.m4 inttypes_h.m4 isc-posix.m4 \
jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 \
lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 lstat.m4 malloc.m4 memcmp.m4 \
perl.m4 prereq.m4 progtest.m4 putenv.m4 readdir.m4 realloc.m4 regex.m4 \
ssize_t.m4 st_mtim.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
utimbuf.m4 utime.m4 utimes.m4
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 check-type.m4 \
chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fstypename.m4 \
getgroups.m4 getline.m4 getloadavg.m4 gettext.m4 inttypes_h.m4 \
isc-posix.m4 jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 lstat.m4 \
malloc.m4 memcmp.m4 perl.m4 prereq.m4 progtest.m4 putenv.m4 readdir.m4 \
realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 strftime.m4 \
uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
##m4-files-end

View File

@@ -89,14 +89,14 @@ VERSION = @VERSION@
YACC = @YACC@
l = @l@
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 chown.m4 \
const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fstypename.m4 getgroups.m4 \
getline.m4 getloadavg.m4 gettext.m4 inttypes_h.m4 isc-posix.m4 \
jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 \
lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 lstat.m4 malloc.m4 memcmp.m4 \
perl.m4 prereq.m4 progtest.m4 putenv.m4 readdir.m4 realloc.m4 regex.m4 \
ssize_t.m4 st_mtim.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 \
utimbuf.m4 utime.m4 utimes.m4
EXTRA_DIST = README Makefile.am.in assert.m4 check-decl.m4 check-type.m4 \
chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 fstypename.m4 \
getgroups.m4 getline.m4 getloadavg.m4 gettext.m4 inttypes_h.m4 \
isc-posix.m4 jm-glibc-io.m4 jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lchown.m4 lcmessage.m4 lfs.m4 ls-mntd-fs.m4 lstat.m4 \
malloc.m4 memcmp.m4 perl.m4 prereq.m4 progtest.m4 putenv.m4 readdir.m4 \
realloc.m4 regex.m4 st_dm_mode.m4 st_mtim.m4 stat.m4 strftime.m4 \
uintmax_t.m4 uptime.m4 utimbuf.m4 utime.m4 utimes.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =

28
m4/check-type.m4 Normal file
View File

@@ -0,0 +1,28 @@
#serial 1
dnl Just like AC_CHECK_TYPE from autoconf-2.12, but also checks in unistd.h
dnl on systems that have it. Fujitsu UXP/V needs this for ssize_t.
undefine([AC_CHECK_TYPE])
dnl AC_CHECK_TYPE(TYPE, DEFAULT)
AC_DEFUN(AC_CHECK_TYPE,
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_CHECK_HEADERS(unistd.h)
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<$1[^a-zA-Z_0-9]>>dnl
changequote([,]), [#include <sys/types.h>
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no; then
AC_DEFINE($1, $2)
fi
])

View File

@@ -11,7 +11,7 @@ AC_DEFUN(jm_MACROS,
AC_REQUIRE([jm_ASSERT])
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
AC_REQUIRE([jm_TYPE_SSIZE_T])
AC_CHECK_TYPE(ssize_t, int)
AC_REQUIRE([jm_STRUCT_UTIMBUF])
AC_REQUIRE([jm_STRUCT_DIRENT_D_TYPE])
AC_REQUIRE([jm_STRUCT_DIRENT_D_INO])

View File

@@ -1,19 +0,0 @@
#serial 1
dnl From Jim Meyering
# If ssize_t is not defined in sys/types.h, define it to `int'.
AC_DEFUN(jm_TYPE_SSIZE_T,
[AC_CACHE_CHECK(for ssize_t in sys/types.h, jm_ac_cv_type_ssize_t,
[
AC_EGREP_HEADER(ssize_t, sys/types.h,
jm_ac_cv_type_ssize_t=yes,
jm_ac_cv_type_ssize_t=no)
if test $jm_ac_cv_type_ssize_t = no; then
AC_DEFINE(ssize_t, int)
fi
]
)
]
)

25
m4/st_dm_mode.m4 Normal file
View File

@@ -0,0 +1,25 @@
# Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member.
AC_DEFUN(AC_STRUCT_ST_DM_MODE,
[AC_CACHE_CHECK([for st_dm_mode in struct stat], ac_cv_struct_st_dm_mode,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
ac_cv_struct_st_dm_mode=yes,
ac_cv_struct_st_dm_mode=no)])
if test $ac_cv_struct_st_dm_mode = yes; then
if test x = y; then
# This code is deliberately never run via ./configure.
# FIXME: this is a hack to make autoheader put the corresponding
# HAVE_* undef for this symbol in config.h.in. This saves me the
# trouble of having to add the #undef in acconfig.h manually.
AC_CHECK_FUNCS(ST_DM_MODE)
fi
# Defining it this way (rather than via AC_DEFINE) short-circuits the
# autoheader check -- autoheader doesn't know it's already been taken
# care of by the hack above.
ac_kludge=HAVE_ST_DM_MODE
AC_DEFINE_UNQUOTED($ac_kludge)
fi
]
)

View File

@@ -1,29 +1,30 @@
#serial 2
#serial 3
dnl From Paul Eggert.
# Define HAVE_ST_MTIM if struct stat has an st_mtim member.
# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
# if it exists.
AC_DEFUN(AC_STRUCT_ST_MTIM,
[AC_CACHE_CHECK([for st_mtim in struct stat], ac_cv_struct_st_mtim,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>], [struct stat s; s.st_mtim;],
ac_cv_struct_st_mtim=yes,
ac_cv_struct_st_mtim=no)])
AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
[AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
ac_cv_struct_st_mtim_nsec,
[ac_save_CPPFLAGS="$CPPFLAGS"
ac_cv_struct_st_mtim_nsec=no
# tv_nsec -- the usual case
# _tv_nsec -- Solaris 2.6, if
# (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
# && !defined __EXTENSIONS__)
# st__tim.tv_nsec -- UnixWare 2.1.2
for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
[ac_cv_struct_st_mtim_nsec=$ac_val; break])
done
CPPFLAGS="$ac_save_CPPFLAGS"])
if test $ac_cv_struct_st_mtim = yes; then
if test x = y; then
# This code is deliberately never run via ./configure.
# FIXME: this is a hack to make autoheader put the corresponding
# HAVE_* undef for this symbol in config.h.in. This saves me the
# trouble of having to add the #undef in acconfig.h manually.
AC_CHECK_FUNCS(ST_MTIM)
fi
# Defining it this way (rather than via AC_DEFINE) short-circuits the
# autoheader check -- autoheader doesn't know it's already been taken
# care of by the hack above.
ac_kludge=HAVE_ST_MTIM
AC_DEFINE_UNQUOTED($ac_kludge)
if test $ac_cv_struct_st_mtim_nsec != no; then
AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec)
fi
]
)

2
man/chgrp.x Normal file
View File

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

55
man/chmod.x Normal file
View File

@@ -0,0 +1,55 @@
[DESCRIPTION]
This manual page
documents the GNU version of
.BR chmod .
.B chmod
changes the permissions of each given file according to
.IR mode ,
which can be either a symbolic representation of changes to make, or
an octal number representing the bit pattern for the new permissions.
.PP
The format of a symbolic mode is
`[ugoa...][[+-=][rwxXstugo...]...][,...]'. Multiple symbolic
operations can be given, separated by commas.
.PP
A combination of the letters `ugoa' controls which users' access to
the file will be changed: the user who owns it (u), other users in the
file's group (g), other users not in the file's group (o), or all
users (a). If none of these are given, the effect is as if `a' were
given, but bits that are set in the umask are not affected.
.PP
The operator `+' causes the permissions selected to be added to the
existing permissions of each file; `-' causes them to be removed; and
`=' causes them to be the only permissions that the file has.
.PP
The letters `rwxXstugo' select the new permissions for the affected
users: read (r), write (w), execute (or access for directories) (x),
execute only if the file is a directory or already has execute
permission for some user (X), set user or group ID on execution (s),
save program text on swap device (t), the permissions that the user
who owns the file currently has for it (u), the permissions that other
users in the file's group have for it (g), and the permissions that
other users not in the file's group have for it (o).
.PP
A numeric mode is from one to four octal digits (0-7), derived by
adding up the bits with values 4, 2, and 1. Any omitted digits are
assumed to be leading zeros. The first digit selects the set user ID
(4) and set group ID (2) and save text image (1) attributes. The
second digit selects permissions for the user who owns the file: read
(4), write (2), and execute (1); the third selects permissions for
other users in the file's group, with the same values; and the fourth
for other users not in the file's group, with the same values.
.PP
.B chmod
never changes the permissions of symbolic links; the
.B chmod
system call cannot change their permissions. This is not a problem
since the permissions of symbolic links are never used.
However, for each symbolic link listed on the command line,
.B chmod
changes the permissions of the pointed-to file.
In contrast,
.B chmod
ignores symbolic links encountered during recursive directory
traversals.
.SH OPTIONS

20
man/chown.x Normal file
View File

@@ -0,0 +1,20 @@
[DESCRIPTION]
This manual page
documents the GNU version of
.BR chown .
.B chown
changes the user and/or group ownership of each given file, according
to its first non-option argument, which is interpreted as follows. If
only a user name (or numeric user ID) is given, that user is made the
owner of each given file, and the files' group is not changed. If the
user name is followed by a colon or dot and a group name (or numeric group ID),
with no spaces between them, the group ownership of the files is
changed as well. If a colon or dot but no group name follows the user name,
that user is made the owner of the files and the group of the files is
changed to that user's login group. If the colon or dot and group are given,
but the user name is omitted, only the group of the files is changed;
in this case,
.B chown
performs the same function as
.BR chgrp .
.Sh OPTIONS

18
man/cp.x Normal file
View File

@@ -0,0 +1,18 @@
.\" Copyright (C) 1994, 95, 96, 97 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of
.\" this manual under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" manual into another language, under the above conditions for modified
.\" versions, except that this permission notice may be stated in a
.\" translation approved by the Foundation.
.\"
[DESCRIPTION]
.\" Add any additional description here

2
man/dd.x Normal file
View File

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

39
man/df.x Normal file
View File

@@ -0,0 +1,39 @@
.\" Copyright (C) 1994, 95, 96, 97, 98 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of
.\" this manual under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" manual into another language, under the above conditions for modified
.\" versions, except that this permission notice may be stated in a
.\" translation approved by the Foundation.
.\"
[DESCRIPTION]
This manual page
documents the GNU version of
.BR df .
.B df
displays the amount of disk space available on the filesystem
containing each file name argument. If no file name is given, the
space available on all currently mounted filesystems is shown. Disk
space is shown in 1K blocks by default, unless the environment
variable POSIXLY_CORRECT is set, in which case 512-byte blocks are
used.
.PP
If an argument is the absolute file name of a disk device node containing a
mounted filesystem,
.B df
shows the space available on that filesystem rather than on the
filesystem containing the device node (which is always the root
filesystem). This version of
.B df
cannot show the space available on unmounted filesystems, because on
most kinds of systems doing so requires very nonportable intimate
knowledge of filesystem structures.
.SH OPTIONS

2
man/dir.x Normal file
View File

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

2
man/dircolors.x Normal file
View File

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

2
man/du.x Normal file
View File

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

382
man/help2man Executable file
View File

@@ -0,0 +1,382 @@
#!/usr/bin/perl -w
# Generate a short man page from --help and --version output.
# Copyright © 1997, 98 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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 Brendan O'Dea <bod@compusol.com.au>
# and François Pinard <pinard@IRO.UMontreal.CA>
require 5.003;
use strict;
use Getopt::Long;
use POSIX 'strftime';
my $RCS_Id = '$Id: help2man,v 1.1 1998/09/09 13:47:43 meyering Exp $';
my $this_program = 'help2man';
my $this_version = '0.0';
if ($RCS_Id =~ /\$Id:\s+(\S+)\s+(\S+)/)
{
$this_version = $2;
($this_program = $1) =~ s/(\.\w+)?,v$//;
}
my $version_info = <<EOT;
$this_program $this_version
Copyright (C) 1997, 98 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EOT
my $help_info = <<EOT;
`$this_program' generates a man page out of `--help' and `--version' output.
Usage: $this_program [OPTION]... EXECUTABLE
--name=STRING use `STRING' as the description for the NAME paragraph
--include=FILE include material from `FILE'
--opt-include=FILE include material from `FILE' if it exists
--output=FILE send output to `FILE'
--help print this help, then exit
--version print $this_program program version number, then exit
EXECUTABLE should accept `--help' and `version' options.
EOT
my ($include, $opt_name, $opt_include, $opt_output, $opt_help,
$opt_version);
# Parse options.
GetOptions (
'name=s' => \$opt_name,
'include=s' => \$include,
'opt-include=s' => \$opt_include,
'output=s' => \$opt_output,
help => sub { print $help_info; exit },
version => sub { print $version_info; exit },
) or die $help_info;
die $help_info unless @ARGV == 1;
my %include = ();
my @include = (); # to retain order
# Process include file (if given). Format is:
#
# [section name]
# verbatim text
if ($include or $opt_include)
{
if (open INC, $include || $opt_include)
{
my $sect;
while (<INC>)
{
if (/^\[([^]]+)\]/)
{
$sect = uc $1;
$sect =~ s/^\s+//;
$sect =~ s/\s+$//;
next;
}
# Silently ignore anything before the first
# section--allows for comments and revision info.
next unless $sect;
push @include, $sect unless $include{$sect};
$include{$sect} ||= '';
$include{$sect} .= $_;
}
close INC;
die "$this_program: no valid information found in `$include'\n"
unless %include;
# Compress trailing blank lines
for (keys %include)
{
$include{$_} =~ s/\n+$//;
$include{$_} .= "\n" unless /^NAME$/;
}
}
else
{
die "$this_program: can't open `$include' ($!)\n" if $include;
}
}
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
# Grab help and version paragraphs from executable
my @help = split /\n\n+/, `$ARGV[0] --manhelp 2>/dev/null`;
my @version = split /\n\n+/, `$ARGV[0] --version 2>/dev/null`
or die "$this_program: can't get `--version' info from $ARGV[0]\n";
@help = split /\n\n+/, `$ARGV[0] --help 2>/dev/null`
or die "$this_program: can't get `--help' info from $ARGV[0]\n"
unless @help;
my $date = strftime "%B %Y", localtime;
(my $program = $ARGV[0]) =~ s!.*/!!;
my $package = $program;
my $version;
if ($opt_output)
{
unlink $opt_output
or die "$this_program: can't unlink $opt_output ($!)\n"
if -e $opt_output;
open STDOUT, ">$opt_output"
or die "$this_program: can't create $opt_output ($!)\n";
}
# The first line of the --version information is assumed to be in one
# of the following formats:
#
# <version>
# <program> <version>
# GNU <program> <version>
# <program> (GNU <package>) <version>
# <program> - GNU <package> <version>
#
# and seperated from any copyright/author details by a blank line.
$_ = shift @version;
if (/^(\S+)\s+\((GNU\s+[^)]+)\)\s+(.*)/ or
/^(\S+)\s+-\s*(GNU\s+\S+)\s+(.*)/)
{
$program = $1;
$package = $2;
$version = $3;
}
elsif (/^(GNU\s+)?(\S+)\s+(.*)/)
{
$program = $2;
$package = $1 ? "$1$2" : $2;
$version = $3;
}
else
{
$version = $_;
}
$program =~ s!.*/!!;
# Check for name in help output
if ($help[0] =~ s/^(?:name|oneliner):\s*(\S.*)//)
{
($include{NAME} = "$program \\- $1") =~ s/\s+$//;
shift @help unless length $help[0];
}
# --name overrides --include contents and/or --manhelp oneliner
$include{NAME} = "$program \\- $opt_name" if $opt_name;
# Default (useless) NAME paragraph
$include{NAME} ||= "$program \\- manual page for $program $version";
# Man pages traditionally have the page title in caps.
my $PROGRAM = uc $program;
# Header.
print <<EOT;
.\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version.
.TH $PROGRAM 1 "$date" "$package $version" "FSF"
.SH NAME
$include{NAME}
EOT
my $accumulate = 1;
my @description = ();
sub convert_option;
# Output converted --help information.
for (@help)
{
chomp;
if (s/^Usage:\s+\S+\s+(.*)\n?//)
{
# Turn the usage clause into a synopsis.
my $synopsis = '';
do {
my $syn = $1;
$syn =~ s/(([][]|\.\.+)+)/\\fR$1\\fI/g;
$syn =~ s/^/\\fI/ unless $syn =~ s/^\\fR//;
$syn .= '\fR';
$syn =~ s/\\fI(\s*)\\fR/$1/g;
$synopsis .= ".br\n" unless $accumulate;
$synopsis .= ".B $program\n";
$synopsis .= "$syn\n";
$accumulate = 0;
} while s/^(?:Usage|\s*or):\s+\S+\s+(.*)\n?//;
# Include file overrides SYNOPSIS
print ".SH SYNOPSIS\n", $include{SYNOPSIS} || $synopsis;
# Dump any accumulated description text.
print ".SH DESCRIPTION\n";
print @description;
# Add additional description text from include file
if ($include{DESCRIPTION})
{
print ".PP\n" unless $include{DESCRIPTION} =~ /^\..P/;
print $include{DESCRIPTION};
}
next unless $_;
}
# Accumulate text if the synopsis has not been produced yet.
if ($accumulate)
{
push @description, ".PP\n" if @description;
push @description, "$_\n";
next;
}
# Catch start of options.
if (/^Options:/)
{
print qq(.SH OPTIONS\n);
s/Options://;
}
# Catch bug report text.
if (/^Report bugs |^Email bug reports to /)
{
print qq(.SH "REPORTING BUGS"\n$_\n);
next;
}
# Special case for tar 1.12: --label=NAME\nPATTERN.
s{(\n[ \t]*)(-V,[ \t]+--label=NAME.*)\n[ \t]+PATTERN[ \t]+}
{$1$2$1\\&...=PATTERN };
# Convert options.
s/(\s)(-[][\w=-]+|\\&\S+)/$1 . convert_option $2/ge;
# Option subsections have second line indented.
print qq(.SS "$1"\n) if s/^(\S.*)\n(\s)/$2/;
# Lines indented more than about 10 spaces may be assumed to be
# continuations of the previous line.
s/\n {10,}/ /g;
# Lines following dotted (*) or numbered points may also be
# continued if indented to the same level as the text following
# the point.
1 while s{((?:^|\n)(\s+)(?:[1-9][.)]|\*)(\s+)(?:[^\n]+))\n\2 \3(\S)}
{$1 $4}g;
# Indented paragraph.
if (/^\s/)
{
for (split /\n/)
{
s/^\s+//;
s/([^,])\s+/$1\n/;
print ".TP\n$_\n" if $_;
}
}
# Anything else.
else
{
print ".PP\n$_\n";
}
}
# Print any include items other than the ones we have already dealt
# with.
for (@include)
{
print qq(.SH "$_"\n$include{$_})
unless /^(NAME|SYNOPSIS|DESCRIPTION|SEE ALSO)$/;
}
# Refer to the real documentation.
if ($include{'SEE ALSO'} or $program ne 'info')
{
print qq(.SH "SEE ALSO"\n);
print $include{'SEE ALSO'}, ".PP\n" if $include{'SEE ALSO'};
print <<EOT unless $program eq 'info';
The full documentation for
.B $program
is maintained as a Texinfo manual. If the
.B info
and
.B $program
programs are properly installed at your site, the command
.IP
.B info $program
.PP
should give you access to the complete manual.
EOT
}
# Output converted --version information.
for (@version)
{
chomp;
# Convert copyright symbol or (c) to nroff character
s/Copyright\s+(?:\xa9|\([Cc]\))/Copyright \\(co/g;
# Insert appropriate headings for copyright and author
if (/^Copyright\s\\/) { print ".SH COPYRIGHT\n" }
elsif (/^Written\s+by/) { print ".SH AUTHOR\n" }
else { print ".PP\n"; }
# Insert line breaks before additional copyright messages and the
# disclaimer
s/(.)\n(Copyright\s|This is free software)/$1\n.br\n$2/g;
print "$_\n";
}
exit;
# Convert option dashes to \- to stop nroff from hyphenating 'em, and
# embolden. Option arguments get italicised.
sub convert_option
{
my $option = '\fB' . shift;
$option =~ s/-/\\-/g;
unless ($option =~ s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/)
{
$option =~ s/=(.)/\\fR=\\fI$1/;
$option =~ s/ (.)/ \\fI$1/;
$option .= '\fR';
}
$option;
}

2
man/install.x Normal file
View File

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

2
man/ln.x Normal file
View File

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

2
man/ls.x Normal file
View File

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

2
man/mkdir.x Normal file
View File

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

2
man/mkfifo.x Normal file
View File

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

2
man/mknod.x Normal file
View File

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

2
man/mv.x Normal file
View File

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

34
man/rm.x Normal file
View File

@@ -0,0 +1,34 @@
[DESCRIPTION]
This manual page
documents the GNU version of
.BR rm .
.B rm
removes each specified file. By default, it does not remove
directories.
.P
If a file is unwritable, the standard input is a tty, and
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

2
man/rmdir.x Normal file
View File

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

2
man/sync.x Normal file
View File

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

2
man/touch.x Normal file
View File

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

2
man/vdir.x Normal file
View File

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

View File

@@ -1,3 +1,175 @@
1998-09-12 Jim Meyering <meyering@ascend.com>
* Version 3.16x.
* src/remove.c (remove_cwd_entries): Declare to be static.
Automatically generate man pages from combination of --help
output and the contents of new, man/*.x files.
* man/Makefile.am (HELP2MAN): Define.
(man_aux): Define.
(EXTRA_DIST): Add $(HELP2MAN) and $(man_aux).
(MAINTAINERCLEANFILES): Add $(man_MANS).
* man/*.x: New files.
* man/GNUmakefile: New file.
* man/Makefile.maint: New file.
* man/help2man: New file.
1998-09-09 Jim Meyering <meyering@ascend.com>
* lib/modechange.c: Protoize.
1998-09-07 Jim Meyering <meyering@ascend.com>
* Version 3.16w.
* src/df.c (show_dev) [!posix_format]: When using --print-type,
let the device path and the file system type share a single (wider)
field if their combined lengths allow it. From Andries Brouwer.
* tests/touch/empty-file: Upon failure, suggest how to rerun the test
with longer delay, in case NFS clock skew was the cause of the failure.
Reported by Kaveh Ghazi.
* tests/ls-2/quoting: Add tests.
* tests/Fetish.pm (run_tests): Add simple PRE/POST hooks.
(_create_file): Don't include $$ in temp file name.
(run_tests): Use shorter suffixes for temp file names.
1998-09-06 Jim Meyering <meyering@ascend.com>
* src/touch.c: Include posixtm.h.
(usage): Correct the description of the format of the
date string argument to -t option.
(main): Update to use rewritten posixtime function.
Reported by Andries Brouwer.
* lib/Makefile.am (libfu_a_SOURCES): Change posixtm.y to posixtm.c.
(noinst_HEADERS): Add posixtm.h.
* lib/posixtm.h: New file.
* lib/posixtm.c: New file. Rewritten based on posixtm.y.
* lib/posixtm.y: Remove file.
1998-09-05 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* src/ls.c (print_dir_name): Put back.
(print_dir): Also print directory name header if print_dir_name is
true.
1998-08-29 Jim Meyering <meyering@ascend.com>
* Version 3.16v.
* src/du.c (long_options): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
* src/cp.c (long_opts): Likewise.
* src/ln.c (long_options): Likewise.
* src/mkdir.c (longopts): Likewise.
* src/rmdir.c (longopts): Likewise.
* src/chown.c: Replace 12 and 13 with CHAR_MAX + 1 and CHAR_MAX + 2
respectively.
* src/chmod.c (long_options): Replace 12 with CHAR_MAX + 1.
* src/chgrp.c (long_options): Replace 12 with CHAR_MAX + 1.
* tests/Fetish.pm: New file -- moved from ls-2/.
* configure.in (AC_OUTPUT): Add tests/dircolors/Makefile.
* tests/Makefile.am (SUBDIRS): Add dircolors.
(EXTRA_DIST): Add Fetish.pm.
* tests/dircolors: New directory
* src/ls.c (print_dir_name): Remove global variable.
(print_dir): When trace_dirs is set, always print the directory
name header.
1998-08-26 Jim Meyering <meyering@ascend.com>
* src/dircolors.c (dc_parse_stream): Don't segfault when a line
contains only one token. Reported by Olav Morkrid.
1998-08-24 Paul Eggert <eggert@twinsun.com>
* src/system.h (CHAR_MIN, CHAR_MAX):
Renamed from SCHAR_MIN, SCHAR_MAX, since these
macros apply to char, not signed char.
* src/df.c, src/du.c, src/touch.c (long_options, main):
Don't assume ASCII.
1998-08-18 Paul Eggert <eggert@twinsun.com>
Port nanosecond-resolution times to UnixWare 2.1.2 and
pedantic Solaris 2.6.
* 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):
Use new ST_MTIM_NSEC macro.
1998-08-16 Jim Meyering <meyering@ascend.com>
* lib/filemode.h (PARAMS): Define and use.
From Kaveh Ghazi.
1998-08-15 Jim Meyering <meyering@ascend.com>
* Version 3.16u.
* Makefile.maint (announcement): New target.
* tests/mv/into-self: Update to reflect changed behavior of mv.
* src/mv.c (do_move): Fail upon attempt to move a directory into itself.
With prodding from François Pinard :-)
* tests/ls-2/Fetish.pm: New file
* tests/ls-2/run-test: New file
* src/copy.c (copy_internal) [one-file-system]: Do copy mount point
directories (but none of their entries). This makes `cp --archive
--one-file-system' use the same policy `tar --one-file-system' does.
From Marty Leisner.
* src/ls.c (qmark_funny_chars): Add comment from Paul eggert.
1998-08-14 Jim Meyering <meyering@ascend.com>
* tests/mv/setup: Work around another bug in Ultrix4.3a's /bin/sh.
Reported by Christian von Roques.
* configure.in (AC_OUTPUT): Add tests/ls-2/Makefile.
* tests/Makefile.am (SUBDIRS): Add ls-2.
* tests/ls-2: New directory
1998-08-14 Christian von Roques <roques@pond.sub.org>
* lib/mountlist.c (read_filesystem_list) [MOUNTED_GETMNT]: Don't
infloop on getmnt(2) returning 0.
* tests/cp/backup-is-src: Avoid bug in Ultrix4.3a /bin/sh,
not initializing output redirection of : command.
* tests/mv/backup-is-src: Likewise.
* tests/rm/i-1: Likewise.
1998-08-12 Jim Meyering <meyering@ascend.com>
* po/Makefile.in.in: Provide automake-style DESTDIR support.
From Johan Danielsson.
(DISTFILES): Remove ChangeLog.
po/ChangeLog: Remove empty file.
* configure.in (AC_STRUCT_ST_DM_MODE): Use it.
* src/ls.c: Include filemode.h.
* src/chmod.c: Likewise.
* lib/filemode.c (ftypelet): Add comments for Cray DMF support.
From Johan Danielsson.
Protoize. Tsort function definitions and remove prototypes of
static functions.
(mode_string): Remove prototype.
* lib/filemode.h (mode_string): New file.
* lib/Makefile.am (noinst_HEADERS): Add filemode.h.
1998-08-09 Jim Meyering <meyering@ascend.com>
* Version 3.16t.

View File

@@ -1,4 +1,17 @@
Changes in release 3.17:
[3.16x]
* man pages are now automatically generated from a combination of --help
output and the contents of new (though mostly empty), man/*.x files.
[3.16w]
* touch now interprets `-t TIME-DATE' as POSIX specifies
* `ls EMPTY-DIR EMPTY-DIR' once again outputs the directory names
[3.16v]
* portability fixes
* `ls -R EMPTY-DIR' now outputs the name of the directory
[3.16u]
* mv now fails (as it should) upon attempt to move a directory into itself
* `cp -a --one-file-system' now copies any mount point directories it
encounters on the selected file system.
[3.16t]
* cp (with --update) and ls compare time stamps with subsecond resolution when
available (e.g., on systems with recent Linux kernels and on Solaris 2.6).

View File

@@ -1,3 +1,12 @@
1998-08-29 Jim Meyering <meyering@ascend.com>
* src/su.c (longopts): Use corresponding short-option character
in place of `1', and `NULL' in place of pointer in initialization.
1998-08-11 Jim Meyering <meyering@ascend.com>
* src/uptime.c (usage): Correct description. Reported by John Murphy.
1998-07-16 Jim Meyering <meyering@ascend.com>
* lib/Makefile.am (noinst_HEADERS): Add lchown.h.

View File

@@ -1,3 +1,24 @@
1998-08-15 Jim Meyering <meyering@ascend.com>
* src/pr.c (usage): Reformat.
* src/ptx.c: Add braces to suppress warning about ambiguous `else'.
* lib/bumpalloc.h: Likewise.
1998-08-13 François Pinard <pinard@iro.umontreal.ca>
* src/ptx.c: New file.
* src/Makefile.am (bin_PROGRAMS): Add ptx.
* lib/bumpalloc.h, lib/diacrit.h, lib/diacrit.c: New files.
* lib/Makefile.am (libtu_a_SOURCES): Add diacrit.c.
(noinst_HEADERS): Add bumpalloc.h and diacrit.h.
1998-08-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* src/pr.c (long_options): Add long names for all options.
(usage): Update help string.
(main): Handle the special options --pages and --columns.
1998-08-02 Jim Meyering <meyering@ascend.com>
* lib/linebuffer.c (readline): Return zero upon error as well as upon

View File

@@ -1,4 +1,7 @@
Changes in release 1.23
[1.22g]
* pr accepts long option names (see `pr --help')
* new program: ptx (moved to this package from being its own distribution)
[1.22f]
* cut accepts new --output-delimiter=STR option
* `sort -o no-such-file no-such-file' now fails, as it should

View File

@@ -26,7 +26,7 @@ subdir = po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
MKINSTALLDIRS = @MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
@@ -46,7 +46,7 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES = cat-id-tbl.c
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
DISTFILES = Makefile.in.in POTFILES.in $(PACKAGE).pot \
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
POTFILES = \
@@ -110,17 +110,17 @@ install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(datadir); \
if test -x "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
fi
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
case "$$cat" in \
*.gmo) destdir=$(gnulocaledir);; \
*) destdir=$(localedir);; \
*.gmo) destdir=$(DESTDIR)$(gnulocaledir);; \
*) destdir=$(DESTDIR)$(localedir);; \
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$$destdir/$$lang/LC_MESSAGES; \
@@ -152,13 +152,13 @@ install-data-yes: all
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(gettextsrcdir); \
if test -x "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
fi; \
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
$(gettextsrcdir)/Makefile.in.in; \
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
@@ -171,12 +171,12 @@ uninstall:
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
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; \
done
rm -f $(gettextsrcdir)/po-Makefile.in.in
rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
check: all

View File

@@ -107,7 +107,7 @@ static struct option const long_options[] =
{"no-dereference", no_argument, 0, 'h'},
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
{"reference", required_argument, 0, 12},
{"reference", required_argument, 0, CHAR_MAX + 1},
{"verbose", no_argument, 0, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
@@ -340,7 +340,7 @@ main (int argc, char **argv)
{
case 0:
break;
case 12:
case CHAR_MAX + 1:
reference_file = optarg;
break;
case 'R':

View File

@@ -27,6 +27,7 @@
#include "closeout.h"
#include "error.h"
#include "savedir.h"
#include "filemode.h"
enum Change_status
{
@@ -47,7 +48,6 @@ enum Verbosity
V_off
};
void mode_string ();
void strip_trailing_slashes ();
static int change_dir_mode PARAMS ((const char *dir,
@@ -82,7 +82,7 @@ static struct option const long_options[] =
{"changes", no_argument, 0, 'c'},
{"silent", no_argument, 0, 'f'},
{"quiet", no_argument, 0, 'f'},
{"reference", required_argument, 0, 12},
{"reference", required_argument, 0, CHAR_MAX + 1},
{"verbose", no_argument, 0, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
@@ -311,7 +311,7 @@ main (int argc, char **argv)
error (1, 0, _("invalid mode"));
modeind = thisind;
break;
case 12:
case CHAR_MAX + 1:
reference_file = optarg;
break;
case 'R':

View File

@@ -113,11 +113,11 @@ static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"changes", no_argument, 0, 'c'},
{"dereference", no_argument, 0, 13},
{"dereference", no_argument, 0, CHAR_MAX + 2},
{"no-dereference", no_argument, 0, 'h'},
{"quiet", no_argument, 0, 'f'},
{"silent", no_argument, 0, 'f'},
{"reference", required_argument, 0, 12},
{"reference", required_argument, 0, CHAR_MAX + 1},
{"verbose", no_argument, 0, 'v'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
@@ -341,10 +341,10 @@ main (int argc, char **argv)
{
case 0:
break;
case 12:
case CHAR_MAX + 1:
reference_file = optarg;
break;
case 13:
case CHAR_MAX + 2:
change_symlinks = 0;
break;
case 'R':

View File

@@ -381,10 +381,6 @@ copy_internal (const char *src_path, const char *dst_path,
return 1;
}
/* Are we crossing a file system boundary? */
if (x->one_file_system && device != 0 && device != src_sb.st_dev)
return 0;
/* We wouldn't insert a node unless nlink > 1, except that we need to
find created files so as to not copy infinitely if a directory is
copied into itself. */
@@ -661,6 +657,10 @@ copy_internal (const char *src_path, const char *dst_path,
if (x->verbose)
printf ("%s -> %s\n", src_path, dst_path);
/* Are we crossing a file system boundary? */
if (x->one_file_system && device != 0 && device != src_sb.st_dev)
return 0;
}
/* Copy the contents of the directory. */

View File

@@ -96,13 +96,13 @@ static struct option const long_opts[] =
{"archive", no_argument, NULL, 'a'},
{"backup", no_argument, NULL, 'b'},
{"force", no_argument, NULL, 'f'},
{"sparse", required_argument, NULL, 2},
{"sparse", required_argument, NULL, CHAR_MAX + 1},
{"interactive", no_argument, NULL, 'i'},
{"link", no_argument, NULL, 'l'},
{"no-dereference", no_argument, NULL, 'd'},
{"one-file-system", no_argument, NULL, 'x'},
{"parents", no_argument, &flag_path, 1},
{"path", no_argument, &flag_path, 1},
{"parents", no_argument, NULL, 'P'},
{"path", no_argument, NULL, 'P'},
{"preserve", no_argument, NULL, 'p'},
{"recursive", no_argument, NULL, 'R'},
{"suffix", required_argument, NULL, 'S'},
@@ -654,7 +654,7 @@ main (int argc, char **argv)
case 0:
break;
case 2:
case CHAR_MAX + 1:
{
int i;

View File

@@ -181,7 +181,7 @@ static struct option const longopts[] =
{"fields", required_argument, 0, 'f'},
{"delimiter", required_argument, 0, 'd'},
{"only-delimited", no_argument, 0, 's'},
{"output-delimiter", required_argument, 0, 14},
{"output-delimiter", required_argument, 0, CHAR_MAX + 1},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
@@ -739,7 +739,7 @@ main (int argc, char **argv)
delim_specified = 1;
break;
case 14:
case CHAR_MAX + 1:
/* Interpret --output-delimiter='' to mean
`use the NUL byte as the delimiter.' */
output_delimiter_length = (optarg[0] == '\0'

View File

@@ -115,7 +115,7 @@ static int print_type;
static struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"block-size", required_argument, NULL, 131},
{"block-size", required_argument, NULL, CHAR_MAX + 3},
{"inodes", no_argument, NULL, 'i'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, NULL, 'H'},
@@ -124,8 +124,8 @@ static struct option const long_options[] =
{"megabytes", no_argument, NULL, 'm'},
{"portability", no_argument, NULL, 'P'},
{"print-type", no_argument, NULL, 'T'},
{"sync", no_argument, NULL, 129},
{"no-sync", no_argument, NULL, 130},
{"sync", no_argument, NULL, CHAR_MAX + 1},
{"no-sync", no_argument, NULL, CHAR_MAX + 2},
{"type", required_argument, NULL, 't'},
{"exclude-type", required_argument, NULL, 'x'},
{"help", no_argument, &show_help, 1},
@@ -246,15 +246,29 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
if (! disk)
disk = "-"; /* unknown */
printf ((print_type ? "%-13s" : "%-20s"), disk);
if ((int) strlen (disk) > (print_type ? 13 : 20) && !posix_format)
printf ((print_type ? "\n%13s" : "\n%20s"), "");
if (! fstype)
fstype = "-"; /* unknown */
/* df.c reserved 5 positions for fstype,
but that does not suffice for type iso9660 */
if (print_type)
printf (" %-5s ", fstype);
{
int disk_name_len = (int) strlen (disk);
int fstype_len = (int) strlen (fstype);
if (disk_name_len + fstype_len + 2 < 20)
printf ("%s%*s ", disk, 18 - disk_name_len, fstype);
else if (!posix_format)
printf ("%s\n%18s ", disk, fstype);
else
printf ("%s %s", disk, fstype);
}
else
{
if ((int) strlen (disk) > 20 && !posix_format)
printf ("%s\n%20s", disk, "");
else
printf ("%-20s", disk);
}
if (inode_format)
{
@@ -654,14 +668,14 @@ main (int argc, char **argv)
case 'P':
posix_format = 1;
break;
case 129:
case CHAR_MAX + 1:
require_sync = 1;
break;
case 130:
case CHAR_MAX + 2:
require_sync = 0;
break;
case 131:
case CHAR_MAX + 3:
human_block_size (optarg, 1, &output_block_size);
break;

View File

@@ -292,6 +292,15 @@ dc_parse_stream (FILE *fp, const char *filename)
if (keywd == NULL)
continue;
if (arg == NULL)
{
error (0, 0, _("%s:%lu: invalid line; missing second token"),
filename, (long unsigned) line_number);
err = 1;
free (keywd);
continue;
}
unrecognized = 0;
if (strcasecmp (keywd, "TERM") == 0)
{

View File

@@ -177,23 +177,23 @@ static uintmax_t tot_size = 0;
static struct option const long_options[] =
{
{"all", no_argument, &opt_all, 1},
{"block-size", required_argument, 0, 129},
{"all", no_argument, NULL, 'a'},
{"block-size", required_argument, 0, CHAR_MAX + 2},
{"bytes", no_argument, NULL, 'b'},
{"count-links", no_argument, &opt_count_all, 1},
{"count-links", no_argument, NULL, 'l'},
{"dereference", no_argument, NULL, 'L'},
{"dereference-args", no_argument, &opt_dereference_arguments, 1},
{"exclude", required_argument, 0, 128},
{"dereference-args", no_argument, NULL, 'D'},
{"exclude", required_argument, 0, CHAR_MAX + 1},
{"exclude-from", required_argument, 0, 'X'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, 0, 'H'},
{"kilobytes", no_argument, NULL, 'k'},
{"max-depth", required_argument, NULL, 13},
{"max-depth", required_argument, NULL, CHAR_MAX + 3},
{"megabytes", no_argument, NULL, 'm'},
{"one-file-system", no_argument, &opt_one_file_system, 1},
{"separate-dirs", no_argument, &opt_separate_dirs, 1},
{"one-file-system", no_argument, NULL, 'x'},
{"separate-dirs", no_argument, NULL, 'S'},
{"summarize", no_argument, NULL, 's'},
{"total", no_argument, &opt_combined_arguments, 1},
{"total", no_argument, NULL, 'c'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
@@ -300,7 +300,7 @@ main (int argc, char **argv)
output_block_size = 1024;
break;
case 13: /* --max-depth=N */
case CHAR_MAX + 3: /* --max-depth=N */
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
error (1, 0, _("invalid maximum depth `%s'"), optarg);
@@ -342,11 +342,11 @@ main (int argc, char **argv)
error (1, errno, "%s", optarg);
break;
case 128:
case CHAR_MAX + 1:
add_exclude (exclude, optarg);
break;
case 129:
case CHAR_MAX + 2:
human_block_size (optarg, 1, &output_block_size);
break;

View File

@@ -108,13 +108,13 @@ static int show_version;
static struct option const long_options[] =
{
{"backup", no_argument, NULL, 'b'},
{"directory", no_argument, &hard_dir_link, 1},
{"directory", no_argument, NULL, 'F'},
{"no-dereference", no_argument, NULL, 'n'},
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
{"suffix", required_argument, NULL, 'S'},
{"symbolic", no_argument, &symbolic_link, 1},
{"verbose", no_argument, &verbose, 1},
{"symbolic", no_argument, NULL, 's'},
{"verbose", no_argument, NULL, 'v'},
{"version-control", required_argument, NULL, 'V'},
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},

View File

@@ -72,6 +72,7 @@
#include "xstrtol.h"
#include "strverscmp.h"
#include "quotearg.h"
#include "filemode.h"
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
@@ -132,8 +133,6 @@ struct bin_str
time_t time ();
#endif
void mode_string ();
char *getgroup ();
char *getuser ();
void strip_trailing_slashes ();
@@ -450,8 +449,15 @@ struct ignore_pattern
static struct ignore_pattern *ignore_patterns;
/* Nonzero means output nongraphic chars in file names as `?'. -q */
/* Nonzero means output nongraphic chars in file names as `?'.
(-q, --hide-control-chars)
qmark_funny_chars and the quoting style (-Q, --quoting-style=WORD) are
independent. The algorithm is: first, obey the quoting style to get a
string representing the file name; then, if qmark_funny_chars is set,
replace all nonprintable chars in that string with `?'. It's necessary
to replace nonprintable chars even in quoted strings, because we don't
want to mess up the terminal if control chars get sent to it, and some
quoting methods pass through control chars as-is. */
static int qmark_funny_chars;
/* Quoting options for file and dir name output. */
@@ -821,6 +827,7 @@ decode_switches (int argc, char **argv)
if (isatty (1))
{
format = many_per_line;
/* See description of qmark_funny_chars, above. */
qmark_funny_chars = 1;
}
else
@@ -1584,7 +1591,7 @@ print_dir (const char *name, const char *realname)
if (trace_dirs)
extract_dirs_from_files (name, 1);
if (print_dir_name)
if (trace_dirs || print_dir_name)
{
DIRED_INDENT ();
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
@@ -2183,6 +2190,7 @@ print_long_format (const struct fileinfo *f)
char *user_name;
#if HAVE_ST_DM_MODE
/* Cray DMF: look at the file's migrated, not real, status */
mode_string (f->stat.st_dm_mode, modebuf);
#else
mode_string (f->stat.st_mode, modebuf);

View File

@@ -43,7 +43,7 @@ static int show_version;
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
{"parents", no_argument, &path_mode, 1},
{"parents", no_argument, NULL, 'p'},
{"help", no_argument, &show_help, 1},
{"verbose", no_argument, NULL, 2},
{"version", no_argument, &show_version, 1},

View File

@@ -177,21 +177,34 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
}
fail = copy (source, dest, 0, x,
&copy_into_self, &rename_succeeded);
fail = copy (source, dest, 0, x, &copy_into_self, &rename_succeeded);
if (!fail)
{
const char *dir_to_remove;
if (copy_into_self)
{
/* Do *not* remove SOURCE if it is the same as or a parent
of DEST. Otherwise, mv would be removing the original
*and* the copy. */
/* In general, when copy returns with copy_into_self set, SOURCE is
the same as, or a parent of DEST. In this case we know it's a
parent. It doesn't make sense to move a directory into itself, and
besides in some situations doing so would give highly nonintuitive
results. Run this `mkdir b; touch a c; mv * b' in an empty
directory. Here's the result of running echo `find b -print`:
b b/a b/b b/b/a b/c. Notice that only file `a' was copied
into b/b. Handle this by giving a diagnostic, removing the
copied-into-self directory, DEST (`b/b' in the example),
and failing. */
dir_to_remove = dest;
error (0, 0,
_("cannot move `%s' to a subdirectory of itself, `%s'"),
source, dest);
}
else if (rename_succeeded)
{
/* No need to remove anything. SOURCE was successfully
renamed to DEST. */
dir_to_remove = NULL;
}
else
{
@@ -217,6 +230,11 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
This function used to resort to copying only when rename
failed and set errno to EXDEV. */
dir_to_remove = source;
}
if (dir_to_remove != NULL)
{
struct rm_options rm_options;
struct File_spec fs;
enum RM_status status;
@@ -226,7 +244,7 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
remove_init ();
fspec_init_file (&fs, source);
fspec_init_file (&fs, dir_to_remove);
status = rm (&fs, 1, &rm_options);
assert (VALID_STATUS (status));
if (status == RM_ERROR)
@@ -235,8 +253,11 @@ do_move (const char *source, const char *dest, const struct cp_options *x)
remove_fini ();
if (fail)
error (0, errno, _("cannot remove `%s'"), source);
error (0, errno, _("cannot remove `%s'"), dir_to_remove);
}
if (copy_into_self)
fail = 1;
}
return fail;

View File

@@ -580,6 +580,27 @@ static struct option const long_options[] =
{"help", no_argument, &show_help, 1},
{"version", no_argument, &show_version, 1},
{"test", no_argument, &test_suite, 1},
{"pages", required_argument, NULL, CHAR_MAX + 1},
{"columns", required_argument, NULL, CHAR_MAX + 2},
{"across", no_argument, NULL, 'a'},
{"show-control-chars", no_argument, NULL, 'c'},
{"double-space", no_argument, NULL, 'd'},
{"expand-tabs", optional_argument, NULL, 'e'},
{"form-feed", no_argument, NULL, 'f'},
{"header", required_argument, NULL, 'h'},
{"output-tabs", optional_argument, NULL, 'i'},
{"join-lines", no_argument, NULL, 'j'},
{"length", required_argument, NULL, 'l'},
{"merge", no_argument, NULL, 'm'},
{"number-lines", optional_argument, NULL, 'n'},
{"first-line-number", required_argument, NULL, 'N'},
{"indent", required_argument, NULL, 'o'},
{"no-file-warnings", no_argument, NULL, 'r'},
{"separator", optional_argument, NULL, 's'},
{"omit-header", no_argument, NULL, 't'},
{"omit-pagination", no_argument, NULL, 'T'},
{"show-nonprinting", no_argument, NULL, 'v'},
{"width", required_argument, NULL, 'w'},
{0, 0, 0, 0}
};
@@ -722,6 +743,24 @@ main (int argc, char **argv)
case 0: /* getopt long option */
break;
case CHAR_MAX + 1: /* --pages=FIRST_PAGE[:LAST_PAGE] */
first_last_page (optarg);
break;
case CHAR_MAX + 2: /* --columns=COLUMN */
{
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|| tmp_long <= 0 || tmp_long > INT_MAX)
{
error (EXIT_FAILURE, 0,
_("`--columns=COLUMN' invalid number of columns: `%s'"),
optarg);
}
columns = (int) tmp_long;
break;
}
case 'a':
print_across_flag = TRUE;
storing_columns = FALSE;
@@ -2416,44 +2455,61 @@ Usage: %s [OPTION]... [FILE]...\n\
Paginate or columnate FILE(s) for printing.\n\
\n\
+FIRST_PAGE[:LAST_PAGE]\n\
--pages=FIRST_PAGE[:LAST_PAGE]\n\
begin [stop] printing with page FIRST_[LAST_]PAGE\n\
-COLUMN produce COLUMN-column output and print columns down,\n\
-COLUMN\n\
--columns=COLUMN produce COLUMN-column output and print columns down,\n\
unless -a is used. Balance number of lines in the\n\
columns on each page.\n\
-a print columns across rather than down, used together\n\
-a, --across print columns across rather than down, used together\n\
with -COLUMN\n\
-c use hat notation (^G) and octal backslash notation\n\
-d double space the output\n\
-e[CHAR[WIDTH]] expand input CHARs (TABs) to tab WIDTH (8)\n\
-F, -f use form feeds instead of newlines to separate pages\n\
-c, --show-control-chars\n\
use hat notation (^G) and octal backslash notation\n\
-d, --double-space\n\
double space the output\n\
-e, --expand-tabs[=CHAR[WIDTH]]\n\
expand input CHARs (TABs) to tab WIDTH (8)\n\
-F, -f, --form-feed\n\
use form feeds instead of newlines to separate pages\n\
(by a 3-line page header with -f or a 5-line header\n\
and trailer without -f)\n\
-h HEADER use a centered HEADER instead of filename in page headers\n\
-h, --header=HEADER\n\
use a centered HEADER instead of filename in page headers\n\
with long headers left-hand-side truncation may occur\n\
-h \"\" prints a blank line. Don't use -h\"\"\n\
-i[CHAR[WIDTH]] replace spaces with CHARs (TABs) to tab WIDTH (8)\n\
-j merge full lines, turns off -w line truncation, no column\n\
-i, --output-tabs[=CHAR[WIDTH]]\n\
replace spaces with CHARs (TABs) to tab WIDTH (8)\n\
-j, --join-lines merge full lines, turns off -w line truncation, no column\n\
alignment, -s[STRING] sets separators\n\
-l PAGE_LENGTH set the page length to PAGE_LENGTH (66) lines\n\
-l, --length PAGE_LENGTH\n\
set the page length to PAGE_LENGTH (66) lines\n\
(default number of lines of text 56, with -f 63)\n"));
printf (_("\
-m print all files in parallel, one in each column,\n\
-m, --merge print all files in parallel, one in each column,\n\
truncate lines, but join lines of full length with -j\n\
-n[SEP[DIGITS]] number lines, use DIGITS (5) digits, then SEP (TAB)\n\
-n, --number-lines[=SEP[DIGITS]]\n\
number lines, use DIGITS (5) digits, then SEP (TAB)\n\
default counting starts with 1st line of input file\n\
-N NUMBER start counting with NUMBER at 1st line of first\n\
-N, --first-line-number=NUMBER\n\
start counting with NUMBER at 1st line of first\n\
page printed (see +FIRST_PAGE)\n\
-o MARGIN offset each line with MARGIN spaces (do not affect -w)\n\
-r inhibit warning when a file cannot be opened\n\
-s[STRING] separate columns by an optional STRING, don't use\n\
-o, --indent=MARGIN\n\
offset each line with MARGIN spaces (do not affect -w)\n\
-r, --no-file-warnings\n\
inhibit warning when a file cannot be opened\n\
-s, --separator[=STRING]\n\
separate columns by an optional STRING, don't use\n\
-s \"STRING\", -s only: No separator used (same as -s\"\"),\n\
without -s: Default separator \'TAB\' with -j and \'space\'\n\
otherwise (same as -s\" \")\n\
-t inhibit page headers and trailers\n\
-T inhibit page headers and trailers, eliminate any page\n\
-t, --omit-header inhibit page headers and trailers\n\
-T, --omit-pagination\n\
inhibit page headers and trailers, eliminate any page\n\
layout by form feeds set in input files\n\
-v use octal backslash notation\n\
-w PAGE_WIDTH set page width to PAGE_WIDTH (72) columns, truncate\n\
-v, --show-nonprinting\n\
use octal backslash notation\n\
-w, --width=PAGE_WIDTH\n\
set page width to PAGE_WIDTH (72) columns, truncate\n\
lines (see also -j option)\n\
--help display this help and exit\n\
--version output version information and exit\n\

2223
src/ptx.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -425,7 +425,7 @@ same_file (const char *file_1, const char *file_2)
/* Recursively remove all of the entries in the current directory.
Return an indication of the success of the operation. */
enum RM_status
static enum RM_status
remove_cwd_entries (const struct rm_options *x)
{
/* NOTE: this is static. */

View File

@@ -64,7 +64,7 @@ static struct option const longopts[] =
{
/* Don't name this `--force' because it's not close enough in meaning
to e.g. rm's -f option. */
{"ignore-fail-on-non-empty", no_argument, NULL, 13},
{"ignore-fail-on-non-empty", no_argument, NULL, CHAR_MAX + 1},
{"path", no_argument, NULL, 'p'},
{"parents", no_argument, NULL, 'p'},
@@ -163,7 +163,7 @@ main (int argc, char **argv)
case 'p':
empty_paths = 1;
break;
case 13:
case CHAR_MAX + 1:
ignore_fail_on_non_empty = 1;
break;
case 14:

View File

@@ -1,5 +1,5 @@
/* su for GNU. Run a shell with substitute user and group IDs.
Copyright (C) 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright (C) 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -170,9 +170,9 @@ static int change_environment;
static struct option const longopts[] =
{
{"command", required_argument, 0, 'c'},
{"fast", no_argument, &fast_startup, 1},
{"fast", no_argument, NULL, 'f'},
{"help", no_argument, &show_help, 1},
{"login", no_argument, &simulate_login, 1},
{"login", no_argument, NULL, 'l'},
{"preserve-environment", no_argument, &change_environment, 0},
{"shell", required_argument, 0, 's'},
{"version", no_argument, &show_version, 1},

View File

@@ -81,16 +81,16 @@
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#endif
#ifdef HAVE_ST_MTIM
#ifdef ST_MTIM_NSEC
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
#else
# define ST_TIME_CMP_NS(a, b, ns) 0
#endif
#define ST_TIME_CMP(a, b, s, ns) \
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.tv_nsec)
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.tv_nsec)
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.tv_nsec)
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
#if !defined(HAVE_MKFIFO)
# define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
@@ -129,20 +129,19 @@
# define CHAR_BIT 8
#endif
/* The extra casts work around common compiler bugs. */
/* The extra casts work around common compiler bugs,
e.g. Cray C 5.0.3.0 when t == time_t. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
It is necessary at least when t == time_t. */
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
#ifndef SCHAR_MIN
# define SCHAR_MIN TYPE_MINIMUM (char)
#ifndef CHAR_MIN
# define CHAR_MIN TYPE_MINIMUM (char)
#endif
#ifndef SCHAR_MAX
# define SCHAR_MAX TYPE_MAXIMUM (char)
#ifndef CHAR_MAX
# define CHAR_MAX TYPE_MAXIMUM (char)
#endif
#ifndef UCHAR_MAX

View File

@@ -132,11 +132,11 @@ static int show_version;
static struct option const long_options[] =
{
{"allow-missing", required_argument, NULL, 11},
{"allow-missing", required_argument, NULL, CHAR_MAX + 1},
{"bytes", required_argument, NULL, 'c'},
{"follow", no_argument, NULL, 'f'},
{"follow-descriptor", no_argument, NULL, 12},
{"follow-name", no_argument, NULL, 13},
{"follow-descriptor", no_argument, NULL, CHAR_MAX + 2},
{"follow-name", no_argument, NULL, CHAR_MAX + 3},
{"lines", required_argument, NULL, 'n'},
{"quiet", no_argument, NULL, 'q'},
{"silent", no_argument, NULL, 'q'},
@@ -1168,15 +1168,15 @@ parse_options (int argc, char **argv,
forever = 1;
break;
case 11:
case CHAR_MAX + 1:
allow_missing = 1;
break;
case 12:
case CHAR_MAX + 2:
follow_mode = follow_descriptor;
break;
case 13:
case CHAR_MAX + 3:
follow_mode = follow_name;
break;

View File

@@ -15,21 +15,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Options:
-a, --time={atime,access,use} Change access time only.
-c, --no-create Do not create files that do not exist.
-d, --date=TIME Specify time and date in various formats.
-f Ignored.
-m, --time={mtime,modify} Change modification time only.
-r, --reference=FILE Use the time and date of reference file FILE.
-t TIME Specify time and date in the form
`MMDDhhmm[[CC]YY][.ss]'.
If no options are given, -am is the default, using the current time.
The -r, -t, and -d options are mutually exclusive. If a file does not
exist, create it unless -c is given.
Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
/* Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
and Randy Smith. */
#include <config.h>
@@ -43,12 +29,12 @@
#include "argmatch.h"
#include "getdate.h"
#include "safe-read.h"
#include "posixtm.h"
#ifndef STDC_HEADERS
time_t time ();
#endif
time_t posixtime ();
int full_write ();
void invalid_arg ();
@@ -96,7 +82,7 @@ static int show_version;
static struct option const longopts[] =
{
{"time", required_argument, 0, 130},
{"time", required_argument, 0, CHAR_MAX + 1},
{"no-create", no_argument, 0, 'c'},
{"date", required_argument, 0, 'd'},
{"file", required_argument, 0, 'r'},
@@ -214,6 +200,8 @@ usage (int status)
else
{
printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);
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\
\n\
@@ -223,12 +211,14 @@ Update the access and modification times of each FILE to the current time.\n\
-f (ignored)\n\
-m change only the modification time\n\
-r, --reference=FILE use this file's times instead of current time\n\
-t STAMP use MMDDhhmm[[CC]YY][.ss] instead of current time\n\
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time\n\
--time=WORD access -a, atime -a, mtime -m, modify -m, use -a\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
STAMP may be used without -t if none of -drt, nor --, are used.\n\
Note that the three time-date formats recognized for the -d and -t options\n\
and for the obsolescent argument are all different.\n\
"));
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
close_stdout ();
@@ -288,13 +278,14 @@ main (int argc, char **argv)
case 't':
posix_date++;
newtime = posixtime (optarg);
newtime = posixtime (optarg,
PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS);
if (newtime == (time_t) -1)
error (1, 0, _("invalid date format `%s'"), optarg);
date_set++;
break;
case 130:
case CHAR_MAX + 1:
i = argmatch (optarg, time_args);
if (i < 0)
{
@@ -338,7 +329,7 @@ main (int argc, char **argv)
if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--"))
{
newtime = posixtime (argv[optind]);
newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
if (newtime != (time_t) -1)
{
optind++;

View File

@@ -162,7 +162,9 @@ usage (int status)
{
printf (_("Usage: %s [OPTION]... [ FILE ]\n"), program_name);
printf (_("\
Output who is currently logged in according to FILE.\n\
Print the current time, the length of time the system has been up,\n\
the number of users on the system, and the average number of jobs\n\
in the run queue over the last 1, 5 and 15 minutes.\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
\n\
--help display this help and exit\n\

287
tests/Fetish.pm Normal file
View File

@@ -0,0 +1,287 @@
package Fetish;
# This is a testing framework.
# In case you're wondering about the name, it comes from the
# names of the three packages: FIleutils, SH-utils, TExtutils.
require 5.003;
use strict;
use vars qw($VERSION @ISA @EXPORT);
use FileHandle;
use File::Compare qw(compare);
@ISA = qw(Exporter);
($VERSION = '$Revision: 1.3 $ ') =~ tr/[0-9].//cd;
@EXPORT = qw (run_tests);
my @Types = qw (IN OUT ERR EXIT PRE POST);
my %Types = map {$_ => 1} @Types;
my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT PRE POST);
my $srcdir = $ENV{srcdir};
my $Global_count = 1;
# A file spec: a scalar or a reference to a single-keyed hash
# ================
# 'contents' contents only (file name is derived from test name)
# {filename => 'contents'} filename and contents
# {filename => undef} filename only -- $(srcdir)/filename must exist
#
# FIXME: If there is more than one input file, the you can't specify REDIRECT.
# PIPE is still ok.
#
# I/O spec: a hash ref with the following properties
# ================
# - one key/value pair
# - the key must be one of these strings: IN, OUT, ERR, EXIT
# - the value must be a file spec
# {OUT => 'data'} put data in a temp file and compare it to stdout from cmd
# {OUT => {'filename'=>undef}} compare contents of existing filename to
# stdout from cmd
# {OUT => {'filename'=>[$CTOR, $DTOR]}} $CTOR and $DTOR are references to
# functions, each which is passed the single argument `filename'.
# $CTOR must create `filename'.
# DTOR may be omitted in which case `sub{unlink @_[0]}' is used.
# FIXME: implement this
# Ditto for `ERR', but compare with stderr
# {EXIT => N} expect exit status of cmd to be N
#
# There may be many input file specs. File names from the input specs
# are concatenated in order on the command line.
# There may be at most one of the OUT-, ERR-, and EXIT-keyed specs.
# If the OUT-(or ERR)-keyed hash ref is omitted, then expect no output
# on stdout (or stderr).
# If the EXIT-keyed one is omitted, then expect the exit status to be zero.
# FIXME: Make sure that no junkfile is also listed as a
# non-junkfile (i.e. with undef for contents)
sub _shell_quote ($)
{
my ($string) = @_;
$string =~ s/\'/\'\\\'\'/g;
return "'$string'";
}
sub _create_file ($$$$)
{
my ($program_name, $test_name, $file_name, $data) = @_;
my $file;
if (defined $file_name)
{
$file = $file_name;
}
else
{
$file = "$test_name.$Global_count";
++$Global_count;
}
# The test spec gave a string.
# Write it to a temp file and return tempfile name.
my $fh = new FileHandle "> $file";
die "$program_name: $file: $!\n" if ! $fh;
print $fh $data;
$fh->close || die "$program_name: $file: $!\n";
return $file;
}
# FIXME: cleanup on interrupt
# FIXME: extract `do_1_test' function
# FIXME: having to include $program_name here is an expedient kludge.
# Library code doesn't `die'.
sub run_tests ($$$$$)
{
my ($program_name, $prog, $t_spec, $save_temps, $verbose) = @_;
# Warn about empty t_spec.
# FIXME
# Remove all temp files upon interrupt.
# FIXME
# Verify that test names are distinct.
my $found_duplicate = 0;
my %seen;
my $t;
foreach $t (@$t_spec)
{
my $test_name = $t->[0];
if ($seen{$test_name})
{
warn "$program_name: $test_name: duplicate test name\n";
$found_duplicate = 1;
}
$seen{$test_name} = 1;
}
return 1 if $found_duplicate;
# FIXME check exit status
system ($prog, '--version');
my @junk_files;
my $fail = 0;
foreach $t (@$t_spec)
{
my $test_name = shift @$t;
my $expect = {};
my ($pre, $post);
# FIXME: maybe don't reset this.
$Global_count = 1;
my @args;
my $io_spec;
my %seen_type;
foreach $io_spec (@$t)
{
if (!ref $io_spec)
{
push @args, $io_spec;
next;
}
die "$program_name: $test_name: invalid test spec\n"
if ref $io_spec ne 'HASH';
my $n = keys %$io_spec;
die "$program_name: $test_name: spec has $n elements --"
. " expected 1\n"
if $n != 1;
my ($type, $val) = each %$io_spec;
die "$program_name: $test_name: invalid key `$type' in test spec\n"
if ! $Types{$type};
# Make sure there's no more than one of OUT, ERR, EXIT.
die "$program_name: $test_name: more than one $type spec\n"
if $Zero_one_type{$type} and $seen_type{$type}++;
if ($type eq 'PRE' or $type eq 'POST')
{
$expect->{$type} = $val;
next;
}
if ($type eq 'EXIT')
{
die "$program_name: $test_name: invalid EXIT code\n"
if $val !~ /^\d+$/;
# FIXME: make sure $data is numeric
$expect->{EXIT} = $val;
next;
}
my $file_spec = $val;
my ($file_name, $contents);
if (!ref $file_spec)
{
($file_name, $contents) = (undef, $file_spec);
}
elsif (ref $file_spec eq 'HASH')
{
my $n = keys %$file_spec;
die "$program_name: $test_name: $type spec has $n elements --"
. " expected 1\n"
if $n != 1;
($file_name, $contents) = each %$file_spec;
}
else
{
die "$program_name: $test_name: invalid RHS in $type-spec\n"
}
my $is_junk_file = (! defined $file_name
|| ($type eq 'IN' && defined $contents));
my $file = _create_file ($program_name, $test_name,
$file_name, $contents);
if ($type eq 'IN')
{
push @args, _shell_quote $file;
}
else
{
$expect->{$type} = $file;
}
if ($is_junk_file)
{
push @junk_files, $file
}
else
{
# FIXME: put $srcdir in here somewhere
warn "$program_name: $test_name: specified file `$file' does"
. " not exist\n"
if ! -f "$srcdir/$file";
}
}
# Expect an exit status of zero if it's not specified.
$expect->{EXIT} ||= 0;
# Allow ERR to be omitted -- in that case, expect no error output.
my $eo;
foreach $eo (qw (OUT ERR))
{
if (!exists $expect->{$eo})
{
$expect->{$eo} = _create_file ($program_name, $test_name,
undef, '');
push @junk_files, $expect->{$eo};
}
}
# FIXME: Does it ever make sense to specify a filename *and* contents
# in OUT or ERR spec?
warn "$test_name...\n" if $verbose;
&{$expect->{PRE}} if $expect->{PRE};
my %tmp;
$tmp{OUT} = "$test_name.O";
$tmp{ERR} = "$test_name.E";
push @junk_files, $tmp{OUT}, $tmp{ERR};
my @cmd = ($prog, @args, "> $tmp{OUT}", "2> $tmp{ERR}");
my $cmd_str = join ' ', @cmd;
warn "Running command: `$cmd_str'\n" if $verbose;
my $rc = 0xffff & system $cmd_str;
if ($rc == 0xff00)
{
warn "$program_name: test $test_name failed: command failed:\n"
. " `$cmd_str': $!\n";
$fail = 1;
goto cleanup;
}
$rc >>= 8 if $rc > 0x80;
if ($expect->{EXIT} != $rc)
{
warn "$program_name: test $test_name failed: exit status mismatch:"
. " expected $expect->{EXIT}, got $rc\n";
$fail = 1;
goto cleanup;
}
foreach $eo (qw (OUT ERR))
{
my $eo_lower = lc $eo;
if (compare ($expect->{$eo}, $tmp{$eo}))
{
warn "$program_name: test $test_name: std$eo_lower mismatch,"
. " comparing $expect->{$eo} and $tmp{$eo}\n";
$fail = 1;
}
}
cleanup:
&{$expect->{POST}} if $expect->{POST};
}
# FIXME: maybe unlink files inside the big foreach loop?
unlink @junk_files if ! $save_temps;
return $fail;
}
## package return
1;

View File

@@ -10,8 +10,8 @@ fi
framework_failure=0
$RM -f a a~ || framework_failure=1
: > a || framework_failure=1
echo a > a~ || framework_failure=1
echo a > a || framework_failure=1
echo a-tilde > a~ || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'

View File

@@ -51,6 +51,7 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do
case "$args" in *sl2*) ln -s foo sl2;; esac
(
(
# echo 1>&2 $CP $options $args
$CP $options $args 2>.err
echo $? $options
@@ -166,5 +167,8 @@ cat <<\EOF > $expected
EOF
# Uncomment this if you see a failure and want to try to diagnose it.
# diff -u $expected $actual 1>&2
cmp $expected $actual
exit $?

View File

@@ -1718,23 +1718,6 @@ else
esac
fi
test -s y.E || rm -f y.E
cat $srcdir/y.I | $xx -s -b4 > y.O 2> y.E
code=$?
if test $code != 1 ; then
$echo "Test y(|) failed: ../../src/cut return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp y.O $srcdir/y.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed y(|)"; fi ;;
1) $echo "Test y(|) failed: files y.O and $srcdir/y.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test y(|) may have failed." 1>&2;
$echo The command "cmp y.O $srcdir/y.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s y.E || rm -f y.E
$xx -s -b4 < $srcdir/y.I > y.O 2> y.E
code=$?
if test $code != 1 ; then
@@ -1769,23 +1752,6 @@ else
esac
fi
test -s z.E || rm -f z.E
cat $srcdir/z.I | $xx > z.O 2> z.E
code=$?
if test $code != 1 ; then
$echo "Test z(|) failed: ../../src/cut return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp z.O $srcdir/z.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed z(|)"; fi ;;
1) $echo "Test z(|) failed: files z.O and $srcdir/z.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test z(|) may have failed." 1>&2;
$echo The command "cmp z.O $srcdir/z.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s z.E || rm -f z.E
$xx < $srcdir/z.I > z.O 2> z.E
code=$?
if test $code != 1 ; then
@@ -1820,23 +1786,6 @@ else
esac
fi
test -s empty-fl.E || rm -f empty-fl.E
cat $srcdir/empty-fl.I | $xx -f '' > empty-fl.O 2> empty-fl.E
code=$?
if test $code != 1 ; then
$echo "Test empty-fl(|) failed: ../../src/cut return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp empty-fl.O $srcdir/empty-fl.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed empty-fl(|)"; fi ;;
1) $echo "Test empty-fl(|) failed: files empty-fl.O and $srcdir/empty-fl.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test empty-fl(|) may have failed." 1>&2;
$echo The command "cmp empty-fl.O $srcdir/empty-fl.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s empty-fl.E || rm -f empty-fl.E
$xx -f '' < $srcdir/empty-fl.I > empty-fl.O 2> empty-fl.E
code=$?
if test $code != 1 ; then
@@ -1871,23 +1820,6 @@ else
esac
fi
test -s missing-fl.E || rm -f missing-fl.E
cat $srcdir/missing-fl.I | $xx -f > missing-fl.O 2> missing-fl.E
code=$?
if test $code != 1 ; then
$echo "Test missing-fl(|) failed: ../../src/cut return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp missing-fl.O $srcdir/missing-fl.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed missing-fl(|)"; fi ;;
1) $echo "Test missing-fl(|) failed: files missing-fl.O and $srcdir/missing-fl.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test missing-fl(|) may have failed." 1>&2;
$echo The command "cmp missing-fl.O $srcdir/missing-fl.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s missing-fl.E || rm -f missing-fl.E
$xx -f < $srcdir/missing-fl.I > missing-fl.O 2> missing-fl.E
code=$?
if test $code != 1 ; then
@@ -1922,23 +1854,6 @@ else
esac
fi
test -s empty-bl.E || rm -f empty-bl.E
cat $srcdir/empty-bl.I | $xx -b '' > empty-bl.O 2> empty-bl.E
code=$?
if test $code != 1 ; then
$echo "Test empty-bl(|) failed: ../../src/cut return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp empty-bl.O $srcdir/empty-bl.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed empty-bl(|)"; fi ;;
1) $echo "Test empty-bl(|) failed: files empty-bl.O and $srcdir/empty-bl.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test empty-bl(|) may have failed." 1>&2;
$echo The command "cmp empty-bl.O $srcdir/empty-bl.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s empty-bl.E || rm -f empty-bl.E
$xx -b '' < $srcdir/empty-bl.I > empty-bl.O 2> empty-bl.E
code=$?
if test $code != 1 ; then
@@ -1973,23 +1888,6 @@ else
esac
fi
test -s missing-bl.E || rm -f missing-bl.E
cat $srcdir/missing-bl.I | $xx -b > missing-bl.O 2> missing-bl.E
code=$?
if test $code != 1 ; then
$echo "Test missing-bl(|) failed: ../../src/cut return code $code differs from expected value 1" 1>&2
errors=`expr $errors + 1`
else
cmp missing-bl.O $srcdir/missing-bl.X > /dev/null 2>&1
case $? in
0) if test "$VERBOSE" ; then $echo "passed missing-bl(|)"; fi ;;
1) $echo "Test missing-bl(|) failed: files missing-bl.O and $srcdir/missing-bl.X differ" 1>&2;
errors=`expr $errors + 1` ;;
2) $echo "Test missing-bl(|) may have failed." 1>&2;
$echo The command "cmp missing-bl.O $srcdir/missing-bl.X" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s missing-bl.E || rm -f missing-bl.E
$xx -b < $srcdir/missing-bl.I > missing-bl.O 2> missing-bl.E
code=$?
if test $code != 1 ; then
@@ -2314,7 +2212,7 @@ else
fi
test -s multichar-od.E || rm -f multichar-od.E
if test $errors = 0 ; then
$echo Passed all 135 tests. 1>&2
$echo Passed all 129 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi

View File

@@ -0,0 +1,12 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
EXTRA_DIST = $(TESTS) simple
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=dircolors
TESTS = run-test

221
tests/dircolors/Makefile.in Normal file
View File

@@ -0,0 +1,221 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
EXTRA_DIST = $(TESTS) simple
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=dircolors
TESTS = run-test
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
all: Makefile
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/dircolors/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/dircolors
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/dircolors/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; \
srcdir=$(srcdir); export srcdir; \
for tst in $(TESTS); do \
if test -f $$tst; then dir=.; \
else dir="$(srcdir)"; fi; \
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
all=`expr $$all + 1`; \
echo "PASS: $$tst"; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="$$failed of $$all tests failed"; \
fi; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
test "$$failed" -eq 0
info:
dvi:
check: all
$(MAKE) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
install-data:
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean
distclean: distclean-generic clean
-rm -f config.status
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: tags distdir check-TESTS info dvi installcheck install-exec \
install-data install uninstall all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

13
tests/dircolors/run-test Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
: ${PERL=perl}
: ${srcdir=.}
case "$PERL" in
*'missing perl')
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
exit 77
;;
esac
exec $PERL -w -I$srcdir/.. -MFetish -- $srcdir/simple

22
tests/dircolors/simple Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/perl -w
require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my @Tests =
(
['a', {IN => {k => "exec\n"}},
{ERR => "dircolors: k:1: invalid line; missing second token\n"},
{EXIT => 1}],
);
my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

1
tests/ls-2/.cvsignore Normal file
View File

@@ -0,0 +1 @@
Makefile

12
tests/ls-2/Makefile.am Normal file
View File

@@ -0,0 +1,12 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
EXTRA_DIST = $(TESTS) quoting
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=ls
TESTS = run-test

221
tests/ls-2/Makefile.in Normal file
View File

@@ -0,0 +1,221 @@
# Makefile.in generated automatically by automake 1.3 from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DISTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
DF_PROG = @DF_PROG@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
LIBOBJS = @LIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MVDIR_PROG = @MVDIR_PROG@
PACKAGE = @PACKAGE@
PERL = @PERL@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
YACC = @YACC@
l = @l@
EXTRA_DIST = $(TESTS) quoting
TESTS_ENVIRONMENT = \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="@PERL@" \
PATH=../../src:$$PATH \
PROG=ls
TESTS = run-test
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP = --best
all: Makefile
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/ls-2/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tests/ls-2
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/ls-2/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
check-TESTS: $(TESTS)
@failed=0; all=0; \
srcdir=$(srcdir); export srcdir; \
for tst in $(TESTS); do \
if test -f $$tst; then dir=.; \
else dir="$(srcdir)"; fi; \
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
all=`expr $$all + 1`; \
echo "PASS: $$tst"; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="$$failed of $$all tests failed"; \
fi; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
test "$$failed" -eq 0
info:
dvi:
check: all
$(MAKE) check-TESTS
installcheck:
install-exec:
@$(NORMAL_INSTALL)
install-data:
@$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
installdirs:
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(DISTCLEANFILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean: mostlyclean-generic
clean: clean-generic mostlyclean
distclean: distclean-generic clean
-rm -f config.status
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
.PHONY: tags distdir check-TESTS info dvi installcheck install-exec \
install-data install uninstall all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

40
tests/ls-2/quoting Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/perl -w
require 5.003;
use strict;
(my $program_name = $0) =~ s|.*/||;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
my $mkdir = {PRE => sub {mkdir 'd',0755 or die "d: $!\n"}};
my $rmdir = {POST => sub {rmdir 'd' or die "d: $!\n"}};
my $q_bell = {IN => {"q\a" => ''}};
my @Tests =
(
# test-name options input expected-output
#
['q-', $q_bell, {OUT => "q\a\n"}, {EXIT => 0}],
['q-N', '-N', $q_bell, {OUT => "q\a\n"}, {ERR => ''}],
['q-q', '-q', $q_bell, {OUT => "q?\n"}],
['q-Q', '-Q', $q_bell, {OUT => "\"q\\a\"\n"}],
['q-lit-q', '--quoting=literal -q', $q_bell, {OUT => "q?\n"}],
['q-qs-lit', '--quoting=literal', $q_bell, {OUT => "q\a\n"}],
['q-qs-sh', '--quoting=shell', $q_bell, {OUT => "q\a\n"}],
['q-qs-sh-a', '--quoting=shell-always', $q_bell, {OUT => "'q\a'\n"}],
['q-qs-c', '--quoting=c', $q_bell, {OUT => "\"q\\a\"\n"}],
['q-qs-esc', '--quoting=escape', $q_bell, {OUT => "q\\a\n"}],
['emptydir', 'd', {OUT => ''}, $mkdir, $rmdir],
['emptydir-x2', 'd d', {OUT => "d:\n\nd:\n"}, $mkdir, $rmdir],
['emptydir-R', '-R d', {OUT => "d:\n"}, $mkdir, $rmdir],
);
my $save_temps = $ENV{SAVE_TEMPS};
my $verbose = $ENV{VERBOSE};
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
exit $fail;

13
tests/ls-2/run-test Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
: ${PERL=perl}
: ${srcdir=.}
case "$PERL" in
*'missing perl')
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
exit 77
;;
esac
exec $PERL -w -I$srcdir/.. -MFetish -- $srcdir/quoting

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

View File

@@ -20,8 +20,8 @@ a2="$other_partition_tmpdir/a~"
framework_failure=0
$RM -f $a $a2 || framework_failure=1
: > $a || framework_failure=1
echo a > $a2 || framework_failure=1
echo a > $a || framework_failure=1
echo a2 > $a2 || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'

View File

@@ -1,4 +1,5 @@
#! /bin/sh
# Demonstrate how mv fails when it tries to move a directory into itself.
: ${MV=mv}
: ${MKDIR=mkdir}
@@ -20,13 +21,37 @@ if test $test_failure = 1; then
fi
fail=0
$MV $dir $file $dir || fail=1
# Make sure we get English translations.
LANGUAGE=C
export LANGUAGE
LC_ALL=C
export LC_ALL
LANG=C
export LANG
# This mv command should fail.
$MV $dir $file $dir > out 2>&1 && fail=1
sed \
-e "s,$MV:,XXX:," \
-e "s,$dir,SRC," \
-e "s,$dir/$dir,DEST," \
out > out2
cat > exp <<\EOF
XXX: cannot move `SRC' to a subdirectory of itself, `DEST'
EOF
cmp out2 exp || fail=1
# Make sure the file is gone.
test -f $file && fail=1
# Make sure the directory is *not* gone.
test -d $dir/$dir/a/b || fail=1
# Make sure the directory is *not* moved.
test -d $dir || fail=1
test -d $dir/$dir && fail=1
# Make sure the file has been moved to the right place.
test -f $dir/$file || fail=1
$RM -rf $dir $file
$RM -rf $dir $file out out2 exp
exit $fail

View File

@@ -7,8 +7,12 @@
: ${DF=df}
: ${MKDIR=mkdir}
# Try these
: ${CANDIDATE_TMP_DIRS="$TMPDIR /tmp /var/tmp /usr/tmp $HOME"}
: ${CANDIDATE_TMP_DIRS=not_set}
# Work around a bug in the way Ultrix4.3a's /bin/sh handles multi-word
# variables set with ${VAR="VALUE"}
test "$CANDIDATE_TMP_DIRS" = not_set \
&& CANDIDATE_TMP_DIRS="$TMPDIR /tmp /var/tmp /usr/tmp $HOME"
other_partition_tmpdir=

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

View File

@@ -15,7 +15,7 @@ tmp=$RM_TMPDIR/t-rm.$$
test_failure=0
mkdir $tmp || test_failure=1
: > $tmp/a || test_failure=1
echo > $tmp/a || test_failure=1
test -f $tmp/a || test_failure=1
if test $test_failure = 1; then

65
tests/stty/basic-1 Executable file
View File

@@ -0,0 +1,65 @@
#! /bin/sh
# Make sure stty can parse most of its options.
: ${STTY=stty}
if test "$VERBOSE" = yes; then
set -x
$RM --version
fi
# The following list of reversible options was generated with
# grep -w REV stty.c|sed -n '/^ {"/{s//REV_/;s/".*/=1/;p;}'|fmt
REV_parenb=1 REV_parodd=1 REV_hupcl=1 REV_hup=1 REV_cstopb=1 REV_cread=1
REV_clocal=1 REV_crtscts=1 REV_ignbrk=1 REV_brkint=1 REV_ignpar=1
REV_parmrk=1 REV_inpck=1 REV_istrip=1 REV_inlcr=1 REV_igncr=1 REV_icrnl=1
REV_ixon=1 REV_ixoff=1 REV_tandem=1 REV_iuclc=1 REV_ixany=1 REV_imaxbel=1
REV_opost=1 REV_olcuc=1 REV_ocrnl=1 REV_onlcr=1 REV_onocr=1 REV_onlret=1
REV_ofill=1 REV_ofdel=1 REV_isig=1 REV_icanon=1 REV_iexten=1 REV_echo=1
REV_echoe=1 REV_crterase=1 REV_echok=1 REV_echonl=1 REV_noflsh=1
REV_xcase=1 REV_tostop=1 REV_echoprt=1 REV_prterase=1 REV_echoctl=1
REV_ctlecho=1 REV_echoke=1 REV_crtkill=1 REV_evenp=1 REV_parity=1
REV_oddp=1 REV_nl=1 REV_cooked=1 REV_raw=1 REV_pass8=1 REV_litout=1
REV_cbreak=1 REV_decctlq=1 REV_tabs=1 REV_lcase=1 REV_LCASE=1
saved_state=.saved-state
$STTY --save > $saved_state || exit 1
trap "status=$?; $STTY `cat $saved_state`; exit $status" 0 1 2 3 15
$STTY `cat $saved_state` || exit 1
# Build a list of all boolean options stty accepts on this system.
options=`stty -a|tail +2|tr ';' '\012'|sed '/ = /d;s/^ //'|tr -s ' -' '\012'`
# Take them one at a time, with and without the leading `-'.
for opt in $options; do
$STTY $opt || exit 1
rev=`eval echo "\\\$REV_$opt"`
if test -n "$rev"; then
$STTY -$opt || exit 1
fi
done
if test -n "$RUN_LONG_TESTS"; then
# Take them in pairs.
for opt1 in $options; do
echo .|tr -d '\012'
for opt2 in $options; do
$STTY $opt1 $opt2 || exit 1
rev1=`eval echo "\\\$REV_$opt1"`
rev2=`eval echo "\\\$REV_$opt2"`
if test -n "$rev1"; then
$STTY -$opt1 $opt2 || exit 1
fi
if test -n "$rev2"; then
$STTY $opt1 -$opt2 || exit 1
fi
if test "$rev1$rev2" = 11; then
$STTY -$opt1 -$opt2 || exit 1
fi
done
done
fi
exit 0

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

View File

@@ -12,6 +12,11 @@ if test "$VERBOSE" = yes; then
$TOUCH --version
fi
DEFAULT_SLEEP_SECONDS=2
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}
fail=0
# FIXME: find writable directories on other partitions
# and run the test in those directories, too.
@@ -32,14 +37,14 @@ if test $framework_failure = 1; then
exit 1
fi
sleep 2
sleep $SLEEP_SECONDS
for d in $TOUCH_DIR_LIST; do
$TOUCH $d/a || fail=1
set x `$LS -t $d/a $d/b`
test "$*" = "x $d/a $d/b" || fail=1
done
sleep 2
sleep $SLEEP_SECONDS
for d in $TOUCH_DIR_LIST; do
$TOUCH $d/b
set x `$LS -t $d/a $d/b`
@@ -48,4 +53,14 @@ for d in $TOUCH_DIR_LIST; do
$RM -rf $d/a $d/b
done
if test $fail != 0; then
cat 1>&2 <<EOF
*** This test has just failed. That can happen when the test is run in an
*** NFS-mounted directory on a system whose clock is not well synchronized
*** with that of the NFS server. If you think that is the reason, set the
*** environment variable SLEEP_SECONDS to some number of seconds larger than
*** the default of $DEFAULT_SLEEP_SECONDS and rerun the test.
EOF
fi
exit $fail

View File

@@ -4,7 +4,6 @@
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A

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