Compare commits

...

174 Commits

Author SHA1 Message Date
Jim Meyering
731cbc77fb . 1997-01-03 05:05:45 +00:00
Jim Meyering
2bd16e646e . 1997-01-03 03:24:22 +00:00
Jim Meyering
7f2c13e703 . 1997-01-03 03:20:24 +00:00
Jim Meyering
635a7c3186 (init_fps): Initialize lines_stored field in three places.
This avoids uninitialized memory reads in close_file.
1997-01-03 03:20:14 +00:00
Jim Meyering
42d1927306 . 1997-01-03 03:16:59 +00:00
Jim Meyering
ba246b0f36 (EXTRA_DIST): Add getgroups.c. 1997-01-03 03:16:29 +00:00
Jim Meyering
13ff080b78 . 1997-01-02 03:13:49 +00:00
Jim Meyering
06a5782edd . 1997-01-02 02:21:58 +00:00
Jim Meyering
12f377da25 . 1997-01-01 23:35:31 +00:00
Jim Meyering
c423a2d74a . 1996-12-31 16:18:06 +00:00
Jim Meyering
04a1a572f4 . 1996-12-30 05:45:23 +00:00
Jim Meyering
1ba3bd3896 (init_header): Plug a small memory leak by using stack
rather than heap for a 15-byte temporary buffer.
1996-12-30 05:43:58 +00:00
Jim Meyering
fb59a28b16 . 1996-12-30 04:11:13 +00:00
Jim Meyering
ab48b17dca . 1996-12-29 20:34:21 +00:00
Jim Meyering
d2ca2163c6 . 1996-12-29 03:47:51 +00:00
Jim Meyering
5ae342e1a9 Two problems fixed by these changes from Joakim Rosqvist.
Quoting Joakim:
1) The "total" number and the size of the first file as
output from 'ls --color -s' did not get colorized according
to the "no"-argument in LS_COLORS. Fixed by adding a function
prep_non_filename_text which prints the C_LEFT C_NORM C_RIGHT
strings (or C_END). It is called from main before any text is
output, and from print_name_with_quoting after having output a
colorized filename.
2) If the "no"-argument of LS_COLORS is set, the terminal will be
set to print in that color after ls exits. The man-pages suggests
setting "no" and "fi" to the terminals default colors to avoid
the problem, but that would mean I can't use anything but the
default color for regular files and non-filename text. Fixed by
outputting C_LEFT immediately followed by C_RIGHT right before
exit, which restores the default color.
1996-12-29 03:47:34 +00:00
Jim Meyering
6c635d1f27 . 1996-12-29 01:48:20 +00:00
Jim Meyering
42640f71df Correct obsolete comment referring to macro that is now ls_mode. 1996-12-28 20:32:39 +00:00
Jim Meyering
0b83b3090b . 1996-12-28 16:04:01 +00:00
Jim Meyering
4b583d1691 . 1996-12-28 13:30:51 +00:00
Jim Meyering
a182aa4e5a . 1996-12-28 06:27:35 +00:00
Jim Meyering
22ca9b17a5 . 1996-12-28 06:07:39 +00:00
Jim Meyering
04916b80de . 1996-12-28 06:06:51 +00:00
Jim Meyering
d7d7ae76b2 . 1996-12-28 06:05:51 +00:00
Jim Meyering
da7809f65c (TAB_WIDTH): Cleaned up definition and renamed from tab_width.
(POS_AFTER_TAB): Cleaned up definition and renamed from pos_after_tab.
1996-12-28 06:04:36 +00:00
Jim Meyering
b7d3a68ce5 . 1996-12-28 05:34:01 +00:00
Jim Meyering
8794c292e7 Fix a couple of thinkos and typos.
Now it works with pr's tests, too.
1996-12-28 05:30:46 +00:00
Jim Meyering
ece3b1d144 . 1996-12-28 05:27:53 +00:00
Jim Meyering
8087dd5668 Regenerate list of explicit files, this time with duplicates removed. 1996-12-28 05:27:25 +00:00
Jim Meyering
1a622aa2d9 . 1996-12-28 05:15:56 +00:00
Jim Meyering
1ea9952168 . 1996-12-28 05:14:37 +00:00
Jim Meyering
4df74fe308 . 1996-12-28 05:12:09 +00:00
Jim Meyering
68545c98ed . 1996-12-28 04:58:34 +00:00
Jim Meyering
4650315342 Indent cpp directives. 1996-12-28 04:58:26 +00:00
Jim Meyering
fbfde91f6a [!WTMP_FILE]: Provide default path.
(UTMP_FILE) [UTMPX_FILE]: Use UTMPX_FILE in favor of UTMP_FILE.
Patch from Kaveh R. Ghazi.
1996-12-28 04:44:35 +00:00
Jim Meyering
e3f1d80dd9 Rewrite the test so that systems lacking
getgroups don't try to use the supplied replacement function --
that depends on the existence of such a function.
1996-12-28 02:59:25 +00:00
Jim Meyering
5e58599e6e (usage): Break long string literal into two separate
printf statements to accomodate default maximum of 2048 characters
for Irix-4.0.5.  Reported by Kaveh Ghazi.
1996-12-28 02:28:56 +00:00
Jim Meyering
c22036ab86 . 1996-12-28 00:22:01 +00:00
Jim Meyering
34ffd87f30 Make 'em arrays of references, not arrays of arrays. 1996-12-28 00:19:56 +00:00
Jim Meyering
cea704d6da . 1996-12-28 00:11:07 +00:00
Jim Meyering
ddf8459662 . 1996-12-27 23:31:41 +00:00
Jim Meyering
8320e65164 Add comment.
Rename local, ng to n_groups.
1996-12-27 03:36:53 +00:00
Jim Meyering
f42460fb09 . 1996-12-24 19:28:22 +00:00
Jim Meyering
24a118665e . 1996-12-23 23:58:14 +00:00
Jim Meyering
3bcffe04d7 revert last change 1996-12-23 23:57:56 +00:00
Jim Meyering
79523152dd remove support for --string option 1996-12-23 23:57:09 +00:00
Jim Meyering
35aaa568cd . 1996-12-23 05:59:33 +00:00
Jim Meyering
85da146bd2 . 1996-12-23 05:59:12 +00:00
Jim Meyering
ae8ee650ea . 1996-12-23 05:46:00 +00:00
Jim Meyering
4a11d01711 . 1996-12-23 05:41:42 +00:00
Jim Meyering
f76a4b618e . 1996-12-23 05:41:19 +00:00
Jim Meyering
c8c91b5e20 . 1996-12-23 05:33:05 +00:00
Jim Meyering
70155d8013 (EXTRA_DIST): Add README. 1996-12-23 05:31:46 +00:00
Jim Meyering
af14a04c19 . 1996-12-23 05:26:10 +00:00
Jim Meyering
6e62afaaed . 1996-12-23 05:15:44 +00:00
Jim Meyering
9190f77006 . 1996-12-23 05:14:55 +00:00
Jim Meyering
5d845a1678 . 1996-12-22 19:09:49 +00:00
Jim Meyering
f6c32178c7 . 1996-12-22 14:20:27 +00:00
Jim Meyering
ff5cd3f6a3 . 1996-12-22 14:18:09 +00:00
Jim Meyering
b3d8117527 . 1996-12-22 14:17:20 +00:00
Jim Meyering
103713c42b . 1996-12-22 14:15:37 +00:00
Jim Meyering
c84fb64144 . 1996-12-22 14:14:01 +00:00
Jim Meyering
8e02fb10ab Use same framework as other tests. 1996-12-22 14:12:06 +00:00
Jim Meyering
1b47ed2714 Use test_vector, not array @t. 1996-12-22 14:09:10 +00:00
Jim Meyering
dcd02c8008 Use test_vector, not array @t. 1996-12-22 14:04:47 +00:00
Jim Meyering
a80c49322b . 1996-12-22 03:32:51 +00:00
Jim Meyering
3982e9cdf8 . 1996-12-22 03:30:23 +00:00
Jim Meyering
a5b6fae599 . 1996-12-22 03:25:05 +00:00
Jim Meyering
b660d78cf5 . 1996-12-22 03:24:25 +00:00
Jim Meyering
c86883a62a . 1996-12-22 03:03:48 +00:00
Jim Meyering
e36197cd8f . 1996-12-22 02:51:34 +00:00
Jim Meyering
2185c1f3d8 Clone the Makefile.am from join-test.
Replace only the definition of $x and the auto-generated lists of test files.
1996-12-22 02:51:17 +00:00
Jim Meyering
48a76e855c Clone the Makefile.am from join-test.
Replace only the definition of $x and the auto-generated lists of test files.
1996-12-22 02:50:34 +00:00
Jim Meyering
19b5a4f761 Clone the Makefile.am from join-test.
Replace only the definition of $x and the auto-generated lists of
test files.
1996-12-22 02:50:15 +00:00
Jim Meyering
9dbd283b1e use 77 as max line len when wrapping 1996-12-22 02:46:14 +00:00
Jim Meyering
4376f9f2ce . 1996-12-22 02:44:12 +00:00
Jim Meyering
37fea371b7 . 1996-12-22 02:34:14 +00:00
Jim Meyering
bb02f48670 . 1996-12-22 02:33:17 +00:00
Jim Meyering
64cd458e0a Add @MAINT@-protected rule for verifying that Makefile.am is
consistent with Test.pm.
1996-12-22 02:32:56 +00:00
Jim Meyering
bc9aded4b9 . 1996-12-22 02:32:01 +00:00
Jim Meyering
a611c6cbf6 (wrap): New function.
Use it.
1996-12-21 22:16:03 +00:00
Jim Meyering
68c33eea03 . 1996-12-21 18:49:14 +00:00
Jim Meyering
fec6a430da update from GNU libc 1996-12-21 13:51:26 +00:00
Jim Meyering
1266fc26ee . 1996-12-21 04:21:29 +00:00
Jim Meyering
41a41dd48e Replace hard-coded /etc/wtmp with WTMP_FILE. Suggestion from Eivind. 1996-12-21 04:14:45 +00:00
Jim Meyering
e59e2e803c . 1996-12-21 04:14:24 +00:00
Jim Meyering
52c7e3147e . 1996-12-21 04:09:35 +00:00
Jim Meyering
8829551700 . 1996-12-21 04:09:07 +00:00
Jim Meyering
e95fe088e1 (usage): Say that UTMP_FILE is the default FILE
rather than hard-coding /etc/utmp.
1996-12-21 04:08:25 +00:00
Jim Meyering
e13281014a (usage): Tweak --usage text. 1996-12-21 03:59:26 +00:00
Jim Meyering
aac56cabe4 . 1996-12-21 03:43:47 +00:00
Jim Meyering
df5f33a5bf . 1996-12-21 03:32:03 +00:00
Jim Meyering
0799786a33 . 1996-12-21 03:21:34 +00:00
Jim Meyering
6621f0a9a9 . 1996-12-21 03:20:48 +00:00
Jim Meyering
d5b9b29ac6 . 1996-12-21 03:15:44 +00:00
Jim Meyering
022a19b21f . 1996-12-21 02:03:14 +00:00
Jim Meyering
12133d7f01 . 1996-12-21 01:59:01 +00:00
Jim Meyering
58dfd6b442 copied from automake-1.1l 1996-12-21 01:56:50 +00:00
Jim Meyering
5fc47138b1 broken out of ../acinclude.m4 1996-12-21 01:50:50 +00:00
Jim Meyering
4a2b289e7c Update from GNU libc. 1996-12-21 01:40:43 +00:00
Jim Meyering
bab072f3aa . 1996-12-21 01:29:41 +00:00
Jim Meyering
8679e372cd . 1996-12-20 06:13:37 +00:00
Jim Meyering
b0690ba414 . 1996-12-20 06:11:59 +00:00
Jim Meyering
ed354b6490 (MAINTAINERCLEANFILES): Use $(in1) and $(in2), not $(in). 1996-12-20 06:11:50 +00:00
Jim Meyering
81d1fa5cb6 New option: --list. Generate lists of files used/generated. 1996-12-20 06:09:45 +00:00
Jim Meyering
421e75544b . 1996-12-20 05:48:34 +00:00
Jim Meyering
7466f41075 . 1996-12-20 05:46:47 +00:00
Jim Meyering
1e7d4b9c70 Adapted for new mk-script.pl. 1996-12-20 05:46:27 +00:00
Jim Meyering
6a13b75511 . 1996-12-20 05:45:24 +00:00
Jim Meyering
ebefd435aa . 1996-12-20 05:41:43 +00:00
Jim Meyering
b3335ab809 remove $nl. 1996-12-20 05:35:26 +00:00
Jim Meyering
d293e5f03c Adapted for new mk-script.pl. 1996-12-20 05:35:01 +00:00
Jim Meyering
0a470f01de Rewrite to be more general -- so it can be used for join, cut, sort, tr,
and soon, pr test suites.
1996-12-20 05:33:17 +00:00
Jim Meyering
b181d31372 . 1996-12-20 03:40:34 +00:00
Jim Meyering
b3a49ee8d0 . 1996-12-19 13:53:16 +00:00
Jim Meyering
35b886ad7b . 1996-12-19 05:21:47 +00:00
Jim Meyering
cecde31171 (ORPHAN): By default, color orphans red on a black background. 1996-12-19 05:21:40 +00:00
Jim Meyering
ae6c43a3ab (usage): Remove --print-data-base.
Now only --print-database remains.  Although it wasn't documented,
--print-data-base was still accepted.  But it made `--p', `--print',
`--print-data', etc. ambiguous.
1996-12-19 05:20:06 +00:00
Jim Meyering
17432bd066 . 1996-12-19 05:16:03 +00:00
Jim Meyering
c835f92a61 (gobble_file): Stat symlinks also when printing with
color and set linkok to reflect existence of referent.
Patches from Joakim Rosqvist, James Antill, and Jesse Thilo.
1996-12-19 05:15:34 +00:00
Jim Meyering
89b765e32c . 1996-12-19 05:14:59 +00:00
Jim Meyering
3752e13942 . 1996-12-19 04:23:21 +00:00
Jim Meyering
858afc04d2 [HAVE_PATHS_H]: Include <paths.h>.
[_PATH_DEFPATH]: Use this to define DEFAULT_LOGIN_PATH.
[_PATH_DEFPATH_ROOT]: Use this to define DEFAULT_ROOT_LOGIN_PATH.
From Rik Faith.
1996-12-19 04:20:53 +00:00
Jim Meyering
5fecd9e4d5 . 1996-12-19 02:35:10 +00:00
Jim Meyering
ae5ee331f1 run cpp-indent 1996-12-18 16:56:46 +00:00
Jim Meyering
954c7bc4cc another new version ... 1996-12-18 16:54:48 +00:00
Jim Meyering
625dc74361 . 1996-12-18 13:57:32 +00:00
Jim Meyering
b26beb4996 . 1996-12-18 13:53:00 +00:00
Jim Meyering
0b3d661480 in progress... 1996-12-18 05:29:52 +00:00
Jim Meyering
33448d128a . 1996-12-18 03:30:59 +00:00
Jim Meyering
b3ef6f599d . 1996-12-18 03:30:30 +00:00
Jim Meyering
72f95044eb (ISDIGIT): Replace with smaller, faster edition
that yields nonzero only on ASCII digits.
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
used to have.  From Paul Eggert.
1996-12-18 03:30:20 +00:00
Jim Meyering
859f8587f8 add blank line. 1996-12-18 03:28:09 +00:00
Jim Meyering
24e15328df . 1996-12-18 03:23:08 +00:00
Jim Meyering
357c53621f (ISDIGIT): Replace with smaller, faster edition
that yields nonzero only on ASCII digits.
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
used to have.  From Paul Eggert.
1996-12-18 03:22:56 +00:00
Jim Meyering
fd688bcc5f . 1996-12-18 03:14:58 +00:00
Jim Meyering
e8c6c8175b . 1996-12-18 03:13:27 +00:00
Jim Meyering
561e4c139e (ROOT_CHOWN_AFFECTS_SYMLINKS): New macro.
(DO_CHOWN): Take an additional parameter.
(LINK_CHOWN): Remove macro.
(copy): When preserving owner and group of a symlink, use
chown only if ROOT_CHOWN_AFFECTS_SYMLINKS and EUID == 0.
Otherwise, the chown would affect the file referenced through the symlink.
1996-12-18 03:13:09 +00:00
Jim Meyering
507288d2c7 . 1996-12-18 01:25:50 +00:00
Jim Meyering
6c47524481 (.pl): Make generated file read-only so
I don't accidentally modify it instead of the one with the .pl suffix.
1996-12-18 01:25:45 +00:00
Jim Meyering
300c151b8b . 1996-12-18 01:22:32 +00:00
Jim Meyering
3c7e9fec08 Update from GNU libc. 1996-12-18 00:21:38 +00:00
Jim Meyering
7235fb47cc . 1996-12-17 23:07:15 +00:00
Jim Meyering
8ef2abf7e9 . 1996-12-17 22:44:57 +00:00
Jim Meyering
5e55e49972 . 1996-12-17 21:54:29 +00:00
Jim Meyering
48a255beb0 . 1996-12-17 05:05:45 +00:00
Jim Meyering
17a2ec94a8 . 1996-12-16 00:40:55 +00:00
Jim Meyering
e7f8503138 . 1996-12-16 00:39:25 +00:00
Jim Meyering
f789ddbdda . 1996-12-15 22:17:29 +00:00
Jim Meyering
1f1bd53b86 . 1996-12-15 20:36:59 +00:00
Jim Meyering
3a2afe3311 apply spec_to_list to expected file, too. 1996-12-15 20:35:32 +00:00
Jim Meyering
20b960db10 . 1996-12-15 20:29:09 +00:00
Jim Meyering
8fd3e8664b (spec_to_list): New function -- factored out... 1996-12-15 20:27:12 +00:00
Jim Meyering
1b25f1c2cd begin generalization -- now it works with two-file input-specs 1996-12-15 20:09:13 +00:00
Jim Meyering
8569e32ec8 . 1996-12-15 20:07:24 +00:00
Jim Meyering
1321f30e73 . 1996-12-14 20:58:17 +00:00
Jim Meyering
290ee99712 . 1996-12-14 05:24:48 +00:00
Jim Meyering
3008ad90f4 twiddle FSF address in comment. 1996-12-14 05:23:41 +00:00
Jim Meyering
8c5b30bc1e (get_format_width, get_format_prec): Avoid
unnecessary comparison of digit to '\0'.
1996-12-14 05:22:46 +00:00
Jim Meyering
f0fa287b4f (digits): Remove; subsumed by new ISDIGIT.
(inittables): Remove initialization of `digits'.
(fraccompare, numcompare, main): Use ISDIGIT (x) instead of digits[x].
(fraccompare, numcompare): Avoid casts to unsigned char that are no
longer needed.
1996-12-14 05:22:17 +00:00
Jim Meyering
4ecb3b28f1 (is_char_class_member): Use ISDIGIT_LOCALE instead of
ISDIGIT to test for characters in CC_DIGIT class.
1996-12-14 05:21:51 +00:00
Jim Meyering
ea93e0b7ad . 1996-12-13 23:41:12 +00:00
Jim Meyering
7603401c86 . 1996-12-13 05:43:35 +00:00
Jim Meyering
90d97b9703 (usage): Clarify description of -u option.
From Karl Berry.
1996-12-13 05:43:26 +00:00
Jim Meyering
4091022393 . 1996-12-13 04:35:00 +00:00
Jim Meyering
338061e307 . 1996-12-13 03:43:44 +00:00
Jim Meyering
6a99b4cc40 . 1996-12-13 03:07:23 +00:00
Jim Meyering
86d6c36d09 (IN_CTYPE_DOMAIN): Rename from ISASCII.
(ISDIGIT): New definition from Paul Eggert.
This one evaluates its argument exactly once.
(yylex): Move increment out of ISALPHA argument.  Use a
comma-expression instead.
1996-12-13 03:05:00 +00:00
Jim Meyering
a7f5043de8 (usage): Update bug-reporting address. 1996-12-13 02:47:33 +00:00
Jim Meyering
5110583f3e . 1996-12-13 02:47:22 +00:00
Jim Meyering
813c8e8bb6 .. 1996-12-12 13:19:43 +00:00
Jim Meyering
7d72c942bb . 1996-12-12 01:34:44 +00:00
Jim Meyering
f17cc2e29c . 1996-12-12 01:34:08 +00:00
Jim Meyering
4f4111709c . 1996-12-12 01:33:13 +00:00
239 changed files with 22566 additions and 760 deletions

View File

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

6
THANKS
View File

@@ -4,10 +4,14 @@ The rest of the addresses are still in the ChangeLog.
Bauke Jan Douma: bjdouma@xs4all.nl
Charles Karney: karney@pppl.gov
Emile LeBlanc: leblanc@math.toronto.edu
James Antill: jmanti%essex.ac.uk@seralph21.essex.ac.uk
Jesse Thilo: jgt2@eecs.lehigh.edu
Joakim Rosqvist: dvljrt@cs.umu.se
Marcus Daniels: marcus@sysc.pdx.edu
Mark A. Thomas: thommark@access.digex.net
Miles Bader: miles@gnu.ai.mit.edu
Peter Eriksson: peter@ifm.liu.se
Santiago Vila Doncel: sanvila@ctv.es
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
Tony Leneis: tony@plaza.ds.adp.com
Wayne Stewart: wstewa@atl.com

View File

@@ -181,7 +181,7 @@ clean-info:
distclean-info:
maintainer-clean-info:
for i in $(INFO_DEPS); do rm `eval echo $$i*`; done
for i in $(INFO_DEPS); do rm -f `eval echo $$i*`; done
tags: TAGS
TAGS:

View File

@@ -3,7 +3,7 @@ noinst_LIBRARIES = libfu.a
## FIXME: Remove mvdir.c, and rmdir.c when
## automake is fixed -- probably for 1.1g
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
INCLUDES = -I.. -I$(srcdir) -I../intl

View File

@@ -49,7 +49,7 @@ RM = @RM@
noinst_LIBRARIES = libfu.a
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c
EXTRA_DIST = mkdir.c rmdir.c getline.c mktime.c strftime.c getgroups.c
INCLUDES = -I.. -I$(srcdir) -I../intl
@@ -94,11 +94,10 @@ HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in alloca.c basename.c error.c \
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
getdate.c getline.c getloadavg.c group-member.c interlock memcmp.c \
getdate.c getgroups.c getline.c group-member.c interlock memcmp.c \
memcpy.c memset.c mkdir.c mktime.c mountlist.c obstack.c obstack.h \
posixtm.c regex.c regex.h rename.c rmdir.c rpmatch.c rx.c rx.h stpcpy.c \
strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c strtoul.c \
ylwrap
strcasecmp.c strdup.c strndup.c strstr.c strtol.c strtoul.c ylwrap
PACKAGE = @PACKAGE@
@@ -111,18 +110,18 @@ TAR = tar
DEP_FILES = .deps/alloca.P .deps/argmatch.P .deps/backupfile.P \
.deps/basename.P .deps/dirname.P .deps/error.P .deps/euidaccess.P \
.deps/fileblocks.P .deps/filemode.P .deps/fnmatch.P .deps/fsusage.P \
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getline.P \
.deps/getloadavg.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \
.deps/ftruncate.P .deps/full-write.P .deps/getdate.P .deps/getgroups.P \
.deps/getline.P .deps/getopt.P .deps/getopt1.P .deps/getversion.P \
.deps/group-member.P .deps/idcache.P .deps/isdir.P .deps/long-options.P \
.deps/makepath.P .deps/memcmp.P .deps/memcpy.P .deps/memset.P \
.deps/mkdir.P .deps/mktime.P .deps/modechange.P .deps/mountlist.P \
.deps/obstack.P .deps/path-concat.P .deps/posixtm.P .deps/regex.P \
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/rx.P \
.deps/safe-read.P .deps/save-cwd.P .deps/savedir.P .deps/stpcpy.P \
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
.deps/userspec.P .deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P \
.deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
.deps/strcasecmp.P .deps/strdup.P .deps/stripslash.P .deps/strndup.P \
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/userspec.P \
.deps/xgetcwd.P .deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P \
.deps/xstrtoul.P .deps/yesno.P
SOURCES = $(libfu_a_SOURCES)
OBJECTS = $(libfu_a_OBJECTS)

View File

@@ -68,8 +68,17 @@ char *malloc ();
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISDIGIT(c) (IN_CTYPE_DOMAIN ((unsigned char) (c)) \
&& isdigit ((unsigned char) (c)))
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#if defined (HAVE_UNISTD_H)
#include <unistd.h>

View File

@@ -34,16 +34,26 @@
#include <stdio.h>
#include <ctype.h>
#if defined (STDC_HEADERS) || !defined (isascii)
# define ISASCII(c) 1
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
#else
# define ISASCII(c) isascii(c)
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
#define ISSPACE(c) (ISASCII (c) && isspace (c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c))
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#if defined (vms)
#include <types.h>
@@ -902,7 +912,7 @@ yylex ()
return sign ? tSNUMBER : tUNUMBER;
}
if (ISALPHA (c)) {
for (p = buff; ISALPHA (c = *yyInput++) || c == '.'; )
for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.'; )
if (p < &buff[sizeof buff - 1])
*p++ = c;
*p = '\0';

59
lib/getgroups.c Normal file
View File

@@ -0,0 +1,59 @@
/* provide consistent interface to getgroups for systems that don't allow N==0
Copyright (C) 1996 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* written by Jim Meyering */
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
char *xmalloc ();
/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, 0) always fails.
On other systems, it returns the number of supplemental groups for the
process is returned.
This function handles that special case and lets the system-
provided function handle all others. */
int
getgroups (n, group)
size_t n;
GETGROUPS_T *group;
{
int n_groups;
GETGROUPS_T *gbuf;
#undef getgroups
if (n != 0)
return getgroups (n, group);
n = 20;
gbuf = NULL;
while (1)
{
gbuf = (GETGROUPS_T *) xrealloc (gbuf, n * sizeof (GETGROUPS_T));
n_groups = getgroups (n, gbuf);
if (n_groups < n)
break;
n += 10;
}
free (gbuf);
return n_groups;
}

View File

@@ -28,12 +28,15 @@
# define HAVE_STRUCT_ERA_ENTRY 1
# define HAVE_TM_GMTOFF 1
# define HAVE_TM_ZONE 1
# define HAVE_TZNAME 1
# define HAVE_TZSET 1
# define MULTIBYTE_IS_FORMAT_SAFE 1
# define STDC_HEADERS 1
# include <ansidecl.h>
# include "../locale/localeinfo.h"
#endif
#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
#ifdef TIME_WITH_SYS_TIME
@@ -46,7 +49,6 @@
# include <time.h>
# endif
#endif
#if HAVE_TZNAME
extern char *tzname[];
#endif
@@ -80,27 +82,31 @@ extern char *tzname[];
# include <stdlib.h>
# include <string.h>
#else
# define memcpy(d, s, n) bcopy (s, d, n)
# define memcpy(d, s, n) bcopy ((s), (d), (n))
#endif
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
#define __P(args) args
#else
#define __P(args) ()
#endif /* GCC. */
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
# else
# define __P(args) ()
# endif /* GCC. */
#endif /* Not __P. */
#ifndef PTR
#ifdef __STDC__
#define PTR void *
#else
#define PTR char *
#endif
# ifdef __STDC__
# define PTR void *
# else
# define PTR char *
# endif
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
# define CHAR_BIT 8
#endif
#ifndef NULL
# define NULL 0
#endif
#define TYPE_SIGNED(t) ((t) -1 < 0)
@@ -118,7 +124,7 @@ extern char *tzname[];
#ifndef __isleap
/* Nonzero if YEAR is a leap year (every 4 years,
except every 100th isn't, and every 400th is). */
#define __isleap(year) \
# define __isleap(year) \
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
#endif
@@ -126,11 +132,14 @@ extern char *tzname[];
#ifdef _LIBC
# define gmtime_r __gmtime_r
# define localtime_r __localtime_r
extern int __tz_compute __P ((time_t timer, const struct tm *tm));
# define tzname __tzname
# define tzset __tzset
#else
# if ! HAVE_LOCALTIME_R
# if ! HAVE_TM_GMTOFF
/* Approximate gmtime_r as best we can in its absence. */
#define gmtime_r my_gmtime_r
# define gmtime_r my_gmtime_r
static struct tm *gmtime_r __P ((const time_t *, struct tm *));
static struct tm *
gmtime_r (t, tp)
@@ -146,7 +155,7 @@ gmtime_r (t, tp)
# endif /* ! HAVE_TM_GMTOFF */
/* Approximate localtime_r as best we can in its absence. */
#define localtime_r my_localtime_r
# define localtime_r my_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));
static struct tm *
localtime_r (t, tp)
@@ -163,20 +172,95 @@ localtime_r (t, tp)
#endif /* ! defined (_LIBC) */
#define add(n, f) \
#if !defined (memset) && !defined (HAVE_MEMSET) && !defined (_LIBC)
/* Some systems lack the `memset' function and we don't want to
introduce additional dependencies. */
static const char spaces[16] = " ";
# define memset_space(P, Len) \
do { \
int _len = (Len); \
\
do \
{ \
int _this = _len > 16 ? 16 : _len; \
memcpy ((P), spaces, _this); \
(P) += _this; \
_len -= _this; \
} \
while (_len > 0); \
} while (0)
#else
# define memset_space(P, Len) memset ((P), ' ', (Len))
#endif
#define add(n, f) \
do \
{ \
i += (n); \
if (i >= maxsize) \
int _n = (n); \
int _delta = width - _n; \
int _incr = _n + (_delta > 0 ? _delta : 0); \
if (i + _incr >= maxsize) \
return 0; \
else \
if (p) \
{ \
f; \
p += (n); \
} \
if (p) \
{ \
if (_delta > 0) \
memset_space (p, _delta); \
f; \
p += _n; \
} \
i += _incr; \
} while (0)
#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
#define cpy(n, s) \
add ((n), \
if (to_lowcase) \
memcpy_lowcase (p, (s), _n); \
else if (to_uppcase) \
memcpy_uppcase (p, (s), _n); \
else \
memcpy ((PTR) p, (PTR) (s), _n))
#ifdef _LIBC
# define TOUPPER(Ch) toupper (Ch)
# define TOLOWER(Ch) tolower (Ch)
#else
# define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch))
# define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
#endif
/* We don't use `isdigit' here since the locale dependent
interpretation is not what we want here. We only need to accept
the arabic digits in the ASCII range. One day there is perhaps a
more reliable way to accept other sets of digits. */
#define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
static char *
memcpy_lowcase (dest, src, len)
char *dest;
const char *src;
size_t len;
{
while (len-- > 0)
dest[len] = TOLOWER (src[len]);
return dest;
}
static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
static char *
memcpy_uppcase (dest, src, len)
char *dest;
const char *src;
size_t len;
{
while (len-- > 0)
dest[len] = TOUPPER (src[len]);
return dest;
}
#if ! HAVE_TM_GMTOFF
/* Yield the difference between *A and *B,
@@ -256,7 +340,7 @@ strftime (s, maxsize, format, tp)
char *s;
size_t maxsize;
const char *format;
register const struct tm *tp;
const struct tm *tp;
{
int hour12 = tp->tm_hour;
#ifdef _NL_CURRENT
@@ -283,15 +367,30 @@ strftime (s, maxsize, format, tp)
size_t month_len = strlen (f_month);
const char *zone;
size_t zonelen;
register size_t i = 0;
register char *p = s;
register const char *f;
size_t i = 0;
char *p = s;
const char *f;
zone = 0;
#if HAVE_TM_ZONE
zone = NULL;
#if !defined _LIBC && HAVE_TM_ZONE
/* XXX We have some problems here. First, the string pointed to by
tm_zone is dynamically allocated while loading the zone data. But
when another zone is loaded since the information in TP were
computed this would be a stale pointer.
The second problem is the POSIX test suite which assumes setting
the environment variable TZ to a new value before calling strftime()
will influence the result (the %Z format) even if the information in
TP is computed with a totally different time zone. --drepper@gnu */
zone = (const char *) tp->tm_zone;
#endif
#if HAVE_TZNAME
/* POSIX.1 8.1.1 requires that whenever strftime() is called, the
time zone names contained in the external variable `tzname' shall
be set as if the tzset() function had been called. */
# if HAVE_TZSET
tzset ();
# endif
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
#endif
@@ -317,6 +416,9 @@ strftime (s, maxsize, format, tp)
char buf[1 + (sizeof (int) < sizeof (time_t)
? INT_STRLEN_BOUND (time_t)
: INT_STRLEN_BOUND (int))];
int width = -1;
int to_lowcase = 0;
int to_uppcase = 0;
#if DO_MULTIBYTE
@@ -391,20 +493,43 @@ strftime (s, maxsize, format, tp)
#endif /* ! DO_MULTIBYTE */
/* Check for flags that can modify a number format. */
++f;
switch (*f)
/* Check for flags that can modify a format. */
pad = 0;
while (1)
{
case '_':
case '-':
pad = *f++;
break;
switch (*++f)
{
/* This influences the number formats. */
case '_':
case '-':
case '0':
pad = *f;
continue;
default:
pad = 0;
/* This changes textual output. */
case '^':
to_uppcase = 1;
continue;
default:
break;
}
break;
}
/* As a GNU extension we allow to specify the field width. */
if (ISDIGIT (*f))
{
width = 0;
do
{
width *= 10;
width += *f - '0';
++f;
}
while (ISDIGIT (*f));
}
/* Check for modifiers. */
switch (*f)
{
@@ -470,10 +595,18 @@ strftime (s, maxsize, format, tp)
subformat:
{
size_t len = strftime (p, maxsize - i, subfmt, tp);
char *old_start = p;
size_t len = strftime (NULL, maxsize - i, subfmt, tp);
if (len == 0 && *subfmt)
return 0;
add (len, ;);
add (len, strftime (p, maxsize - i, subfmt, tp));
if (to_uppcase)
while (old_start < p)
{
*old_start = TOUPPER (*old_start);
++old_start;
}
}
break;
@@ -529,8 +662,9 @@ strftime (s, maxsize, format, tp)
jump to one of these two labels. */
do_number_spacepad:
/* Force `_' flag. */
pad = '_';
/* Force `_' flag unless overwritten by `0' flag. */
if (pad != '0')
pad = '_';
do_number:
/* Format the number according to the MODIFIER flag. */
@@ -640,6 +774,10 @@ strftime (s, maxsize, format, tp)
add (1, *p = '\n');
break;
case 'P':
to_lowcase = 1;
/* FALLTHROUGH */
case 'p':
cpy (ap_len, ampm);
break;

1
m4/.cvsignore Normal file
View File

@@ -0,0 +1 @@
Makefile

11
m4/Makefile.am Normal file
View File

@@ -0,0 +1,11 @@
## Process this file with automake to produce Makefile.in
# Generate this list with
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
gettext.m4 header.m4 init.m4 install.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lcmessage.m4 lispdir.m4 maintainer.m4 memcmp.m4 mktime.m4 \
obstack.m4 progtest.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strftime.m4 \
strtod.m4 termios.m4 uptime.m4 winsz.m4

153
m4/Makefile.in Normal file
View File

@@ -0,0 +1,153 @@
# Makefile.in generated automatically by automake 1.1l from Makefile.am
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# Generate this list with
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
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
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
YACC = @YACC@
GENCAT = @GENCAT@
PERL = @PERL@
MV = @MV@
GMSGFMT = @GMSGFMT@
CC = @CC@
RANLIB = @RANLIB@
LN = @LN@
RM = @RM@
EXTRA_DIST = README \
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
gettext.m4 header.m4 init.m4 install.m4 jm-mktime.m4 jm-winsz1.m4 \
jm-winsz2.m4 lcmessage.m4 lispdir.m4 maintainer.m4 memcmp.m4 mktime.m4 \
obstack.m4 progtest.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strftime.m4 \
strtod.m4 termios.m4 uptime.m4 winsz.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = README Makefile.am Makefile.in README
PACKAGE = @PACKAGE@
VERSION = @VERSION@
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
$(TEXINFOS) $(MANS) $(EXTRA_DIST)
TAR = tar
default: all
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
cd $(top_srcdir) && automake --gnu m4/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 = m4
distdir: $(DISTFILES)
@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
info:
dvi:
check: all
$(MAKE)
installcheck:
install-exec:
$(NORMAL_INSTALL)
install-data:
$(NORMAL_INSTALL)
install: install-exec install-data all
@:
uninstall:
all: Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' 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
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: default tags distdir info dvi installcheck install-exec \
install-data install uninstall all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# 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:

9
m4/README Normal file
View File

@@ -0,0 +1,9 @@
These files are used by a program called aclocal (part of the GNU automake
package). aclocal uses these files to create aclocal.m4 which is in turn
used by autoconf to create the configure script at the the top level in
this distribution.
Some of these files are copies of the ones in the automake-1.1l
distribution. Others are specific to this package.
Eventually, I expect that aclocal will evolve so that this directory
can contain only the .m4 files specific to this package.

61
m4/ccstdc.m4 Normal file
View File

@@ -0,0 +1,61 @@
## ----------------------------------------- ##
## ANSIfy the C compiler whenever possible. ##
## From Franc,ois Pinard ##
## ----------------------------------------- ##
# serial 1
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
# @ovindex CC
# If the C compiler in not in ANSI C mode by default, try to add an option
# to output variable @code{CC} to make it so. This macro tries various
# options that select ANSI C on some system or another. It considers the
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
# handles function prototypes correctly.
#
# If you use this macro, you should check after calling it whether the C
# compiler has been set to accept ANSI C; if not, the shell variable
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
# program @code{ansi2knr}, which comes with Ghostscript.
# @end defmac
AC_DEFUN(AM_PROG_CC_STDC,
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
AC_CACHE_VAL(am_cv_prog_cc_stdc,
[am_cv_prog_cc_stdc=no
ac_save_CC="$CC"
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#if !defined(__STDC__) || __STDC__ != 1
choke me
#endif
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/stat.h>
#endif
], [
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};],
[am_cv_prog_cc_stdc="$ac_arg"; break])
done
CC="$ac_save_CC"
])
AC_MSG_RESULT($am_cv_prog_cc_stdc)
case "x$am_cv_prog_cc_stdc" in
x|xno) ;;
*) CC="$CC $am_cv_prog_cc_stdc" ;;
esac
])

21
m4/dmalloc.m4 Normal file
View File

@@ -0,0 +1,21 @@
## ----------------------------------- ##
## Check if --with-dmalloc was given. ##
## From Franc,ois Pinard ##
## ----------------------------------- ##
# serial 1
AC_DEFUN(AM_WITH_DMALLOC,
[AC_MSG_CHECKING(if malloc debugging is wanted)
AC_ARG_WITH(dmalloc,
[ --with-dmalloc use dmalloc, as in
ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz],
[if test "$withval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(WITH_DMALLOC)
LIBS="$LIBS -ldmalloc"
LDFLAGS="$LDFLAGS -g"
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no)])
])

13
m4/error.m4 Normal file
View File

@@ -0,0 +1,13 @@
dnl From Jim Meyering. Use this if you use the GNU error.[ch].
dnl FIXME: Migrate into libit
AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
[AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
am_cv_lib_error_at_line=yes,
am_cv_lib_error_at_line=no)])
if test $am_cv_lib_error_at_line = no; then
LIBOBJS="$LIBOBJS error.o"
fi
AC_SUBST(LIBOBJS)dnl
])

36
m4/getgroups.m4 Normal file
View File

@@ -0,0 +1,36 @@
#serial 1
dnl From Jim Meyering.
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_getgroups if the replacement function should be used. */
dnl #undef getgroups
dnl
AC_DEFUN(jm_FUNC_GETGROUPS,
[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
AC_CHECK_FUNCS(getgroups)
# Run the program to test the functionality of the system-supplied
# getgroups function only if there is such a function.
if test $ac_cv_func_getgroups = yes; then
AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
[AC_TRY_RUN([
int
main ()
{
/* On Ultrix 4.3, getgroups (0, 0) always fails. */
exit (getgroups (0, 0) == -1 ? 1 : 0);
}
],
jm_cv_func_working_getgroups=yes,
jm_cv_func_working_getgroups=no,
dnl When crosscompiling, assume getgroups is broken.
jm_cv_func_working_getgroups=no)
])
if test $jm_cv_func_working_getgroups = no; then
LIBOBJS="$LIBOBJS getgroups.o"
AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups)
fi
fi
])

45
m4/getline.m4 Normal file
View File

@@ -0,0 +1,45 @@
#serial 1
dnl See if there's a working, system-supplied version of the getline function.
dnl We can't just to AC_REPLACE_FUNCS(getline) because some systems
dnl have a function by that name in -linet that doesn't have anything
dnl to do with the function we need.
AC_DEFUN(AM_FUNC_GETLINE,
[dnl
am_getline_needs_run_time_check=no
am_cv_func_working_getline=yes
AC_CHECK_FUNC(getline,
dnl Found it in some library. Verify that it works.
am_getline_needs_run_time_check=yes,
am_cv_func_working_getline=no)
if test $am_getline_needs_run_time_check = yes; then
AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
[echo fooN |tr -d '\012'|tr N '\012' > conftestdata
AC_TRY_RUN([
# include <stdio.h>
# include <sys/types.h>
# if HAVE_STRING_H
# include <string.h>
# endif
int main ()
{ /* Based on a test program from Karl Heuer. */
char *line = NULL;
size_t siz = 0;
int len;
FILE *in = fopen ("./conftestdata", "r");
if (!in)
return 1;
len = getline (&line, &siz, in);
exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
}
], am_cv_func_working_getline=yes dnl The library version works.
, am_cv_func_working_getline=no dnl The library version does NOT work.
, am_cv_func_working_getline=no dnl We're cross compiling.
)])
fi
if test $am_cv_func_working_getline = no; then
LIBOBJS="$LIBOBJS getline.o"
AC_SUBST(LIBOBJS)dnl
fi
])

124
m4/getloadavg.m4 Normal file
View File

@@ -0,0 +1,124 @@
#serial 2
AC_DEFUN(AM_FUNC_GETLOADAVG,
[ac_have_func=no # yes means we've found a way to get the load average.
am_cv_saved_LIBS="$LIBS"
# Solaris has libkstat which does not require root.
AC_CHECK_LIB(kstat, kstat_open)
if test $ac_cv_lib_kstat_kstat_open = yes ; then ac_have_func=yes ; fi
# Some systems with -lutil have (and need) -lkvm as well, some do not.
# On Solaris, -lkvm requires nlist from -lelf, so check that first
# to get the right answer into the cache.
# For kstat on solaris, we need libelf to force the definition of SVR4 below.
AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
if test $ac_have_func = no; then
AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
# Check for the 4.4BSD definition of getloadavg.
AC_CHECK_LIB(util, getloadavg,
[LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
fi
if test $ac_have_func = no; then
# There is a commonly available library for RS/6000 AIX.
# Since it is not a standard part of AIX, it might be installed locally.
ac_save_LIBS="$LIBS"
LIBS="-L/usr/local/lib $LIBS"
AC_CHECK_LIB(getloadavg, getloadavg,
LIBS="-lgetloadavg $LIBS", LIBS="$ac_save_LIBS")
fi
# Make sure it is really in the library, if we think we found it.
AC_REPLACE_FUNCS(getloadavg)
if test $ac_cv_func_getloadavg = yes; then
AC_DEFINE(HAVE_GETLOADAVG)
ac_have_func=yes
else
AC_DEFINE(C_GETLOADAVG)
# Figure out what our getloadavg.c needs.
ac_have_func=no
AC_CHECK_HEADER(sys/dg_sys_info.h,
[ac_have_func=yes; AC_DEFINE(DGUX)
AC_CHECK_LIB(dgc, dg_sys_info)])
# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
# uses stabs), but it is still SVR4. We cannot check for <elf.h> because
# Irix 4.0.5F has the header but not the library.
if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
ac_have_func=yes; AC_DEFINE(SVR4)
fi
if test $ac_have_func = no; then
AC_CHECK_HEADER(inq_stats/cpustats.h,
[ac_have_func=yes; AC_DEFINE(UMAX)
AC_DEFINE(UMAX4_3)])
fi
if test $ac_have_func = no; then
AC_CHECK_HEADER(sys/cpustats.h,
[ac_have_func=yes; AC_DEFINE(UMAX)])
fi
if test $ac_have_func = no; then
AC_CHECK_HEADERS(mach/mach.h)
fi
AC_CHECK_HEADER(nlist.h,
[AC_DEFINE(NLIST_STRUCT)
AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
[AC_TRY_COMPILE([#include <nlist.h>],
[struct nlist n; n.n_un.n_name = 0;],
ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
if test $ac_cv_struct_nlist_n_un = yes; then
AC_DEFINE(NLIST_NAME_UNION)
fi
])dnl
fi # Do not have getloadavg in system libraries.
# Some definitions of getloadavg require that the program be installed setgid.
dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory.
AC_CACHE_CHECK(whether getloadavg requires setgid,
ac_cv_func_getloadavg_setgid,
[AC_EGREP_CPP([Yowza Am I SETGID yet],
[#include "$srcdir/lib/getloadavg.c"
#ifdef LDAV_PRIVILEGED
Yowza Am I SETGID yet
#endif],
ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
if test $ac_cv_func_getloadavg_setgid = yes; then
NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED)
else
NEED_SETGID=false
fi
AC_SUBST(NEED_SETGID)dnl
if test $ac_cv_func_getloadavg_setgid = yes; then
AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
changequote(<<, >>)dnl
<<
# On Solaris, /dev/kmem is a symlink. Get info on the real file.
ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
# If we got an error (system does not support symlinks), try without -L.
test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
ac_cv_group_kmem=`echo $ac_ls_output \
| sed -ne 's/[ ][ ]*/ /g;
s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/;
/ /s/.* //;p;'`
>>
changequote([, ])dnl
)
KMEM_GROUP=$ac_cv_group_kmem
fi
AC_SUBST(KMEM_GROUP)dnl
if test x = "x$am_cv_saved_LIBS"; then
GETLOADAVG_LIBS="$LIBS"
else
GETLOADAVG_LIBS=`echo "$LIBS"|sed "s!$am_cv_saved_LIBS!!"`
fi
AC_SUBST(GETLOADAVG_LIBS)dnl
LIBS="$am_cv_saved_LIBS"
])

287
m4/gettext.m4 Normal file
View File

@@ -0,0 +1,287 @@
# Macro to add for using GNU gettext.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
# serial 1
AC_DEFUN(AM_WITH_NLS,
[AC_MSG_CHECKING([whether NLS is requested])
dnl Default is enabled NLS
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
USE_NLS=$enableval, USE_NLS=yes)
AC_MSG_RESULT($USE_NLS)
AC_SUBST(USE_NLS)
USE_INCLUDED_LIBINTL=no
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
AC_DEFINE(ENABLE_NLS)
AC_MSG_CHECKING([whether included gettext is requested])
AC_ARG_WITH(included-gettext,
[ --with-included-gettext use the GNU gettext library included here],
nls_cv_force_use_gnu_gettext=$withval,
nls_cv_force_use_gnu_gettext=no)
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
dnl User does not insist on using GNU NLS library. Figure out what
dnl to use. If gettext or catgets are available (in this order) we
dnl use this. Else we have to fall back to GNU NLS library.
dnl catgets is only used if permitted by option --with-catgets.
nls_cv_header_intl=
nls_cv_header_libgt=
CATOBJEXT=NONE
AC_CHECK_HEADER(libintl.h,
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
if test "$gt_cv_func_gettext_libc" != "yes"; then
AC_CHECK_LIB(intl, bindtextdomain,
[AC_CACHE_CHECK([for gettext in libintl],
gt_cv_func_gettext_libintl,
[AC_TRY_LINK([], [return (int) gettext ("")],
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)])])
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
AC_DEFINE(HAVE_GETTEXT)
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
if test "$MSGFMT" != "no"; then
AC_CHECK_FUNCS(dcgettext)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr],
[CATOBJEXT=.gmo
DATADIRNAME=share],
[CATOBJEXT=.mo
DATADIRNAME=lib])
INSTOBJEXT=.mo
fi
fi
])
if test "$CATOBJEXT" = "NONE"; then
AC_MSG_CHECKING([whether catgets can be used])
AC_ARG_WITH(catgets,
[ --with-catgets use catgets functions if available],
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
AC_MSG_RESULT($nls_cv_use_catgets)
if test "$nls_cv_use_catgets" = "yes"; then
dnl No gettext in C library. Try catgets next.
AC_CHECK_LIB(i, main)
AC_CHECK_FUNC(catgets,
[AC_DEFINE(HAVE_CATGETS)
INTLOBJS="\$(CATOBJS)"
AC_PATH_PROG(GENCAT, gencat, no)dnl
if test "$GENCAT" != "no"; then
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
if test "$GMSGFMT" = "no"; then
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
fi
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.cat
INSTOBJEXT=.cat
DATADIRNAME=lib
INTLDEPS="../intl/libintl.a"
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi])
fi
fi
if test "$CATOBJEXT" = "NONE"; then
dnl Neither gettext nor catgets in included in the C library.
dnl Fall back on GNU gettext library.
nls_cv_use_gnu_gettext=yes
fi
fi
if test "$nls_cv_use_gnu_gettext" = "yes"; then
dnl Mark actions used to generate GNU NLS library.
INTLOBJS="\$(GETTOBJS)"
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_SUBST(MSGFMT)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.gmo
INSTOBJEXT=.mo
DATADIRNAME=share
INTLDEPS="../intl/libintl.a"
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
dnl Test whether we really found GNU xgettext.
if test "$XGETTEXT" != ":"; then
dnl If it is no GNU xgettext we define it as : so that the
dnl Makefiles still can work.
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
: ;
else
AC_MSG_RESULT(
[found xgettext programs is not GNU xgettext; ignore it])
XGETTEXT=":"
fi
fi
# We need to process the po/ directory.
POSUB=po
else
DATADIRNAME=share
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
# If this is used in GNU gettext we have to set USE_NLS to `yes'
# because some of the sources are only built for this goal.
if test "$PACKAGE" = gettext; then
USE_NLS=yes
USE_INCLUDED_LIBINTL=yes
fi
dnl These rules are solely for the distribution goal. While doing this
dnl we only have to keep exactly one list of the available catalogs
dnl in configure.in.
for lang in $ALL_LINGUAS; do
GMOFILES="$GMOFILES $lang.gmo"
POFILES="$POFILES $lang.po"
done
dnl Make all variables we use known to autoconf.
AC_SUBST(USE_INCLUDED_LIBINTL)
AC_SUBST(CATALOGS)
AC_SUBST(CATOBJEXT)
AC_SUBST(DATADIRNAME)
AC_SUBST(GMOFILES)
AC_SUBST(INSTOBJEXT)
AC_SUBST(INTLDEPS)
AC_SUBST(INTLLIBS)
AC_SUBST(INTLOBJS)
AC_SUBST(POFILES)
AC_SUBST(POSUB)
])
AC_DEFUN(AM_GNU_GETTEXT,
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_ISC_POSIX])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_C_INLINE])dnl
AC_REQUIRE([AC_TYPE_OFF_T])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
unistd.h values.h])
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
__argz_count __argz_stringify __argz_next])
if test "${ac_cv_func_stpcpy+set}" != "set"; then
AC_CHECK_FUNCS(stpcpy)
fi
if test "${ac_cv_func_stpcpy}" = "yes"; then
AC_DEFINE(HAVE_STPCPY)
fi
AM_LC_MESSAGES
AM_WITH_NLS
if test "x$CATOBJEXT" != "x"; then
if test "x$ALL_LINGUAS" = "x"; then
LINGUAS=
else
AC_MSG_CHECKING(for catalogs to be installed)
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
esac
done
LINGUAS=$NEW_LINGUAS
AC_MSG_RESULT($LINGUAS)
fi
dnl Construct list of names of catalog files to be constructed.
if test -n "$LINGUAS"; then
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
fi
fi
dnl Determine which catalog format we have (if any is needed)
dnl For now we know about two different formats:
dnl Linux libc-5 and the normal X/Open format
test -d intl || mkdir intl
if test "$CATOBJEXT" = ".cat"; then
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
dnl Transform the SED scripts while copying because some dumb SEDs
dnl cannot handle comments.
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
fi
dnl po2tbl.sed is always needed.
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
dnl In the intl/Makefile.in we have a special dependency which makes
dnl only sense for gettext. We comment this out for non-gettext
dnl packages.
if test "$PACKAGE" = "gettext"; then
GT_NO="#NO#"
GT_YES=
else
GT_NO=
GT_YES="#YES#"
fi
AC_SUBST(GT_NO)
AC_SUBST(GT_YES)
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
dnl Try to locate is.
MKINSTALLDIRS=
if test $ac_aux_dir; then
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
fi
if test -z $MKINSTALLDIRS; then
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
fi
AC_SUBST(MKINSTALLDIRS)
dnl Generate list of files to be processed by xgettext which will
dnl be included in po/Makefile.
test -d po || mkdir po
if test "x$srcdir" != "x."; then
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
posrcprefix="$srcdir/"
else
posrcprefix="../$srcdir/"
fi
else
posrcprefix="../"
fi
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
< $srcdir/po/POTFILES.in > po/POTFILES
])

12
m4/header.m4 Normal file
View File

@@ -0,0 +1,12 @@
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
changequote([,]))])

20
m4/init.m4 Normal file
View File

@@ -0,0 +1,20 @@
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version)
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AM_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
VERSION=[$2]
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AM_SANITY_CHECK
AC_ARG_PROGRAM
AC_PROG_MAKE_SET])

13
m4/install.m4 Normal file
View File

@@ -0,0 +1,13 @@
## --------------------------------------------------------- ##
## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ##
## substitution. ##
## From Franc,ois Pinard ##
## --------------------------------------------------------- ##
# serial 1
AC_DEFUN(AM_PROG_INSTALL,
[AC_REQUIRE([AC_PROG_INSTALL])
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
AC_SUBST(INSTALL_SCRIPT)dnl
])

14
m4/jm-mktime.m4 Normal file
View File

@@ -0,0 +1,14 @@
#serial 1
dnl From Jim Meyering.
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_mktime if the replacement function should be used. */
dnl #undef mktime
dnl
AC_DEFUN(jm_FUNC_MKTIME,
[AC_REQUIRE([AM_FUNC_MKTIME])dnl
if test $am_cv_func_working_mktime = no; then
AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
fi
])

19
m4/jm-winsz1.m4 Normal file
View File

@@ -0,0 +1,19 @@
dnl From Jim Meyering.
#serial 1
AC_DEFUN(jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H,
[AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
jm_cv_sys_tiocgwinsz_needs_termios_h,
[jm_cv_sys_tiocgwinsz_needs_termios_h=no
if test $am_cv_sys_posix_termios = yes; then
AC_EGREP_CPP([yes],
[#include <sys/types.h>
# include <termios.h>
# ifdef TIOCGWINSZ
yes
# endif
], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
fi
])
])

22
m4/jm-winsz2.m4 Normal file
View File

@@ -0,0 +1,22 @@
#serial 2
AC_DEFUN(jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
[AC_REQUIRE([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
[jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no; then
AC_EGREP_CPP([yes],
[#include <sys/types.h>
# include <sys/ioctl.h>
# ifdef TIOCGWINSZ
yes
# endif
], jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
fi
])
if test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
fi
])

14
m4/lcmessage.m4 Normal file
View File

@@ -0,0 +1,14 @@
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
# serial 1
AC_DEFUN(AM_LC_MESSAGES,
[if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES)
fi
fi])

38
m4/lispdir.m4 Normal file
View File

@@ -0,0 +1,38 @@
## ------------------------
## Emacs LISP file handling
## From Ulrich Drepper
## ------------------------
# serial 1
AC_DEFUN(AM_PATH_LISPDIR,
[# If set to t, that means we are running in a shell under Emacs.
# If you have an Emacs named "t", then use the full path.
test "$EMACS" = t && EMACS=
AC_PATH_PROG(EMACS, emacs xemacs, no)
if test $EMACS != "no"; then
AC_MSG_CHECKING([where .elc files should go])
dnl Set default value
lispdir="\$(datadir)/emacs/site-lisp"
if test "x$prefix" = "xNONE"; then
if test -d $ac_default_prefix/share/emacs/site-lisp; then
lispdir="\$(prefix)/share/emacs/site-lisp"
else
if test -d $ac_default_prefix/lib/emacs/site-lisp; then
lispdir="\$(prefix)/lib/emacs/site-lisp"
fi
fi
else
if test -d $prefix/share/emacs/site-lisp; then
lispdir="\$(prefix)/share/emacs/site-lisp"
else
if test -d $prefix/lib/emacs/site-lisp; then
lispdir="\$(prefix)/lib/emacs/site-lisp"
fi
fi
fi
AC_MSG_RESULT($lispdir)
ELCFILES="\$(ELCFILES)"
fi
AC_SUBST(lispdir)
AC_SUBST(ELCFILES)])

22
m4/maintainer.m4 Normal file
View File

@@ -0,0 +1,22 @@
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
if test $USE_MAINTAINER_MODE = yes; then
MAINT=
else
MAINT='#M#'
fi
AC_SUBST(MAINT)dnl
]
)

13
m4/memcmp.m4 Normal file
View File

@@ -0,0 +1,13 @@
#serial 1
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to rpl_memcmp if the replacement function should be used. */
dnl #undef memcmp
dnl
AC_DEFUN(jm_FUNC_MEMCMP,
[AC_REQUIRE([AC_FUNC_MEMCMP])dnl
if test $ac_cv_func_memcmp_clean = no; then
AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp)
fi
])

34
m4/mktime.m4 Normal file
View File

@@ -0,0 +1,34 @@
dnl From Jim Meyering.
dnl FIXME: this should migrate into libit.
AC_DEFUN(AM_FUNC_MKTIME,
[AC_REQUIRE([AC_HEADER_TIME])dnl
AC_CHECK_HEADERS(sys/time.h)
AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
[AC_TRY_RUN([/* Test program from Tony Leneis (tony@plaza.ds.adp.com). */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
int
main ()
{
time_t today = time (0);
struct tm *local = localtime (&today);
exit (mktime (local) != today);
}
],
am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
dnl When crosscompiling, assume mktime is missing or broken.
am_cv_func_working_mktime=no)
])
if test $am_cv_func_working_mktime = no; then
LIBOBJS="$LIBOBJS mktime.o"
fi
])

15
m4/obstack.m4 Normal file
View File

@@ -0,0 +1,15 @@
dnl From Jim Meyering.
dnl FIXME: migrate into libit.
AC_DEFUN(AM_FUNC_OBSTACK,
[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
[AC_TRY_LINK([#include "obstack.h"],
[struct obstack *mem;obstack_free(mem,(char *) 0)],
am_cv_func_obstack=yes,
am_cv_func_obstack=no)])
if test $am_cv_func_obstack = yes; then
AC_DEFINE(HAVE_OBSTACK)
else
LIBOBJS="$LIBOBJS obstack.o"
fi
])

42
m4/progtest.m4 Normal file
View File

@@ -0,0 +1,42 @@
# Search path for a program which passes the given test.
# Ulrich Drepper <drepper@cygnus.com>, 1996.
# serial 1
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
[# Extract the first word of "$2", so it can be a program name with args.
set dummy $2; ac_word=[$]2
AC_MSG_CHECKING([for $ac_word])
AC_CACHE_VAL(ac_cv_path_$1,
[case "[$]$1" in
/*)
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in ifelse([$5], , $PATH, [$5]); do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if [$3]; then
ac_cv_path_$1="$ac_dir/$ac_word"
break
fi
fi
done
IFS="$ac_save_ifs"
dnl If no 4th arg is given, leave the cache variable unset,
dnl so AC_PATH_PROGS will keep looking.
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
])dnl
;;
esac])dnl
$1="$ac_cv_path_$1"
if test -n "[$]$1"; then
AC_MSG_RESULT([$]$1)
else
AC_MSG_RESULT(no)
fi
AC_SUBST($1)dnl
])

25
m4/protos.m4 Normal file
View File

@@ -0,0 +1,25 @@
## ------------------------------- ##
## Check for function prototypes. ##
## From Franc,ois Pinard ##
## ------------------------------- ##
# serial 1
AC_DEFUN(AM_C_PROTOTYPES,
[AC_REQUIRE([AM_PROG_CC_STDC])
AC_BEFORE([$0], [AC_C_INLINE])
AC_MSG_CHECKING([for function prototypes])
if test "$am_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT(yes)
AC_DEFINE(PROTOTYPES)
U= ANSI2KNR=
else
AC_MSG_RESULT(no)
U=_ ANSI2KNR=./ansi2knr
# Ensure some checks needed by ansi2knr itself.
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h)
fi
AC_SUBST(U)dnl
AC_SUBST(ANSI2KNR)dnl
])

12
m4/ptrdiff.m4 Normal file
View File

@@ -0,0 +1,12 @@
# From Ulrich Drepper.
# serial 1
AC_DEFUN(AM_TYPE_PTRDIFF_T,
[AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
[AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
if test $am_cv_type_ptrdiff_t = yes; then
AC_DEFINE(HAVE_PTRDIFF_T)
fi
])

37
m4/regex.m4 Normal file
View File

@@ -0,0 +1,37 @@
## --------------------------------- ##
## Check if --with-regex was given. ##
## --------------------------------- ##
# serial 1
# The idea is to distribute rx.[hc] and regex.[hc] together, for a while.
# The WITH_REGEX symbol (which should also be documented in acconfig.h)
# is used to decide which of regex.h or rx.h should be included in the
# application. If `./configure --with-regex' is given (the default), the
# package will use gawk's regex. If `./configure --without-regex', a
# check is made to see if rx is already installed, as with newer Linux'es.
# If not found, the package will use the rx from the distribution.
# If found, the package will use the system's rx which, on Linux at least,
# will result in a smaller executable file.
AC_DEFUN(AM_WITH_REGEX,
[AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
AC_ARG_WITH(regex,
[ --without-regex use GNU rx in lieu of gawk's regex for matching],
[test "$withval" = yes && am_with_regex=1],
[am_with_regex=1])
if test -n "$am_with_regex"; then
AC_MSG_RESULT(regex)
AC_DEFINE(WITH_REGEX)
AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
if test $am_cv_gnu_regex = no; then
LIBOBJS="$LIBOBJS regex.o"
fi
else
AC_MSG_RESULT(rx)
AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
fi
AC_SUBST(LIBOBJS)dnl
])

19
m4/sanity.m4 Normal file
View File

@@ -0,0 +1,19 @@
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
echo timestamp > conftestfile
# Do this in a subshell so we don't clobber the current shell's
# arguments. FIXME: maybe try `-L' hack like GETLOADAVG test?
if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])

125
m4/strftime.m4 Normal file
View File

@@ -0,0 +1,125 @@
#serial 2
dnl From Jim Meyering.
dnl If you use this macro in a package, you should
dnl add the following two lines to acconfig.h:
dnl /* Define to gnu_strftime if the replacement function should be used. */
dnl #undef strftime
dnl
AC_DEFUN(jm_FUNC_GNU_STRFTIME,
[AC_REQUIRE([AC_HEADER_TIME])dnl
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_CHECK_HEADERS(sys/time.h)
AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
[AC_TRY_RUN(
changequote(<<, >>)dnl
<< /* Ulrich Drepper provided parts of the test program. */
#if STDC_HEADERS
# include <stdlib.h>
#endif
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
static int
compare (const char *fmt, const struct tm *tm, const char *expected)
{
char buf[99];
strftime (buf, 99, fmt, tm);
if (strcmp (buf, expected))
{
#ifdef SHOW_FAILURES
printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
fmt, expected, buf);
#endif
return 1;
}
return 0;
}
int
main ()
{
int n_fail = 0;
struct tm *tm;
time_t t = 738367; /* Fri Jan 9 13:06:07 1970 */
tm = gmtime (&t);
/* This is necessary to make strftime give consistent zone strings and
e.g., seconds since the epoch (%s). */
putenv ("TZ=GMT");
#undef CMP
#define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
CMP ("%-m", "1"); /* GNU */
CMP ("%A", "Friday");
CMP ("%^A", "FRIDAY"); /* The ^ is a GNU extension. */
CMP ("%B", "January");
CMP ("%^B", "JANUARY");
CMP ("%C", "19"); /* POSIX.2 */
CMP ("%D", "01/09/70"); /* POSIX.2 */
CMP ("%G", "1970"); /* GNU */
CMP ("%H", "13");
CMP ("%I", "01");
CMP ("%M", "06");
CMP ("%M", "06");
CMP ("%R", "13:06"); /* POSIX.2 */
CMP ("%S", "07");
CMP ("%T", "13:06:07"); /* POSIX.2 */
CMP ("%U", "01");
CMP ("%V", "02");
CMP ("%W", "01");
CMP ("%X", "13:06:07");
CMP ("%Y", "1970");
CMP ("%Z", "GMT");
CMP ("%_m", " 1"); /* GNU */
CMP ("%a", "Fri");
CMP ("%^a", "FRI");
CMP ("%b", "Jan");
CMP ("%^b", "JAN");
CMP ("%c", "Fri Jan 9 13:06:07 1970");
CMP ("%^c", "FRI JAN 9 13:06:07 1970");
CMP ("%d", "09");
CMP ("%e", " 9"); /* POSIX.2 */
CMP ("%g", "70"); /* GNU */
CMP ("%h", "Jan"); /* POSIX.2 */
CMP ("%^h", "JAN");
CMP ("%j", "009");
CMP ("%k", "13"); /* GNU */
CMP ("%l", " 1"); /* GNU */
CMP ("%m", "01");
CMP ("%n", "\n"); /* POSIX.2 */
CMP ("%p", "PM");
CMP ("%r", "01:06:07 PM"); /* POSIX.2 */
CMP ("%s", "738367"); /* GNU */
CMP ("%t", "\t"); /* POSIX.2 */
CMP ("%u", "5"); /* POSIX.2 */
CMP ("%w", "5");
CMP ("%x", "01/09/70");
CMP ("%y", "70");
CMP ("%z", "+0000"); /* GNU */
exit (n_fail ? 1 : 0);
}
>>,
changequote([, ])dnl
jm_cv_func_working_gnu_strftime=yes,
jm_cv_func_working_gnu_strftime=no,
dnl When crosscompiling, assume strftime is missing or broken.
jm_cv_func_working_gnu_strftime=no)
])
if test $jm_cv_func_working_gnu_strftime = no; then
LIBOBJS="$LIBOBJS strftime.o"
AC_DEFINE_UNQUOTED(strftime, gnu_strftime)
fi
])

69
m4/strtod.m4 Normal file
View File

@@ -0,0 +1,69 @@
## Copyright (C) 1996 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
## From Jim Meyering.
## serial 1
## @defmac AC_FUNC_STRTOD
## @maindex FUNC_STRTOD
## @ovindex LIBOBJS
## If the @code{strtod} function is not available, or does not work
## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
## variable @code{LIBOBJS}.
## @end defmac
AC_DEFUN(AM_FUNC_STRTOD,
[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
[AC_TRY_RUN([
double strtod ();
int
main()
{
{
/* Some versions of Linux strtod mis-parse strings with leading '+'. */
char *string = " +69";
char *term;
double value;
value = strtod (string, &term);
if (value != 69 || term != (string + 4))
exit (1);
}
{
/* Under Solaris 2.4, strtod returns the wrong value for the
terminating character under some conditions. */
char *string = "NaN";
char *term;
strtod (string, &term);
if (term != string && *(term - 1) == 0)
exit (1);
}
exit (0);
}
], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
AC_SUBST(LIBOBJS)dnl
am_cv_func_strtod_needs_libm=no
if test $am_cv_func_strtod = no; then
AC_CHECK_FUNCS(pow)
if test $ac_cv_func_pow = no; then
AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
[AC_MSG_WARN(can't find library containing definition of pow)])
fi
fi
])

14
m4/termios.m4 Normal file
View File

@@ -0,0 +1,14 @@
dnl From Jim Meyering.
# serial 1
AC_DEFUN(AM_SYS_POSIX_TERMIOS,
[AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
[AC_TRY_LINK([#include <sys/types.h>
#include <unistd.h>
#include <termios.h>],
[/* SunOS 4.0.3 has termios.h but not the library calls. */
tcgetattr(0, 0);],
am_cv_sys_posix_termios=yes,
am_cv_sys_posix_termios=no)])
])

15
m4/uptime.m4 Normal file
View File

@@ -0,0 +1,15 @@
#serial 1
AC_DEFUN(jm_SYS_PROC_UPTIME,
[ dnl Require AC_PROG_CC to see if we're cross compiling.
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for /proc/uptime], jm_cv_have_proc_uptime,
[jm_cv_have_proc_uptime=no
test -f /proc/uptime \
&& test $ac_cv_prog_cc_cross = no \
&& cat < /proc/uptime >/dev/null 2>/dev/null \
&& jm_cv_have_proc_uptime=yes])
if test $jm_cv_have_proc_uptime = yes; then
AC_DEFINE(HAVE_PROC_UPTIME)
fi
])

35
m4/winsz.m4 Normal file
View File

@@ -0,0 +1,35 @@
dnl From Jim Meyering.
# serial 1
AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
[AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
[am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
gwinsz_in_termios_h=no
if test $am_cv_sys_posix_termios = yes; then
AC_EGREP_CPP([yes],
[#include <sys/types.h>
# include <termios.h>
# ifdef TIOCGWINSZ
yes
# endif
], gwinsz_in_termios_h=yes)
fi
if test $gwinsz_in_termios_h = no; then
AC_EGREP_CPP([yes],
[#include <sys/types.h>
# include <sys/ioctl.h>
# ifdef TIOCGWINSZ
yes
# endif
], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
fi
])
if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
fi
])

View File

@@ -1,3 +1,93 @@
Thu Jan 2 21:16:16 1997 Jim Meyering <meyering@na-net.ornl.gov>
* lib/Makefile.am (EXTRA_DIST): Add getgroups.c.
Wed Jan 1 17:30:26 1997 Jim Meyering <meyering@na-net.ornl.gov>
* lib/getgroups.c: New file.
* configure.in (AC_ARG_PROGRAM): Remove explicit use.
It's implicit in AM_INIT_AUTOMAKE. From Wayne Stewart.
(list_mounted_fs): Fix typo (by declaring NUMSYS) in test for
getfsstat on osf1. From hitchens@epa001.enet.dec.com.
Sun Dec 29 21:55:13 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (jm_FUNC_GETGROUPS): Use it.
Sat Dec 28 14:32:05 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/ls.c: Two problems fixed by these changes from Joakim Rosqvist.
Quoting Joakim:
1) The "total" number and the size of the first file as
output from 'ls --color -s' did not get colorized according
to the "no"-argument in LS_COLORS. Fixed by adding a function
prep_non_filename_text which prints the C_LEFT C_NORM C_RIGHT
strings (or C_END). It is called from main before any text is
output, and from print_name_with_quoting after having output a
colorized filename.
2) If the "no"-argument of LS_COLORS is set, the terminal will be
set to print in that color after ls exits. The man-pages suggests
setting "no" and "fi" to the terminals default colors to avoid
the problem, but that would mean I can't use anything but the
default color for regular files and non-filename text. Fixed by
outputting C_LEFT immediately followed by C_RIGHT right before
exit, which restores the default color.
Fri Dec 27 17:29:02 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Makefile.am (aclocal.m4): No longer depend on acinclude.m4.
* configure.in: AC_REQUIRE version 2.12 of autoconf.
Sun Dec 22 23:29:10 1996 Jim Meyering <meyering@na-net.ornl.gov>
* acinclude.m4: Move macros to individual files in new directory, m4/.
See ChangeLog entries in sh-utils for the details.
Wed Dec 18 23:09:19 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/dircolors.hin (ORPHAN): By default, color orphans red on
a black background.
* src/dircolors.c (usage): Remove --print-data-base.
Now only --print-database remains. Although it wasn't documented,
--print-data-base was still accepted. But it made `--p', `--print',
`--print-data', etc. ambiguous.
* src/ls.c (gobble_file): Stat symlinks also when printing with
color and set linkok to reflect existence of referent.
Patches from Joakim Rosqvist, James Antill, and Jesse Thilo.
Tue Dec 17 21:03:40 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/system.h (ISDIGIT): Replace with smaller, faster edition
that yields nonzero only on ASCII digits.
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
used to have. From Paul Eggert.
* lib/backupfile.c (ISDIGIT): Likewise.
* lib/getdate.y (ISDIGIT): Likewise.
* src/cp.c (ROOT_CHOWN_AFFECTS_SYMLINKS): New macro.
(DO_CHOWN): Take an additional parameter.
(LINK_CHOWN): Remove macro.
(copy): When preserving owner and group of a symlink, use
chown only if ROOT_CHOWN_AFFECTS_SYMLINKS and EUID == 0.
Otherwise, the chown would affect the file referenced through
the symlink.
Sat Dec 14 14:51:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
* acinclude.m4 (jm_SYS_PROC_UPTIME): Fix typo in cache variable
name for cross compiling.
Remove definitions of gettext-related macros. The gettext
installation procedure installs corresponding .m4 files so that
aclocal will use them.
Wed Dec 11 19:34:22 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.14.
Tue Dec 10 00:14:24 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: Bump version to 3.13k.

View File

@@ -1,6 +1,16 @@
Changes in release 3.15:
[3.14b]:
* Using --program-prefix no longer applies the prefix twice
* ls --color properly restores color attributes upon completion when the
normal (`no') color attribute is not the default color.
* with ls -s --color, the `total' and size of the first file are printed
* ls --color stats symlinks and distinguishes between regular symlinks
and orphan ones.
* cp --preserve preserves owner and group of symlinks on Linux when run
with EUID == 0
* dircolors no longer accepts --print-data-base (alternate spelling of
--print-database)
Changes in release 3.14:
[3.13k]
[3.13j]
* ls --color highlights based on suffix rules only for regular files
* touch --date=DATE accepts dates like those in an RCS log listing, e.g.,
`1992/11/01 05:44:34'.
@@ -8,7 +18,6 @@ Changes in release 3.14:
* df accepts -F as a synonym for -t for compatibility with Solaris
* cp -i /dev/null existing-file now prompts before overwriting the target
* ls --color highlights orphaned symlinks text on terminals that support it
[3.13i]
* ls -l honors current locale with respect to abbreviated month names (and,
with --full-time day names) on systems with a locale-supporting strftime
function, e.g., ones based on recent versions of the GNU C library

View File

@@ -1,3 +1,159 @@
Fri Dec 27 17:25:18 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/who-users.c [!WTMP_FILE]: Provide default path.
(UTMP_FILE) [UTMPX_FILE]: Use UTMPX_FILE in favor of UTMP_FILE.
Patch from Kaveh R. Ghazi.
Indent cpp directives.
* m4/getgroups.m4: Rewrite the test so that systems lacking
getgroups don't try to use the supplied replacement function --
that depends on the existence of such a function.
* Makefile.am (aclocal.m4): No longer depend on acinclude.m4.
* configure.in (jm_FUNC_GETGROUPS): Use it.
Reported by Marcus Daniels.
AC_REQUIRE version 2.12 of autoconf.
Sun Dec 22 23:31:32 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: Increment version to 1.14a.
* m4/Makefile.am (EXTRA_DIST): Add README.
Fri Dec 20 19:28:37 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/who-users.c (usage): Say that UTMP_FILE is the default FILE
rather than hard-coding /etc/utmp. Replace hard-coded /etc/wtmp
with WTMP_FILE. Suggestion from Eivind.
* src/seq.c (usage): Tweak --help text.
* configure.in (AC_OUTPUT): Add m4/Makefile.
* lib/Makefile.am (EXTRA_DIST): Add getgroups.c.
* Makefile.am (SUBDIRS): Add m4.
(aclocal-files): Add rules that rely on (GNU) make's include
directive that computes dependencies for aclocal.m4.
(aclocal.m4): Override automake-generated rule.
* m4/Makefile.am: New file.
* lib/strftime.c: Update from GNU libc.
* m4/getline.m4: New file, extracted from acinclude.m4.
* m4/getloadavg.m4: Likewise.
* m4/jm-mktime.m4: Likewise.
* m4/jm-winsz1.m4: Likewise.
* m4/jm-winsz2.m4: Likewise.
* m4/memcmp.m4: Likewise.
* m4/strftime.m4: Likewise.
* m4/uptime.m4: Likewise.
* m4/ccstdc.m4: Copied from automake-1.1l.
* m4/dmalloc.m4: Likewise.
* m4/error.m4: Likewise.
* m4/gettext.m4: Likewise.
* m4/header.m4: Likewise.
* m4/init.m4: Likewise.
* m4/install.m4: Likewise.
* m4/lcmessage.m4: Likewise.
* m4/lispdir.m4: Likewise.
* m4/maintainer.m4: Likewise.
* m4/mktime.m4: Likewise.
* m4/obstack.m4: Likewise.
* m4/progtest.m4: Likewise.
* m4/protos.m4: Likewise.
* m4/ptrdiff.m4: Likewise.
* m4/regex.m4: Likewise.
* m4/sanity.m4: Likewise.
* m4/strtod.m4: Likewise.
* m4/termios.m4: Likewise.
* m4/winsz.m4: Likewise.
* m4/getgroups.m4: New file.
(jm_FUNC_GETGROUPS): New macro
* lib/getgroups.c: New file.
* m4: New directory.
Wed Dec 18 07:47:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (AC_CHECK_HEADERS): Add paths.h.
* src/su.c [HAVE_PATHS_H]: Include <paths.h>.
[_PATH_DEFPATH]: Use this to define DEFAULT_LOGIN_PATH.
[_PATH_DEFPATH_ROOT]: Use this to define DEFAULT_ROOT_LOGIN_PATH.
From Rik Faith.
* acinclude.m4 (jm_FUNC_GNU_STRFTIME): Change m4 quote strings
outside the quoted test program. Quote the test program with <<, >>.
Reported by Andreas Schwab.
(AM_FUNC_GETLOADAVG): Likewise.
(jm_FUNC_GNU_STRFTIME): Add tests for new, upcasing ^ modifier
Tue Dec 17 18:54:32 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/Makefile.am (install-exec-local): Properly redirect stdout
and stderr to /dev/null. From Eric Backus.
* lib/strftime.c: Update from GNU libc.
* acinclude.m4 (jm_SYS_PROC_UPTIME): Require AC_PROG_CC, rather than
now-obsolete AC_C_CROSS.
(jm_FUNC_MKTIME): When redefining, use rpl_ prefix, not gnu_ one
since there's nothing GNU-specific about the replacement. Contrast
with gnu_ prefix added to strftime.
(jm_FUNC_MEMCMP): New macro.
* configure.in: Use jm_FUNC_MEMCMP instead of AM_FUNC_MEMCMP.
* acconfig.h: Add memcmp.
Sun Dec 15 18:37:08 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (check for 3-argument setpriority function): Complete
partial change made on Dec 12. From Arne Juul.
Sat Dec 14 14:51:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
* acinclude.m4 (jm_SYS_PROC_UPTIME): Fix typo in cache variable
name for cross compiling.
Remove definitions of gettext-related macros. The gettext
installation procedure installs corresponding .m4 files so that
aclocal will use them.
Thu Dec 12 06:07:30 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.14.
* src/system.h (ISDIGIT): Replace with smaller, faster edition
that yields nonzero only on ASCII digits.
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
used to have. From Paul Eggert.
* configure.in: Bump version to 1.14.
* lib/getdate.y (IN_CTYPE_DOMAIN): Rename from ISASCII.
(ISDIGIT): New definition from Paul Eggert.
This one evaluates its argument exactly once.
(yylex): Move increment out of ISALPHA argument. Use a
comma-expression instead.
* src/false.sh (usage): Update bug-reporting address.
* src/groups.sh (usage): Likewise.
* src/nohup.sh (usage): Likewise.
* src/true.sh (usage): Likewise.
Reported by Karl Heuer.
* configure.in (check for 3-argument setpriority function): Add nohup
to list of scripts, not the list of programs.
From Karl Heuer.
* POTFILES.in: Add chroot.c. Reported by Michel Robitaille.
Wed Dec 11 19:33:36 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.13.
Tue Dec 10 06:36:57 1996 Jim Meyering <meyering@na-net.ornl.gov>
* acinclude.m4 (jm_SYS_PROC_UPTIME): New macro. Derived from the
@@ -280,8 +436,7 @@ Mon Oct 28 17:40:54 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in: Don't output confusing diagnostic: `checking for
shadow password routines'. Suggestion from François Pinard.
Thu Oct 24 13:50:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund\
.de>
Thu Oct 24 13:50:46 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* src/tee.c (main): Ignore SIGPIPE.

View File

@@ -1,5 +1,9 @@
Changes in release 1.15
[1.14b]
Changes in release 1.14
* fix bug in getdate.y that broke date's --date=DATE option on systems
like SunOS4.
Changes in release 1.13
[1.12t]
* two patches for ISC
* Regenerate all Makefile.in using a patched version of automake-1.1l.
[1.12s]

View File

@@ -1,3 +1,146 @@
Thu Jan 2 21:17:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
* src/pr.c (init_fps): Initialize lines_stored field in three places.
This avoids uninitialized memory reads in close_file.
Wed Jan 1 17:32:18 1997 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (AC_ARG_PROGRAM): Remove explicit use.
It's implicit in AM_INIT_AUTOMAKE. From Wayne Stewart.
Sun Dec 29 23:42:57 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/pr.c (init_header): Plug a small memory leak by using stack
rather than heap for a 15-byte temporary buffer.
Sat Dec 28 00:03:23 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/pr.c (TAB_WIDTH): Parenthesize uses of parameters and renamed
from tab_width.
(POS_AFTER_TAB): Renamed from pos_after_tab. Define in terms of
TAB_WIDTH rather than duplicating the expression.
Fri Dec 27 17:29:02 1996 Jim Meyering <meyering@na-net.ornl.gov>
* tests/join-test/mk-script.pl: Fix a couple of thinkos and typos.
Now it works with pr's tests, too.
* tests/pr-test/Makefile.am (explicit): Regenerate list of files,
this time with duplicates removed.
* src/pr.c (usage): Break long string literal into two separate
printf statements to accomodate default maximum of 2048 characters
for Irix-4.0.5. Reported by Kaveh Ghazi.
* Makefile.am (aclocal.m4): No longer depend on acinclude.m4.
* tests/Makefile.am (SUBDIRS): Add pr-test.
* configure.in: AC_REQUIRE version 2.12 of autoconf.
AC_OUTPUT: Add tests/pr-test/Makefile.
Sun Dec 22 08:11:27 1996 Jim Meyering <meyering@na-net.ornl.gov>
* acinclude.m4: Move macros to individual files in new directory, m4/.
See ChangeLog entries in sh-utils for the details.
* configure.in: Increment version to 1.20a.
* tests/md5sum-test/Makefile.am: Use same framework as other tests.
* tests/md5sum-test/Test.pm: New file.
Sat Dec 21 20:32:58 1996 Jim Meyering <meyering@na-net.ornl.gov>
* tests/Makefile.am (EXTRA_DIST): Add README and Makefile.am.in.
* tests/Makefile.am.in: New file.
* tests/sort-test/Makefile.am: Clone the Makefile.am from join-test.
Replace only the definition of $x and the auto-generated lists of
test files.
* tests/cut-test/Makefile.am: Likewise.
* tests/tr-test/Makefile.am: Likewise.
* tests/join-test/Makefile.am: Add @MAINT@-protected rule for
verifying that Makefile.am is consistent with Test.pm.
Fri Dec 20 00:08:36 1996 Jim Meyering <meyering@na-net.ornl.gov>
* tests/join-test/Makefile.am (MAINTAINERCLEANFILES): Use $(in1)
and $(in2), not $(in).
* tests/join-test/mk-script.pl: New option: --list.
Generate lists of files used/generated.
Thu Dec 19 23:28:41 1996 Jim Meyering <meyering@na-net.ornl.gov>
* tests/join-test/mk-script.pl: Rewrite to be more general -- so
it can be used for join, cut, sort, tr, and soon, pr test suites.
* tests/tr-test/mk-script.pl: Symlink through CVS repo to join's
mk-script.pl.
* tests/sort-test/mk-script.pl: Likewise.
* tests/cut-test/mk-script.pl: Likewise.
* tests/tr-test/Test.pm: Adapted for new mk-script.pl.
* tests/join-test/Test.pm: Likewise.
Tue Dec 17 16:48:51 1996 Jim Meyering <meyering@na-net.ornl.gov>
* tests/join-test/Makefile.am (.pl): Make generated file read-only so
I don't accidentally modify it instead of the one with the .pl suffix.
* acinclude.m4 (jm_SYS_PROC_UPTIME): Require AC_PROG_CC, rather than
now-obsolete AC_C_CROSS.
(jm_FUNC_MKTIME): When redefining, use rpl_ prefix, not gnu_ one
since there's nothing GNU-specific about the replacement. Contrast
with gnu_ prefix added to strftime.
(jm_FUNC_MEMCMP): New macro.
* configure.in: Use jm_FUNC_MEMCMP instead of AM_FUNC_MEMCMP.
* acconfig.h: Add memcmp.
* README: Remove warning about memcmp. The new macro handles it.
Mon Dec 16 23:03:27 1996 Jim Meyering <meyering@na-net.ornl.gov>
* tests/Makefile.am (pkgdata_DATA): Remove unnecessary assignment.
From Eric Backus.
(AUTOMAKE_OPTIONS): Likewise.
Sat Dec 14 14:51:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
* acinclude.m4 (jm_SYS_PROC_UPTIME): Fix typo in cache variable
name for cross compiling.
Remove definitions of gettext-related macros. The gettext
installation procedure installs corresponding .m4 files so that
aclocal will use them.
1996-12-12 Paul Eggert <eggert@twinsun.com>
* system.h (ISDIGIT): Replace with smaller, faster edition
that yields nonzero only on ASCII digits.
(ISDIGIT_LOCALE): New macro, with same meaning that ISDIGIT
used to have.
* tr.c (is_char_class_member): Use ISDIGIT_LOCALE instead of
ISDIGIT to test for characters in CC_DIGIT class.
* sort.c (digits): Remove; subsumed by new ISDIGIT.
(inittables): Remove initialization of `digits'.
(fraccompare, numcompare, main): Use ISDIGIT (x) instead of digits[x].
(fraccompare, numcompare): Avoid casts to unsigned char that are no
longer needed.
* csplit.c (get_format_width, get_format_prec): Avoid
unnecessary comparison of digit to '\0'.
Thu Dec 12 23:42:51 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/sort.c (usage): Clarify description of -u option.
From Karl Berry.
Wed Dec 11 19:32:18 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.20.
Tue Dec 10 00:15:50 1996 Jim Meyering <meyering@na-net.ornl.gov>
The file name, `build-script.pl' is longer than 14 characters.

View File

@@ -1,3 +1,6 @@
Changes in release 1.21
[1.20b]
* Using --program-prefix no longer applies the prefix twice
Changes in release 1.20
Changes in test release 1.19r
* see ChangeLog
@@ -32,7 +35,7 @@ Changes in release 1.20
* fix bug in sort -c that sometimes resulted in a segfault
Changes in test release 1.19p
* md5sum's --string option is being deprecated and is no longer documented.
It is still accepted, but will be removed altogether in 1.21.
It is still accepted, but will be removed altogether in 1.22.
* tr '[:lower:]' '[:upper:]' no longer fails when LC_CTYPE is set to
iso_8859_1 on Solaris -- or any other character set with differing
numbers of uppercase and lowercase characters

View File

@@ -37,14 +37,15 @@
uid_t geteuid ();
#endif
#ifdef HAVE_LCHOWN
# define LINK_CHOWN(FILE, OWNER, GROUP) lchown(FILE, OWNER, GROUP)
#else
# define LINK_CHOWN(FILE, OWNER, GROUP) chown(FILE, OWNER, GROUP)
/* On Linux (from slackware-1.2.13 to 2.0.2?) there is no lchown function.
To change ownership of symlinks, you must run chown with an effective
UID of 0. */
#ifdef __linux__
# define ROOT_CHOWN_AFFECTS_SYMLINKS
#endif
#define DO_CHOWN(FILE, NEW_UID, NEW_GID) \
(LINK_CHOWN ((FILE), (myeuid == 0 ? (NEW_UID) : myeuid), (NEW_GID)) \
#define DO_CHOWN(Chown, File, New_uid, New_gid) \
(Chown ((File), (myeuid == 0 ? (New_uid) : myeuid), (New_gid)) \
/* If non-root uses -p, it's ok if we can't preserve ownership. \
But root probably wants to know, e.g. if NFS disallows it. */ \
&& (errno != EPERM || myeuid == 0))
@@ -823,17 +824,6 @@ copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
goto un_backup;
}
/* Change the owner and group of the just-created symbolic link
if this system has the lchown function. */
#ifdef HAVE_LCHOWN
if (flag_preserve
&& DO_CHOWN (dst_path, src_sb.st_uid, src_sb.st_gid))
{
error (0, errno, "%s", dst_path);
goto un_backup;
}
#endif
return 0;
}
else
@@ -910,16 +900,39 @@ copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
goto un_backup;
}
/* Change the owner and group of the just-created symbolic link
if this system has the lchown function. */
#ifdef HAVE_LCHOWN
if (flag_preserve
&& DO_CHOWN (dst_path, src_sb.st_uid, src_sb.st_gid))
if (flag_preserve)
{
error (0, errno, "%s", dst_path);
goto un_backup;
}
/* Preserve the owner and group of the just-`copied'
symbolic link, if possible. */
#ifdef HAVE_LCHOWN
if (DO_CHOWN (lchown, dst_path, src_sb.st_uid, src_sb.st_gid))
{
error (0, errno, "%s", dst_path);
goto un_backup;
}
#else
# ifdef ROOT_CHOWN_AFFECTS_SYMLINKS
if (myeuid == 0)
{
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
{
error (0, errno, "%s", dst_path);
goto un_backup;
}
}
else
{
/* FIXME: maybe give a diagnostic: you must be root
to preserve ownership and group of symlinks. */
}
# else
/* Can't preserve ownership of symlinks.
FIXME: maybe give a warning or even error for symlinks
in directories with the sticky bit set -- there, not
preserving owner/group is a potential security problem. */
# endif
#endif
}
return 0;
}
@@ -947,7 +960,7 @@ copy (const char *src_path, const char *dst_path, int new_dst, dev_t device,
return 1;
}
if (DO_CHOWN (dst_path, src_sb.st_uid, src_sb.st_gid))
if (DO_CHOWN (chown, dst_path, src_sb.st_uid, src_sb.st_gid))
{
error (0, errno, "%s", dst_path);
return 1;

View File

@@ -12,8 +12,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by Stuart Kemp, cpsrk@groper.jcu.edu.au.
Modified by David MacKenzie, djm@gnu.ai.mit.edu. */
@@ -1306,9 +1306,8 @@ get_format_width (char **format_ptr)
int ch_save;
start = *format_ptr;
for (; **format_ptr; (*format_ptr)++)
if (!ISDIGIT (**format_ptr))
break;
for (; ISDIGIT (**format_ptr); (*format_ptr)++)
continue;
ch_save = **format_ptr;
**format_ptr = '\0';
@@ -1344,9 +1343,8 @@ get_format_prec (char **format_ptr)
}
start = *format_ptr;
for (; **format_ptr; (*format_ptr)++)
if (!ISDIGIT (**format_ptr))
break;
for (; ISDIGIT (**format_ptr); (*format_ptr)++)
continue;
/* ANSI 4.9.6.1 says that if the precision is negative, it's as good as
not there. */

View File

@@ -88,8 +88,6 @@ static struct option const long_options[] =
{"csh", no_argument, NULL, 'c'},
{"c-shell", no_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
/* I deprecate --print-data-base. `database' is one word. */
{"print-data-base", no_argument, NULL, 'p'},
{"print-database", no_argument, NULL, 'p'},
{"version", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}

View File

@@ -36,6 +36,7 @@ FIFO 40;33 # pipe
SOCK 01;35 # socket
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file
# This is for files with execute permission:
EXEC 01;32

View File

@@ -29,7 +29,7 @@ usage="Usage: $0 [OPTION]... [USERNAME]...
Same as id -Gn. If no USERNAME, use current process.
Report bugs to bug-gnu-utils@gnu.ai.mit.edu"
Report bugs to sh-utils-bugs@gnu.ai.mit.edu"
case $# in
1 )

View File

@@ -15,17 +15,17 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* If the macro MULTI_COL is defined,
/* If ls_mode is LS_MULTI_COL,
the multi-column format is the default regardless
of the type of output device.
This is for the `dir' program.
If the macro LONG_FORMAT is defined,
If ls_mode is LS_LONG_FORMAT,
the long format is the default regardless of the
type of output device.
This is for the `vdir' program.
If neither is defined,
If ls_mode is LS_LS,
the output format depends on whether the output
device is a terminal.
This is for the `ls' program. */
@@ -194,6 +194,7 @@ static void print_long_format __P ((const struct fileinfo *f));
static void print_many_per_line __P ((void));
static void print_name_with_quoting __P ((const char *p, unsigned int mode,
int linkok));
static void prep_non_filename_text __P ((void));
static void print_type_indicator __P ((unsigned int mode));
static void print_with_commas __P ((void));
static void queue_directory __P ((const char *name, const char *realname));
@@ -673,7 +674,10 @@ main (int argc, char **argv)
usage (EXIT_SUCCESS);
if (print_with_color)
parse_ls_color ();
{
parse_ls_color ();
prep_non_filename_text ();
}
format_needs_stat = sort_type == sort_time || sort_type == sort_size
|| format == long_format
@@ -743,6 +747,13 @@ main (int argc, char **argv)
if (fclose (stdout) == EOF)
error (EXIT_FAILURE, errno, _("write error"));
/* Restore default color before exiting */
if (print_with_color)
{
put_indicator (&color_indicator[C_LEFT]);
put_indicator (&color_indicator[C_RIGHT]);
}
exit (exit_status);
}
@@ -1285,7 +1296,7 @@ get_funky_string (char **dest, const char **src, int equals_end)
*(q++) = *(p++) & 037;
++count;
}
else if ( *p == '?' )
else if ( *p == '?')
{
*(q++) = 127;
++count;
@@ -1630,7 +1641,7 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
#ifdef S_ISLNK
if (S_ISLNK (files[files_index].stat.st_mode)
&& (explicit_arg || format == long_format))
&& (explicit_arg || format == long_format || print_with_color))
{
char *linkpath;
struct stat linkstats;
@@ -1642,9 +1653,12 @@ gobble_file (const char *name, int explicit_arg, const char *dirname)
they won't be traced and when no indicator is needed. */
if (linkpath
&& ((explicit_arg && format != long_format)
|| indicator_style != none)
|| indicator_style != none
|| print_with_color)
&& stat (linkpath, &linkstats) == 0)
{
files[files_index].linkok = 1;
/* Symbolic links to directories that are mentioned on the
command line are automatically traced if not being
listed as files. */
@@ -2134,7 +2148,7 @@ print_long_format (const struct fileinfo *f)
if (f->linkname)
{
FPUTS_LITERAL (" -> ", stdout);
print_name_with_quoting (f->linkname, f->linkmode, f->linkok-1);
print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1);
if (indicator_style != none)
print_type_indicator (f->linkmode);
}
@@ -2297,15 +2311,19 @@ print_name_with_quoting (const char *p, unsigned int mode, int linkok)
free (quoted);
if (print_with_color)
prep_non_filename_text ();
}
static void
prep_non_filename_text (void)
{
if (color_indicator[C_END].string != NULL)
put_indicator (&color_indicator[C_END]);
else
{
if (color_indicator[C_END].string != NULL)
put_indicator (&color_indicator[C_END]);
else
{
put_indicator (&color_indicator[C_LEFT]);
put_indicator (&color_indicator[C_NORM]);
put_indicator (&color_indicator[C_RIGHT]);
}
put_indicator (&color_indicator[C_LEFT]);
put_indicator (&color_indicator[C_NORM]);
put_indicator (&color_indicator[C_RIGHT]);
}
}

View File

@@ -33,7 +33,7 @@ usage_help="Run COMMAND, ignoring hangup signals.
--help display this help and exit
--version output version information and exit
Report bugs to bug-gnu-utils@gnu.ai.mit.edu"
Report bugs to sh-utils-bugs@gnu.ai.mit.edu"
if [ $# -eq 0 ]; then
echo >&2 "$usage"

View File

@@ -457,13 +457,13 @@ static int input_position;
status if there were any. */
static int failed_opens = 0;
/* The horizontal position we'll be at after printing a tab character
of width c_ from the position h_. */
#define pos_after_tab(c_, h_) h_ - h_ % c_ + c_
/* The number of spaces taken up if we print a tab character with width
c_ from position h_. */
#define tab_width(c_, h_) - h_ % c_ + c_
#define TAB_WIDTH(c_, h_) ((c_) - ((h_) % (c_)))
/* The horizontal position we'll be at after printing a tab character
of width c_ from the position h_. */
#define POS_AFTER_TAB(c_, h_) ((h_) + TAB_WIDTH (c_, h_))
/* (-NNN) Number of columns of text to print. */
static int columns = 1;
@@ -996,7 +996,7 @@ init_parameters (int number_of_files)
if (number_separator == input_tab_char)
{
number_width = chars_per_number +
tab_width (chars_per_input_tab,
TAB_WIDTH (chars_per_input_tab,
(chars_per_margin + chars_per_number));
}
else
@@ -1076,6 +1076,7 @@ init_fps (int number_of_files, char **av)
if (open_file (*av, p) == 0)
return 1;
init_header (*av, fileno (p->fp));
p->lines_stored = 0;
}
else
{
@@ -1086,6 +1087,7 @@ init_fps (int number_of_files, char **av)
p->full_page_printed = FALSE;
++total_files;
init_header ("", -1);
p->lines_stored = 0;
}
firstname = p->name;
@@ -1096,6 +1098,7 @@ init_fps (int number_of_files, char **av)
p->fp = firstfp;
p->status = OPEN;
p->full_page_printed = FALSE;
p->lines_stored = 0;
}
}
files_ready_to_read = total_files;
@@ -1360,7 +1363,7 @@ init_header (char *filename, int desc)
int chars_per_middle, chars_free, lhs_blanks, rhs_blanks;
char *f = filename;
char *no_middle = "";
char *header_text, *t_buf;
char *header_text;
struct tm *tmptr;
struct stat st;
char *datim = "- Date/Time --";
@@ -1376,18 +1379,16 @@ init_header (char *filename, int desc)
sprintf (header, "%s", " "); /* blank line header */
else
{
#define T_BUF_FMT "%y-%m-%d %H:%M" /* date/time short format */
#define T_BUF_SIZE 15
char t_buf[T_BUF_SIZE];
/* If parallel files or standard input, use current time. */
if (desc < 0 || !strcmp (filename, "-") || fstat (desc, &st))
st.st_mtime = time (NULL);
{
size_t t_buf_size = 15;
const char *fmt = "%y-%m-%d %H:%M"; /* date/time short format */
t_buf = (char *) xmalloc (t_buf_size);
tmptr = localtime (&st.st_mtime);
strftime (t_buf, t_buf_size, fmt, tmptr);
}
tmptr = localtime (&st.st_mtime);
strftime (t_buf, T_BUF_SIZE, T_BUF_FMT, tmptr);
chars_per_middle = chars_per_line - CHARS_FOR_DATE_AND_PAGE;
if (chars_per_middle < 3)
@@ -1643,6 +1644,7 @@ init_store_cols (void)
if (line_vector != NULL)
free ((int *) line_vector);
/* FIXME: here's where it was allocated. */
line_vector = (int *) xmalloc ((total_lines + 1) * sizeof (int *));
if (end_vector != NULL)
@@ -1927,7 +1929,7 @@ print_white_space (void)
register int goal = h_old + spaces_not_printed;
while (goal - h_old > 1
&& (h_new = pos_after_tab (chars_per_output_tab, h_old)) <= goal)
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
{
putchar (output_tab_char);
h_old = h_new;
@@ -2234,6 +2236,17 @@ print_stored (COLUMN *p)
int line = p->current_line++;
register char *first = &buff[line_vector[line]];
/* FIXME
UMR: Uninitialized memory read:
* This is occurring while in:
print_stored [pr.c:2239]
* Reading 4 bytes from 0x5148c in the heap.
* Address 0x5148c is 4 bytes into a malloc'd block at 0x51488 of 676 bytes
* This block was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:94]
init_store_cols [pr.c:1648]
*/
register char *last = &buff[line_vector[line + 1]];
pad_vertically = TRUE;
@@ -2298,7 +2311,7 @@ char_to_clump (int c)
if (c == input_tab_char)
{
width = tab_width (chars_per_input_tab, input_position);
width = TAB_WIDTH (chars_per_input_tab, input_position);
if (untabify_input)
{
@@ -2427,7 +2440,8 @@ Paginate or columnate FILE(s) for printing.\n\
-j 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\
(default number of lines of text 56, with -f 63)\n\
(default number of lines of text 56, with -f 63)\n"));
printf (_("\
-m 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\

View File

@@ -88,14 +88,15 @@ Usage: %s [OPTION]... LAST\n\
or: %s [OPTION]... FIRST INCREMENT LAST\n\
"), program_name, program_name, program_name);
printf (_("\
Print numbers from FIRST (default 1) to LAST, moving by STEP (default 1).\n\
Print numbers from FIRST to LAST, in steps of INCREMENT.\n\
\n\
-f, --format FORMAT use printf(3) style FORMAT (default: %%g)\n\
-s, --separator STRING use STRING for separating numbers (default: \\n)\n\
-s, --separator STRING use STRING to separate numbers (default: \\n)\n\
-w, --equal-width equalize width by padding with leading zeroes\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
If FIRST or INCREMENT is omitted, it defaults to 1.\n\
FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
INCREMENT should be positive if FIRST is smaller than LAST, and negative\n\
otherwise. When given, the FORMAT argument must contain exactly one of\n\

View File

@@ -129,9 +129,6 @@ struct month
/* The name this program was run with. */
char *program_name;
/* Table of digits. */
static int digits[UCHAR_LIM];
/* Table of white space. */
static int blanks[UCHAR_LIM];
@@ -236,8 +233,8 @@ Write sorted concatenation of all FILE(s) to standard output.\n\
-s stabilize sort by disabling last resort comparison\n\
-t SEP use SEParator instead of non- to whitespace transition\n\
-T DIRECT use DIRECT for temporary files, not $TMPDIR or %s\n\
-u with -c, check for strict ordering\n\
-u with -m, only output the first of an equal sequence\n\
-u with -c, check for strict ordering;\n\
with -m, only output the first of an equal sequence\n\
-z end lines with 0 byte, not newline, for find -print0\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -459,8 +456,6 @@ inittables (void)
{
if (ISBLANK (i))
blanks[i] = 1;
if (ISDIGIT (i))
digits[i] = 1;
if (!ISPRINT (i))
nonprinting[i] = 1;
if (!ISALNUM (i) && !ISBLANK (i))
@@ -762,29 +757,29 @@ findlines (struct buffer *buf, struct lines *lines)
static int
fraccompare (register const char *a, register const char *b)
{
register int tmpa = UCHAR (*a);
register int tmpb = UCHAR (*b);
register int tmpa = *a;
register int tmpb = *b;
if (tmpa == '.' && tmpb == '.')
{
do
tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
while (tmpa == tmpb && digits[tmpa]);
if (digits[tmpa] && digits[tmpb])
tmpa = *++a, tmpb = *++b;
while (tmpa == tmpb && ISDIGIT (tmpa));
if (ISDIGIT (tmpa) && ISDIGIT (tmpb))
return tmpa - tmpb;
if (digits[tmpa])
if (ISDIGIT (tmpa))
{
while (tmpa == '0')
tmpa = UCHAR (*++a);
if (digits[tmpa])
tmpa = *++a;
if (ISDIGIT (tmpa))
return 1;
return 0;
}
if (digits[tmpb])
if (ISDIGIT (tmpb))
{
while (tmpb == '0')
tmpb = UCHAR (*++b);
if (digits[tmpb])
tmpb = *++b;
if (ISDIGIT (tmpb))
return -1;
return 0;
}
@@ -793,18 +788,18 @@ fraccompare (register const char *a, register const char *b)
else if (tmpa == '.')
{
do
tmpa = UCHAR (*++a);
tmpa = *++a;
while (tmpa == '0');
if (digits[tmpa])
if (ISDIGIT (tmpa))
return 1;
return 0;
}
else if (tmpb == '.')
{
do
tmpb = UCHAR (*++b);
tmpb = *++b;
while (tmpb == '0');
if (digits[tmpb])
if (ISDIGIT (tmpb))
return -1;
return 0;
}
@@ -831,44 +826,45 @@ numcompare (register const char *a, register const char *b)
if (tmpa == '-')
{
do
tmpa = UCHAR (*++a);
tmpa = *++a;
while (tmpa == '0');
if (tmpb != '-')
{
if (tmpa == '.')
do
tmpa = UCHAR (*++a);
tmpa = *++a;
while (tmpa == '0');
if (digits[tmpa])
if (ISDIGIT (tmpa))
return -1;
while (tmpb == '0')
tmpb = UCHAR (*++b);
tmpb = *++b;
if (tmpb == '.')
do
tmpb = *++b;
while (tmpb == '0');
if (digits[tmpb])
if (ISDIGIT (tmpb))
return -1;
return 0;
}
do
tmpb = UCHAR (*++b);
tmpb = *++b;
while (tmpb == '0');
while (tmpa == tmpb && digits[tmpa])
tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
while (tmpa == tmpb && ISDIGIT (tmpa))
tmpa = *++a, tmpb = *++b;
if ((tmpa == '.' && !digits[tmpb]) || (tmpb == '.' && !digits[tmpa]))
if ((tmpa == '.' && !ISDIGIT (tmpb))
|| (tmpb == '.' && !ISDIGIT (tmpa)))
return -fraccompare (a, b);
if (digits[tmpa])
for (loga = 1; digits[UCHAR (*++a)]; ++loga)
if (ISDIGIT (tmpa))
for (loga = 1; ISDIGIT (*++a); ++loga)
;
else
loga = 0;
if (digits[tmpb])
for (logb = 1; digits[UCHAR (*++b)]; ++logb)
if (ISDIGIT (tmpb))
for (logb = 1; ISDIGIT (*++b); ++logb)
;
else
logb = 0;
@@ -884,45 +880,46 @@ numcompare (register const char *a, register const char *b)
else if (tmpb == '-')
{
do
tmpb = UCHAR (*++b);
tmpb = *++b;
while (tmpb == '0');
if (tmpb == '.')
do
tmpb = *++b;
while (tmpb == '0');
if (digits[tmpb])
if (ISDIGIT (tmpb))
return 1;
while (tmpa == '0')
tmpa = UCHAR (*++a);
tmpa = *++a;
if (tmpa == '.')
do
tmpa = UCHAR (*++a);
tmpa = *++a;
while (tmpa == '0');
if (digits[tmpa])
if (ISDIGIT (tmpa))
return 1;
return 0;
}
else
{
while (tmpa == '0')
tmpa = UCHAR (*++a);
tmpa = *++a;
while (tmpb == '0')
tmpb = UCHAR (*++b);
tmpb = *++b;
while (tmpa == tmpb && digits[tmpa])
tmpa = UCHAR (*++a), tmpb = UCHAR (*++b);
while (tmpa == tmpb && ISDIGIT (tmpa))
tmpa = *++a, tmpb = *++b;
if ((tmpa == '.' && !digits[tmpb]) || (tmpb == '.' && !digits[tmpa]))
if ((tmpa == '.' && !ISDIGIT (tmpb))
|| (tmpb == '.' && !ISDIGIT (tmpa)))
return fraccompare (a, b);
if (digits[tmpa])
for (loga = 1; digits[UCHAR (*++a)]; ++loga)
if (ISDIGIT (tmpa))
for (loga = 1; ISDIGIT (*++a); ++loga)
;
else
loga = 0;
if (digits[tmpb])
for (logb = 1; digits[UCHAR (*++b)]; ++logb)
if (ISDIGIT (tmpb))
for (logb = 1; ISDIGIT (*++b); ++logb)
;
else
logb = 0;
@@ -1787,13 +1784,13 @@ main (int argc, char **argv)
key = (struct keyfield *) xmalloc (sizeof (struct keyfield));
key_init (key);
s = argv[i] + 1;
if (! (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])])))
if (! (ISDIGIT (*s) || (*s == '.' && ISDIGIT (s[1]))))
badfieldspec (argv[i]);
for (t = 0; digits[UCHAR (*s)]; ++s)
for (t = 0; ISDIGIT (*s); ++s)
t = 10 * t + *s - '0';
t2 = 0;
if (*s == '.')
for (++s; digits[UCHAR (*s)]; ++s)
for (++s; ISDIGIT (*s); ++s)
t2 = 10 * t2 + *s - '0';
if (t2 || t)
{
@@ -1809,7 +1806,7 @@ main (int argc, char **argv)
else if (argv[i][0] == '-' && argv[i][1])
{
s = argv[i] + 1;
if (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])]))
if (ISDIGIT (*s) || (*s == '.' && ISDIGIT (s[1])))
{
if (!key)
{
@@ -1818,11 +1815,11 @@ main (int argc, char **argv)
key specifiers,\nthe +POS specifier must come first"));
usage (SORT_FAILURE);
}
for (t = 0; digits[UCHAR (*s)]; ++s)
for (t = 0; ISDIGIT (*s); ++s)
t = t * 10 + *s - '0';
t2 = 0;
if (*s == '.')
for (++s; digits[UCHAR (*s)]; ++s)
for (++s; ISDIGIT (*s); ++s)
t2 = t2 * 10 + *s - '0';
key->eword = t;
key->echar = t2;
@@ -1860,9 +1857,9 @@ key specifiers,\nthe +POS specifier must come first"));
xmalloc (sizeof (struct keyfield));
key_init (key);
/* Get POS1. */
if (!digits[UCHAR (*s)])
if (!ISDIGIT (*s))
badfieldspec (argv[i]);
for (t = 0; digits[UCHAR (*s)]; ++s)
for (t = 0; ISDIGIT (*s); ++s)
t = 10 * t + *s - '0';
if (t == 0)
{
@@ -1875,14 +1872,14 @@ to the `-k' option must be positive"));
t2 = 0;
if (*s == '.')
{
if (!digits[UCHAR (s[1])])
if (!ISDIGIT (s[1]))
{
/* Provoke with `sort -k1.' */
error (0, 0, _("starting field spec has `.' but \
lacks following character offset"));
badfieldspec (argv[i]);
}
for (++s; digits[UCHAR (*s)]; ++s)
for (++s; ISDIGIT (*s); ++s)
t2 = 10 * t2 + *s - '0';
if (t2 == 0)
{
@@ -1920,7 +1917,7 @@ lacks following field spec"));
badfieldspec (argv[i]);
}
/* Get POS2. */
for (t = 0; digits[UCHAR (*s)]; ++s)
for (t = 0; ISDIGIT (*s); ++s)
t = t * 10 + *s - '0';
if (t == 0)
{
@@ -1933,14 +1930,14 @@ to the `-k' option must be positive"));
t2 = 0;
if (*s == '.')
{
if (!digits[UCHAR (s[1])])
if (!ISDIGIT (s[1]))
{
/* Provoke with `sort -k1,1.' */
error (0, 0, _("ending field spec has `.' \
but lacks following character offset"));
badfieldspec (argv[i]);
}
for (++s; digits[UCHAR (*s)]; ++s)
for (++s; ISDIGIT (*s); ++s)
t2 = t2 * 10 + *s - '0';
}
else

View File

@@ -114,11 +114,23 @@ uid_t getuid ();
#include "error.h"
#ifdef HAVE_PATHS_H
#include <paths.h>
#endif
/* The default PATH for simulated logins to non-superuser accounts. */
#ifdef _PATH_DEFPATH
#define DEFAULT_LOGIN_PATH _PATH_DEFPATH
#else
#define DEFAULT_LOGIN_PATH ":/usr/ucb:/bin:/usr/bin"
#endif
/* The default PATH for simulated logins to superuser accounts. */
#ifdef _PATH_DEFPATH_ROOT
#define DEFAULT_ROOT_LOGIN_PATH _PATH_DEFPATH_ROOT
#else
#define DEFAULT_ROOT_LOGIN_PATH "/usr/ucb:/bin:/usr/bin:/etc"
#endif
/* The shell to run if none is given in the user's passwd entry. */
#define DEFAULT_SHELL "/bin/sh"

View File

@@ -338,7 +338,6 @@ char *alloca ();
#endif
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
@@ -347,6 +346,17 @@ char *alloca ();
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#ifndef __P
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)

View File

@@ -450,7 +450,7 @@ is_char_class_member (enum Char_class char_class, unsigned int c)
result = ISCNTRL (c);
break;
case CC_DIGIT:
result = ISDIGIT (c);
result = ISDIGIT_LOCALE (c);
break;
case CC_GRAPH:
result = ISGRAPH (c);

View File

@@ -41,45 +41,58 @@
#include <time.h>
#include <getopt.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
# include <sys/param.h>
#endif
#include "system.h"
#include "error.h"
#if !defined (UTMP_FILE) && defined (_PATH_UTMP) /* 4.4BSD. */
#define UTMP_FILE _PATH_UTMP
#if !defined (UTMP_FILE) && defined (_PATH_UTMP)
# define UTMP_FILE _PATH_UTMP
#endif
#if defined (UTMPX_FILE) /* Solaris, SysVr4 */
#undef UTMP_FILE
#define UTMP_FILE UTMPX_FILE
#if !defined (WTMP_FILE) && defined (_PATH_WTMP)
# define WTMP_FILE _PATH_WTMP
#endif
#ifdef UTMPX_FILE /* Solaris, SysVr4 */
# undef UTMP_FILE
# define UTMP_FILE UTMPX_FILE
#endif
#ifdef WTMPX_FILE /* Solaris, SysVr4 */
# undef WTMP_FILE
# define WTMP_FILE WTMPX_FILE
#endif
#ifndef UTMP_FILE
#define UTMP_FILE "/etc/utmp"
# define UTMP_FILE "/etc/utmp"
#endif
#ifndef WTMP_FILE
# define WTMP_FILE "/etc/wtmp"
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
# define MAXHOSTNAMELEN 64
#endif
#ifndef S_IWGRP
#define S_IWGRP 020
# define S_IWGRP 020
#endif
#ifdef WHO
#define COMMAND_NAME "who"
#else
#ifdef USERS
#define COMMAND_NAME "users"
#else
#ifdef UPTIME
#define COMMAND_NAME "uptime"
# define COMMAND_NAME "who"
#else
# ifdef USERS
# define COMMAND_NAME "users"
# else
# ifdef UPTIME
# define COMMAND_NAME "uptime"
# else
error You must define one of WHO, UPTIME or USERS.
#endif /* UPTIME */
#endif /* USERS */
# endif /* UPTIME */
# endif /* USERS */
#endif /* WHO */
int gethostname ();
@@ -146,7 +159,7 @@ print_uptime (int n)
struct tm *tmn;
double avg[3];
int loads;
#ifdef HAVE_PROC_UPTIME
# ifdef HAVE_PROC_UPTIME
FILE *fp;
double upsecs;
@@ -161,34 +174,34 @@ print_uptime (int n)
uptime = (time_t) upsecs;
fclose (fp);
}
#endif /* HAVE_PROC_UPTIME */
# endif /* HAVE_PROC_UPTIME */
/* Loop through all the utmp entries we just read and count up the valid
ones, also in the process possibly gleaning boottime. */
while (n--)
{
if (this->ut_name[0]
#ifdef USER_PROCESS
# ifdef USER_PROCESS
&& this->ut_type == USER_PROCESS
#endif
# endif
)
{
++entries;
}
/* If BOOT_MSG is defined, we can get boottime from utmp. This avoids
possibly needing special privs to read /dev/kmem. */
#ifdef BOOT_MSG
# if HAVE_PROC_UPTIME
# ifdef BOOT_MSG
# if HAVE_PROC_UPTIME
if (uptime == 0)
# endif /* HAVE_PROC_UPTIME */
# endif /* HAVE_PROC_UPTIME */
if (!strcmp (this->ut_line, BOOT_MSG))
boot_time = UT_TIME_MEMBER (this);
#endif /* BOOT_MSG */
# endif /* BOOT_MSG */
++this;
}
time_now = time (0);
#if defined HAVE_PROC_UPTIME
# if defined HAVE_PROC_UPTIME
if (uptime == 0)
#endif
# endif
{
if (boot_time == 0)
error (1, errno, _("couldn't get boot time"));
@@ -206,11 +219,11 @@ print_uptime (int n)
printf (" %2d:%02d, %d %s", uphours, upmins, entries,
(entries == 1) ? _("user") : _("users"));
#if defined (HAVE_GETLOADAVG) || defined (C_GETLOADAVG)
# if defined (HAVE_GETLOADAVG) || defined (C_GETLOADAVG)
loads = getloadavg (avg, 3);
#else
# else
loads = -1;
#endif
# endif
if (loads == -1)
putchar ('\n');
@@ -290,8 +303,8 @@ print_entry (STRUCT_UTMP *this)
time_t last_change;
char mesg;
#define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
#define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)
# define DEV_DIR_WITH_TRAILING_SLASH "/dev/"
# define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)
char line[sizeof (this->ut_line) + DEV_DIR_LEN + 1];
time_t tm;
@@ -343,7 +356,7 @@ print_entry (STRUCT_UTMP *this)
else
printf (" . ");
}
#ifdef HAVE_UT_HOST
# ifdef HAVE_UT_HOST
if (this->ut_host[0])
{
extern char *canon_host ();
@@ -370,7 +383,7 @@ print_entry (STRUCT_UTMP *this)
else
printf (" (%s)", host);
}
#endif
# endif
putchar ('\n');
}
@@ -388,9 +401,9 @@ list_entries_who (int n)
while (n--)
{
if (this->ut_name[0]
#ifdef USER_PROCESS
# ifdef USER_PROCESS
&& this->ut_type == USER_PROCESS
#endif
# endif
)
{
char *trimmed_name;
@@ -431,9 +444,9 @@ list_entries_users (int n)
for (i = 0; i < n; i++)
{
if (this->ut_name[0]
#ifdef USER_PROCESS
# ifdef USER_PROCESS
&& this->ut_type == USER_PROCESS
#endif
# endif
)
{
char *trimmed_name;
@@ -491,9 +504,9 @@ scan_entries (int n)
while (n--)
{
if (this->ut_name[0]
#ifdef USER_PROCESS
# ifdef USER_PROCESS
&& this->ut_type == USER_PROCESS
#endif
# endif
)
print_entry (this);
this++;
@@ -550,13 +563,13 @@ who (char *filename)
else
scan_entries (users);
#else
#ifdef USERS
# ifdef USERS
list_entries_users (users);
#else
#ifdef UPTIME
# else
# ifdef UPTIME
print_uptime (users);
#endif /* UPTIME */
#endif /* USERS */
# endif /* UPTIME */
# endif /* USERS */
#endif /* WHO */
}
@@ -575,9 +588,9 @@ search_entries (int n, char *line)
while (n--)
{
if (this->ut_name[0]
#ifdef USER_PROCESS
# ifdef USER_PROCESS
&& this->ut_type == USER_PROCESS
#endif
# endif
&& !strncmp (line, this->ut_line, sizeof (this->ut_line)))
return this;
this++;
@@ -639,9 +652,9 @@ usage (int status)
--help display this help and exit\n\
--version output version information and exit\n\
\n\
If FILE not given, uses /etc/utmp. /etc/wtmp as FILE is common.\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual.\n\
"));
"), UTMP_FILE, WTMP_FILE);
puts (_("\nReport bugs to sh-utils-bugs@gnu.ai.mit.edu"));
}
exit (status);
@@ -660,10 +673,11 @@ usage (int status)
printf (_("Usage: %s [OPTION]... [ FILE ]\n"), program_name);
printf (_("\
Output who is currently logged in according to FILE.\n\
If FILE not given, uses /etc/utmp. /etc/wtmp as FILE is common.\n\
If FILE is not specified, use %s. %s as FILE is common.\n\
\n\
--help display this help and exit\n\
--version output version information and exit\n"));
--version output version information and exit\n"),
UTMP_FILE, WTMP_FILE);
puts (_("\nReport bugs to sh-utils-bugs@gnu.ai.mit.edu"));
}
exit (status);

3
tests/README Normal file
View File

@@ -0,0 +1,3 @@
A note about Makefile.am.in.
It is used (usually only by the maintainer) to generate most of the
Makefile.am files in these subdirectories.

View File

@@ -5,3 +5,4 @@ t*.exp
t*.err
build-script
Makefile
mk-script

View File

@@ -1,15 +1,26 @@
## Process this file with automake to produce Makefile.in.
##test-files-begin
x = cut
t = t1 t2 t3 t4 t5 t6 t7 t8 t9 tA tB tC tD ta tb tc td te tf tg th \
ti tj tk tl tm tn to tp tq tr ts tt tu tv tw tx ty tz
explicit =
maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
t6.in t6.exp t7.in t7.exp t8.in t8.exp t9.in t9.exp ta.in ta.exp tb.in tb.exp \
tc.in tc.exp td.in td.exp te.in te.exp tf.in tf.exp tg.in tg.exp th.in th.exp \
ti.in ti.exp tj.in tj.exp tk.in tk.exp tl.in tl.exp tm.in tm.exp tn.in tn.exp \
to.in to.exp tp.in tp.exp tq.in tq.exp tr.in tr.exp ts.in ts.exp tt.in tt.exp \
tu.in tu.exp tv.in tv.exp tw.in tw.exp tx.in tx.exp ty.in ty.exp tz.in tz.exp \
tA.in tA.exp tB.in tB.exp tC.in tC.exp tD.in tD.exp
run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
t5.err t6.out t6.err t7.out t7.err t8.out t8.err t9.out t9.err ta.out ta.err \
tb.out tb.err tc.out tc.err td.out td.err te.out te.err tf.out tf.err tg.out \
tg.err th.out th.err ti.out ti.err tj.out tj.err tk.out tk.err tl.out tl.err \
tm.out tm.err tn.out tn.err to.out to.err tp.out tp.err tq.out tq.err tr.out \
tr.err ts.out ts.err tt.out tt.err tu.out tu.err tv.out tv.err tw.out tw.err \
tx.out tx.err ty.out ty.err tz.out tz.err tA.out tA.err tB.out tB.err tC.out \
tC.err tD.out tD.err
##test-files-end
in = $(t:=.in)
exp = $(t:=.exp)
out = $(t:=.out)
err = $(t:=.err)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(in) $(exp)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -26,7 +37,19 @@ SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(in) $(exp)
CLEANFILES = $(out) $(err)
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no

View File

@@ -43,15 +43,24 @@ GMSGFMT = @GMSGFMT@
CC = @CC@
x = cut
t = t1 t2 t3 t4 t5 t6 t7 t8 t9 tA tB tC tD ta tb tc td te tf tg th \
ti tj tk tl tm tn to tp tq tr ts tt tu tv tw tx ty tz
explicit =
maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
t6.in t6.exp t7.in t7.exp t8.in t8.exp t9.in t9.exp ta.in ta.exp tb.in tb.exp \
tc.in tc.exp td.in td.exp te.in te.exp tf.in tf.exp tg.in tg.exp th.in th.exp \
ti.in ti.exp tj.in tj.exp tk.in tk.exp tl.in tl.exp tm.in tm.exp tn.in tn.exp \
to.in to.exp tp.in tp.exp tq.in tq.exp tr.in tr.exp ts.in ts.exp tt.in tt.exp \
tu.in tu.exp tv.in tv.exp tw.in tw.exp tx.in tx.exp ty.in ty.exp tz.in tz.exp \
tA.in tA.exp tB.in tB.exp tC.in tC.exp tD.in tD.exp
run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
t5.err t6.out t6.err t7.out t7.err t8.out t8.err t9.out t9.err ta.out ta.err \
tb.out tb.err tc.out tc.err td.out td.err te.out te.err tf.out tf.err tg.out \
tg.err th.out th.err ti.out ti.err tj.out tj.err tk.out tk.err tl.out tl.err \
tm.out tm.err tn.out tn.err to.out to.err tp.out tp.err tq.out tq.err tr.out \
tr.err ts.out ts.err tt.out tt.err tu.out tu.err tv.out tv.err tw.out tw.err \
tx.out tx.err ty.out ty.err tz.out tz.err tA.out tA.err tB.out tB.err tC.out \
tC.err tD.out tD.err
in = $(t:=.in)
exp = $(t:=.exp)
out = $(t:=.out)
err = $(t:=.err)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(in) $(exp)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -61,8 +70,8 @@ TESTS = $x-tests
SUFFIXES = .pl
MAINTAINERCLEANFILES = $x-tests $(in) $(exp)
CLEANFILES = $(out) $(err)
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -185,7 +194,19 @@ $x-tests: @MAINT@mk-script Test.pm
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -2,27 +2,26 @@ package Test;
require 5.002;
use strict;
my $nl = "\n";
@Test::t = (
my @tv = (
# test flags input expected output expected return code
#
['1', '-d: -f1,3-', "a:b:c$nl", "a:c\n", 0],
['1', '-d: -f1,3-', "a:b:c\n", "a:c\n", 0],
['2', '-d: -f1,3-', "a:b:c\n", "a:c\n", 0],
['3', '-d: -f2-', "a:b:c$nl", "b:c\n", 0],
['4', '-d: -f4', "a:b:c$nl", "\n", 0],
['3', '-d: -f2-', "a:b:c\n", "b:c\n", 0],
['4', '-d: -f4', "a:b:c\n", "\n", 0],
['5', '-d: -f4', "", "", 0],
['6', '-c4', "123$nl", "\n", 0],
['6', '-c4', "123\n", "\n", 0],
['7', '-c4', "123", "\n", 0],
['8', '-c4', "123\n1", "\n\n", 0],
['9', '-c4', "", "", 0],
['a', '-s -d: -f3-', "a:b:c$nl", "c\n", 0],
['b', '-s -d: -f2,3', "a:b:c$nl", "b:c\n", 0],
['c', '-s -d: -f1,3', "a:b:c$nl", "a:c\n", 0],
['a', '-s -d: -f3-', "a:b:c\n", "c\n", 0],
['b', '-s -d: -f2,3', "a:b:c\n", "b:c\n", 0],
['c', '-s -d: -f1,3', "a:b:c\n", "a:c\n", 0],
# Trailing colon should not be output
['d', '-s -d: -f1,3', "a:b:c:$nl", "a:c\n", 0],
['e', '-s -d: -f3-', "a:b:c:$nl", "c:\n", 0],
['f', '-s -d: -f3-4', "a:b:c:$nl", "c:\n", 0],
['g', '-s -d: -f3,4', "a:b:c:$nl", "c:\n", 0],
['d', '-s -d: -f1,3', "a:b:c:\n", "a:c\n", 0],
['e', '-s -d: -f3-', "a:b:c:\n", "c:\n", 0],
['f', '-s -d: -f3-4', "a:b:c:\n", "c:\n", 0],
['g', '-s -d: -f3,4', "a:b:c:\n", "c:\n", 0],
# Make sure -s suppresses non-delimited lines
['h', '-s -d: -f2,3', "abc\n", "", 0],
#
@@ -59,4 +58,9 @@ my $nl = "\n";
['D', '-b', ":\n", "", 1],
);
sub test_vector
{
return @tv;
}
1;

681
tests/cut/cut-tests Executable file
View File

@@ -0,0 +1,681 @@
#! /bin/sh
# This script was generated automatically by build-script.
case $# in
0) xx='../../src/cut';;
*) xx="$1";;
esac
test "$VERBOSE" && echo=echo || echo=:
$echo testing program: $xx
errors=0
test "$srcdir" || srcdir=.
test "$VERBOSE" && $xx --version 2> /dev/null
$xx -d: -f1,3- $srcdir/t1.in > t1.out 2> t1.err
code=$?
if test $code != 0 ; then
$echo Test 1 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1.out $srcdir/t1.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1; fi ;; # equal files
1) $echo Test 1 failed: files t1.out and $srcdir/t1.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1 may have failed. 1>&2;
$echo The command "cmp t1.out $srcdir/t1.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1.err || rm -f t1.err
$xx -d: -f1,3- $srcdir/t2.in > t2.out 2> t2.err
code=$?
if test $code != 0 ; then
$echo Test 2 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t2.out $srcdir/t2.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 2; fi ;; # equal files
1) $echo Test 2 failed: files t2.out and $srcdir/t2.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 2 may have failed. 1>&2;
$echo The command "cmp t2.out $srcdir/t2.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t2.err || rm -f t2.err
$xx -d: -f2- $srcdir/t3.in > t3.out 2> t3.err
code=$?
if test $code != 0 ; then
$echo Test 3 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t3.out $srcdir/t3.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 3; fi ;; # equal files
1) $echo Test 3 failed: files t3.out and $srcdir/t3.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 3 may have failed. 1>&2;
$echo The command "cmp t3.out $srcdir/t3.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t3.err || rm -f t3.err
$xx -d: -f4 $srcdir/t4.in > t4.out 2> t4.err
code=$?
if test $code != 0 ; then
$echo Test 4 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4.out $srcdir/t4.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4; fi ;; # equal files
1) $echo Test 4 failed: files t4.out and $srcdir/t4.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4 may have failed. 1>&2;
$echo The command "cmp t4.out $srcdir/t4.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4.err || rm -f t4.err
$xx -d: -f4 $srcdir/t5.in > t5.out 2> t5.err
code=$?
if test $code != 0 ; then
$echo Test 5 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5.out $srcdir/t5.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5; fi ;; # equal files
1) $echo Test 5 failed: files t5.out and $srcdir/t5.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5 may have failed. 1>&2;
$echo The command "cmp t5.out $srcdir/t5.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5.err || rm -f t5.err
$xx -c4 $srcdir/t6.in > t6.out 2> t6.err
code=$?
if test $code != 0 ; then
$echo Test 6 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t6.out $srcdir/t6.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 6; fi ;; # equal files
1) $echo Test 6 failed: files t6.out and $srcdir/t6.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 6 may have failed. 1>&2;
$echo The command "cmp t6.out $srcdir/t6.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t6.err || rm -f t6.err
$xx -c4 $srcdir/t7.in > t7.out 2> t7.err
code=$?
if test $code != 0 ; then
$echo Test 7 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t7.out $srcdir/t7.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 7; fi ;; # equal files
1) $echo Test 7 failed: files t7.out and $srcdir/t7.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 7 may have failed. 1>&2;
$echo The command "cmp t7.out $srcdir/t7.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t7.err || rm -f t7.err
$xx -c4 $srcdir/t8.in > t8.out 2> t8.err
code=$?
if test $code != 0 ; then
$echo Test 8 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t8.out $srcdir/t8.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 8; fi ;; # equal files
1) $echo Test 8 failed: files t8.out and $srcdir/t8.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 8 may have failed. 1>&2;
$echo The command "cmp t8.out $srcdir/t8.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t8.err || rm -f t8.err
$xx -c4 $srcdir/t9.in > t9.out 2> t9.err
code=$?
if test $code != 0 ; then
$echo Test 9 failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t9.out $srcdir/t9.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 9; fi ;; # equal files
1) $echo Test 9 failed: files t9.out and $srcdir/t9.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 9 may have failed. 1>&2;
$echo The command "cmp t9.out $srcdir/t9.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t9.err || rm -f t9.err
$xx -s -d: -f3- $srcdir/ta.in > ta.out 2> ta.err
code=$?
if test $code != 0 ; then
$echo Test a failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp ta.out $srcdir/ta.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed a; fi ;; # equal files
1) $echo Test a failed: files ta.out and $srcdir/ta.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test a may have failed. 1>&2;
$echo The command "cmp ta.out $srcdir/ta.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s ta.err || rm -f ta.err
$xx -s -d: -f2,3 $srcdir/tb.in > tb.out 2> tb.err
code=$?
if test $code != 0 ; then
$echo Test b failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tb.out $srcdir/tb.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed b; fi ;; # equal files
1) $echo Test b failed: files tb.out and $srcdir/tb.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test b may have failed. 1>&2;
$echo The command "cmp tb.out $srcdir/tb.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tb.err || rm -f tb.err
$xx -s -d: -f1,3 $srcdir/tc.in > tc.out 2> tc.err
code=$?
if test $code != 0 ; then
$echo Test c failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tc.out $srcdir/tc.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed c; fi ;; # equal files
1) $echo Test c failed: files tc.out and $srcdir/tc.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test c may have failed. 1>&2;
$echo The command "cmp tc.out $srcdir/tc.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tc.err || rm -f tc.err
$xx -s -d: -f1,3 $srcdir/td.in > td.out 2> td.err
code=$?
if test $code != 0 ; then
$echo Test d failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp td.out $srcdir/td.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed d; fi ;; # equal files
1) $echo Test d failed: files td.out and $srcdir/td.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test d may have failed. 1>&2;
$echo The command "cmp td.out $srcdir/td.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s td.err || rm -f td.err
$xx -s -d: -f3- $srcdir/te.in > te.out 2> te.err
code=$?
if test $code != 0 ; then
$echo Test e failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp te.out $srcdir/te.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed e; fi ;; # equal files
1) $echo Test e failed: files te.out and $srcdir/te.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test e may have failed. 1>&2;
$echo The command "cmp te.out $srcdir/te.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s te.err || rm -f te.err
$xx -s -d: -f3-4 $srcdir/tf.in > tf.out 2> tf.err
code=$?
if test $code != 0 ; then
$echo Test f failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tf.out $srcdir/tf.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed f; fi ;; # equal files
1) $echo Test f failed: files tf.out and $srcdir/tf.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test f may have failed. 1>&2;
$echo The command "cmp tf.out $srcdir/tf.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tf.err || rm -f tf.err
$xx -s -d: -f3,4 $srcdir/tg.in > tg.out 2> tg.err
code=$?
if test $code != 0 ; then
$echo Test g failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tg.out $srcdir/tg.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed g; fi ;; # equal files
1) $echo Test g failed: files tg.out and $srcdir/tg.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test g may have failed. 1>&2;
$echo The command "cmp tg.out $srcdir/tg.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tg.err || rm -f tg.err
$xx -s -d: -f2,3 $srcdir/th.in > th.out 2> th.err
code=$?
if test $code != 0 ; then
$echo Test h failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp th.out $srcdir/th.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed h; fi ;; # equal files
1) $echo Test h failed: files th.out and $srcdir/th.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test h may have failed. 1>&2;
$echo The command "cmp th.out $srcdir/th.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s th.err || rm -f th.err
$xx -d: -f1-3 $srcdir/ti.in > ti.out 2> ti.err
code=$?
if test $code != 0 ; then
$echo Test i failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp ti.out $srcdir/ti.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed i; fi ;; # equal files
1) $echo Test i failed: files ti.out and $srcdir/ti.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test i may have failed. 1>&2;
$echo The command "cmp ti.out $srcdir/ti.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s ti.err || rm -f ti.err
$xx -d: -f1-4 $srcdir/tj.in > tj.out 2> tj.err
code=$?
if test $code != 0 ; then
$echo Test j failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tj.out $srcdir/tj.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed j; fi ;; # equal files
1) $echo Test j failed: files tj.out and $srcdir/tj.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test j may have failed. 1>&2;
$echo The command "cmp tj.out $srcdir/tj.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tj.err || rm -f tj.err
$xx -d: -f2-3 $srcdir/tk.in > tk.out 2> tk.err
code=$?
if test $code != 0 ; then
$echo Test k failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tk.out $srcdir/tk.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed k; fi ;; # equal files
1) $echo Test k failed: files tk.out and $srcdir/tk.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test k may have failed. 1>&2;
$echo The command "cmp tk.out $srcdir/tk.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tk.err || rm -f tk.err
$xx -d: -f2-4 $srcdir/tl.in > tl.out 2> tl.err
code=$?
if test $code != 0 ; then
$echo Test l failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tl.out $srcdir/tl.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed l; fi ;; # equal files
1) $echo Test l failed: files tl.out and $srcdir/tl.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test l may have failed. 1>&2;
$echo The command "cmp tl.out $srcdir/tl.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tl.err || rm -f tl.err
$xx -s -d: -f1-3 $srcdir/tm.in > tm.out 2> tm.err
code=$?
if test $code != 0 ; then
$echo Test m failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tm.out $srcdir/tm.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed m; fi ;; # equal files
1) $echo Test m failed: files tm.out and $srcdir/tm.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test m may have failed. 1>&2;
$echo The command "cmp tm.out $srcdir/tm.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tm.err || rm -f tm.err
$xx -s -d: -f1-4 $srcdir/tn.in > tn.out 2> tn.err
code=$?
if test $code != 0 ; then
$echo Test n failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tn.out $srcdir/tn.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed n; fi ;; # equal files
1) $echo Test n failed: files tn.out and $srcdir/tn.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test n may have failed. 1>&2;
$echo The command "cmp tn.out $srcdir/tn.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tn.err || rm -f tn.err
$xx -s -d: -f2-3 $srcdir/to.in > to.out 2> to.err
code=$?
if test $code != 0 ; then
$echo Test o failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp to.out $srcdir/to.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed o; fi ;; # equal files
1) $echo Test o failed: files to.out and $srcdir/to.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test o may have failed. 1>&2;
$echo The command "cmp to.out $srcdir/to.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s to.err || rm -f to.err
$xx -s -d: -f2-4 $srcdir/tp.in > tp.out 2> tp.err
code=$?
if test $code != 0 ; then
$echo Test p failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tp.out $srcdir/tp.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed p; fi ;; # equal files
1) $echo Test p failed: files tp.out and $srcdir/tp.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test p may have failed. 1>&2;
$echo The command "cmp tp.out $srcdir/tp.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tp.err || rm -f tp.err
$xx -s -d: -f2-4 $srcdir/tq.in > tq.out 2> tq.err
code=$?
if test $code != 0 ; then
$echo Test q failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tq.out $srcdir/tq.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed q; fi ;; # equal files
1) $echo Test q failed: files tq.out and $srcdir/tq.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test q may have failed. 1>&2;
$echo The command "cmp tq.out $srcdir/tq.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tq.err || rm -f tq.err
$xx -s -d: -f2-4 $srcdir/tr.in > tr.out 2> tr.err
code=$?
if test $code != 0 ; then
$echo Test r failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tr.out $srcdir/tr.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed r; fi ;; # equal files
1) $echo Test r failed: files tr.out and $srcdir/tr.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test r may have failed. 1>&2;
$echo The command "cmp tr.out $srcdir/tr.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tr.err || rm -f tr.err
$xx -s -d: -f1-4 $srcdir/ts.in > ts.out 2> ts.err
code=$?
if test $code != 0 ; then
$echo Test s failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp ts.out $srcdir/ts.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed s; fi ;; # equal files
1) $echo Test s failed: files ts.out and $srcdir/ts.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test s may have failed. 1>&2;
$echo The command "cmp ts.out $srcdir/ts.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s ts.err || rm -f ts.err
$xx -s -d: -f3- $srcdir/tt.in > tt.out 2> tt.err
code=$?
if test $code != 0 ; then
$echo Test t failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tt.out $srcdir/tt.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed t; fi ;; # equal files
1) $echo Test t failed: files tt.out and $srcdir/tt.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test t may have failed. 1>&2;
$echo The command "cmp tt.out $srcdir/tt.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tt.err || rm -f tt.err
$xx -s -f3- $srcdir/tu.in > tu.out 2> tu.err
code=$?
if test $code != 0 ; then
$echo Test u failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tu.out $srcdir/tu.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed u; fi ;; # equal files
1) $echo Test u failed: files tu.out and $srcdir/tu.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test u may have failed. 1>&2;
$echo The command "cmp tu.out $srcdir/tu.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tu.err || rm -f tu.err
$xx -f3- $srcdir/tv.in > tv.out 2> tv.err
code=$?
if test $code != 0 ; then
$echo Test v failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tv.out $srcdir/tv.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed v; fi ;; # equal files
1) $echo Test v failed: files tv.out and $srcdir/tv.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test v may have failed. 1>&2;
$echo The command "cmp tv.out $srcdir/tv.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tv.err || rm -f tv.err
$xx -b 1 $srcdir/tw.in > tw.out 2> tw.err
code=$?
if test $code != 0 ; then
$echo Test w failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tw.out $srcdir/tw.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed w; fi ;; # equal files
1) $echo Test w failed: files tw.out and $srcdir/tw.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test w may have failed. 1>&2;
$echo The command "cmp tw.out $srcdir/tw.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tw.err || rm -f tw.err
$xx -s -d: -f2-4 $srcdir/tx.in > tx.out 2> tx.err
code=$?
if test $code != 0 ; then
$echo Test x failed: ../../src/cut return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp tx.out $srcdir/tx.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed x; fi ;; # equal files
1) $echo Test x failed: files tx.out and $srcdir/tx.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test x may have failed. 1>&2;
$echo The command "cmp tx.out $srcdir/tx.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tx.err || rm -f tx.err
$xx -s -b4 $srcdir/ty.in > ty.out 2> ty.err
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 ty.out $srcdir/ty.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed y; fi ;; # equal files
1) $echo Test y failed: files ty.out and $srcdir/ty.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test y may have failed. 1>&2;
$echo The command "cmp ty.out $srcdir/ty.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s ty.err || rm -f ty.err
$xx $srcdir/tz.in > tz.out 2> tz.err
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 tz.out $srcdir/tz.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed z; fi ;; # equal files
1) $echo Test z failed: files tz.out and $srcdir/tz.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test z may have failed. 1>&2;
$echo The command "cmp tz.out $srcdir/tz.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tz.err || rm -f tz.err
$xx -f '' $srcdir/tA.in > tA.out 2> tA.err
code=$?
if test $code != 1 ; then
$echo Test A failed: ../../src/cut return code $code differs from expected value 1 1>&2
errors=`expr $errors + 1`
else
cmp tA.out $srcdir/tA.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed A; fi ;; # equal files
1) $echo Test A failed: files tA.out and $srcdir/tA.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test A may have failed. 1>&2;
$echo The command "cmp tA.out $srcdir/tA.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tA.err || rm -f tA.err
$xx -f $srcdir/tB.in > tB.out 2> tB.err
code=$?
if test $code != 1 ; then
$echo Test B failed: ../../src/cut return code $code differs from expected value 1 1>&2
errors=`expr $errors + 1`
else
cmp tB.out $srcdir/tB.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed B; fi ;; # equal files
1) $echo Test B failed: files tB.out and $srcdir/tB.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test B may have failed. 1>&2;
$echo The command "cmp tB.out $srcdir/tB.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tB.err || rm -f tB.err
$xx -b '' $srcdir/tC.in > tC.out 2> tC.err
code=$?
if test $code != 1 ; then
$echo Test C failed: ../../src/cut return code $code differs from expected value 1 1>&2
errors=`expr $errors + 1`
else
cmp tC.out $srcdir/tC.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed C; fi ;; # equal files
1) $echo Test C failed: files tC.out and $srcdir/tC.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test C may have failed. 1>&2;
$echo The command "cmp tC.out $srcdir/tC.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tC.err || rm -f tC.err
$xx -b $srcdir/tD.in > tD.out 2> tD.err
code=$?
if test $code != 1 ; then
$echo Test D failed: ../../src/cut return code $code differs from expected value 1 1>&2
errors=`expr $errors + 1`
else
cmp tD.out $srcdir/tD.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed D; fi ;; # equal files
1) $echo Test D failed: files tD.out and $srcdir/tD.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test D may have failed. 1>&2;
$echo The command "cmp tD.out $srcdir/tD.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s tD.err || rm -f tD.err
if test $errors = 0 ; then
$echo Passed all 39 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi
test $errors = 0 || errors=1
exit $errors

View File

@@ -3,16 +3,185 @@
# @configure_input@
require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use strict;
use Test;
$| = 1;
sub validate
{
my %seen;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
@$test_vector;
die "wrong number of elements in test $test_name\n"
if (!defined $e_ret_code || defined $rest);
assert (!ref $test_name);
assert (!ref $flags);
assert (!ref $e_ret_code);
my $xx = $ARGV[0];
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined $seen{$test_name});
$seen{$test_name} = 1;
}
}
print <<EOF;
# Given a spec for the input file(s) or expected output file of a single
# test, create a file for any string. A file is created for each literal
# string -- not for named files. Whether a perl `string' is treated as
# a string to be put in a file for a test or the name of an existing file
# depends on how many references have to be traversed to get from
# the top level variable to the actual string literal.
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
# as the contents of a file.
# If $SPEC is an array reference, consider each element of the array.
# If the element is a string reference, treat the string as the name of
# an existing file. Otherwise, the element must be a string and is treated
# just like a scalar $SPEC. When a file is created, its name is derived
# from the name TEST_NAME of the corresponding test and the TYPE of file.
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
# the expected output for test `7c' would be named t7c.exp.
#
# Also, return two lists of file names:
# - maintainer-generated files -- names of files created by this function
# - files named explicitly in Test.pm
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
assert ($type eq 'in' || $type eq 'exp');
my @explicit_file;
my @maint_gen_file;
my @content_string;
if (ref $spec)
{
assert (ref $spec eq 'ARRAY');
my $file_spec;
foreach $file_spec (@$spec)
{
# A file spec may be a string or a reference.
# If it's a string, that string is to be the contents of a
# generated (by this script) file with name derived from the
# name of this test.
# If it's a reference, then it must be the name of an existing
# file.
if (ref $file_spec)
{
my $r = ref $file_spec;
die "bad test: $test_name is $r\n"
if ref $file_spec ne 'SCALAR';
my $existing_file = $$file_spec;
# FIXME: make sure $existing_file exists somewhere.
push (@explicit_file, $existing_file);
}
else
{
push (@content_string, $file_spec);
}
}
}
else
{
push (@content_string, $spec);
}
my $i = 1;
my $file_contents;
foreach $file_contents (@content_string)
{
my $suffix = (@content_string > 1 ? $i : '');
my $maint_gen_file = "t$test_name.$type$suffix";
push (@maint_gen_file, $maint_gen_file);
open (F, ">$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
print F $file_contents;
close (F) || die "$0: $maint_gen_file: $!\n";
++$i;
}
my %h = (
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
);
return \%h;
}
sub wrap
{
my ($preferred_line_len, @tok) = @_;
assert ($preferred_line_len > 0);
my @lines;
my $line = '';
my $word;
foreach $word (@tok)
{
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
{
push (@lines, $line);
$line = $word;
next;
}
my $sp = ($line ? ' ' : '');
$line .= "$sp$word";
}
push (@lines, $line);
return @lines;
}
# ~~~~~~~ main ~~~~~~~~
{
$| = 1;
die "Usage: $0: program-name\n" if @ARGV != 1;
my $xx = $ARGV[0];
if ($xx eq '--list')
{
validate ();
# Output three lists of files:
# EXPLICIT -- file names specified in Test.pm
# MAINT_GEN -- maintainer-generated files
# RUN_GEN -- files created when running the tests
my $test_vector;
my @exp;
my @maint;
my @run;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
push (@run, ("t$test_name.out", "t$test_name.err"));
my $in = spec_to_list ($in_spec, $test_name, 'in');
push (@exp, @{$in->{EXPLICIT}});
push (@maint, @{$in->{MAINT_GEN}});
my $e = spec_to_list ($exp_spec, $test_name, 'exp');
push (@exp, @{$e->{EXPLICIT}});
push (@maint, @{$e->{MAINT_GEN}});
}
# The list of explicitly mentioned files may contain duplicates.
# Eliminated any duplicates.
my %e = map {$_ => 1} @exp;
@exp = sort keys %e;
my $len = 77;
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
exit 0;
}
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
case \$# in
@@ -26,38 +195,39 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
my %seen;
validate ();
my $test_vector;
foreach $test_vector (@Test::t)
{
my ($test_name, $flags, $file1, $file2, $expected, $e_ret_code)
= @{$test_vector};
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined ($seen{$test_name}));
$seen{$test_name} = 1;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
my $in1 = "t$test_name.in1";
my $in2 = "t$test_name.in2";
my $exp_name = "t$test_name.exp";
my $out = "t$test_name.out";
my $in = spec_to_list ($in_spec, $test_name, 'in');
open (IN1, ">$in1") || die "$0: $in1: $!\n";
print IN1 $file1;
close (IN1) || die "$0: $in1: $!\n";
my @srcdir_rel_in_file;
my $f;
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
{
push (@srcdir_rel_in_file, "\$srcdir/$f");
}
open (IN2, ">$in2") || die "$0: $in2: $!\n";
print IN2 $file2;
close (IN2) || die "$0: $in2: $!\n";
my $exp = spec_to_list ($exp_spec, $test_name, 'exp');
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
assert (@all == 1);
my $exp_name = "\$srcdir/$all[0]";
my $out = "t$test_name.out";
my $err_output = "t$test_name.err";
open (EXP, ">$exp_name") || die "$0: $exp_name: $!\n";
print EXP $expected;
close (EXP) || die "$0: $exp_name: $!\n";
my $err_output = "t$test_name.err";
my $cmd = "\$xx $flags \$srcdir/$in1 \$srcdir/$in2 > $out 2> $err_output";
$exp_name = "\$srcdir/$exp_name";
print <<EOF ;
my $redirect_stdin = ((@srcdir_rel_in_file == 1
&& defined $Test::input_via_stdin
&& $Test::input_via_stdin)
? '< ' : '');
my $z = $Test::common_option_prefix if defined $Test::common_option_prefix;
$z ||= '';
my $cmd = "\$xx $z$flags $redirect_stdin" . join (' ', @srcdir_rel_in_file)
. " > $out 2> $err_output";
print <<EOF;
$cmd
code=\$?
if test \$code != $e_ret_code ; then
@@ -77,12 +247,14 @@ fi
test -s $err_output || rm -f $err_output
EOF
}
my $n_tests = Test::test_vector ();
print <<EOF2 ;
if test \$errors = 0 ; then
\$echo Passed all tests. 1>&2
\$echo Passed all $n_tests tests. 1>&2
else
\$echo Failed \$errors tests. 1>&2
fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
}

View File

@@ -3,16 +3,185 @@
# @configure_input@
require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use strict;
use Test;
$| = 1;
sub validate
{
my %seen;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
@$test_vector;
die "wrong number of elements in test $test_name\n"
if (!defined $e_ret_code || defined $rest);
assert (!ref $test_name);
assert (!ref $flags);
assert (!ref $e_ret_code);
my $xx = $ARGV[0];
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined $seen{$test_name});
$seen{$test_name} = 1;
}
}
print <<EOF;
# Given a spec for the input file(s) or expected output file of a single
# test, create a file for any string. A file is created for each literal
# string -- not for named files. Whether a perl `string' is treated as
# a string to be put in a file for a test or the name of an existing file
# depends on how many references have to be traversed to get from
# the top level variable to the actual string literal.
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
# as the contents of a file.
# If $SPEC is an array reference, consider each element of the array.
# If the element is a string reference, treat the string as the name of
# an existing file. Otherwise, the element must be a string and is treated
# just like a scalar $SPEC. When a file is created, its name is derived
# from the name TEST_NAME of the corresponding test and the TYPE of file.
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
# the expected output for test `7c' would be named t7c.exp.
#
# Also, return two lists of file names:
# - maintainer-generated files -- names of files created by this function
# - files named explicitly in Test.pm
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
assert ($type eq 'in' || $type eq 'exp');
my @explicit_file;
my @maint_gen_file;
my @content_string;
if (ref $spec)
{
assert (ref $spec eq 'ARRAY');
my $file_spec;
foreach $file_spec (@$spec)
{
# A file spec may be a string or a reference.
# If it's a string, that string is to be the contents of a
# generated (by this script) file with name derived from the
# name of this test.
# If it's a reference, then it must be the name of an existing
# file.
if (ref $file_spec)
{
my $r = ref $file_spec;
die "bad test: $test_name is $r\n"
if ref $file_spec ne 'SCALAR';
my $existing_file = $$file_spec;
# FIXME: make sure $existing_file exists somewhere.
push (@explicit_file, $existing_file);
}
else
{
push (@content_string, $file_spec);
}
}
}
else
{
push (@content_string, $spec);
}
my $i = 1;
my $file_contents;
foreach $file_contents (@content_string)
{
my $suffix = (@content_string > 1 ? $i : '');
my $maint_gen_file = "t$test_name.$type$suffix";
push (@maint_gen_file, $maint_gen_file);
open (F, ">$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
print F $file_contents;
close (F) || die "$0: $maint_gen_file: $!\n";
++$i;
}
my %h = (
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
);
return \%h;
}
sub wrap
{
my ($preferred_line_len, @tok) = @_;
assert ($preferred_line_len > 0);
my @lines;
my $line = '';
my $word;
foreach $word (@tok)
{
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
{
push (@lines, $line);
$line = $word;
next;
}
my $sp = ($line ? ' ' : '');
$line .= "$sp$word";
}
push (@lines, $line);
return @lines;
}
# ~~~~~~~ main ~~~~~~~~
{
$| = 1;
die "Usage: $0: program-name\n" if @ARGV != 1;
my $xx = $ARGV[0];
if ($xx eq '--list')
{
validate ();
# Output three lists of files:
# EXPLICIT -- file names specified in Test.pm
# MAINT_GEN -- maintainer-generated files
# RUN_GEN -- files created when running the tests
my $test_vector;
my @exp;
my @maint;
my @run;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
push (@run, ("t$test_name.out", "t$test_name.err"));
my $in = spec_to_list ($in_spec, $test_name, 'in');
push (@exp, @{$in->{EXPLICIT}});
push (@maint, @{$in->{MAINT_GEN}});
my $e = spec_to_list ($exp_spec, $test_name, 'exp');
push (@exp, @{$e->{EXPLICIT}});
push (@maint, @{$e->{MAINT_GEN}});
}
# The list of explicitly mentioned files may contain duplicates.
# Eliminated any duplicates.
my %e = map {$_ => 1} @exp;
@exp = sort keys %e;
my $len = 77;
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
exit 0;
}
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
case \$# in
@@ -26,38 +195,39 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
my %seen;
validate ();
my $test_vector;
foreach $test_vector (@Test::t)
{
my ($test_name, $flags, $file1, $file2, $expected, $e_ret_code)
= @{$test_vector};
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined ($seen{$test_name}));
$seen{$test_name} = 1;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
my $in1 = "t$test_name.in1";
my $in2 = "t$test_name.in2";
my $exp_name = "t$test_name.exp";
my $out = "t$test_name.out";
my $in = spec_to_list ($in_spec, $test_name, 'in');
open (IN1, ">$in1") || die "$0: $in1: $!\n";
print IN1 $file1;
close (IN1) || die "$0: $in1: $!\n";
my @srcdir_rel_in_file;
my $f;
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
{
push (@srcdir_rel_in_file, "\$srcdir/$f");
}
open (IN2, ">$in2") || die "$0: $in2: $!\n";
print IN2 $file2;
close (IN2) || die "$0: $in2: $!\n";
my $exp = spec_to_list ($exp_spec, $test_name, 'exp');
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
assert (@all == 1);
my $exp_name = "\$srcdir/$all[0]";
my $out = "t$test_name.out";
my $err_output = "t$test_name.err";
open (EXP, ">$exp_name") || die "$0: $exp_name: $!\n";
print EXP $expected;
close (EXP) || die "$0: $exp_name: $!\n";
my $err_output = "t$test_name.err";
my $cmd = "\$xx $flags \$srcdir/$in1 \$srcdir/$in2 > $out 2> $err_output";
$exp_name = "\$srcdir/$exp_name";
print <<EOF ;
my $redirect_stdin = ((@srcdir_rel_in_file == 1
&& defined $Test::input_via_stdin
&& $Test::input_via_stdin)
? '< ' : '');
my $z = $Test::common_option_prefix if defined $Test::common_option_prefix;
$z ||= '';
my $cmd = "\$xx $z$flags $redirect_stdin" . join (' ', @srcdir_rel_in_file)
. " > $out 2> $err_output";
print <<EOF;
$cmd
code=\$?
if test \$code != $e_ret_code ; then
@@ -77,12 +247,14 @@ fi
test -s $err_output || rm -f $err_output
EOF
}
my $n_tests = Test::test_vector ();
print <<EOF2 ;
if test \$errors = 0 ; then
\$echo Passed all tests. 1>&2
\$echo Passed all $n_tests tests. 1>&2
else
\$echo Failed \$errors tests. 1>&2
fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
}

View File

@@ -6,3 +6,4 @@ t*.exp
join-tests
build-script
Makefile
mk-script

View File

@@ -1,16 +1,31 @@
## Process this file with automake to produce Makefile.in.
##test-files-begin
x = join
t = t1a t1b t1c t1d t1e t1f t2a t2b t2c t3a t4a t4b t4c t4d t4e t5a t5b \
t5c t5d t5e t5f t5g t5h t5i t5j t5k t5l t5m t6a t6b t6c t7a t8a t8b t9a
explicit =
maint_gen = t1a.in1 t1a.in2 t1a.exp t1b.in1 t1b.in2 t1b.exp t1c.in1 t1c.in2 \
t1c.exp t1d.in1 t1d.in2 t1d.exp t1e.in1 t1e.in2 t1e.exp t1f.in1 t1f.in2 \
t1f.exp t2a.in1 t2a.in2 t2a.exp t2b.in1 t2b.in2 t2b.exp t2c.in1 t2c.in2 \
t2c.exp t3a.in1 t3a.in2 t3a.exp t4a.in1 t4a.in2 t4a.exp t4b.in1 t4b.in2 \
t4b.exp t4c.in1 t4c.in2 t4c.exp t4d.in1 t4d.in2 t4d.exp t4e.in1 t4e.in2 \
t4e.exp t5a.in1 t5a.in2 t5a.exp t5b.in1 t5b.in2 t5b.exp t5c.in1 t5c.in2 \
t5c.exp t5d.in1 t5d.in2 t5d.exp t5e.in1 t5e.in2 t5e.exp t5f.in1 t5f.in2 \
t5f.exp t5g.in1 t5g.in2 t5g.exp t5h.in1 t5h.in2 t5h.exp t5i.in1 t5i.in2 \
t5i.exp t5j.in1 t5j.in2 t5j.exp t5k.in1 t5k.in2 t5k.exp t5l.in1 t5l.in2 \
t5l.exp t5m.in1 t5m.in2 t5m.exp t6a.in1 t6a.in2 t6a.exp t6b.in1 t6b.in2 \
t6b.exp t6c.in1 t6c.in2 t6c.exp t7a.in1 t7a.in2 t7a.exp t8a.in1 t8a.in2 \
t8a.exp t8b.in1 t8b.in2 t8b.exp t9a.in1 t9a.in2 t9a.exp
run_gen = t1a.out t1a.err t1b.out t1b.err t1c.out t1c.err t1d.out t1d.err \
t1e.out t1e.err t1f.out t1f.err t2a.out t2a.err t2b.out t2b.err t2c.out \
t2c.err t3a.out t3a.err t4a.out t4a.err t4b.out t4b.err t4c.out t4c.err \
t4d.out t4d.err t4e.out t4e.err t5a.out t5a.err t5b.out t5b.err t5c.out \
t5c.err t5d.out t5d.err t5e.out t5e.err t5f.out t5f.err t5g.out t5g.err \
t5h.out t5h.err t5i.out t5i.err t5j.out t5j.err t5k.out t5k.err t5l.out \
t5l.err t5m.out t5m.err t6a.out t6a.err t6b.out t6b.err t6c.out t6c.err \
t7a.out t7a.err t8a.out t8a.err t8b.out t8b.err t9a.out t9a.err
##test-files-end
in1 = $(t:=.in1)
in2 = $(t:=.in2)
exp = $(t:=.exp)
out = $(t:=.out)
err = $(t:=.err)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(in1) $(in2) $(exp)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -27,7 +42,19 @@ SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(in) $(exp)
CLEANFILES = $(out) $(err)
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no

View File

@@ -43,16 +43,29 @@ GMSGFMT = @GMSGFMT@
CC = @CC@
x = join
t = t1a t1b t1c t1d t1e t1f t2a t2b t2c t3a t4a t4b t4c t4d t4e t5a t5b \
t5c t5d t5e t5f t5g t5h t5i t5j t5k t5l t5m t6a t6b t6c t7a t8a t8b t9a
explicit =
maint_gen = t1a.in1 t1a.in2 t1a.exp t1b.in1 t1b.in2 t1b.exp t1c.in1 t1c.in2 \
t1c.exp t1d.in1 t1d.in2 t1d.exp t1e.in1 t1e.in2 t1e.exp t1f.in1 t1f.in2 \
t1f.exp t2a.in1 t2a.in2 t2a.exp t2b.in1 t2b.in2 t2b.exp t2c.in1 t2c.in2 \
t2c.exp t3a.in1 t3a.in2 t3a.exp t4a.in1 t4a.in2 t4a.exp t4b.in1 t4b.in2 \
t4b.exp t4c.in1 t4c.in2 t4c.exp t4d.in1 t4d.in2 t4d.exp t4e.in1 t4e.in2 \
t4e.exp t5a.in1 t5a.in2 t5a.exp t5b.in1 t5b.in2 t5b.exp t5c.in1 t5c.in2 \
t5c.exp t5d.in1 t5d.in2 t5d.exp t5e.in1 t5e.in2 t5e.exp t5f.in1 t5f.in2 \
t5f.exp t5g.in1 t5g.in2 t5g.exp t5h.in1 t5h.in2 t5h.exp t5i.in1 t5i.in2 \
t5i.exp t5j.in1 t5j.in2 t5j.exp t5k.in1 t5k.in2 t5k.exp t5l.in1 t5l.in2 \
t5l.exp t5m.in1 t5m.in2 t5m.exp t6a.in1 t6a.in2 t6a.exp t6b.in1 t6b.in2 \
t6b.exp t6c.in1 t6c.in2 t6c.exp t7a.in1 t7a.in2 t7a.exp t8a.in1 t8a.in2 \
t8a.exp t8b.in1 t8b.in2 t8b.exp t9a.in1 t9a.in2 t9a.exp
run_gen = t1a.out t1a.err t1b.out t1b.err t1c.out t1c.err t1d.out t1d.err \
t1e.out t1e.err t1f.out t1f.err t2a.out t2a.err t2b.out t2b.err t2c.out \
t2c.err t3a.out t3a.err t4a.out t4a.err t4b.out t4b.err t4c.out t4c.err \
t4d.out t4d.err t4e.out t4e.err t5a.out t5a.err t5b.out t5b.err t5c.out \
t5c.err t5d.out t5d.err t5e.out t5e.err t5f.out t5f.err t5g.out t5g.err \
t5h.out t5h.err t5i.out t5i.err t5j.out t5j.err t5k.out t5k.err t5l.out \
t5l.err t5m.out t5m.err t6a.out t6a.err t6b.out t6b.err t6c.out t6c.err \
t7a.out t7a.err t8a.out t8a.err t8b.out t8b.err t9a.out t9a.err
in1 = $(t:=.in1)
in2 = $(t:=.in2)
exp = $(t:=.exp)
out = $(t:=.out)
err = $(t:=.err)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(in1) $(in2) $(exp)
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
@@ -62,8 +75,8 @@ TESTS = $x-tests
SUFFIXES = .pl
MAINTAINERCLEANFILES = $x-tests $(in) $(exp)
CLEANFILES = $(out) $(err)
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
@@ -186,7 +199,19 @@ $x-tests: @MAINT@mk-script Test.pm
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@@ -2,110 +2,100 @@ package Test;
require 5.002;
use strict;
my $nl = "\n";
@Test::t = (
my @tv = (
# test name
# flags file-1 file-2 expected output expected return code
#
['1a', '-a1', "a 1\n", "b\n", "a 1\n", 0],
['1b', '-a2', "a 1\n", "b\n", "b\n", 0], # Got "\n"
['1c', '-a1 -a2', "a 1\n", "b\n", "a 1\nb\n", 0], # Got "a 1\n\n"
['1d', '-a1', "a 1\nb\n", "b\n", "a 1\nb\n", 0],
['1e', '-a2', "a 1\nb\n", "b\n", "b\n", 0],
['1f', '-a2', "b\n", "a\nb\n", "a\nb\n", 0],
['1a', '-a1', ["a 1\n", "b\n"], "a 1\n", 0],
['1b', '-a2', ["a 1\n", "b\n"], "b\n", 0], # Got "\n"
['1c', '-a1 -a2', ["a 1\n", "b\n"], "a 1\nb\n", 0], # Got "a 1\n\n"
['1d', '-a1', ["a 1\nb\n", "b\n"], "a 1\nb\n", 0],
['1e', '-a2', ["a 1\nb\n", "b\n"], "b\n", 0],
['1f', '-a2', ["b\n", "a\nb\n"], "a\nb\n", 0],
['2a', '-a1 -e .', "a\nb\nc\n", "a x y\nb\nc\n", "a x y\nb\nc\n", 0],
['2b', '-a1 -e . -o 2.1,2.2,2.3', "a\nb\nc\n", "a x y\nb\nc\n",
['2a', '-a1 -e .', ["a\nb\nc\n", "a x y\nb\nc\n"], "a x y\nb\nc\n", 0],
['2b', '-a1 -e . -o 2.1,2.2,2.3', ["a\nb\nc\n", "a x y\nb\nc\n"],
"a x y\nb . .\nc . .\n", 0],
['2c', '-a1 -e . -o 2.1,2.2,2.3', "a\nb\nc\nd\n", "a x y\nb\nc\n",
['2c', '-a1 -e . -o 2.1,2.2,2.3', ["a\nb\nc\nd\n", "a x y\nb\nc\n"],
"a x y\nb . .\nc . .\n. . .\n", 0],
['3a', '-t:', "a:1\nb:1\n", "a:2:\nb:2:\n", "a:1:2:\nb:1:2:\n", 0],
['3a', '-t:', ["a:1\nb:1\n", "a:2:\nb:2:\n"], "a:1:2:\nb:1:2:\n", 0],
# Just like -a1 and -a2 when there are no pairable lines
['4a', '-v 1', "a 1\n", "b\n", "a 1\n", 0],
['4b', '-v 2', "a 1\n", "b\n", "b\n", 0],
['4a', '-v 1', ["a 1\n", "b\n"], "a 1\n", 0],
['4b', '-v 2', ["a 1\n", "b\n"], "b\n", 0],
['4c', '-v 1', "a 1\nb\n", "b\n", "a 1\n", 0],
['4d', '-v 2', "a 1\nb\n", "b\n", "", 0],
['4e', '-v 2', "b\n", "a 1\nb\n", "a 1\n", 0],
['4c', '-v 1', ["a 1\nb\n", "b\n"], "a 1\n", 0],
['4d', '-v 2', ["a 1\nb\n", "b\n"], "", 0],
['4e', '-v 2', ["b\n", "a 1\nb\n"], "a 1\n", 0],
['5a', '-a1 -e - -o 1.1 2.2',
"a 1\nb 2\n", "a 11\nb\n", "a 11\nb -\n", 0],
["a 1\nb 2\n", "a 11\nb\n"], "a 11\nb -\n", 0],
['5b', '-a1 -e - -o 1.1 2.2',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\nfeb 15",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15"],
"apr 06\naug 14\ndec -\nfeb 15\n", 0],
['5c', '-a1 -e - -o 1.1 2.2',
"aug 20\ndec 18\n",
"aug 14\ndate\nfeb 15",
["aug 20\ndec 18\n", "aug 14\ndate\nfeb 15"],
"aug 14\ndec -\n", 0],
['5d', '-a1 -e - -o 1.1 2.2', "dec 18\n", "", "dec -\n", 0],
['5d', '-a1 -e - -o 1.1 2.2',
["dec 18\n", ""], "dec -\n", 0],
['5e', '-a2 -e - -o 1.1 2.2',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\nfeb 15\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n"],
"apr 06\naug 14\n- -\nfeb 15\n", 0],
['5f', '-a2 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\nfeb 15\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n"],
"06 apr\n14 aug\n- -\n15 feb\n", 0],
['5g', '-a1 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\nfeb 15\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n"],
"06 apr\n14 aug\n- dec\n15 feb\n", 0],
['5h', '-a1 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
"06 apr\n14 aug\n- dec\n- feb\n", 0],
['5i', '-a1 -e - -o 1.1 2.2',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
"apr 06\naug 14\ndec -\nfeb -\n", 0],
['5j', '-a2 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
"06 apr\n14 aug\n- -\n", 0],
['5k', '-a2 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\nfeb 05\n",
"apr 06\naug 14\ndate\n",
["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
"06 apr\n14 aug\n- -\n", 0],
['5l', '-a1 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\n",
"apr 06\naug 14\ndate\nfeb 15\n",
["apr 15\naug 20\ndec 18\n", "apr 06\naug 14\ndate\nfeb 15\n"],
"06 apr\n14 aug\n- dec\n", 0],
['5m', '-a2 -e - -o 2.2 1.1',
"apr 15\naug 20\ndec 18\n",
"apr 06\naug 14\ndate\nfeb 15\n",
["apr 15\naug 20\ndec 18\n", "apr 06\naug 14\ndate\nfeb 15\n"],
"06 apr\n14 aug\n- -\n15 -\n", 0],
['6a', '-e -',
"a 1\nb 2\nd 4\n",
"a 21\nb 22\nc 23\nf 26\n",
["a 1\nb 2\nd 4\n", "a 21\nb 22\nc 23\nf 26\n"],
"a 1 21\nb 2 22\n", 0],
['6b', '-a1 -e -',
"a 1\nb 2\nd 4\n",
"a 21\nb 22\nc 23\nf 26\n",
["a 1\nb 2\nd 4\n", "a 21\nb 22\nc 23\nf 26\n"],
"a 1 21\nb 2 22\nd 4\n", 0],
['6c', '-a1 -e -',
"a 21\nb 22\nc 23\nf 26\n",
"a 1\nb 2\nd 4\n",
["a 21\nb 22\nc 23\nf 26\n", "a 1\nb 2\nd 4\n"],
"a 21 1\nb 22 2\nc 23\nf 26\n", 0],
['7a', '-a1 -e . -o 2.7', "a\nb\nc\n", "a x y\nb\nc\n", ".\n.\n.\n", 0],
['7a', '-a1 -e . -o 2.7',
["a\nb\nc\n", "a x y\nb\nc\n"], ".\n.\n.\n", 0],
['8a', '-a1 -e . -o 0,1.2',
"a\nb\nc\nd G\n",
"a x y\nb\nc\ne\n",
["a\nb\nc\nd G\n", "a x y\nb\nc\ne\n"],
"a .\nb .\nc .\nd G\n", 0],
['8b', '-a1 -a2 -e . -o 0,1.2',
"a\nb\nc\nd G\n",
"a x y\nb\nc\ne\n",
["a\nb\nc\nd G\n", "a x y\nb\nc\ne\n"],
"a .\nb .\nc .\nd G\ne .\n", 0],
# From David Dyck
['9a', '', " a 1\n b 2\n", " a Y\n b Z\n", "a 1 Y\nb 2 Z\n", 0],
['9a', '', [" a 1\n b 2\n", " a Y\n b Z\n"], "a 1 Y\nb 2 Z\n", 0],
);
sub test_vector
{
return @tv;
}
1;

613
tests/join/join-tests Executable file
View File

@@ -0,0 +1,613 @@
#! /bin/sh
# This script was generated automatically by build-script.
case $# in
0) xx='../../src/join';;
*) xx="$1";;
esac
test "$VERBOSE" && echo=echo || echo=:
$echo testing program: $xx
errors=0
test "$srcdir" || srcdir=.
test "$VERBOSE" && $xx --version 2> /dev/null
$xx -a1 $srcdir/t1a.in1 $srcdir/t1a.in2 > t1a.out 2> t1a.err
code=$?
if test $code != 0 ; then
$echo Test 1a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1a.out $srcdir/t1a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1a; fi ;; # equal files
1) $echo Test 1a failed: files t1a.out and $srcdir/t1a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1a may have failed. 1>&2;
$echo The command "cmp t1a.out $srcdir/t1a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1a.err || rm -f t1a.err
$xx -a2 $srcdir/t1b.in1 $srcdir/t1b.in2 > t1b.out 2> t1b.err
code=$?
if test $code != 0 ; then
$echo Test 1b failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1b.out $srcdir/t1b.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1b; fi ;; # equal files
1) $echo Test 1b failed: files t1b.out and $srcdir/t1b.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1b may have failed. 1>&2;
$echo The command "cmp t1b.out $srcdir/t1b.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1b.err || rm -f t1b.err
$xx -a1 -a2 $srcdir/t1c.in1 $srcdir/t1c.in2 > t1c.out 2> t1c.err
code=$?
if test $code != 0 ; then
$echo Test 1c failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1c.out $srcdir/t1c.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1c; fi ;; # equal files
1) $echo Test 1c failed: files t1c.out and $srcdir/t1c.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1c may have failed. 1>&2;
$echo The command "cmp t1c.out $srcdir/t1c.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1c.err || rm -f t1c.err
$xx -a1 $srcdir/t1d.in1 $srcdir/t1d.in2 > t1d.out 2> t1d.err
code=$?
if test $code != 0 ; then
$echo Test 1d failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1d.out $srcdir/t1d.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1d; fi ;; # equal files
1) $echo Test 1d failed: files t1d.out and $srcdir/t1d.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1d may have failed. 1>&2;
$echo The command "cmp t1d.out $srcdir/t1d.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1d.err || rm -f t1d.err
$xx -a2 $srcdir/t1e.in1 $srcdir/t1e.in2 > t1e.out 2> t1e.err
code=$?
if test $code != 0 ; then
$echo Test 1e failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1e.out $srcdir/t1e.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1e; fi ;; # equal files
1) $echo Test 1e failed: files t1e.out and $srcdir/t1e.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1e may have failed. 1>&2;
$echo The command "cmp t1e.out $srcdir/t1e.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1e.err || rm -f t1e.err
$xx -a2 $srcdir/t1f.in1 $srcdir/t1f.in2 > t1f.out 2> t1f.err
code=$?
if test $code != 0 ; then
$echo Test 1f failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1f.out $srcdir/t1f.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1f; fi ;; # equal files
1) $echo Test 1f failed: files t1f.out and $srcdir/t1f.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1f may have failed. 1>&2;
$echo The command "cmp t1f.out $srcdir/t1f.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1f.err || rm -f t1f.err
$xx -a1 -e . $srcdir/t2a.in1 $srcdir/t2a.in2 > t2a.out 2> t2a.err
code=$?
if test $code != 0 ; then
$echo Test 2a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t2a.out $srcdir/t2a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 2a; fi ;; # equal files
1) $echo Test 2a failed: files t2a.out and $srcdir/t2a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 2a may have failed. 1>&2;
$echo The command "cmp t2a.out $srcdir/t2a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t2a.err || rm -f t2a.err
$xx -a1 -e . -o 2.1,2.2,2.3 $srcdir/t2b.in1 $srcdir/t2b.in2 > t2b.out 2> t2b.err
code=$?
if test $code != 0 ; then
$echo Test 2b failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t2b.out $srcdir/t2b.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 2b; fi ;; # equal files
1) $echo Test 2b failed: files t2b.out and $srcdir/t2b.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 2b may have failed. 1>&2;
$echo The command "cmp t2b.out $srcdir/t2b.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t2b.err || rm -f t2b.err
$xx -a1 -e . -o 2.1,2.2,2.3 $srcdir/t2c.in1 $srcdir/t2c.in2 > t2c.out 2> t2c.err
code=$?
if test $code != 0 ; then
$echo Test 2c failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t2c.out $srcdir/t2c.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 2c; fi ;; # equal files
1) $echo Test 2c failed: files t2c.out and $srcdir/t2c.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 2c may have failed. 1>&2;
$echo The command "cmp t2c.out $srcdir/t2c.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t2c.err || rm -f t2c.err
$xx -t: $srcdir/t3a.in1 $srcdir/t3a.in2 > t3a.out 2> t3a.err
code=$?
if test $code != 0 ; then
$echo Test 3a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t3a.out $srcdir/t3a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 3a; fi ;; # equal files
1) $echo Test 3a failed: files t3a.out and $srcdir/t3a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 3a may have failed. 1>&2;
$echo The command "cmp t3a.out $srcdir/t3a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t3a.err || rm -f t3a.err
$xx -v 1 $srcdir/t4a.in1 $srcdir/t4a.in2 > t4a.out 2> t4a.err
code=$?
if test $code != 0 ; then
$echo Test 4a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4a.out $srcdir/t4a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4a; fi ;; # equal files
1) $echo Test 4a failed: files t4a.out and $srcdir/t4a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4a may have failed. 1>&2;
$echo The command "cmp t4a.out $srcdir/t4a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4a.err || rm -f t4a.err
$xx -v 2 $srcdir/t4b.in1 $srcdir/t4b.in2 > t4b.out 2> t4b.err
code=$?
if test $code != 0 ; then
$echo Test 4b failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4b.out $srcdir/t4b.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4b; fi ;; # equal files
1) $echo Test 4b failed: files t4b.out and $srcdir/t4b.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4b may have failed. 1>&2;
$echo The command "cmp t4b.out $srcdir/t4b.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4b.err || rm -f t4b.err
$xx -v 1 $srcdir/t4c.in1 $srcdir/t4c.in2 > t4c.out 2> t4c.err
code=$?
if test $code != 0 ; then
$echo Test 4c failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4c.out $srcdir/t4c.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4c; fi ;; # equal files
1) $echo Test 4c failed: files t4c.out and $srcdir/t4c.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4c may have failed. 1>&2;
$echo The command "cmp t4c.out $srcdir/t4c.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4c.err || rm -f t4c.err
$xx -v 2 $srcdir/t4d.in1 $srcdir/t4d.in2 > t4d.out 2> t4d.err
code=$?
if test $code != 0 ; then
$echo Test 4d failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4d.out $srcdir/t4d.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4d; fi ;; # equal files
1) $echo Test 4d failed: files t4d.out and $srcdir/t4d.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4d may have failed. 1>&2;
$echo The command "cmp t4d.out $srcdir/t4d.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4d.err || rm -f t4d.err
$xx -v 2 $srcdir/t4e.in1 $srcdir/t4e.in2 > t4e.out 2> t4e.err
code=$?
if test $code != 0 ; then
$echo Test 4e failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4e.out $srcdir/t4e.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4e; fi ;; # equal files
1) $echo Test 4e failed: files t4e.out and $srcdir/t4e.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4e may have failed. 1>&2;
$echo The command "cmp t4e.out $srcdir/t4e.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4e.err || rm -f t4e.err
$xx -a1 -e - -o 1.1 2.2 $srcdir/t5a.in1 $srcdir/t5a.in2 > t5a.out 2> t5a.err
code=$?
if test $code != 0 ; then
$echo Test 5a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5a.out $srcdir/t5a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5a; fi ;; # equal files
1) $echo Test 5a failed: files t5a.out and $srcdir/t5a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5a may have failed. 1>&2;
$echo The command "cmp t5a.out $srcdir/t5a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5a.err || rm -f t5a.err
$xx -a1 -e - -o 1.1 2.2 $srcdir/t5b.in1 $srcdir/t5b.in2 > t5b.out 2> t5b.err
code=$?
if test $code != 0 ; then
$echo Test 5b failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5b.out $srcdir/t5b.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5b; fi ;; # equal files
1) $echo Test 5b failed: files t5b.out and $srcdir/t5b.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5b may have failed. 1>&2;
$echo The command "cmp t5b.out $srcdir/t5b.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5b.err || rm -f t5b.err
$xx -a1 -e - -o 1.1 2.2 $srcdir/t5c.in1 $srcdir/t5c.in2 > t5c.out 2> t5c.err
code=$?
if test $code != 0 ; then
$echo Test 5c failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5c.out $srcdir/t5c.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5c; fi ;; # equal files
1) $echo Test 5c failed: files t5c.out and $srcdir/t5c.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5c may have failed. 1>&2;
$echo The command "cmp t5c.out $srcdir/t5c.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5c.err || rm -f t5c.err
$xx -a1 -e - -o 1.1 2.2 $srcdir/t5d.in1 $srcdir/t5d.in2 > t5d.out 2> t5d.err
code=$?
if test $code != 0 ; then
$echo Test 5d failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5d.out $srcdir/t5d.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5d; fi ;; # equal files
1) $echo Test 5d failed: files t5d.out and $srcdir/t5d.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5d may have failed. 1>&2;
$echo The command "cmp t5d.out $srcdir/t5d.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5d.err || rm -f t5d.err
$xx -a2 -e - -o 1.1 2.2 $srcdir/t5e.in1 $srcdir/t5e.in2 > t5e.out 2> t5e.err
code=$?
if test $code != 0 ; then
$echo Test 5e failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5e.out $srcdir/t5e.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5e; fi ;; # equal files
1) $echo Test 5e failed: files t5e.out and $srcdir/t5e.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5e may have failed. 1>&2;
$echo The command "cmp t5e.out $srcdir/t5e.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5e.err || rm -f t5e.err
$xx -a2 -e - -o 2.2 1.1 $srcdir/t5f.in1 $srcdir/t5f.in2 > t5f.out 2> t5f.err
code=$?
if test $code != 0 ; then
$echo Test 5f failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5f.out $srcdir/t5f.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5f; fi ;; # equal files
1) $echo Test 5f failed: files t5f.out and $srcdir/t5f.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5f may have failed. 1>&2;
$echo The command "cmp t5f.out $srcdir/t5f.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5f.err || rm -f t5f.err
$xx -a1 -e - -o 2.2 1.1 $srcdir/t5g.in1 $srcdir/t5g.in2 > t5g.out 2> t5g.err
code=$?
if test $code != 0 ; then
$echo Test 5g failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5g.out $srcdir/t5g.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5g; fi ;; # equal files
1) $echo Test 5g failed: files t5g.out and $srcdir/t5g.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5g may have failed. 1>&2;
$echo The command "cmp t5g.out $srcdir/t5g.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5g.err || rm -f t5g.err
$xx -a1 -e - -o 2.2 1.1 $srcdir/t5h.in1 $srcdir/t5h.in2 > t5h.out 2> t5h.err
code=$?
if test $code != 0 ; then
$echo Test 5h failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5h.out $srcdir/t5h.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5h; fi ;; # equal files
1) $echo Test 5h failed: files t5h.out and $srcdir/t5h.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5h may have failed. 1>&2;
$echo The command "cmp t5h.out $srcdir/t5h.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5h.err || rm -f t5h.err
$xx -a1 -e - -o 1.1 2.2 $srcdir/t5i.in1 $srcdir/t5i.in2 > t5i.out 2> t5i.err
code=$?
if test $code != 0 ; then
$echo Test 5i failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5i.out $srcdir/t5i.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5i; fi ;; # equal files
1) $echo Test 5i failed: files t5i.out and $srcdir/t5i.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5i may have failed. 1>&2;
$echo The command "cmp t5i.out $srcdir/t5i.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5i.err || rm -f t5i.err
$xx -a2 -e - -o 2.2 1.1 $srcdir/t5j.in1 $srcdir/t5j.in2 > t5j.out 2> t5j.err
code=$?
if test $code != 0 ; then
$echo Test 5j failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5j.out $srcdir/t5j.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5j; fi ;; # equal files
1) $echo Test 5j failed: files t5j.out and $srcdir/t5j.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5j may have failed. 1>&2;
$echo The command "cmp t5j.out $srcdir/t5j.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5j.err || rm -f t5j.err
$xx -a2 -e - -o 2.2 1.1 $srcdir/t5k.in1 $srcdir/t5k.in2 > t5k.out 2> t5k.err
code=$?
if test $code != 0 ; then
$echo Test 5k failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5k.out $srcdir/t5k.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5k; fi ;; # equal files
1) $echo Test 5k failed: files t5k.out and $srcdir/t5k.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5k may have failed. 1>&2;
$echo The command "cmp t5k.out $srcdir/t5k.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5k.err || rm -f t5k.err
$xx -a1 -e - -o 2.2 1.1 $srcdir/t5l.in1 $srcdir/t5l.in2 > t5l.out 2> t5l.err
code=$?
if test $code != 0 ; then
$echo Test 5l failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5l.out $srcdir/t5l.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5l; fi ;; # equal files
1) $echo Test 5l failed: files t5l.out and $srcdir/t5l.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5l may have failed. 1>&2;
$echo The command "cmp t5l.out $srcdir/t5l.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5l.err || rm -f t5l.err
$xx -a2 -e - -o 2.2 1.1 $srcdir/t5m.in1 $srcdir/t5m.in2 > t5m.out 2> t5m.err
code=$?
if test $code != 0 ; then
$echo Test 5m failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5m.out $srcdir/t5m.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5m; fi ;; # equal files
1) $echo Test 5m failed: files t5m.out and $srcdir/t5m.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5m may have failed. 1>&2;
$echo The command "cmp t5m.out $srcdir/t5m.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5m.err || rm -f t5m.err
$xx -e - $srcdir/t6a.in1 $srcdir/t6a.in2 > t6a.out 2> t6a.err
code=$?
if test $code != 0 ; then
$echo Test 6a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t6a.out $srcdir/t6a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 6a; fi ;; # equal files
1) $echo Test 6a failed: files t6a.out and $srcdir/t6a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 6a may have failed. 1>&2;
$echo The command "cmp t6a.out $srcdir/t6a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t6a.err || rm -f t6a.err
$xx -a1 -e - $srcdir/t6b.in1 $srcdir/t6b.in2 > t6b.out 2> t6b.err
code=$?
if test $code != 0 ; then
$echo Test 6b failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t6b.out $srcdir/t6b.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 6b; fi ;; # equal files
1) $echo Test 6b failed: files t6b.out and $srcdir/t6b.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 6b may have failed. 1>&2;
$echo The command "cmp t6b.out $srcdir/t6b.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t6b.err || rm -f t6b.err
$xx -a1 -e - $srcdir/t6c.in1 $srcdir/t6c.in2 > t6c.out 2> t6c.err
code=$?
if test $code != 0 ; then
$echo Test 6c failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t6c.out $srcdir/t6c.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 6c; fi ;; # equal files
1) $echo Test 6c failed: files t6c.out and $srcdir/t6c.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 6c may have failed. 1>&2;
$echo The command "cmp t6c.out $srcdir/t6c.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t6c.err || rm -f t6c.err
$xx -a1 -e . -o 2.7 $srcdir/t7a.in1 $srcdir/t7a.in2 > t7a.out 2> t7a.err
code=$?
if test $code != 0 ; then
$echo Test 7a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t7a.out $srcdir/t7a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 7a; fi ;; # equal files
1) $echo Test 7a failed: files t7a.out and $srcdir/t7a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 7a may have failed. 1>&2;
$echo The command "cmp t7a.out $srcdir/t7a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t7a.err || rm -f t7a.err
$xx -a1 -e . -o 0,1.2 $srcdir/t8a.in1 $srcdir/t8a.in2 > t8a.out 2> t8a.err
code=$?
if test $code != 0 ; then
$echo Test 8a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t8a.out $srcdir/t8a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 8a; fi ;; # equal files
1) $echo Test 8a failed: files t8a.out and $srcdir/t8a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 8a may have failed. 1>&2;
$echo The command "cmp t8a.out $srcdir/t8a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t8a.err || rm -f t8a.err
$xx -a1 -a2 -e . -o 0,1.2 $srcdir/t8b.in1 $srcdir/t8b.in2 > t8b.out 2> t8b.err
code=$?
if test $code != 0 ; then
$echo Test 8b failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t8b.out $srcdir/t8b.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 8b; fi ;; # equal files
1) $echo Test 8b failed: files t8b.out and $srcdir/t8b.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 8b may have failed. 1>&2;
$echo The command "cmp t8b.out $srcdir/t8b.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t8b.err || rm -f t8b.err
$xx $srcdir/t9a.in1 $srcdir/t9a.in2 > t9a.out 2> t9a.err
code=$?
if test $code != 0 ; then
$echo Test 9a failed: ../../src/join return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t9a.out $srcdir/t9a.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 9a; fi ;; # equal files
1) $echo Test 9a failed: files t9a.out and $srcdir/t9a.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 9a may have failed. 1>&2;
$echo The command "cmp t9a.out $srcdir/t9a.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t9a.err || rm -f t9a.err
if test $errors = 0 ; then
$echo Passed all 35 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi
test $errors = 0 || errors=1
exit $errors

View File

@@ -1,3 +0,0 @@
:
perl -pe 's/\\\n$//' "$@" \
| ./build-script

View File

@@ -3,16 +3,185 @@
# @configure_input@
require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use strict;
use Test;
$| = 1;
sub validate
{
my %seen;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
@$test_vector;
die "wrong number of elements in test $test_name\n"
if (!defined $e_ret_code || defined $rest);
assert (!ref $test_name);
assert (!ref $flags);
assert (!ref $e_ret_code);
my $xx = $ARGV[0];
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined $seen{$test_name});
$seen{$test_name} = 1;
}
}
print <<EOF;
# Given a spec for the input file(s) or expected output file of a single
# test, create a file for any string. A file is created for each literal
# string -- not for named files. Whether a perl `string' is treated as
# a string to be put in a file for a test or the name of an existing file
# depends on how many references have to be traversed to get from
# the top level variable to the actual string literal.
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
# as the contents of a file.
# If $SPEC is an array reference, consider each element of the array.
# If the element is a string reference, treat the string as the name of
# an existing file. Otherwise, the element must be a string and is treated
# just like a scalar $SPEC. When a file is created, its name is derived
# from the name TEST_NAME of the corresponding test and the TYPE of file.
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
# the expected output for test `7c' would be named t7c.exp.
#
# Also, return two lists of file names:
# - maintainer-generated files -- names of files created by this function
# - files named explicitly in Test.pm
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
assert ($type eq 'in' || $type eq 'exp');
my @explicit_file;
my @maint_gen_file;
my @content_string;
if (ref $spec)
{
assert (ref $spec eq 'ARRAY');
my $file_spec;
foreach $file_spec (@$spec)
{
# A file spec may be a string or a reference.
# If it's a string, that string is to be the contents of a
# generated (by this script) file with name derived from the
# name of this test.
# If it's a reference, then it must be the name of an existing
# file.
if (ref $file_spec)
{
my $r = ref $file_spec;
die "bad test: $test_name is $r\n"
if ref $file_spec ne 'SCALAR';
my $existing_file = $$file_spec;
# FIXME: make sure $existing_file exists somewhere.
push (@explicit_file, $existing_file);
}
else
{
push (@content_string, $file_spec);
}
}
}
else
{
push (@content_string, $spec);
}
my $i = 1;
my $file_contents;
foreach $file_contents (@content_string)
{
my $suffix = (@content_string > 1 ? $i : '');
my $maint_gen_file = "t$test_name.$type$suffix";
push (@maint_gen_file, $maint_gen_file);
open (F, ">$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
print F $file_contents;
close (F) || die "$0: $maint_gen_file: $!\n";
++$i;
}
my %h = (
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
);
return \%h;
}
sub wrap
{
my ($preferred_line_len, @tok) = @_;
assert ($preferred_line_len > 0);
my @lines;
my $line = '';
my $word;
foreach $word (@tok)
{
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
{
push (@lines, $line);
$line = $word;
next;
}
my $sp = ($line ? ' ' : '');
$line .= "$sp$word";
}
push (@lines, $line);
return @lines;
}
# ~~~~~~~ main ~~~~~~~~
{
$| = 1;
die "Usage: $0: program-name\n" if @ARGV != 1;
my $xx = $ARGV[0];
if ($xx eq '--list')
{
validate ();
# Output three lists of files:
# EXPLICIT -- file names specified in Test.pm
# MAINT_GEN -- maintainer-generated files
# RUN_GEN -- files created when running the tests
my $test_vector;
my @exp;
my @maint;
my @run;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
push (@run, ("t$test_name.out", "t$test_name.err"));
my $in = spec_to_list ($in_spec, $test_name, 'in');
push (@exp, @{$in->{EXPLICIT}});
push (@maint, @{$in->{MAINT_GEN}});
my $e = spec_to_list ($exp_spec, $test_name, 'exp');
push (@exp, @{$e->{EXPLICIT}});
push (@maint, @{$e->{MAINT_GEN}});
}
# The list of explicitly mentioned files may contain duplicates.
# Eliminated any duplicates.
my %e = map {$_ => 1} @exp;
@exp = sort keys %e;
my $len = 77;
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
exit 0;
}
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
case \$# in
@@ -26,38 +195,39 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
my %seen;
validate ();
my $test_vector;
foreach $test_vector (@Test::t)
{
my ($test_name, $flags, $file1, $file2, $expected, $e_ret_code)
= @{$test_vector};
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined ($seen{$test_name}));
$seen{$test_name} = 1;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
my $in1 = "t$test_name.in1";
my $in2 = "t$test_name.in2";
my $exp_name = "t$test_name.exp";
my $out = "t$test_name.out";
my $in = spec_to_list ($in_spec, $test_name, 'in');
open (IN1, ">$in1") || die "$0: $in1: $!\n";
print IN1 $file1;
close (IN1) || die "$0: $in1: $!\n";
my @srcdir_rel_in_file;
my $f;
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
{
push (@srcdir_rel_in_file, "\$srcdir/$f");
}
open (IN2, ">$in2") || die "$0: $in2: $!\n";
print IN2 $file2;
close (IN2) || die "$0: $in2: $!\n";
my $exp = spec_to_list ($exp_spec, $test_name, 'exp');
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
assert (@all == 1);
my $exp_name = "\$srcdir/$all[0]";
my $out = "t$test_name.out";
my $err_output = "t$test_name.err";
open (EXP, ">$exp_name") || die "$0: $exp_name: $!\n";
print EXP $expected;
close (EXP) || die "$0: $exp_name: $!\n";
my $err_output = "t$test_name.err";
my $cmd = "\$xx $flags \$srcdir/$in1 \$srcdir/$in2 > $out 2> $err_output";
$exp_name = "\$srcdir/$exp_name";
print <<EOF ;
my $redirect_stdin = ((@srcdir_rel_in_file == 1
&& defined $Test::input_via_stdin
&& $Test::input_via_stdin)
? '< ' : '');
my $z = $Test::common_option_prefix if defined $Test::common_option_prefix;
$z ||= '';
my $cmd = "\$xx $z$flags $redirect_stdin" . join (' ', @srcdir_rel_in_file)
. " > $out 2> $err_output";
print <<EOF;
$cmd
code=\$?
if test \$code != $e_ret_code ; then
@@ -77,12 +247,14 @@ fi
test -s $err_output || rm -f $err_output
EOF
}
my $n_tests = Test::test_vector ();
print <<EOF2 ;
if test \$errors = 0 ; then
\$echo Passed all tests. 1>&2
\$echo Passed all $n_tests tests. 1>&2
else
\$echo Failed \$errors tests. 1>&2
fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
}

View File

@@ -1,52 +0,0 @@
# TODO: make sure all test_names are unique!!!!
# test name
# flags file-1 file-2 expected output expected return code
#
('1a', '-a1', "a 1\n", "b\n", "a 1\n", 0);
('1b', '-a2', "a 1\n", "b\n", "b\n", 0); # Got "\n"
('1c', '-a1 -a2', "a 1\n", "b\n", "a 1\nb\n", 0); # Got "a 1\n\n"
('1d', '-a1', "a 1\nb\n", "b\n", "a 1\nb\n", 0);
('1e', '-a2', "a 1\nb\n", "b\n", "b\n", 0);
('1f', '-a2', "b\n", "a\nb\n", "a\nb\n", 0);
('2a', '-a1 -e .', "a\nb\nc\n", "a x y\nb\nc\n", "a x y\nb\nc\n", 0);
('2b', '-a1 -e . -o 2.1,2.2,2.3', "a\nb\nc\n", "a x y\nb\nc\n", "a x y\nb . .\nc . .\n", 0);
('2c', '-a1 -e . -o 2.1,2.2,2.3', "a\nb\nc\nd\n", "a x y\nb\nc\n", "a x y\nb . .\nc . .\n. . .\n", 0);
('3a', '-t:', "a:1\nb:1\n", "a:2:\nb:2:\n", "a:1:2:\nb:1:2:\n", 0);
# Just like -a1 and -a2 when there are no pairable lines
('4a', '-v 1', "a 1\n", "b\n", "a 1\n", 0);
('4b', '-v 2', "a 1\n", "b\n", "b\n", 0);
('4c', '-v 1', "a 1\nb\n", "b\n", "a 1\n", 0);
('4d', '-v 2', "a 1\nb\n", "b\n", "", 0);
('4e', '-v 2', "b\n", "a 1\nb\n", "a 1\n", 0);
('5a', '-a1 -e - -o 1.1 2.2', "a 1\nb 2\n", "a 11\nb\n", "a 11\nb -\n", 0);
('5b', '-a1 -e - -o 1.1 2.2', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15", "apr 06\naug 14\ndec -\nfeb 15\n", 0);
('5c', '-a1 -e - -o 1.1 2.2', "aug 20\ndec 18\n", "aug 14\ndate\nfeb 15", "aug 14\ndec -\n", 0);
('5d', '-a1 -e - -o 1.1 2.2', "dec 18\n", "", "dec -\n", 0);
('5e', '-a2 -e - -o 1.1 2.2', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n", "apr 06\naug 14\n- -\nfeb 15\n", 0);
('5f', '-a2 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n", "06 apr\n14 aug\n- -\n15 feb\n", 0);
('5g', '-a1 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n", "06 apr\n14 aug\n- dec\n15 feb\n", 0);
('5h', '-a1 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n", "06 apr\n14 aug\n- dec\n- feb\n", 0);
('5i', '-a1 -e - -o 1.1 2.2', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n", "apr 06\naug 14\ndec -\nfeb -\n", 0);
('5j', '-a2 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n", "06 apr\n14 aug\n- -\n", 0);
('5k', '-a2 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n", "06 apr\n14 aug\n- -\n", 0);
('5l', '-a1 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\n", "apr 06\naug 14\ndate\nfeb 15\n", "06 apr\n14 aug\n- dec\n", 0);
('5m', '-a2 -e - -o 2.2 1.1', "apr 15\naug 20\ndec 18\n", "apr 06\naug 14\ndate\nfeb 15\n", "06 apr\n14 aug\n- -\n15 -\n", 0);
('6a', '-e -', "a 1\nb 2\nd 4\n", "a 21\nb 22\nc 23\nf 26\n", "a 1 21\nb 2 22\n", 0);
('6b', '-a1 -e -', "a 1\nb 2\nd 4\n", "a 21\nb 22\nc 23\nf 26\n", "a 1 21\nb 2 22\nd 4\n", 0);
('6c', '-a1 -e -', "a 21\nb 22\nc 23\nf 26\n", "a 1\nb 2\nd 4\n", "a 21 1\nb 22 2\nc 23\nf 26\n", 0);
('7a', '-a1 -e . -o 2.7', "a\nb\nc\n", "a x y\nb\nc\n", ".\n.\n.\n", 0);
('8a', '-a1 -e . -o 0,1.2', "a\nb\nc\nd G\n", "a x y\nb\nc\ne\n", "a .\nb .\nc .\nd G\n", 0);
('8b', '-a1 -a2 -e . -o 0,1.2', "a\nb\nc\nd G\n", "a x y\nb\nc\ne\n", "a .\nb .\nc .\nd G\ne .\n", 0);
# From David Dyck
('9a', '', " a 1\n b 2\n", " a Y\n b Z\n", "a 1 Y\nb 2 Z\n", 0);

View File

@@ -3,16 +3,185 @@
# @configure_input@
require 5.002;
use strict;
use POSIX qw (assert);
BEGIN { push @INC, '@srcdir@' if '@srcdir@' ne '.'; }
use strict;
use Test;
$| = 1;
sub validate
{
my %seen;
my $test_vector;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $expected, $e_ret_code, $rest) =
@$test_vector;
die "wrong number of elements in test $test_name\n"
if (!defined $e_ret_code || defined $rest);
assert (!ref $test_name);
assert (!ref $flags);
assert (!ref $e_ret_code);
my $xx = $ARGV[0];
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined $seen{$test_name});
$seen{$test_name} = 1;
}
}
print <<EOF;
# Given a spec for the input file(s) or expected output file of a single
# test, create a file for any string. A file is created for each literal
# string -- not for named files. Whether a perl `string' is treated as
# a string to be put in a file for a test or the name of an existing file
# depends on how many references have to be traversed to get from
# the top level variable to the actual string literal.
# If $SPEC is a literal Perl string (not a reference), then treat $SPEC
# as the contents of a file.
# If $SPEC is an array reference, consider each element of the array.
# If the element is a string reference, treat the string as the name of
# an existing file. Otherwise, the element must be a string and is treated
# just like a scalar $SPEC. When a file is created, its name is derived
# from the name TEST_NAME of the corresponding test and the TYPE of file.
# E.g., the inputs for test `3a' would be named t3a.in1 and t3a.in2, and
# the expected output for test `7c' would be named t7c.exp.
#
# Also, return two lists of file names:
# - maintainer-generated files -- names of files created by this function
# - files named explicitly in Test.pm
sub spec_to_list ($$$)
{
my ($spec, $test_name, $type) = @_;
assert ($type eq 'in' || $type eq 'exp');
my @explicit_file;
my @maint_gen_file;
my @content_string;
if (ref $spec)
{
assert (ref $spec eq 'ARRAY');
my $file_spec;
foreach $file_spec (@$spec)
{
# A file spec may be a string or a reference.
# If it's a string, that string is to be the contents of a
# generated (by this script) file with name derived from the
# name of this test.
# If it's a reference, then it must be the name of an existing
# file.
if (ref $file_spec)
{
my $r = ref $file_spec;
die "bad test: $test_name is $r\n"
if ref $file_spec ne 'SCALAR';
my $existing_file = $$file_spec;
# FIXME: make sure $existing_file exists somewhere.
push (@explicit_file, $existing_file);
}
else
{
push (@content_string, $file_spec);
}
}
}
else
{
push (@content_string, $spec);
}
my $i = 1;
my $file_contents;
foreach $file_contents (@content_string)
{
my $suffix = (@content_string > 1 ? $i : '');
my $maint_gen_file = "t$test_name.$type$suffix";
push (@maint_gen_file, $maint_gen_file);
open (F, ">$maint_gen_file") || die "$0: $maint_gen_file: $!\n";
print F $file_contents;
close (F) || die "$0: $maint_gen_file: $!\n";
++$i;
}
my %h = (
EXPLICIT => \@explicit_file,
MAINT_GEN => \@maint_gen_file
);
return \%h;
}
sub wrap
{
my ($preferred_line_len, @tok) = @_;
assert ($preferred_line_len > 0);
my @lines;
my $line = '';
my $word;
foreach $word (@tok)
{
if ($line && length ($line) + 1 + length ($word) > $preferred_line_len)
{
push (@lines, $line);
$line = $word;
next;
}
my $sp = ($line ? ' ' : '');
$line .= "$sp$word";
}
push (@lines, $line);
return @lines;
}
# ~~~~~~~ main ~~~~~~~~
{
$| = 1;
die "Usage: $0: program-name\n" if @ARGV != 1;
my $xx = $ARGV[0];
if ($xx eq '--list')
{
validate ();
# Output three lists of files:
# EXPLICIT -- file names specified in Test.pm
# MAINT_GEN -- maintainer-generated files
# RUN_GEN -- files created when running the tests
my $test_vector;
my @exp;
my @maint;
my @run;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
push (@run, ("t$test_name.out", "t$test_name.err"));
my $in = spec_to_list ($in_spec, $test_name, 'in');
push (@exp, @{$in->{EXPLICIT}});
push (@maint, @{$in->{MAINT_GEN}});
my $e = spec_to_list ($exp_spec, $test_name, 'exp');
push (@exp, @{$e->{EXPLICIT}});
push (@maint, @{$e->{MAINT_GEN}});
}
# The list of explicitly mentioned files may contain duplicates.
# Eliminated any duplicates.
my %e = map {$_ => 1} @exp;
@exp = sort keys %e;
my $len = 77;
print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n";
print join (" \\\n", wrap ($len, 'maint_gen =', @maint)), "\n";
print join (" \\\n", wrap ($len, 'run_gen =', @run)), "\n";
exit 0;
}
print <<EOF;
#! /bin/sh
# This script was generated automatically by build-script.
case \$# in
@@ -26,38 +195,39 @@ test "\$srcdir" || srcdir=.
test "\$VERBOSE" && \$xx --version 2> /dev/null
EOF
my %seen;
validate ();
my $test_vector;
foreach $test_vector (@Test::t)
{
my ($test_name, $flags, $file1, $file2, $expected, $e_ret_code)
= @{$test_vector};
die "$0: $.: duplicate test name \`$test_name'\n"
if (defined ($seen{$test_name}));
$seen{$test_name} = 1;
foreach $test_vector (Test::test_vector ())
{
my ($test_name, $flags, $in_spec, $exp_spec, $e_ret_code)
= @$test_vector;
my $in1 = "t$test_name.in1";
my $in2 = "t$test_name.in2";
my $exp_name = "t$test_name.exp";
my $out = "t$test_name.out";
my $in = spec_to_list ($in_spec, $test_name, 'in');
open (IN1, ">$in1") || die "$0: $in1: $!\n";
print IN1 $file1;
close (IN1) || die "$0: $in1: $!\n";
my @srcdir_rel_in_file;
my $f;
foreach $f (@{$in->{EXPLICIT}}, @{$in->{MAINT_GEN}})
{
push (@srcdir_rel_in_file, "\$srcdir/$f");
}
open (IN2, ">$in2") || die "$0: $in2: $!\n";
print IN2 $file2;
close (IN2) || die "$0: $in2: $!\n";
my $exp = spec_to_list ($exp_spec, $test_name, 'exp');
my @all = (@{$exp->{EXPLICIT}}, @{$exp->{MAINT_GEN}});
assert (@all == 1);
my $exp_name = "\$srcdir/$all[0]";
my $out = "t$test_name.out";
my $err_output = "t$test_name.err";
open (EXP, ">$exp_name") || die "$0: $exp_name: $!\n";
print EXP $expected;
close (EXP) || die "$0: $exp_name: $!\n";
my $err_output = "t$test_name.err";
my $cmd = "\$xx $flags \$srcdir/$in1 \$srcdir/$in2 > $out 2> $err_output";
$exp_name = "\$srcdir/$exp_name";
print <<EOF ;
my $redirect_stdin = ((@srcdir_rel_in_file == 1
&& defined $Test::input_via_stdin
&& $Test::input_via_stdin)
? '< ' : '');
my $z = $Test::common_option_prefix if defined $Test::common_option_prefix;
$z ||= '';
my $cmd = "\$xx $z$flags $redirect_stdin" . join (' ', @srcdir_rel_in_file)
. " > $out 2> $err_output";
print <<EOF;
$cmd
code=\$?
if test \$code != $e_ret_code ; then
@@ -77,12 +247,14 @@ fi
test -s $err_output || rm -f $err_output
EOF
}
my $n_tests = Test::test_vector ();
print <<EOF2 ;
if test \$errors = 0 ; then
\$echo Passed all tests. 1>&2
\$echo Passed all $n_tests tests. 1>&2
else
\$echo Failed \$errors tests. 1>&2
fi
test \$errors = 0 || errors=1
exit \$errors
EOF2
}

View File

@@ -1 +1,7 @@
Makefile
join-tests
mk-script
t*.exp
t*.in
t*.log
t*.out

View File

@@ -1,4 +1,44 @@
## Process this file with automake to produce Makefile.in.
TESTS = md5-rfc
EXTRA_DIST = $(TESTS)
##test-files-begin
x = md5sum
explicit =
maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
t6.in t6.exp t7.in t7.exp
run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
t5.err t6.out t6.err t7.out t7.err
##test-files-end
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
SUFFIXES = .pl
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no

View File

@@ -39,15 +39,33 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
RANLIB = @RANLIB@
GENCAT = @GENCAT@
PERL = @PERL@
GMSGFMT = @GMSGFMT@
CC = @CC@
TESTS = md5-rfc
EXTRA_DIST = $(TESTS)
x = md5sum
explicit =
maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
t6.in t6.exp t7.in t7.exp
run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
t5.err t6.out t6.err t7.out t7.err
EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
noinst_SCRIPTS = $x-tests
PERL = @PERL@
editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
TESTS = $x-tests
SUFFIXES = .pl
MAINTAINERCLEANFILES = $x-tests $(maint_gen)
CLEANFILES = $(run_gen)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
SCRIPTS = $(noinst_SCRIPTS)
DIST_COMMON = Makefile.am Makefile.in
@@ -61,6 +79,7 @@ TAR = tar
default: all
.SUFFIXES:
.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
cd $(top_srcdir) && automake --gnu tests/md5sum-test/Makefile
@@ -119,7 +138,7 @@ install: install-exec install-data all
uninstall:
all: Makefile
all: $(SCRIPTS) Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
@@ -157,6 +176,27 @@ mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$x-tests: @MAINT@mk-script Test.pm
./mk-script ../../src/$x > $@.n
mv $@.n $@
chmod 755 $@
.pl:
rm -f $@ $@.tmp
$(editpl) $< > $@.tmp
chmod +x-w $@.tmp
mv $@.tmp $@
@MAINT@rebuild-check: Test.pm mk-script
@MAINT@ rb=rb-check; rm -f $rb; \
@MAINT@ m_template=../Makefile.am.in; \
@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
@MAINT@ echo "x = $$tool" >> $$rb; \
@MAINT@ ./mk-script --list >> $$rb; \
@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
# 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:

41
tests/md5sum/Test.pm Normal file
View File

@@ -0,0 +1,41 @@
# -*-perl-*-
package Test;
require 5.002;
use strict;
$Test::input_via_stdin = 1;
sub test_vector
{
my @tvec =
(
# test-name options input expected-output expected-return-code
#
['1', '', '', 'd41d8cd98f00b204e9800998ecf8427e', 0],
['2', '', 'a', '0cc175b9c0f1b6a831c399e269772661', 0],
['3', '', 'abc', '900150983cd24fb0d6963f7d28e17f72', 0],
['4', '', 'message digest', 'f96b697d7cb7938d525a2f31aaf161d0', 0],
['5', '', 'abcdefghijklmnopqrstuvwxyz',
'c3fcd3d76192e4007dfb496cca67e13b', 0],
['6', '',
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
'd174ab98d277d9f5a5611c2c9f419d9f', 0],
['7', '', '1234567890123456789012345678901234567890'
. '1234567890123456789012345678901234567890',
'57edf4a22be3c955ac49da2e2107b67a', 0],
);
my @tv;
# Append two spaces, the input file name (-), and a newline to each
# expected output string.
my $t;
foreach $t (@tvec)
{
my ($test_name, $flags, $in, $exp, $ret) = @$t;
push (@tv, [$test_name, $flags, $in, "$exp -\n", $ret]);
}
return @tv;
}
1;

View File

@@ -1,41 +0,0 @@
#! /bin/sh
md5sum=${MD5SUM:-../../src/md5sum}
test "$VERBOSE" = yes && $md5sum --version
set - \
1 d41d8cd98f00b204e9800998ecf8427e "" \
2 0cc175b9c0f1b6a831c399e269772661 a \
3 900150983cd24fb0d6963f7d28e17f72 abc \
4 f96b697d7cb7938d525a2f31aaf161d0 'message digest' \
5 c3fcd3d76192e4007dfb496cca67e13b abcdefghijklmnopqrstuvwxyz \
6 d174ab98d277d9f5a5611c2c9f419d9f ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \
7 57edf4a22be3c955ac49da2e2107b67a 12345678901234567890123456789012345678901234567890123456789012345678901234567890 \
LAST NA NA
fail=0
while :; do
test_name=$1
test x$test_name = xLAST && break
expected_result="$2 -"
string=$3
tmp=md-$$
tmp_exp=$tmp.exp
tmp_out=$tmp.out
tmp_files="$tmp_exp $tmp_out"
rm -f $tmp_files
if test "$VERBOSE" = yes; then
#echo "testing \`$nice $args $nice\` = $expected_result ..."
echo "test $test_name... " | tr -d '\012'
fi
echo "$string"|tr -d '\012'| $md5sum - > $tmp_out
echo "$expected_result" > $tmp_exp
${DIFF:-diff} $tmp_out $tmp_exp \
&& ok=ok || ok=FAIL fail=1
test "$VERBOSE" = yes && echo $ok
rm -f $tmp_files
shift; shift; shift
done
exit $fail

137
tests/md5sum/md5sum-tests Executable file
View File

@@ -0,0 +1,137 @@
#! /bin/sh
# This script was generated automatically by build-script.
case $# in
0) xx='../../src/md5sum';;
*) xx="$1";;
esac
test "$VERBOSE" && echo=echo || echo=:
$echo testing program: $xx
errors=0
test "$srcdir" || srcdir=.
test "$VERBOSE" && $xx --version 2> /dev/null
$xx < $srcdir/t1.in > t1.out 2> t1.err
code=$?
if test $code != 0 ; then
$echo Test 1 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t1.out $srcdir/t1.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 1; fi ;; # equal files
1) $echo Test 1 failed: files t1.out and $srcdir/t1.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 1 may have failed. 1>&2;
$echo The command "cmp t1.out $srcdir/t1.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t1.err || rm -f t1.err
$xx < $srcdir/t2.in > t2.out 2> t2.err
code=$?
if test $code != 0 ; then
$echo Test 2 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t2.out $srcdir/t2.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 2; fi ;; # equal files
1) $echo Test 2 failed: files t2.out and $srcdir/t2.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 2 may have failed. 1>&2;
$echo The command "cmp t2.out $srcdir/t2.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t2.err || rm -f t2.err
$xx < $srcdir/t3.in > t3.out 2> t3.err
code=$?
if test $code != 0 ; then
$echo Test 3 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t3.out $srcdir/t3.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 3; fi ;; # equal files
1) $echo Test 3 failed: files t3.out and $srcdir/t3.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 3 may have failed. 1>&2;
$echo The command "cmp t3.out $srcdir/t3.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t3.err || rm -f t3.err
$xx < $srcdir/t4.in > t4.out 2> t4.err
code=$?
if test $code != 0 ; then
$echo Test 4 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t4.out $srcdir/t4.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 4; fi ;; # equal files
1) $echo Test 4 failed: files t4.out and $srcdir/t4.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 4 may have failed. 1>&2;
$echo The command "cmp t4.out $srcdir/t4.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t4.err || rm -f t4.err
$xx < $srcdir/t5.in > t5.out 2> t5.err
code=$?
if test $code != 0 ; then
$echo Test 5 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t5.out $srcdir/t5.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 5; fi ;; # equal files
1) $echo Test 5 failed: files t5.out and $srcdir/t5.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 5 may have failed. 1>&2;
$echo The command "cmp t5.out $srcdir/t5.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t5.err || rm -f t5.err
$xx < $srcdir/t6.in > t6.out 2> t6.err
code=$?
if test $code != 0 ; then
$echo Test 6 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t6.out $srcdir/t6.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 6; fi ;; # equal files
1) $echo Test 6 failed: files t6.out and $srcdir/t6.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 6 may have failed. 1>&2;
$echo The command "cmp t6.out $srcdir/t6.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t6.err || rm -f t6.err
$xx < $srcdir/t7.in > t7.out 2> t7.err
code=$?
if test $code != 0 ; then
$echo Test 7 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
errors=`expr $errors + 1`
else
cmp t7.out $srcdir/t7.exp
case $? in
0) if test "$VERBOSE" ; then $echo passed 7; fi ;; # equal files
1) $echo Test 7 failed: files t7.out and $srcdir/t7.exp differ 1>&2;
errors=`expr $errors + 1` ;;
2) $echo Test 7 may have failed. 1>&2;
$echo The command "cmp t7.out $srcdir/t7.exp" failed. 1>&2 ;
errors=`expr $errors + 1` ;;
esac
fi
test -s t7.err || rm -f t7.err
if test $errors = 0 ; then
$echo Passed all 7 tests. 1>&2
else
$echo Failed $errors tests. 1>&2
fi
test $errors = 0 || errors=1
exit $errors

6
tests/pr/.cvsignore Normal file
View File

@@ -0,0 +1,6 @@
t*.out
t*.in
t*.exp
t*.err
Makefile
mk-script

330
tests/pr/0F Normal file
View File

@@ -0,0 +1,330 @@
- Date/Time -- x Page 1
- Date/Time -- x Page 2
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
- Date/Time -- x Page 3
- Date/Time -- x Page 4
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

396
tests/pr/0FF Normal file
View File

@@ -0,0 +1,396 @@
- Date/Time -- x Page 1
- Date/Time -- x Page 2
- Date/Time -- x Page 3
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
- Date/Time -- x Page 4
- Date/Time -- x Page 5
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
- Date/Time -- x Page 6
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

36
tests/pr/0FFnt Normal file
View File

@@ -0,0 +1,36 @@
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

35
tests/pr/0FFt Normal file
View File

@@ -0,0 +1,35 @@
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

37
tests/pr/0FnFnt Normal file
View File

@@ -0,0 +1,37 @@
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

36
tests/pr/0FnFt Normal file
View File

@@ -0,0 +1,36 @@
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

36
tests/pr/0Fnt Normal file
View File

@@ -0,0 +1,36 @@
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

35
tests/pr/0Ft Normal file
View File

@@ -0,0 +1,35 @@
1 FF-Test: FF's at Start of File V
2 Options -b -3 / -a -3 / ...
3 --------------------------------------------
4 3456789 123456789 123456789 123456789 12345678
5 3 Columns downwards ..., <= 5 lines per page
6 FF-Arangements: Empty Pages at start
7 \ftext; \f\ntext;
8 \f\ftext; \f\f\ntext; \f\n\ftext; \f\n\f\n;
9 3456789 123456789 123456789
10 zzzzzzzzzzzzzzzzzzzzzzzzzz123456789
1 12345678
2 12345678
3 line truncation before FF; r_r_o_l-test:
14 456789 123456789 123456789 123456789
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

198
tests/pr/3-0F Normal file
View File

@@ -0,0 +1,198 @@
- Date/Time -- x Page 3
- Date/Time -- x Page 4
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678

45
tests/pr/3-5l17f-t Normal file
View File

@@ -0,0 +1,45 @@
- Date/Time -- x Page 3
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678
4 12345678
5 12345678
6 12345678
7 12345678
8 12345678
9 3456789 abcdefghi
40 DEFGHI 123456789
41 yzxyzxyz XYZXYZXYZ abcabcab
42 456789 123456789 abcdefghi ABCDEDFHI
- Date/Time -- x Page 4
43 xyzxyzxyz XYZXYZXYZ abcabcab
44 456789 123456789 xyzxyzxyz XYZXYZXYZ
5 12345678
6 12345678
7 12345678
8 12345678
9 12345678
50 12345678
1 12345678
2 12345678
3 12345678
4 12345678
55 yzxyzxyz XYZXYZXYZ abcabcab
56 456789 123456789 abcdefghi ABCDEDFHI
- Date/Time -- x Page 5
57 xyzxyzxyz XYZXYZXYZ abcabcab
58 456789 123456789 xyzxyzxyz XYZXYZXYZ
9 12345678
60 DEFGHI 123456789
1
2
3 ------- EOF -------- EOF -------- EOF -------

462
tests/pr/3-FF Normal file
View File

@@ -0,0 +1,462 @@
- Date/Time -- x Page 3
15 xyzxyzxyz XYZXYZXYZ abcabcab
16 456789 123456789 xyzxyzxyz XYZXYZXYZ
7 12345678
8 12345678
9 3456789 ab
20 DEFGHI 123
1 12345678
2 12345678
3 12345678
4 12345678
5 12345678
6 12345678
27 no truncation before FF; (r_l-test):
28 no trunc
- Date/Time -- x Page 4
- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ abcabcab
30 456789 123456789 xyzxyzxyz XYZXYZXYZ
1 12345678
2 3456789 abcdefghi
3 12345678
4 12345678
5 12345678
6 12345678
7 12345678
8 12345678
9 3456789 abcdefghi
40 DEFGHI 123456789
41 yzxyzxyz XYZXYZXYZ abcabcab
42 456789 123456789 abcdefghi ABCDEDFHI
- Date/Time -- x Page 6
- Date/Time -- x Page 7
- Date/Time -- x Page 8
43 xyzxyzxyz XYZXYZXYZ abcabcab
44 456789 123456789 xyzxyzxyz XYZXYZXYZ
5 12345678
6 12345678
7 12345678
8 12345678
9 12345678
50 12345678
1 12345678
2 12345678
3 12345678
4 12345678
55 yzxyzxyz XYZXYZXYZ abcabcab
56 456789 123456789 abcdefghi ABCDEDFHI
- Date/Time -- x Page 9
57 xyzxyzxyz XYZXYZXYZ abcabcab
58 456789 123456789 xyzxyzxyz XYZXYZXYZ
9 12345678
60 DEFGHI 123456789

119
tests/pr/3a2l17-FF Normal file
View File

@@ -0,0 +1,119 @@
- Date/Time -- x Page 3
15 xyzxyzxyz XYZXYZXYZ abcabcab 16 456789 123456789 xyzxyzxyz XYZXY
7 8
9 3456789 ab 20 DEFGHI 123
1 2
3 4
5 6
27 no truncation before FF; (r_l-te 28 no trunc
- Date/Time -- x Page 4
- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ abcabcab 30 456789 123456789 xyzxyzxyz XYZXY
1 2 3456789 abcdefghi
3 4
5 6
7 8
9 3456789 abcdefghi 40 DEFGHI 123456789
41 yzxyzxyz XYZXYZXYZ abcabcab 42 456789 123456789 abcdefghi ABCDE
- Date/Time -- x Page 6
- Date/Time -- x Page 7
- Date/Time -- x Page 8
43 xyzxyzxyz XYZXYZXYZ abcabcab 44 456789 123456789 xyzxyzxyz XYZXY
5 6
7 8
9 50
1 2
3 4
55 yzxyzxyz XYZXYZXYZ abcabcab 56 456789 123456789 abcdefghi ABCDE
- Date/Time -- x Page 9
57 xyzxyzxyz XYZXYZXYZ abcabcab 58 456789 123456789 xyzxyzxyz XYZXY
9 60 DEFGHI 123456789

18
tests/pr/3a3f-0F Normal file
View File

@@ -0,0 +1,18 @@
- Date/Time -- x Page 3
- Date/Time -- x Page 4
15 xyzxyzxyz XYZXYZXYZ 16 456789 123456789 xyz 7
8 9 3456789 ab 20 DEFGHI 123
1 2 3
4 5 6
27 no truncation before 28 no trunc
- Date/Time -- x Page 5
29 xyzxyzxyz XYZXYZXYZ 30 456789 123456789 xyz 1
2 3456789 abcdefghi 3

45
tests/pr/3a3l15-t Normal file
View File

@@ -0,0 +1,45 @@
- Date/Time -- x Page 3
1 2 3456789 abcdefghi 3
4 5 6
7 8 9 3456789 abcdefghi
40 DEFGHI 123456789 41 yzxyzxyz XYZXYZXYZ a 42 456789 123456789 abc
43 xyzxyzxyz XYZXYZXYZ 44 456789 123456789 xyz 5
- Date/Time -- x Page 4
6 7 8
9 50 1
2 3 4
55 yzxyzxyz XYZXYZXYZ a 56 456789 123456789 abc 57 xyzxyzxyz XYZXYZXYZ
58 456789 123456789 xyz 9 60 DEFGHI 123456789
- Date/Time -- x Page 5
1 2 3 ------- EOF --------

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