mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
69 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72e1d14aec | ||
|
|
584f4d85cf | ||
|
|
9096ee8e42 | ||
|
|
f7c0efdba2 | ||
|
|
a3c0837bc3 | ||
|
|
834b042b93 | ||
|
|
f0e77e8722 | ||
|
|
5c094d2ab2 | ||
|
|
1eb146483f | ||
|
|
1b3c2bbb06 | ||
|
|
edbbc8335c | ||
|
|
48405e4b9c | ||
|
|
f9ae8064f2 | ||
|
|
9ce9d75ddb | ||
|
|
d59ce5651c | ||
|
|
981c203fab | ||
|
|
c0385fb129 | ||
|
|
ac88b78ef3 | ||
|
|
e01fce9e16 | ||
|
|
164bff8dc0 | ||
|
|
7b7b9007db | ||
|
|
c0ad97a781 | ||
|
|
c5a9a5f563 | ||
|
|
b363124be4 | ||
|
|
d06d2de67c | ||
|
|
82f324a6fd | ||
|
|
84f0e8fc80 | ||
|
|
9a27c21fbf | ||
|
|
1fff978392 | ||
|
|
4d87b9a10e | ||
|
|
8fd24dfea9 | ||
|
|
9355314687 | ||
|
|
5c6991f93d | ||
|
|
9e9d7be706 | ||
|
|
49b81671fd | ||
|
|
38429fe661 | ||
|
|
ce0ba9e9d9 | ||
|
|
5b3b5af5b8 | ||
|
|
6a2cf8a297 | ||
|
|
22fd1ff303 | ||
|
|
cb1386ec32 | ||
|
|
da2761cc1a | ||
|
|
1fc1a65968 | ||
|
|
b6f403c606 | ||
|
|
fa59cde3fe | ||
|
|
6f7507be50 | ||
|
|
33df2fe237 | ||
|
|
87c3c9c7c6 | ||
|
|
e622324cbe | ||
|
|
99114dd25a | ||
|
|
e29225aa01 | ||
|
|
8bfd3a7d70 | ||
|
|
f9abdd4a47 | ||
|
|
c7f7a81276 | ||
|
|
f721219e91 | ||
|
|
ded46c159b | ||
|
|
9cc2f64ff3 | ||
|
|
ae3a2c75ff | ||
|
|
24fa66e128 | ||
|
|
b6a0fe5ab0 | ||
|
|
da190d7c06 | ||
|
|
ddd448d549 | ||
|
|
71bd321379 | ||
|
|
93449adfa4 | ||
|
|
21041064bd | ||
|
|
f5443ca875 | ||
|
|
eb771bb870 | ||
|
|
43589db615 | ||
|
|
04a86ff23a |
2
THANKS
2
THANKS
@@ -3,6 +3,7 @@ The rest of the addresses are still in the ChangeLog.
|
||||
|
||||
Achim Blumensath: blume@corona.oche.de
|
||||
Andreas Schwab: schwab@issan.informatik.uni-dortmund.de
|
||||
Andries Brouwer: Andries.Brouwer@cwi.nl
|
||||
Arne Henrik Juul: arnej@imf.unit.no
|
||||
Bauke Jan Douma: bjdouma@xs4all.nl
|
||||
Bengt Martensson: bengt@mathematik.uni-Bremen.de
|
||||
@@ -35,6 +36,7 @@ Masami Takikawa: takikawm@CS.ORST.EDU
|
||||
Matthew S. Levine: mslevine@theory.lcs.mit.edu
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Noel Cragg: noel@red-bean.com
|
||||
Olav Morkrid: olav@funcom.com
|
||||
Peter Eriksson: peter@ifm.liu.se
|
||||
Paul Eggert: eggert@twinsun.com
|
||||
Philippe De Muyter: phdm@macqel.be
|
||||
|
||||
@@ -35,6 +35,7 @@ START-INFO-DIR-ENTRY
|
||||
* od: (textutils)od invocation. Dump files in octal, etc.
|
||||
* paste: (textutils)paste invocation. Merge lines of files.
|
||||
* pr: (textutils)pr invocation. Paginate or columnate files.
|
||||
* ptx: (textutils)ptx invocation. Produce permuted indexes.
|
||||
* sort: (textutils)sort invocation. Sort text files.
|
||||
* split: (textutils)split invocation. Split into fixed-size pieces.
|
||||
* sum: (textutils)sum invocation. Print traditional checksum.
|
||||
@@ -117,12 +118,89 @@ This manual documents version @value{VERSION} of the GNU text utilities.
|
||||
* Formatting file contents:: fmt pr fold
|
||||
* Output of parts of files:: head tail split csplit
|
||||
* Summarizing files:: wc sum cksum md5sum
|
||||
* Operating on sorted files:: sort uniq comm
|
||||
* Operating on sorted files:: sort uniq comm ptx
|
||||
* Operating on fields within a line:: cut paste join
|
||||
* Operating on characters:: tr expand unexpand
|
||||
* Opening the software toolbox:: The software tools philosophy.
|
||||
* Index:: General index.
|
||||
|
||||
@detailmenu
|
||||
--- The Detailed Node Listing ---
|
||||
|
||||
Output of entire files
|
||||
|
||||
* cat invocation:: Concatenate and write files.
|
||||
* tac invocation:: Concatenate and write files in reverse.
|
||||
* nl invocation:: Number lines and write files.
|
||||
* od invocation:: Write files in octal or other formats.
|
||||
|
||||
Formatting file contents
|
||||
|
||||
* fmt invocation:: Reformat paragraph text.
|
||||
* pr invocation:: Paginate or columnate files for printing.
|
||||
* fold invocation:: Wrap input lines to fit in specified width.
|
||||
|
||||
Output of parts of files
|
||||
|
||||
* head invocation:: Output the first part of files.
|
||||
* tail invocation:: Output the last part of files.
|
||||
* split invocation:: Split a file into fixed-size pieces.
|
||||
* csplit invocation:: Split a file into context-determined pieces.
|
||||
|
||||
Summarizing files
|
||||
|
||||
* wc invocation:: Print byte, word, and line counts.
|
||||
* sum invocation:: Print checksum and block counts.
|
||||
* cksum invocation:: Print CRC checksum and byte counts.
|
||||
* md5sum invocation:: Print or check message-digests.
|
||||
|
||||
Operating on sorted files
|
||||
|
||||
* sort invocation:: Sort text files.
|
||||
* uniq invocation:: Uniqify files.
|
||||
* comm invocation:: Compare two sorted files line by line.
|
||||
* ptx invocation:: Produce a permuted index of file contents.
|
||||
|
||||
@code{ptx}: Produce permuted indexes
|
||||
|
||||
* General options in ptx:: Options which affect general program behaviour.
|
||||
* Charset selection in ptx:: Underlying character set considerations.
|
||||
* Input processing in ptx:: Input fields, contexts, and keyword selection.
|
||||
* Output formatting in ptx:: Types of output format, and sizing the fields.
|
||||
* Compatibility in ptx:: The GNU extensions to @code{ptx}
|
||||
|
||||
Operating on fields within a line
|
||||
|
||||
* cut invocation:: Print selected parts of lines.
|
||||
* paste invocation:: Merge lines of files.
|
||||
* join invocation:: Join lines on a common field.
|
||||
|
||||
Operating on characters
|
||||
|
||||
* tr invocation:: Translate, squeeze, and/or delete characters.
|
||||
* expand invocation:: Convert tabs to spaces.
|
||||
* unexpand invocation:: Convert spaces to tabs.
|
||||
|
||||
@code{tr}: Translate, squeeze, and/or delete characters
|
||||
|
||||
* Character sets:: Specifying sets of characters.
|
||||
* Translating:: Changing one characters to another.
|
||||
* Squeezing:: Squeezing repeats and deleting.
|
||||
* Warnings in tr:: Warning messages.
|
||||
|
||||
Opening the software toolbox
|
||||
|
||||
* Toolbox introduction:: Toolbox introduction
|
||||
* I/O redirection:: I/O redirection
|
||||
* The who command:: The @code{who} command
|
||||
* The cut command:: The @code{cut} command
|
||||
* The sort command:: The @code{sort} command
|
||||
* The uniq command:: The @code{uniq} command
|
||||
* Putting the tools together:: Putting the tools together
|
||||
|
||||
@end detailmenu
|
||||
@end menu
|
||||
|
||||
@end ifinfo
|
||||
|
||||
|
||||
@@ -872,10 +950,12 @@ The program accepts the following options. Also see @ref{Common options}.
|
||||
|
||||
@table @samp
|
||||
|
||||
@item +@var{first_page}[@var{:last_page}]
|
||||
@opindex +@var{first_page}[@var{:last_page}]
|
||||
@item +@var{first_page}[:@var{last_page}]
|
||||
@itemx --pages=@var{first_page}[:@var{last_page}]
|
||||
@opindex +@var{first_page}[:@var{last_page}]
|
||||
@opindex --pages
|
||||
Begin printing with page @var{first_page} and stop with
|
||||
@var{last_page}. Missing @samp{:LAST_PAGE} implies end of file. While
|
||||
@var{last_page}. Missing @samp{:@var{last_page}} implies end of file. While
|
||||
estimating the number of skipped pages each form feed in the input file
|
||||
results in a new page. Page counting with and without
|
||||
@samp{+@var{first_page}} is identical. By default, it starts with the
|
||||
@@ -883,7 +963,9 @@ first page of input file (not first page printed). Page numbering may be
|
||||
altered by @samp{-N} option.
|
||||
|
||||
@item -@var{column}
|
||||
@itemx --columns=@var{column}
|
||||
@opindex -@var{column}
|
||||
@opindex --columns
|
||||
@cindex down columns
|
||||
With each single @var{file}, produce @var{column}-column output and
|
||||
print columns down. The column width is automatically estimated from
|
||||
@@ -892,24 +974,32 @@ truncated. The number of lines in the columns on each page will be
|
||||
balanced. @samp{-@var{column}} may not be used with @samp{-m} option.
|
||||
|
||||
@item -a
|
||||
@itemx --across
|
||||
@opindex -a
|
||||
@opindex --across
|
||||
@cindex across columns
|
||||
With each single @var{file}, print columns across rather than down.
|
||||
@var{column} must be greater than one.
|
||||
|
||||
@item -c
|
||||
@itemx --show-control-chars
|
||||
@opindex -c
|
||||
@opindex --show-control-chars
|
||||
Print control characters using hat notation (e.g., @samp{^G}); print
|
||||
other unprintable characters in octal backslash notation. By default,
|
||||
unprintable characters are not changed.
|
||||
|
||||
@item -d
|
||||
@itemx --double-space
|
||||
@opindex -d
|
||||
@opindex --double-space
|
||||
@cindex double spacing
|
||||
Double space the output.
|
||||
|
||||
@item -e[@var{in-tabchar}[@var{in-tabwidth}]]
|
||||
@itemx --expand-tabs[=@var{in-tabchar}[@var{in-tabwidth}]]
|
||||
@opindex -e
|
||||
@opindex --expand-tabs
|
||||
@cindex input tabs
|
||||
Expand tabs to spaces on input. Optional argument @var{in-tabchar} is
|
||||
the input tab character (default is @key{TAB}). Second optional
|
||||
@@ -918,15 +1008,19 @@ is 8).
|
||||
|
||||
@item -f
|
||||
@itemx -F
|
||||
@itemx --form-feed
|
||||
@opindex -F
|
||||
@opindex -f
|
||||
@opindex --form-feed
|
||||
Use a form feed instead of newlines to separate output pages. Default
|
||||
page length of 66 lines is not altered. But the number of lines of text
|
||||
per page changes from 56 to 63 lines.
|
||||
|
||||
|
||||
@item -h @var{HEADER}
|
||||
@itemx --header=@var{HEADER}
|
||||
@opindex -h
|
||||
@opindex --header
|
||||
Replace the file name in the header with the centered string
|
||||
@var{header}. Left-hand-side truncation (marked by a @samp{*}) may occur
|
||||
if the total header line @samp{yy-mm-dd HH:MM HEADER Page nnnn}
|
||||
@@ -935,7 +1029,9 @@ header. Don't use @samp{-h""}. A space between the -h option and the
|
||||
argument is always peremptory.
|
||||
|
||||
@item -i[@var{out-tabchar}[@var{out-tabwidth}]]
|
||||
@itemx --output-tabs[=@var{out-tabchar}[@var{out-tabwidth}]]
|
||||
@opindex -i
|
||||
@opindex --output-tabs
|
||||
@cindex output tabs
|
||||
Replace spaces with tabs on output. Optional argument @var{out-tabchar}
|
||||
is the output tab character (default is @key{TAB}). Second optional
|
||||
@@ -943,7 +1039,9 @@ argument @var{out-tabwidth} is the output tab character's width (default
|
||||
is 8).
|
||||
|
||||
@item -j
|
||||
@itemx --join-lines
|
||||
@opindex -j
|
||||
@opindex --join-lines
|
||||
Merge lines of full length. Used together with the column options
|
||||
@samp{-@var{column}}, @samp{-a -@var{column}} or @samp{-m}. Turns off
|
||||
@samp{-w} line truncation; no column alignment used; may be used with
|
||||
@@ -951,14 +1049,18 @@ Merge lines of full length. Used together with the column options
|
||||
|
||||
|
||||
@item -l @var{page_length}
|
||||
@itemx --length=@var{page_length}
|
||||
@opindex -l
|
||||
@opindex --length
|
||||
Set the page length to @var{page_length} (default 66) lines. If
|
||||
@var{page_length} is less than or equal 10 (and <= 3 with @samp{-f}),
|
||||
the headers and footers are omitted, and all form feeds set in input
|
||||
files are eliminated, as if the @samp{-T} option had been given.
|
||||
|
||||
@item -m
|
||||
@itemx --merge
|
||||
@opindex -m
|
||||
@opindex --merge
|
||||
Merge and print all @var{file}s in parallel, one in each column. If a
|
||||
line is too long to fit in a column, it is truncated (but see
|
||||
@samp{-j}). @samp{-s[@var{separator}]} may be used. Empty pages in some
|
||||
@@ -970,7 +1072,9 @@ line numbers. The default header becomes
|
||||
|
||||
|
||||
@item -n[@var{number-separator}[@var{digits}]]
|
||||
@itemx --number-lines[=@var{number-separator}[@var{digits}]]
|
||||
@opindex -n
|
||||
@opindex --number-lines
|
||||
Precede each column with a line number; with parallel @var{file}s
|
||||
(@samp{-m}), precede only each line with a line number. Optional argument
|
||||
@var{number-separator} is the character to print after each number
|
||||
@@ -980,12 +1084,16 @@ first line of the input file (not with the first line printed, see
|
||||
@samp{-N}).
|
||||
|
||||
@item -N @var{line_number}
|
||||
@itemx --first-line-number=@var{line_number}
|
||||
@opindex -N
|
||||
@opindex --first-line-number
|
||||
Start line counting with no. @var{line_number} at first line of first
|
||||
page printed.
|
||||
|
||||
@item -o @var{n}
|
||||
@itemx --indent=@var{n}
|
||||
@opindex -o
|
||||
@opindex --indent
|
||||
@cindex indenting lines
|
||||
@cindex left margin
|
||||
Indent each line with @var{n} (default is zero) spaces wide, i.e., set
|
||||
@@ -993,12 +1101,16 @@ the left margin. The total page width is @var{n} plus the width set
|
||||
with the @samp{-w} option.
|
||||
|
||||
@item -r
|
||||
@itemx --no-file-warnings
|
||||
@opindex -r
|
||||
@opindex --no-file-warnings
|
||||
Do not print a warning message when an argument @var{file} cannot be
|
||||
opened. (The exit status will still be nonzero, however.)
|
||||
|
||||
@item -s[@var{separator}]
|
||||
@itemx --separator[=@var{separator}]
|
||||
@opindex -s
|
||||
@opindex --separator
|
||||
Separate columns by a string @var{separator}. Don't use
|
||||
@samp{-s @var{separator}}, no space between flag and argument. If this
|
||||
option is omitted altogether, the default is @key{TAB} together with
|
||||
@@ -1007,7 +1119,9 @@ option is omitted altogether, the default is @key{TAB} together with
|
||||
does not affect line truncation or column alignment.
|
||||
|
||||
@item -t
|
||||
@itemx --omit-header
|
||||
@opindex -t
|
||||
@opindex --omit-header
|
||||
Do not print the usual header [and footer] on each page, and do not fill
|
||||
out the bottoms of pages (with blank lines or a form feed). No page
|
||||
structure is produced, but retain form feeds set in the input files. The
|
||||
@@ -1017,16 +1131,22 @@ useful together with other options; e.g.: @samp{-t -e4}, expand
|
||||
Use of @samp{-t} overrides @samp{-h}.
|
||||
|
||||
@item -T
|
||||
@itemx --omit-pagination
|
||||
@opindex -T
|
||||
@opindex --omit-pagination
|
||||
Do not print header [and footer]. In addition eliminate all form feeds
|
||||
set in the input files.
|
||||
|
||||
@item -v
|
||||
@itemx --show-nonprinting
|
||||
@opindex -v
|
||||
@opindex --show-nonprinting
|
||||
Print unprintable characters in octal backslash notation.
|
||||
|
||||
@item -w @var{page_width}
|
||||
@itemx --width=@var{page_width}
|
||||
@opindex -w
|
||||
@opindex --width
|
||||
Set the page width to @var{page_width} (default 72) characters.
|
||||
With/without @samp{-w}, header lines are always truncated to
|
||||
@var{page_width} characters. With @samp{-w}, text lines are truncated,
|
||||
@@ -1738,6 +1858,7 @@ These commands work with (or produce) sorted files.
|
||||
* sort invocation:: Sort text files.
|
||||
* uniq invocation:: Uniqify files.
|
||||
* comm invocation:: Compare two sorted files line by line.
|
||||
* ptx invocation::
|
||||
@end menu
|
||||
|
||||
|
||||
@@ -2188,6 +2309,469 @@ Upon normal completion @code{comm} produces an exit code of zero.
|
||||
If there is an error it exits with nonzero status.
|
||||
|
||||
|
||||
@node ptx invocation
|
||||
@section @code{ptx}: Produce permuted indexes
|
||||
|
||||
@pindex ptx
|
||||
|
||||
@code{ptx} reads a text file and essentially produces a permuted index, with
|
||||
each keyword in its context. The calling sketch is either one of:
|
||||
|
||||
@example
|
||||
ptx [@var{option} @dots{}] [@var{file} @dots{}]
|
||||
ptx -G [@var{option} @dots{}] [@var{input} [@var{output}]]
|
||||
@end example
|
||||
|
||||
The @samp{-G} (or its equivalent: @samp{--traditional}) option disables
|
||||
all GNU extensions and revert to traditional mode, thus introducing some
|
||||
limitations, and changes several of the program's default option values.
|
||||
When @samp{-G} is not specified, GNU extensions are always enabled. GNU
|
||||
extensions to @code{ptx} are documented wherever appropriate in this
|
||||
document. See @xref{Compatibility in ptx} for an explicit list of them.
|
||||
|
||||
Individual options are explained in incoming sections.
|
||||
|
||||
When GNU extensions are enabled, there may be zero, one or several
|
||||
@var{file} after the options. If there is no @var{file}, the program
|
||||
reads the standard input. If there is one or several @var{file}, they
|
||||
give the name of input files which are all read in turn, as if all the
|
||||
input files were concatenated. However, there is a full contextual
|
||||
break between each file and, when automatic referencing is requested,
|
||||
file names and line numbers refer to individual text input files. In
|
||||
all cases, the program produces the permuted index onto the standard
|
||||
output.
|
||||
|
||||
When GNU extensions are @emph{not} enabled, that is, when the program
|
||||
operates in traditional mode, there may be zero, one or two parameters
|
||||
besides the options. If there is no parameters, the program reads the
|
||||
standard input and produces the permuted index onto the standard output.
|
||||
If there is only one parameter, it names the text @var{input} to be read
|
||||
instead of the standard input. If two parameters are given, they give
|
||||
respectively the name of the @var{input} file to read and the name of
|
||||
the @var{output} file to produce. @emph{Be very careful} to note that,
|
||||
in this case, the contents of file given by the second parameter is
|
||||
destroyed. This behaviour is dictated only by System V @code{ptx}
|
||||
compatibility, because GNU Standards discourage output parameters not
|
||||
introduced by an option.
|
||||
|
||||
Note that for @emph{any} file named as the value of an option or as an
|
||||
input text file, a single dash @kbd{-} may be used, in which case
|
||||
standard input is assumed. However, it would not make sense to use this
|
||||
convention more than once per program invocation.
|
||||
|
||||
@menu
|
||||
* General options in ptx:: Options which affect general program behaviour.
|
||||
* Charset selection in ptx:: Underlying character set considerations.
|
||||
* Input processing in ptx:: Input fields, contexts, and keyword selection.
|
||||
* Output formatting in ptx:: Types of output format, and sizing the fields.
|
||||
* Compatibility in ptx::
|
||||
@end menu
|
||||
|
||||
|
||||
@node General options in ptx
|
||||
@subsection General options
|
||||
|
||||
@table @code
|
||||
|
||||
@item -C
|
||||
@itemx --copyright
|
||||
Prints a short note about the Copyright and copying conditions, then
|
||||
exit without further processing.
|
||||
|
||||
@item -G
|
||||
@itemx --traditional
|
||||
As already explained, this option disables all GNU extensions to
|
||||
@code{ptx} and switch to traditional mode.
|
||||
|
||||
@item --help
|
||||
Prints a short help on standard output, then exit without further
|
||||
processing.
|
||||
|
||||
@item --version
|
||||
Prints the program verison on standard output, then exit without further
|
||||
processing.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Charset selection in ptx
|
||||
@subsection Charset selection
|
||||
|
||||
As it is setup now, the program assumes that the input file is coded
|
||||
using 8-bit ISO 8859-1 code, also known as Latin-1 character set,
|
||||
@emph{unless} if it is compiled for MS-DOS, in which case it uses the
|
||||
character set of the IBM-PC. (GNU @code{ptx} is not known to work on
|
||||
smaller MS-DOS machines anymore.) Compared to 7-bit ASCII, the set of
|
||||
characters which are letters is then different, this fact alters the
|
||||
behaviour of regular expression matching. Thus, the default regular
|
||||
expression for a keyword allows foreign or diacriticized letters.
|
||||
Keyword sorting, however, is still crude; it obeys the underlying
|
||||
character set ordering quite blindly.
|
||||
|
||||
@table @code
|
||||
|
||||
@item -f
|
||||
@itemx --ignore-case
|
||||
Fold lower case letters to upper case for sorting.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Input processing in ptx
|
||||
@subsection Word selection and input processing
|
||||
|
||||
@table @code
|
||||
|
||||
@item -b @var{file}
|
||||
@item --break-file=@var{file}
|
||||
|
||||
This option is an alternative way to option @code{-W} for describing
|
||||
which characters make up words. This option introduces the name of a
|
||||
file which contains a list of characters which can@emph{not} be part of
|
||||
one word, this file is called the @dfn{Break file}. Any character which
|
||||
is not part of the Break file is a word constituent. If both options
|
||||
@code{-b} and @code{-W} are specified, then @code{-W} has precedence and
|
||||
@code{-b} is ignored.
|
||||
|
||||
When GNU extensions are enabled, the only way to avoid newline as a
|
||||
break character is to write all the break characters in the file with no
|
||||
newline at all, not even at the end of the file. When GNU extensions
|
||||
are disabled, spaces, tabs and newlines are always considered as break
|
||||
characters even if not included in the Break file.
|
||||
|
||||
@item -i @var{file}
|
||||
@itemx --ignore-file=@var{file}
|
||||
|
||||
The file associated with this option contains a list of words which will
|
||||
never be taken as keywords in concordance output. It is called the
|
||||
@dfn{Ignore file}. The file contains exactly one word in each line; the
|
||||
end of line separation of words is not subject to the value of the
|
||||
@code{-S} option.
|
||||
|
||||
There is a default Ignore file used by @code{ptx} when this option is
|
||||
not specified, usually found in @file{/usr/local/lib/eign} if this has
|
||||
not been changed at installation time. If you want to deactivate the
|
||||
default Ignore file, specify @code{/dev/null} instead.
|
||||
|
||||
@item -o @var{file}
|
||||
@itemx --only-file=@var{file}
|
||||
|
||||
The file associated with this option contains a list of words which will
|
||||
be retained in concordance output, any word not mentioned in this file
|
||||
is ignored. The file is called the @dfn{Only file}. The file contains
|
||||
exactly one word in each line; the end of line separation of words is
|
||||
not subject to the value of the @code{-S} option.
|
||||
|
||||
There is no default for the Only file. In the case there are both an
|
||||
Only file and an Ignore file, a word will be subject to be a keyword
|
||||
only if it is given in the Only file and not given in the Ignore file.
|
||||
|
||||
@item -r
|
||||
@itemx --references
|
||||
|
||||
On each input line, the leading sequence of non white characters will be
|
||||
taken to be a reference that has the purpose of identifying this input
|
||||
line on the produced permuted index. See @xref{Output formatting in ptx} for
|
||||
more information about reference production. Using this option change
|
||||
the default value for option @code{-S}.
|
||||
|
||||
Using this option, the program does not try very hard to remove
|
||||
references from contexts in output, but it succeeds in doing so
|
||||
@emph{when} the context ends exactly at the newline. If option
|
||||
@code{-r} is used with @code{-S} default value, or when GNU extensions
|
||||
are disabled, this condition is always met and references are completely
|
||||
excluded from the output contexts.
|
||||
|
||||
@item -S @var{regexp}
|
||||
@itemx --sentence-regexp=@var{regexp}
|
||||
|
||||
This option selects which regular expression will describe the end of a
|
||||
line or the end of a sentence. In fact, there is other distinction
|
||||
between end of lines or end of sentences than the effect of this regular
|
||||
expression, and input line boundaries have no special significance
|
||||
outside this option. By default, when GNU extensions are enabled and if
|
||||
@code{-r} option is not used, end of sentences are used. In this
|
||||
case, the precise @var{regex} is imported from GNU emacs:
|
||||
|
||||
@example
|
||||
[.?!][]\"')@}]*\\($\\|\t\\| \\)[ \t\n]*
|
||||
@end example
|
||||
|
||||
Whenever GNU extensions are disabled or if @code{-r} option is used, end
|
||||
of lines are used; in this case, the default @var{regexp} is just:
|
||||
|
||||
@example
|
||||
\n
|
||||
@end example
|
||||
|
||||
Using an empty REGEXP is equivalent to completely disabling end of line or end
|
||||
of sentence recognition. In this case, the whole file is considered to
|
||||
be a single big line or sentence. The user might want to disallow all
|
||||
truncation flag generation as well, through option @code{-F ""}.
|
||||
@xref{Regexps, , Syntax of Regular Expressions, emacs, The GNU Emacs
|
||||
Manual}.
|
||||
|
||||
When the keywords happen to be near the beginning of the input line or
|
||||
sentence, this often creates an unused area at the beginning of the
|
||||
output context line; when the keywords happen to be near the end of the
|
||||
input line or sentence, this often creates an unused area at the end of
|
||||
the output context line. The program tries to fill those unused areas
|
||||
by wrapping around context in them; the tail of the input line or
|
||||
sentence is used to fill the unused area on the left of the output line;
|
||||
the head of the input line or sentence is used to fill the unused area
|
||||
on the right of the output line.
|
||||
|
||||
As a matter of convenience to the user, many usual backslashed escape
|
||||
sequences, as found in the C language, are recognized and converted to
|
||||
the corresponding characters by @code{ptx} itself.
|
||||
|
||||
@item -W @var{regexp}
|
||||
@itemx --word-regexp=@var{regexp}
|
||||
|
||||
This option selects which regular expression will describe each keyword.
|
||||
By default, if GNU extensions are enabled, a word is a sequence of
|
||||
letters; the @var{regexp} used is @code{\w+}. When GNU extensions are
|
||||
disabled, a word is by default anything which ends with a space, a tab
|
||||
or a newline; the @var{regexp} used is @code{[^ \t\n]+}.
|
||||
|
||||
An empty REGEXP is equivalent to not using this option, letting the
|
||||
default dive in. @xref{Regexps, , Syntax of Regular Expressions, emacs,
|
||||
The GNU Emacs Manual}.
|
||||
|
||||
As a matter of convenience to the user, many usual backslashed escape
|
||||
sequences, as found in the C language, are recognized and converted to
|
||||
the corresponding characters by @code{ptx} itself.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Output formatting in ptx
|
||||
@subsection Output formatting
|
||||
|
||||
Output format is mainly controlled by @code{-O} and @code{-T} options,
|
||||
described in the table below. When neither @code{-O} nor @code{-T} is
|
||||
selected, and if GNU extensions are enabled, the program choose an
|
||||
output format suited for a dumb terminal. Each keyword occurrence is
|
||||
output to the center of one line, surrounded by its left and right
|
||||
contexts. Each field is properly justified, so the concordance output
|
||||
could readily be observed. As a special feature, if automatic
|
||||
references are selected by option @code{-A} and are output before the
|
||||
left context, that is, if option @code{-R} is @emph{not} selected, then
|
||||
a colon is added after the reference; this nicely interfaces with GNU
|
||||
Emacs @code{next-error} processing. In this default output format, each
|
||||
white space character, like newline and tab, is merely changed to
|
||||
exactly one space, with no special attempt to compress consecutive
|
||||
spaces. This might change in the future. Except for those white space
|
||||
characters, every other character of the underlying set of 256
|
||||
characters is transmitted verbatim.
|
||||
|
||||
Output format is further controlled by the following options.
|
||||
|
||||
@table @code
|
||||
|
||||
@item -g @var{number}
|
||||
@itemx --gap-size=@var{number}
|
||||
|
||||
Select the size of the minimum white gap between the fields on the output
|
||||
line.
|
||||
|
||||
@item -w @var{number}
|
||||
@itemx --width=@var{number}
|
||||
|
||||
Select the output maximum width of each final line. If references are
|
||||
used, they are included or excluded from the output maximum width
|
||||
depending on the value of option @code{-R}. If this option is not
|
||||
selected, that is, when references are output before the left context,
|
||||
the output maximum width takes into account the maximum length of all
|
||||
references. If this options is selected, that is, when references are
|
||||
output after the right context, the output maximum width does not take
|
||||
into account the space taken by references, nor the gap that precedes
|
||||
them.
|
||||
|
||||
@item -A
|
||||
@itemx --auto-reference
|
||||
|
||||
Select automatic references. Each input line will have an automatic
|
||||
reference made up of the file name and the line ordinal, with a single
|
||||
colon between them. However, the file name will be empty when standard
|
||||
input is being read. If both @code{-A} and @code{-r} are selected, then
|
||||
the input reference is still read and skipped, but the automatic
|
||||
reference is used at output time, overriding the input reference.
|
||||
|
||||
@item -R
|
||||
@itemx --right-side-refs
|
||||
|
||||
In default output format, when option @code{-R} is not used, any
|
||||
reference produced by the effect of options @code{-r} or @code{-A} are
|
||||
given to the far right of output lines, after the right context. In
|
||||
default output format, when option @code{-R} is specified, references
|
||||
are rather given to the beginning of each output line, before the left
|
||||
context. For any other output format, option @code{-R} is almost
|
||||
ignored, except for the fact that the width of references is @emph{not}
|
||||
taken into account in total output width given by @code{-w} whenever
|
||||
@code{-R} is selected.
|
||||
|
||||
This option is automatically selected whenever GNU extensions are
|
||||
disabled.
|
||||
|
||||
@item -F @var{string}
|
||||
@itemx --flac-truncation=@var{string}
|
||||
|
||||
This option will request that any truncation in the output be reported
|
||||
using the string @var{string}. Most output fields theoretically extend
|
||||
towards the beginning or the end of the current line, or current
|
||||
sentence, as selected with option @code{-S}. But there is a maximum
|
||||
allowed output line width, changeable through option @code{-w}, which is
|
||||
further divided into space for various output fields. When a field has
|
||||
to be truncated because cannot extend until the beginning or the end of
|
||||
the current line to fit in the, then a truncation occurs. By default,
|
||||
the string used is a single slash, as in @code{-F /}.
|
||||
|
||||
@var{string} may have more than one character, as in @code{-F ...}.
|
||||
Also, in the particular case @var{string} is empty (@code{-F ""}),
|
||||
truncation flagging is disabled, and no truncation marks are appended in
|
||||
this case.
|
||||
|
||||
As a matter of convenience to the user, many usual backslashed escape
|
||||
sequences, as found in the C language, are recognized and converted to
|
||||
the corresponding characters by @code{ptx} itself.
|
||||
|
||||
@item -M @var{string}
|
||||
@itemx --macro-name=@var{string}
|
||||
|
||||
Select another @var{string} to be used instead of @samp{xx}, while
|
||||
generating output suitable for @code{nroff}, @code{troff} or @TeX{}.
|
||||
|
||||
@item -O
|
||||
@itemx --format=roff
|
||||
|
||||
Choose an output format suitable for @code{nroff} or @code{troff}
|
||||
processing. Each output line will look like:
|
||||
|
||||
@example
|
||||
.xx "@var{tail}" "@var{before}" "@var{keyword_and_after}" "@var{head}" "@var{ref}"
|
||||
@end example
|
||||
|
||||
so it will be possible to write an @samp{.xx} roff macro to take care of
|
||||
the output typesetting. This is the default output format when GNU
|
||||
extensions are disabled. Option @samp{-M} might be used to change
|
||||
@samp{xx} to another macro name.
|
||||
|
||||
In this output format, each non-graphical character, like newline and
|
||||
tab, is merely changed to exactly one space, with no special attempt to
|
||||
compress consecutive spaces. Each quote character: @kbd{"} is doubled
|
||||
so it will be correctly processed by @code{nroff} or @code{troff}.
|
||||
|
||||
@item -T
|
||||
@itemx --format=tex
|
||||
|
||||
Choose an output format suitable for @TeX{} processing. Each output
|
||||
line will look like:
|
||||
|
||||
@example
|
||||
\xx @{@var{tail}@}@{@var{before}@}@{@var{keyword}@}@{@var{after}@}@{@var{head}@}@{@var{ref}@}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
so it will be possible to write write a @code{\xx} definition to take
|
||||
care of the output typesetting. Note that when references are not being
|
||||
produced, that is, neither option @code{-A} nor option @code{-r} is
|
||||
selected, the last parameter of each @code{\xx} call is inhibited.
|
||||
Option @samp{-M} might be used to change @samp{xx} to another macro
|
||||
name.
|
||||
|
||||
In this output format, some special characters, like @kbd{$}, @kbd{%},
|
||||
@kbd{&}, @kbd{#} and @kbd{_} are automatically protected with a
|
||||
backslash. Curly brackets @kbd{@{}, @kbd{@}} are also protected with a
|
||||
backslash, but also enclosed in a pair of dollar signs to force
|
||||
mathematical mode. The backslash itself produces the sequence
|
||||
@code{\backslash@{@}}. Circumflex and tilde diacritics produce the
|
||||
sequence @code{^\@{ @}} and @code{~\@{ @}} respectively. Other
|
||||
diacriticized characters of the underlying character set produce an
|
||||
appropriate @TeX{} sequence as far as possible. The other non-graphical
|
||||
characters, like newline and tab, and all others characters which are
|
||||
not part of ASCII, are merely changed to exactly one space, with no
|
||||
special attempt to compress consecutive spaces. Let me know how to
|
||||
improve this special character processing for @TeX{}.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Compatibility in ptx
|
||||
@subsection The GNU extensions to @code{ptx}
|
||||
|
||||
This version of @code{ptx} contains a few features which do not exist in
|
||||
System V @code{ptx}. These extra features are suppressed by using the
|
||||
@samp{-G} command line option, unless overridden by other command line
|
||||
options. Some GNU extensions cannot be recovered by overriding, so the
|
||||
simple rule is to avoid @samp{-G} if you care about GNU extensions.
|
||||
Here are the differences between this program and System V @code{ptx}.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
This program can read many input files at once, it always writes the
|
||||
resulting concordance on standard output. On the other end, System V
|
||||
@code{ptx} reads only one file and produce the result on standard output
|
||||
or, if a second @var{file} parameter is given on the command, to that
|
||||
@var{file}.
|
||||
|
||||
Having output parameters not introduced by options is a quite dangerous
|
||||
practice which GNU avoids as far as possible. So, for using @code{ptx}
|
||||
portably between GNU and System V, you should pay attention to always
|
||||
use it with a single input file, and always expect the result on
|
||||
standard output. You might also want to automatically configure in a
|
||||
@samp{-G} option to @code{ptx} calls in products using @code{ptx}, if
|
||||
the configurator finds that the installed @code{ptx} accepts @samp{-G}.
|
||||
|
||||
@item
|
||||
The only options available in System V @code{ptx} are options @samp{-b},
|
||||
@samp{-f}, @samp{-g}, @samp{-i}, @samp{-o}, @samp{-r}, @samp{-t} and
|
||||
@samp{-w}. All other options are GNU extensions and are not repeated in
|
||||
this enumeration. Moreover, some options have a slightly different
|
||||
meaning when GNU extensions are enabled, as explained below.
|
||||
|
||||
@item
|
||||
By default, concordance output is not formatted for @code{troff} or
|
||||
@code{nroff}. It is rather formatted for a dumb terminal. @code{troff}
|
||||
or @code{nroff} output may still be selected through option @code{-O}.
|
||||
|
||||
@item
|
||||
Unless @code{-R} option is used, the maximum reference width is
|
||||
subtracted from the total output line width. With GNU extensions
|
||||
disabled, width of references is not taken into account in the output
|
||||
line width computations.
|
||||
|
||||
@item
|
||||
All 256 characters, even @kbd{NUL}s, are always read and processed from
|
||||
input file with no adverse effect, even if GNU extensions are disabled.
|
||||
However, System V @code{ptx} does not accept 8-bit characters, a few
|
||||
control characters are rejected, and the tilda @kbd{~} is condemned.
|
||||
|
||||
@item
|
||||
Input line length is only limited by available memory, even if GNU
|
||||
extensions are disabled. However, System V @code{ptx} processes only
|
||||
the first 200 characters in each line.
|
||||
|
||||
@item
|
||||
The break (non-word) characters default to be every character except all
|
||||
letters of the underlying character set, diacriticized or not. When GNU
|
||||
extensions are disabled, the break characters default to space, tab and
|
||||
newline only.
|
||||
|
||||
@item
|
||||
The program makes better use of output line width. If GNU extensions
|
||||
are disabled, the program rather tries to imitate System V @code{ptx},
|
||||
but still, there are some slight disposition glitches this program does
|
||||
not completely reproduce.
|
||||
|
||||
@item
|
||||
The user can specify both an Ignore file and an Only file. This is not
|
||||
allowed with System V @code{ptx}.
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@node Operating on fields within a line
|
||||
@chapter Operating on fields within a line
|
||||
|
||||
@@ -2845,7 +3429,6 @@ ones, to tabs.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@c What's GNU?
|
||||
@c Arnold Robbins
|
||||
@node Opening the software toolbox
|
||||
@@ -2856,13 +3439,13 @@ number 2, in the @cite{What's GNU?} column. It was written by Arnold
|
||||
Robbins.
|
||||
|
||||
@menu
|
||||
* Toolbox introduction::
|
||||
* I/O redirection::
|
||||
* The who command::
|
||||
* The cut command::
|
||||
* The sort command::
|
||||
* The uniq command::
|
||||
* Putting the tools together::
|
||||
* Toolbox introduction:: Toolbox introduction
|
||||
* I/O redirection:: I/O redirection
|
||||
* The who command:: The @code{who} command
|
||||
* The cut command:: The @code{cut} command
|
||||
* The sort command:: The @code{sort} command
|
||||
* The uniq command:: The @code{uniq} command
|
||||
* Putting the tools together:: Putting the tools together
|
||||
@end menu
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
Makefile
|
||||
getdate.c
|
||||
posixtm.c
|
||||
safe-stat.h
|
||||
safe-stat.c
|
||||
safe-lstat.c
|
||||
|
||||
@@ -6,7 +6,7 @@ noinst_LIBRARIES = libfu.a
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
|
||||
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
|
||||
addext.c argmatch.c backupfile.c basename.c \
|
||||
closeout.c dirname.c exclude.c filemode.c \
|
||||
full-write.c human.c idcache.c \
|
||||
@@ -21,7 +21,7 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h filemode.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
BUILT_SOURCES = getdate.c
|
||||
|
||||
@@ -95,7 +95,7 @@ noinst_LIBRARIES = libfu.a
|
||||
|
||||
INCLUDES = -I.. -I$(srcdir) -I../intl
|
||||
|
||||
libfu_a_SOURCES = getdate.y posixtm.y getopt.c getopt1.c \
|
||||
libfu_a_SOURCES = getdate.y posixtm.c getopt.c getopt1.c \
|
||||
addext.c argmatch.c backupfile.c basename.c \
|
||||
closeout.c dirname.c exclude.c filemode.c \
|
||||
full-write.c human.c idcache.c \
|
||||
@@ -110,10 +110,10 @@ noinst_HEADERS = argmatch.h backupfile.h closeout.h \
|
||||
error.h exclude.h filemode.h fnmatch.h fsusage.h \
|
||||
getdate.h getline.h getopt.h group-member.h human.h lchown.h long-options.h \
|
||||
makepath.h modechange.h mountlist.h hash.h path-concat.h pathmax.h \
|
||||
quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
posixtm.h quotearg.h regex.h safe-read.h save-cwd.h savedir.h strverscmp.h \
|
||||
xalloc.h xstrtol.h xstrtoul.h
|
||||
|
||||
BUILT_SOURCES = getdate.c posixtm.c
|
||||
BUILT_SOURCES = getdate.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@@ -133,7 +133,6 @@ hash$U.o path-concat$U.o quotearg$U.o safe-read$U.o save-cwd$U.o \
|
||||
savedir$U.o stripslash$U.o userspec$U.o xgetcwd$U.o xmalloc$U.o \
|
||||
xstrdup$U.o xstrtol$U.o xstrtoul$U.o yesno$U.o
|
||||
AR = ar
|
||||
YLWRAP = $(srcdir)/ylwrap
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
@@ -143,9 +142,9 @@ DIST_COMMON = Makefile.am Makefile.in TODO alloca.c chown.c error.c \
|
||||
error.h euidaccess.c fileblocks.c fnmatch.c fsusage.c ftruncate.c \
|
||||
getdate.c getgroups.c getline.c group-member.c lchown.c lstat.c \
|
||||
malloc.c memcmp.c memcpy.c memset.c mkdir.c mktime.c mountlist.c \
|
||||
obstack.c obstack.h posixtm.c realloc.c regex.c rename.c rmdir.c \
|
||||
rpmatch.c stat.c stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c \
|
||||
strstr.c strtol.c strtoul.c strverscmp.c utime.c ylwrap
|
||||
obstack.c obstack.h realloc.c regex.c rename.c rmdir.c rpmatch.c stat.c \
|
||||
stpcpy.c strcasecmp.c strdup.c strftime.c strndup.c strstr.c strtol.c \
|
||||
strtoul.c strverscmp.c utime.c ylwrap
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -162,15 +161,14 @@ DEP_FILES = .deps/addext.P .deps/alloca.P .deps/argmatch.P \
|
||||
.deps/isdir.P .deps/lchown.P .deps/long-options.P .deps/lstat.P \
|
||||
.deps/makepath.P .deps/malloc.P .deps/memcmp.P .deps/memcpy.P \
|
||||
.deps/memset.P .deps/mkdir.P .deps/mktime.P .deps/modechange.P \
|
||||
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm \
|
||||
.deps/posixtm.P .deps/quotearg.P .deps/realloc.P .deps/regex.P \
|
||||
.deps/rename.P .deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P \
|
||||
.deps/save-cwd.P .deps/savedir.P .deps/stat.P .deps/stpcpy.P \
|
||||
.deps/strcasecmp.P .deps/strdup.P .deps/strftime.P .deps/stripslash.P \
|
||||
.deps/strndup.P .deps/strstr.P .deps/strtol.P .deps/strtoul.P \
|
||||
.deps/strverscmp.P .deps/userspec.P .deps/utime.P .deps/xgetcwd.P \
|
||||
.deps/xmalloc.P .deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P \
|
||||
.deps/yesno.P
|
||||
.deps/mountlist.P .deps/obstack.P .deps/path-concat.P .deps/posixtm.P \
|
||||
.deps/quotearg.P .deps/realloc.P .deps/regex.P .deps/rename.P \
|
||||
.deps/rmdir.P .deps/rpmatch.P .deps/safe-read.P .deps/save-cwd.P \
|
||||
.deps/savedir.P .deps/stat.P .deps/stpcpy.P .deps/strcasecmp.P \
|
||||
.deps/strdup.P .deps/strftime.P .deps/stripslash.P .deps/strndup.P \
|
||||
.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/strverscmp.P \
|
||||
.deps/userspec.P .deps/utime.P .deps/xgetcwd.P .deps/xmalloc.P \
|
||||
.deps/xstrdup.P .deps/xstrtol.P .deps/xstrtoul.P .deps/yesno.P
|
||||
SOURCES = $(libfu_a_SOURCES)
|
||||
OBJECTS = $(libfu_a_OBJECTS)
|
||||
|
||||
@@ -231,8 +229,10 @@ libfu.a: $(libfu_a_OBJECTS) $(libfu_a_DEPENDENCIES)
|
||||
$(AR) cru libfu.a $(libfu_a_OBJECTS) $(libfu_a_LIBADD)
|
||||
$(RANLIB) libfu.a
|
||||
.y.c:
|
||||
$(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(YFLAGS)
|
||||
posixtm.h: posixtm.c
|
||||
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
|
||||
if test -f y.tab.h; then \
|
||||
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
|
||||
else :; fi
|
||||
getdate.h: getdate.c
|
||||
|
||||
addext_.c: addext.c $(ANSI2KNR)
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
void mode_string (short unsigned int mode, char *str);
|
||||
#ifndef PARAMS
|
||||
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void mode_string PARAMS ((short unsigned int mode, char *str));
|
||||
|
||||
1135
lib/posixtm.c
1135
lib/posixtm.c
File diff suppressed because it is too large
Load Diff
16
lib/posixtm.h
Normal file
16
lib/posixtm.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef POSIXTM_H_
|
||||
# define POSIXTM_H_
|
||||
|
||||
/* POSIX Date Syntax flags. */
|
||||
# define PDS_LEADING_YEAR 1
|
||||
# define PDS_TRAILING_YEAR 2
|
||||
# define PDS_CENTURY 4
|
||||
# define PDS_SECONDS 8
|
||||
|
||||
time_t
|
||||
posixtime (const char *s, unsigned int syntax_bits);
|
||||
|
||||
struct tm *
|
||||
posixtm (const char *s, unsigned int syntax_bits);
|
||||
|
||||
#endif
|
||||
11
m4/ChangeLog
11
m4/ChangeLog
@@ -1,3 +1,14 @@
|
||||
1998-08-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Port nanosecond-resolution times to UnixWare 2.1.2 and
|
||||
pedantic Solaris 2.6.
|
||||
|
||||
* st_mtim.m4 (AC_STRUCT_ST_MTIM_NSEC): Renamed from
|
||||
AC_STRUCT_ST_MTIM.
|
||||
* st_mtim.m4 (AC_STRUCT_ST_MTIM_NSEC):
|
||||
Generate name of ns member, instead of just 1 or undef.
|
||||
Allow for UnixWare 2.1.2 and Solaris 2.6 if in pedantic mode.
|
||||
|
||||
1998-08-15 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* ssize_t.m4 (jm_TYPE_SSIZE_T): Remove file.
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
#serial 2
|
||||
#serial 3
|
||||
|
||||
dnl From Paul Eggert.
|
||||
|
||||
# Define HAVE_ST_MTIM if struct stat has an st_mtim member.
|
||||
# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim,
|
||||
# if it exists.
|
||||
|
||||
AC_DEFUN(AC_STRUCT_ST_MTIM,
|
||||
[AC_CACHE_CHECK([for st_mtim in struct stat], ac_cv_struct_st_mtim,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/stat.h>], [struct stat s; s.st_mtim;],
|
||||
ac_cv_struct_st_mtim=yes,
|
||||
ac_cv_struct_st_mtim=no)])
|
||||
AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC,
|
||||
[AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim],
|
||||
ac_cv_struct_st_mtim_nsec,
|
||||
[ac_save_CPPFLAGS="$CPPFLAGS"
|
||||
ac_cv_struct_st_mtim_nsec=no
|
||||
# tv_nsec -- the usual case
|
||||
# _tv_nsec -- Solaris 2.6, if
|
||||
# (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
|
||||
# && !defined __EXTENSIONS__)
|
||||
# st__tim.tv_nsec -- UnixWare 2.1.2
|
||||
for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
|
||||
CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
|
||||
[ac_cv_struct_st_mtim_nsec=$ac_val; break])
|
||||
done
|
||||
CPPFLAGS="$ac_save_CPPFLAGS"])
|
||||
|
||||
if test $ac_cv_struct_st_mtim = yes; then
|
||||
if test x = y; then
|
||||
# This code is deliberately never run via ./configure.
|
||||
# FIXME: this is a hack to make autoheader put the corresponding
|
||||
# HAVE_* undef for this symbol in config.h.in. This saves me the
|
||||
# trouble of having to add the #undef in acconfig.h manually.
|
||||
AC_CHECK_FUNCS(ST_MTIM)
|
||||
fi
|
||||
# Defining it this way (rather than via AC_DEFINE) short-circuits the
|
||||
# autoheader check -- autoheader doesn't know it's already been taken
|
||||
# care of by the hack above.
|
||||
ac_kludge=HAVE_ST_MTIM
|
||||
AC_DEFINE_UNQUOTED($ac_kludge)
|
||||
if test $ac_cv_struct_st_mtim_nsec != no; then
|
||||
AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec)
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1,3 +1,95 @@
|
||||
1998-09-07 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16w.
|
||||
|
||||
* src/df.c (show_dev) [!posix_format]: When using --print-type,
|
||||
let the device path and the file system type share a single (wider)
|
||||
field if their combined lengths allow it. From Andries Brouwer.
|
||||
|
||||
* tests/touch/empty-file: Upon failure, suggest how to rerun the test
|
||||
with longer delay, in case NFS clock skew was the cause of the failure.
|
||||
Reported by Kaveh Ghazi.
|
||||
|
||||
* tests/ls-2/quoting: Add tests.
|
||||
* tests/Fetish.pm (run_tests): Add simple PRE/POST hooks.
|
||||
(_create_file): Don't include $$ in temp file name.
|
||||
(run_tests): Use shorter suffixes for temp file names.
|
||||
|
||||
1998-09-06 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/touch.c: Include posixtm.h.
|
||||
(usage): Correct the description of the format of the
|
||||
date string argument to -t option.
|
||||
(main): Update to use rewritten posixtime function.
|
||||
Reported by Andries Brouwer.
|
||||
|
||||
* lib/Makefile.am (libfu_a_SOURCES): Change posixtm.y to posixtm.c.
|
||||
(noinst_HEADERS): Add posixtm.h.
|
||||
|
||||
* lib/posixtm.h: New file.
|
||||
* lib/posixtm.c: New file. Rewritten based on posixtm.y.
|
||||
* lib/posixtm.y: Remove file.
|
||||
|
||||
1998-09-05 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* src/ls.c (print_dir_name): Put back.
|
||||
(print_dir): Also print directory name header if print_dir_name is
|
||||
true.
|
||||
|
||||
1998-08-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16v.
|
||||
|
||||
* src/du.c (long_options): Use corresponding short-option character
|
||||
in place of `1', and `NULL' in place of pointer in initialization.
|
||||
* src/cp.c (long_opts): Likewise.
|
||||
* src/ln.c (long_options): Likewise.
|
||||
* src/mkdir.c (longopts): Likewise.
|
||||
* src/rmdir.c (longopts): Likewise.
|
||||
* src/chown.c: Replace 12 and 13 with CHAR_MAX + 1 and CHAR_MAX + 2
|
||||
respectively.
|
||||
* src/chmod.c (long_options): Replace 12 with CHAR_MAX + 1.
|
||||
* src/chgrp.c (long_options): Replace 12 with CHAR_MAX + 1.
|
||||
|
||||
* tests/Fetish.pm: New file -- moved from ls-2/.
|
||||
* configure.in (AC_OUTPUT): Add tests/dircolors/Makefile.
|
||||
* tests/Makefile.am (SUBDIRS): Add dircolors.
|
||||
(EXTRA_DIST): Add Fetish.pm.
|
||||
* tests/dircolors: New directory
|
||||
|
||||
* src/ls.c (print_dir_name): Remove global variable.
|
||||
(print_dir): When trace_dirs is set, always print the directory
|
||||
name header.
|
||||
|
||||
1998-08-26 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/dircolors.c (dc_parse_stream): Don't segfault when a line
|
||||
contains only one token. Reported by Olav Morkrid.
|
||||
|
||||
1998-08-24 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* src/system.h (CHAR_MIN, CHAR_MAX):
|
||||
Renamed from SCHAR_MIN, SCHAR_MAX, since these
|
||||
macros apply to char, not signed char.
|
||||
|
||||
* src/df.c, src/du.c, src/touch.c (long_options, main):
|
||||
Don't assume ASCII.
|
||||
|
||||
1998-08-18 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
Port nanosecond-resolution times to UnixWare 2.1.2 and
|
||||
pedantic Solaris 2.6.
|
||||
|
||||
* configure.in (AC_STRUCT_ST_MTIM_NSEC): Renamed from AC_STRUCT_ST_MTIM.
|
||||
* acconfig.h (ST_MTIM_NSEC): New #undef.
|
||||
* src/system.h: (ST_TIME_CMP_NS, ATIME_CMP, CTIME_CMP, MTIME_CMP):
|
||||
Use new ST_MTIM_NSEC macro.
|
||||
|
||||
1998-08-16 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* lib/filemode.h (PARAMS): Define and use.
|
||||
From Kaveh Ghazi.
|
||||
|
||||
1998-08-15 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* Version 3.16u.
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
Changes in release 3.17:
|
||||
[3.16w]
|
||||
* touch now interprets `-t TIME-DATE' as POSIX specifies
|
||||
* `ls EMPTY-DIR EMPTY-DIR' once again outputs the directory names
|
||||
[3.16v]
|
||||
* portability fixes
|
||||
* `ls -R EMPTY-DIR' now outputs the name of the directory
|
||||
[3.16u]
|
||||
* mv now fails (as it should) upon attempt to move a directory into itself
|
||||
* `cp -a --one-file-system' now copies any mount point directories it
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
1998-08-29 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/su.c (longopts): Use corresponding short-option character
|
||||
in place of `1', and `NULL' in place of pointer in initialization.
|
||||
|
||||
1998-08-11 Jim Meyering <meyering@ascend.com>
|
||||
|
||||
* src/uptime.c (usage): Correct description. Reported by John Murphy.
|
||||
|
||||
@@ -107,7 +107,7 @@ static struct option const long_options[] =
|
||||
{"no-dereference", no_argument, 0, 'h'},
|
||||
{"silent", no_argument, 0, 'f'},
|
||||
{"quiet", no_argument, 0, 'f'},
|
||||
{"reference", required_argument, 0, 12},
|
||||
{"reference", required_argument, 0, CHAR_MAX + 1},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
@@ -340,7 +340,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 12:
|
||||
case CHAR_MAX + 1:
|
||||
reference_file = optarg;
|
||||
break;
|
||||
case 'R':
|
||||
|
||||
@@ -82,7 +82,7 @@ static struct option const long_options[] =
|
||||
{"changes", no_argument, 0, 'c'},
|
||||
{"silent", no_argument, 0, 'f'},
|
||||
{"quiet", no_argument, 0, 'f'},
|
||||
{"reference", required_argument, 0, 12},
|
||||
{"reference", required_argument, 0, CHAR_MAX + 1},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
@@ -311,7 +311,7 @@ main (int argc, char **argv)
|
||||
error (1, 0, _("invalid mode"));
|
||||
modeind = thisind;
|
||||
break;
|
||||
case 12:
|
||||
case CHAR_MAX + 1:
|
||||
reference_file = optarg;
|
||||
break;
|
||||
case 'R':
|
||||
|
||||
@@ -113,11 +113,11 @@ static struct option const long_options[] =
|
||||
{
|
||||
{"recursive", no_argument, 0, 'R'},
|
||||
{"changes", no_argument, 0, 'c'},
|
||||
{"dereference", no_argument, 0, 13},
|
||||
{"dereference", no_argument, 0, CHAR_MAX + 2},
|
||||
{"no-dereference", no_argument, 0, 'h'},
|
||||
{"quiet", no_argument, 0, 'f'},
|
||||
{"silent", no_argument, 0, 'f'},
|
||||
{"reference", required_argument, 0, 12},
|
||||
{"reference", required_argument, 0, CHAR_MAX + 1},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
@@ -341,10 +341,10 @@ main (int argc, char **argv)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 12:
|
||||
case CHAR_MAX + 1:
|
||||
reference_file = optarg;
|
||||
break;
|
||||
case 13:
|
||||
case CHAR_MAX + 2:
|
||||
change_symlinks = 0;
|
||||
break;
|
||||
case 'R':
|
||||
|
||||
8
src/cp.c
8
src/cp.c
@@ -96,13 +96,13 @@ static struct option const long_opts[] =
|
||||
{"archive", no_argument, NULL, 'a'},
|
||||
{"backup", no_argument, NULL, 'b'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"sparse", required_argument, NULL, 2},
|
||||
{"sparse", required_argument, NULL, CHAR_MAX + 1},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"link", no_argument, NULL, 'l'},
|
||||
{"no-dereference", no_argument, NULL, 'd'},
|
||||
{"one-file-system", no_argument, NULL, 'x'},
|
||||
{"parents", no_argument, &flag_path, 1},
|
||||
{"path", no_argument, &flag_path, 1},
|
||||
{"parents", no_argument, NULL, 'P'},
|
||||
{"path", no_argument, NULL, 'P'},
|
||||
{"preserve", no_argument, NULL, 'p'},
|
||||
{"recursive", no_argument, NULL, 'R'},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
@@ -654,7 +654,7 @@ main (int argc, char **argv)
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case CHAR_MAX + 1:
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ static struct option const longopts[] =
|
||||
{"fields", required_argument, 0, 'f'},
|
||||
{"delimiter", required_argument, 0, 'd'},
|
||||
{"only-delimited", no_argument, 0, 's'},
|
||||
{"output-delimiter", required_argument, 0, 14},
|
||||
{"output-delimiter", required_argument, 0, CHAR_MAX + 1},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{0, 0, 0, 0}
|
||||
@@ -739,7 +739,7 @@ main (int argc, char **argv)
|
||||
delim_specified = 1;
|
||||
break;
|
||||
|
||||
case 14:
|
||||
case CHAR_MAX + 1:
|
||||
/* Interpret --output-delimiter='' to mean
|
||||
`use the NUL byte as the delimiter.' */
|
||||
output_delimiter_length = (optarg[0] == '\0'
|
||||
|
||||
38
src/df.c
38
src/df.c
@@ -115,7 +115,7 @@ static int print_type;
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"block-size", required_argument, NULL, 131},
|
||||
{"block-size", required_argument, NULL, CHAR_MAX + 3},
|
||||
{"inodes", no_argument, NULL, 'i'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, NULL, 'H'},
|
||||
@@ -124,8 +124,8 @@ static struct option const long_options[] =
|
||||
{"megabytes", no_argument, NULL, 'm'},
|
||||
{"portability", no_argument, NULL, 'P'},
|
||||
{"print-type", no_argument, NULL, 'T'},
|
||||
{"sync", no_argument, NULL, 129},
|
||||
{"no-sync", no_argument, NULL, 130},
|
||||
{"sync", no_argument, NULL, CHAR_MAX + 1},
|
||||
{"no-sync", no_argument, NULL, CHAR_MAX + 2},
|
||||
{"type", required_argument, NULL, 't'},
|
||||
{"exclude-type", required_argument, NULL, 'x'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
@@ -246,15 +246,29 @@ show_dev (const char *disk, const char *mount_point, const char *fstype,
|
||||
|
||||
if (! disk)
|
||||
disk = "-"; /* unknown */
|
||||
|
||||
printf ((print_type ? "%-13s" : "%-20s"), disk);
|
||||
if ((int) strlen (disk) > (print_type ? 13 : 20) && !posix_format)
|
||||
printf ((print_type ? "\n%13s" : "\n%20s"), "");
|
||||
|
||||
if (! fstype)
|
||||
fstype = "-"; /* unknown */
|
||||
|
||||
/* df.c reserved 5 positions for fstype,
|
||||
but that does not suffice for type iso9660 */
|
||||
if (print_type)
|
||||
printf (" %-5s ", fstype);
|
||||
{
|
||||
int disk_name_len = (int) strlen (disk);
|
||||
int fstype_len = (int) strlen (fstype);
|
||||
if (disk_name_len + fstype_len + 2 < 20)
|
||||
printf ("%s%*s ", disk, 18 - disk_name_len, fstype);
|
||||
else if (!posix_format)
|
||||
printf ("%s\n%18s ", disk, fstype);
|
||||
else
|
||||
printf ("%s %s", disk, fstype);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((int) strlen (disk) > 20 && !posix_format)
|
||||
printf ("%s\n%20s", disk, "");
|
||||
else
|
||||
printf ("%-20s", disk);
|
||||
}
|
||||
|
||||
if (inode_format)
|
||||
{
|
||||
@@ -654,14 +668,14 @@ main (int argc, char **argv)
|
||||
case 'P':
|
||||
posix_format = 1;
|
||||
break;
|
||||
case 129:
|
||||
case CHAR_MAX + 1:
|
||||
require_sync = 1;
|
||||
break;
|
||||
case 130:
|
||||
case CHAR_MAX + 2:
|
||||
require_sync = 0;
|
||||
break;
|
||||
|
||||
case 131:
|
||||
case CHAR_MAX + 3:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
|
||||
@@ -292,6 +292,15 @@ dc_parse_stream (FILE *fp, const char *filename)
|
||||
if (keywd == NULL)
|
||||
continue;
|
||||
|
||||
if (arg == NULL)
|
||||
{
|
||||
error (0, 0, _("%s:%lu: invalid line; missing second token"),
|
||||
filename, (long unsigned) line_number);
|
||||
err = 1;
|
||||
free (keywd);
|
||||
continue;
|
||||
}
|
||||
|
||||
unrecognized = 0;
|
||||
if (strcasecmp (keywd, "TERM") == 0)
|
||||
{
|
||||
|
||||
24
src/du.c
24
src/du.c
@@ -177,23 +177,23 @@ static uintmax_t tot_size = 0;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"all", no_argument, &opt_all, 1},
|
||||
{"block-size", required_argument, 0, 129},
|
||||
{"all", no_argument, NULL, 'a'},
|
||||
{"block-size", required_argument, 0, CHAR_MAX + 2},
|
||||
{"bytes", no_argument, NULL, 'b'},
|
||||
{"count-links", no_argument, &opt_count_all, 1},
|
||||
{"count-links", no_argument, NULL, 'l'},
|
||||
{"dereference", no_argument, NULL, 'L'},
|
||||
{"dereference-args", no_argument, &opt_dereference_arguments, 1},
|
||||
{"exclude", required_argument, 0, 128},
|
||||
{"dereference-args", no_argument, NULL, 'D'},
|
||||
{"exclude", required_argument, 0, CHAR_MAX + 1},
|
||||
{"exclude-from", required_argument, 0, 'X'},
|
||||
{"human-readable", no_argument, NULL, 'h'},
|
||||
{"si", no_argument, 0, 'H'},
|
||||
{"kilobytes", no_argument, NULL, 'k'},
|
||||
{"max-depth", required_argument, NULL, 13},
|
||||
{"max-depth", required_argument, NULL, CHAR_MAX + 3},
|
||||
{"megabytes", no_argument, NULL, 'm'},
|
||||
{"one-file-system", no_argument, &opt_one_file_system, 1},
|
||||
{"separate-dirs", no_argument, &opt_separate_dirs, 1},
|
||||
{"one-file-system", no_argument, NULL, 'x'},
|
||||
{"separate-dirs", no_argument, NULL, 'S'},
|
||||
{"summarize", no_argument, NULL, 's'},
|
||||
{"total", no_argument, &opt_combined_arguments, 1},
|
||||
{"total", no_argument, NULL, 'c'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{NULL, 0, NULL, 0}
|
||||
@@ -300,7 +300,7 @@ main (int argc, char **argv)
|
||||
output_block_size = 1024;
|
||||
break;
|
||||
|
||||
case 13: /* --max-depth=N */
|
||||
case CHAR_MAX + 3: /* --max-depth=N */
|
||||
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|
||||
|| tmp_long < 0 || tmp_long > INT_MAX)
|
||||
error (1, 0, _("invalid maximum depth `%s'"), optarg);
|
||||
@@ -342,11 +342,11 @@ main (int argc, char **argv)
|
||||
error (1, errno, "%s", optarg);
|
||||
break;
|
||||
|
||||
case 128:
|
||||
case CHAR_MAX + 1:
|
||||
add_exclude (exclude, optarg);
|
||||
break;
|
||||
|
||||
case 129:
|
||||
case CHAR_MAX + 2:
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
|
||||
6
src/ln.c
6
src/ln.c
@@ -108,13 +108,13 @@ static int show_version;
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"backup", no_argument, NULL, 'b'},
|
||||
{"directory", no_argument, &hard_dir_link, 1},
|
||||
{"directory", no_argument, NULL, 'F'},
|
||||
{"no-dereference", no_argument, NULL, 'n'},
|
||||
{"force", no_argument, NULL, 'f'},
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"suffix", required_argument, NULL, 'S'},
|
||||
{"symbolic", no_argument, &symbolic_link, 1},
|
||||
{"verbose", no_argument, &verbose, 1},
|
||||
{"symbolic", no_argument, NULL, 's'},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{"version-control", required_argument, NULL, 'V'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
|
||||
2
src/ls.c
2
src/ls.c
@@ -1591,7 +1591,7 @@ print_dir (const char *name, const char *realname)
|
||||
if (trace_dirs)
|
||||
extract_dirs_from_files (name, 1);
|
||||
|
||||
if (print_dir_name)
|
||||
if (trace_dirs || print_dir_name)
|
||||
{
|
||||
DIRED_INDENT ();
|
||||
PUSH_CURRENT_DIRED_POS (&subdired_obstack);
|
||||
|
||||
@@ -43,7 +43,7 @@ static int show_version;
|
||||
static struct option const longopts[] =
|
||||
{
|
||||
{"mode", required_argument, NULL, 'm'},
|
||||
{"parents", no_argument, &path_mode, 1},
|
||||
{"parents", no_argument, NULL, 'p'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"verbose", no_argument, NULL, 2},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
|
||||
8
src/pr.c
8
src/pr.c
@@ -580,8 +580,8 @@ static struct option const long_options[] =
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
{"test", no_argument, &test_suite, 1},
|
||||
{"pages", required_argument, NULL, 128},
|
||||
{"columns", required_argument, NULL, 129},
|
||||
{"pages", required_argument, NULL, CHAR_MAX + 1},
|
||||
{"columns", required_argument, NULL, CHAR_MAX + 2},
|
||||
{"across", no_argument, NULL, 'a'},
|
||||
{"show-control-chars", no_argument, NULL, 'c'},
|
||||
{"double-space", no_argument, NULL, 'd'},
|
||||
@@ -743,11 +743,11 @@ main (int argc, char **argv)
|
||||
case 0: /* getopt long option */
|
||||
break;
|
||||
|
||||
case 128: /* --pages=FIRST_PAGE[:LAST_PAGE] */
|
||||
case CHAR_MAX + 1: /* --pages=FIRST_PAGE[:LAST_PAGE] */
|
||||
first_last_page (optarg);
|
||||
break;
|
||||
|
||||
case 129: /* --columns=COLUMN */
|
||||
case CHAR_MAX + 2: /* --columns=COLUMN */
|
||||
{
|
||||
long int tmp_long;
|
||||
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK
|
||||
|
||||
@@ -64,7 +64,7 @@ static struct option const longopts[] =
|
||||
{
|
||||
/* Don't name this `--force' because it's not close enough in meaning
|
||||
to e.g. rm's -f option. */
|
||||
{"ignore-fail-on-non-empty", no_argument, NULL, 13},
|
||||
{"ignore-fail-on-non-empty", no_argument, NULL, CHAR_MAX + 1},
|
||||
|
||||
{"path", no_argument, NULL, 'p'},
|
||||
{"parents", no_argument, NULL, 'p'},
|
||||
@@ -163,7 +163,7 @@ main (int argc, char **argv)
|
||||
case 'p':
|
||||
empty_paths = 1;
|
||||
break;
|
||||
case 13:
|
||||
case CHAR_MAX + 1:
|
||||
ignore_fail_on_non_empty = 1;
|
||||
break;
|
||||
case 14:
|
||||
|
||||
6
src/su.c
6
src/su.c
@@ -1,5 +1,5 @@
|
||||
/* su for GNU. Run a shell with substitute user and group IDs.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -170,9 +170,9 @@ static int change_environment;
|
||||
static struct option const longopts[] =
|
||||
{
|
||||
{"command", required_argument, 0, 'c'},
|
||||
{"fast", no_argument, &fast_startup, 1},
|
||||
{"fast", no_argument, NULL, 'f'},
|
||||
{"help", no_argument, &show_help, 1},
|
||||
{"login", no_argument, &simulate_login, 1},
|
||||
{"login", no_argument, NULL, 'l'},
|
||||
{"preserve-environment", no_argument, &change_environment, 0},
|
||||
{"shell", required_argument, 0, 's'},
|
||||
{"version", no_argument, &show_version, 1},
|
||||
|
||||
21
src/system.h
21
src/system.h
@@ -81,16 +81,16 @@
|
||||
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ST_MTIM
|
||||
#ifdef ST_MTIM_NSEC
|
||||
# define ST_TIME_CMP_NS(a, b, ns) ((a).ns < (b).ns ? -1 : (a).ns > (b).ns)
|
||||
#else
|
||||
# define ST_TIME_CMP_NS(a, b, ns) 0
|
||||
#endif
|
||||
#define ST_TIME_CMP(a, b, s, ns) \
|
||||
((a).s < (b).s ? -1 : (a).s > (b).s ? 1 : ST_TIME_CMP_NS(a, b, ns))
|
||||
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.tv_nsec)
|
||||
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.tv_nsec)
|
||||
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.tv_nsec)
|
||||
#define ATIME_CMP(a, b) ST_TIME_CMP (a, b, st_atime, st_atim.ST_MTIM_NSEC)
|
||||
#define CTIME_CMP(a, b) ST_TIME_CMP (a, b, st_ctime, st_ctim.ST_MTIM_NSEC)
|
||||
#define MTIME_CMP(a, b) ST_TIME_CMP (a, b, st_mtime, st_mtim.ST_MTIM_NSEC)
|
||||
|
||||
#if !defined(HAVE_MKFIFO)
|
||||
# define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
|
||||
@@ -129,20 +129,19 @@
|
||||
# define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* The extra casts work around common compiler bugs. */
|
||||
/* The extra casts work around common compiler bugs,
|
||||
e.g. Cray C 5.0.3.0 when t == time_t. */
|
||||
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
||||
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
|
||||
It is necessary at least when t == time_t. */
|
||||
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
|
||||
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
|
||||
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
|
||||
|
||||
#ifndef SCHAR_MIN
|
||||
# define SCHAR_MIN TYPE_MINIMUM (char)
|
||||
#ifndef CHAR_MIN
|
||||
# define CHAR_MIN TYPE_MINIMUM (char)
|
||||
#endif
|
||||
|
||||
#ifndef SCHAR_MAX
|
||||
# define SCHAR_MAX TYPE_MAXIMUM (char)
|
||||
#ifndef CHAR_MAX
|
||||
# define CHAR_MAX TYPE_MAXIMUM (char)
|
||||
#endif
|
||||
|
||||
#ifndef UCHAR_MAX
|
||||
|
||||
12
src/tail.c
12
src/tail.c
@@ -132,11 +132,11 @@ static int show_version;
|
||||
|
||||
static struct option const long_options[] =
|
||||
{
|
||||
{"allow-missing", required_argument, NULL, 11},
|
||||
{"allow-missing", required_argument, NULL, CHAR_MAX + 1},
|
||||
{"bytes", required_argument, NULL, 'c'},
|
||||
{"follow", no_argument, NULL, 'f'},
|
||||
{"follow-descriptor", no_argument, NULL, 12},
|
||||
{"follow-name", no_argument, NULL, 13},
|
||||
{"follow-descriptor", no_argument, NULL, CHAR_MAX + 2},
|
||||
{"follow-name", no_argument, NULL, CHAR_MAX + 3},
|
||||
{"lines", required_argument, NULL, 'n'},
|
||||
{"quiet", no_argument, NULL, 'q'},
|
||||
{"silent", no_argument, NULL, 'q'},
|
||||
@@ -1168,15 +1168,15 @@ parse_options (int argc, char **argv,
|
||||
forever = 1;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
case CHAR_MAX + 1:
|
||||
allow_missing = 1;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
case CHAR_MAX + 2:
|
||||
follow_mode = follow_descriptor;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
case CHAR_MAX + 3:
|
||||
follow_mode = follow_name;
|
||||
break;
|
||||
|
||||
|
||||
33
src/touch.c
33
src/touch.c
@@ -15,21 +15,7 @@
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Options:
|
||||
-a, --time={atime,access,use} Change access time only.
|
||||
-c, --no-create Do not create files that do not exist.
|
||||
-d, --date=TIME Specify time and date in various formats.
|
||||
-f Ignored.
|
||||
-m, --time={mtime,modify} Change modification time only.
|
||||
-r, --reference=FILE Use the time and date of reference file FILE.
|
||||
-t TIME Specify time and date in the form
|
||||
`MMDDhhmm[[CC]YY][.ss]'.
|
||||
|
||||
If no options are given, -am is the default, using the current time.
|
||||
The -r, -t, and -d options are mutually exclusive. If a file does not
|
||||
exist, create it unless -c is given.
|
||||
|
||||
Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
|
||||
/* Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,
|
||||
and Randy Smith. */
|
||||
|
||||
#include <config.h>
|
||||
@@ -43,12 +29,12 @@
|
||||
#include "argmatch.h"
|
||||
#include "getdate.h"
|
||||
#include "safe-read.h"
|
||||
#include "posixtm.h"
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
time_t time ();
|
||||
#endif
|
||||
|
||||
time_t posixtime ();
|
||||
int full_write ();
|
||||
void invalid_arg ();
|
||||
|
||||
@@ -96,7 +82,7 @@ static int show_version;
|
||||
|
||||
static struct option const longopts[] =
|
||||
{
|
||||
{"time", required_argument, 0, 130},
|
||||
{"time", required_argument, 0, CHAR_MAX + 1},
|
||||
{"no-create", no_argument, 0, 'c'},
|
||||
{"date", required_argument, 0, 'd'},
|
||||
{"file", required_argument, 0, 'r'},
|
||||
@@ -214,6 +200,8 @@ usage (int status)
|
||||
else
|
||||
{
|
||||
printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);
|
||||
printf (_(" or : %s [-acm] MMDDhhmm[YY] FILE... (obsolescent)\n"),
|
||||
program_name);
|
||||
printf (_("\
|
||||
Update the access and modification times of each FILE to the current time.\n\
|
||||
\n\
|
||||
@@ -223,12 +211,14 @@ Update the access and modification times of each FILE to the current time.\n\
|
||||
-f (ignored)\n\
|
||||
-m change only the modification time\n\
|
||||
-r, --reference=FILE use this file's times instead of current time\n\
|
||||
-t STAMP use MMDDhhmm[[CC]YY][.ss] instead of current time\n\
|
||||
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time\n\
|
||||
--time=WORD access -a, atime -a, mtime -m, modify -m, use -a\n\
|
||||
--help display this help and exit\n\
|
||||
--version output version information and exit\n\
|
||||
\n\
|
||||
STAMP may be used without -t if none of -drt, nor --, are used.\n\
|
||||
Note that the three time-date formats recognized for the -d and -t options\n\
|
||||
and for the obsolescent argument are all different.\n\
|
||||
"));
|
||||
puts (_("\nReport bugs to <fileutils-bugs@gnu.org>."));
|
||||
close_stdout ();
|
||||
@@ -288,13 +278,14 @@ main (int argc, char **argv)
|
||||
|
||||
case 't':
|
||||
posix_date++;
|
||||
newtime = posixtime (optarg);
|
||||
newtime = posixtime (optarg,
|
||||
PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS);
|
||||
if (newtime == (time_t) -1)
|
||||
error (1, 0, _("invalid date format `%s'"), optarg);
|
||||
date_set++;
|
||||
break;
|
||||
|
||||
case 130:
|
||||
case CHAR_MAX + 1:
|
||||
i = argmatch (optarg, time_args);
|
||||
if (i < 0)
|
||||
{
|
||||
@@ -338,7 +329,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--"))
|
||||
{
|
||||
newtime = posixtime (argv[optind]);
|
||||
newtime = posixtime (argv[optind], PDS_TRAILING_YEAR);
|
||||
if (newtime != (time_t) -1)
|
||||
{
|
||||
optind++;
|
||||
|
||||
@@ -12,12 +12,12 @@ use FileHandle;
|
||||
use File::Compare qw(compare);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
($VERSION = '$Revision: 1.9 $ ') =~ tr/[0-9].//cd;
|
||||
($VERSION = '$Revision: 1.3 $ ') =~ tr/[0-9].//cd;
|
||||
@EXPORT = qw (run_tests);
|
||||
|
||||
my @Types = qw (IN OUT ERR EXIT);
|
||||
my @Types = qw (IN OUT ERR EXIT PRE POST);
|
||||
my %Types = map {$_ => 1} @Types;
|
||||
my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT);
|
||||
my %Zero_one_type = map {$_ => 1} qw (OUT ERR EXIT PRE POST);
|
||||
my $srcdir = $ENV{srcdir};
|
||||
my $Global_count = 1;
|
||||
|
||||
@@ -73,7 +73,7 @@ sub _create_file ($$$$)
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = "$test_name-$$.$Global_count";
|
||||
$file = "$test_name.$Global_count";
|
||||
++$Global_count;
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ sub run_tests ($$$$$)
|
||||
{
|
||||
my $test_name = shift @$t;
|
||||
my $expect = {};
|
||||
my ($pre, $post);
|
||||
|
||||
# FIXME: maybe don't reset this.
|
||||
$Global_count = 1;
|
||||
@@ -156,6 +157,12 @@ sub run_tests ($$$$$)
|
||||
die "$program_name: $test_name: more than one $type spec\n"
|
||||
if $Zero_one_type{$type} and $seen_type{$type}++;
|
||||
|
||||
if ($type eq 'PRE' or $type eq 'POST')
|
||||
{
|
||||
$expect->{$type} = $val;
|
||||
next;
|
||||
}
|
||||
|
||||
if ($type eq 'EXIT')
|
||||
{
|
||||
die "$program_name: $test_name: invalid EXIT code\n"
|
||||
@@ -229,9 +236,10 @@ sub run_tests ($$$$$)
|
||||
# in OUT or ERR spec?
|
||||
|
||||
warn "$test_name...\n" if $verbose;
|
||||
&{$expect->{PRE}} if $expect->{PRE};
|
||||
my %tmp;
|
||||
$tmp{OUT} = "$test_name-out";
|
||||
$tmp{ERR} = "$test_name-err";
|
||||
$tmp{OUT} = "$test_name.O";
|
||||
$tmp{ERR} = "$test_name.E";
|
||||
push @junk_files, $tmp{OUT}, $tmp{ERR};
|
||||
my @cmd = ($prog, @args, "> $tmp{OUT}", "2> $tmp{ERR}");
|
||||
my $cmd_str = join ' ', @cmd;
|
||||
@@ -242,7 +250,7 @@ sub run_tests ($$$$$)
|
||||
warn "$program_name: test $test_name failed: command failed:\n"
|
||||
. " `$cmd_str': $!\n";
|
||||
$fail = 1;
|
||||
next;
|
||||
goto cleanup;
|
||||
}
|
||||
$rc >>= 8 if $rc > 0x80;
|
||||
if ($expect->{EXIT} != $rc)
|
||||
@@ -250,7 +258,7 @@ sub run_tests ($$$$$)
|
||||
warn "$program_name: test $test_name failed: exit status mismatch:"
|
||||
. " expected $expect->{EXIT}, got $rc\n";
|
||||
$fail = 1;
|
||||
next;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
foreach $eo (qw (OUT ERR))
|
||||
@@ -263,6 +271,10 @@ sub run_tests ($$$$$)
|
||||
$fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
&{$expect->{POST}} if $expect->{POST};
|
||||
|
||||
}
|
||||
|
||||
# FIXME: maybe unlink files inside the big foreach loop?
|
||||
12
tests/dircolors/Makefile.am
Normal file
12
tests/dircolors/Makefile.am
Normal file
@@ -0,0 +1,12 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
EXTRA_DIST = $(TESTS) simple
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=dircolors
|
||||
|
||||
TESTS = run-test
|
||||
221
tests/dircolors/Makefile.in
Normal file
221
tests/dircolors/Makefile.in
Normal file
@@ -0,0 +1,221 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DF_PROG = @DF_PROG@
|
||||
GENCAT = @GENCAT@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MVDIR_PROG = @MVDIR_PROG@
|
||||
PACKAGE = @PACKAGE@
|
||||
PERL = @PERL@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
EXTRA_DIST = $(TESTS) simple
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
PROG=dircolors
|
||||
|
||||
TESTS = run-test
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/dircolors/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = tests/dircolors
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/dircolors/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
for tst in $(TESTS); do \
|
||||
if test -f $$tst; then dir=.; \
|
||||
else dir="$(srcdir)"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
echo "PASS: $$tst"; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
fi; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: tags distdir check-TESTS info dvi installcheck install-exec \
|
||||
install-data install uninstall all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
13
tests/dircolors/run-test
Executable file
13
tests/dircolors/run-test
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
: ${PERL=perl}
|
||||
: ${srcdir=.}
|
||||
|
||||
case "$PERL" in
|
||||
*'missing perl')
|
||||
echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test"
|
||||
exit 77
|
||||
;;
|
||||
esac
|
||||
|
||||
exec $PERL -w -I$srcdir/.. -MFetish -- $srcdir/simple
|
||||
22
tests/dircolors/simple
Executable file
22
tests/dircolors/simple
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/perl -w
|
||||
require 5.003;
|
||||
use strict;
|
||||
|
||||
(my $program_name = $0) =~ s|.*/||;
|
||||
|
||||
# Turn off localisation of executable's ouput.
|
||||
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
|
||||
|
||||
my @Tests =
|
||||
(
|
||||
['a', {IN => {k => "exec\n"}},
|
||||
{ERR => "dircolors: k:1: invalid line; missing second token\n"},
|
||||
{EXIT => 1}],
|
||||
);
|
||||
|
||||
my $save_temps = $ENV{DEBUG};
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
|
||||
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
|
||||
exit $fail;
|
||||
@@ -1,12 +1,12 @@
|
||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
||||
|
||||
EXTRA_DIST = $(TESTS) Fetish.pm quoting
|
||||
EXTRA_DIST = $(TESTS) quoting
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
LS=ls
|
||||
PROG=ls
|
||||
|
||||
TESTS = run-test
|
||||
|
||||
@@ -89,14 +89,14 @@ VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
l = @l@
|
||||
|
||||
EXTRA_DIST = $(TESTS) Fetish.pm quoting
|
||||
EXTRA_DIST = $(TESTS) quoting
|
||||
|
||||
TESTS_ENVIRONMENT = \
|
||||
top_srcdir=$(top_srcdir) \
|
||||
srcdir=$(srcdir) \
|
||||
PERL="@PERL@" \
|
||||
PATH=../../src:$$PATH \
|
||||
LS=ls
|
||||
PROG=ls
|
||||
|
||||
TESTS = run-test
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# -*-perl-*-
|
||||
package Test;
|
||||
require 5.002;
|
||||
use strict;
|
||||
|
||||
# Always copy filename arguments from $srcdir to current directory
|
||||
# before running ls on them. Otherwise, we'd have to factor out
|
||||
# differences in $srcdir from the expected output.
|
||||
$Test::copy_fileargs_default = 1;
|
||||
|
||||
sub test_vector
|
||||
{
|
||||
my @tv =
|
||||
(
|
||||
# test-name options input expected-output expected-return-code
|
||||
#
|
||||
['q-', '', {"q\a" => 'contents'}, "q\a\n", 0],
|
||||
['q-N', '-N', {"q\a" => ''}, "q\a\n", 0],
|
||||
['q-q', '-q', {"q\a" => ''}, "q?\n", 0],
|
||||
['q-Q', '-Q', {"q\a" => ''}, "\"q\\a\"\n", 0],
|
||||
['q-qs-lit', '--quoting=literal', {"q\a" => ''}, "q\a\n", 0],
|
||||
['q-qs-sh', '--quoting=shell', {"q\a" => ''}, "q\a\n", 0],
|
||||
['q-qs-sh-a', '--quoting=shell-always', {"q\a" => ''}, "'q\a'\n", 0],
|
||||
['q-qs-c', '--quoting=c', {"q\a" => ''}, "\"q\\a\"\n", 0],
|
||||
['q-qs-esc', '--quoting=escape', {"q\a" => ''}, "q\\a\n", 0],
|
||||
);
|
||||
|
||||
return @tv;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -4,10 +4,11 @@ use strict;
|
||||
|
||||
(my $program_name = $0) =~ s|.*/||;
|
||||
|
||||
# Make sure the tools use the expected locale.
|
||||
$ENV{LANGUAGE} = 'C';
|
||||
$ENV{LC_ALL} = 'C';
|
||||
$ENV{LANG} = 'C';
|
||||
# Turn off localisation of executable's ouput.
|
||||
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
|
||||
|
||||
my $mkdir = {PRE => sub {mkdir 'd',0755 or die "d: $!\n"}};
|
||||
my $rmdir = {POST => sub {rmdir 'd' or die "d: $!\n"}};
|
||||
|
||||
my $q_bell = {IN => {"q\a" => ''}};
|
||||
my @Tests =
|
||||
@@ -25,11 +26,15 @@ my @Tests =
|
||||
['q-qs-sh-a', '--quoting=shell-always', $q_bell, {OUT => "'q\a'\n"}],
|
||||
['q-qs-c', '--quoting=c', $q_bell, {OUT => "\"q\\a\"\n"}],
|
||||
['q-qs-esc', '--quoting=escape', $q_bell, {OUT => "q\\a\n"}],
|
||||
|
||||
['emptydir', 'd', {OUT => ''}, $mkdir, $rmdir],
|
||||
['emptydir-x2', 'd d', {OUT => "d:\n\nd:\n"}, $mkdir, $rmdir],
|
||||
['emptydir-R', '-R d', {OUT => "d:\n"}, $mkdir, $rmdir],
|
||||
);
|
||||
|
||||
my $save_temps = 0;
|
||||
my $save_temps = $ENV{SAVE_TEMPS};
|
||||
my $verbose = $ENV{VERBOSE};
|
||||
|
||||
my $prog = $ENV{LS} || 'ls';
|
||||
my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
|
||||
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
|
||||
exit $fail;
|
||||
|
||||
@@ -10,4 +10,4 @@ case "$PERL" in
|
||||
;;
|
||||
esac
|
||||
|
||||
exec $PERL -w -I$srcdir -MFetish -- $srcdir/quoting
|
||||
exec $PERL -w -I$srcdir/.. -MFetish -- $srcdir/quoting
|
||||
|
||||
@@ -12,6 +12,11 @@ if test "$VERBOSE" = yes; then
|
||||
$TOUCH --version
|
||||
fi
|
||||
|
||||
DEFAULT_SLEEP_SECONDS=2
|
||||
SLEEP_SECONDS=${SLEEP_SECONDS=$DEFAULT_SLEEP_SECONDS}
|
||||
|
||||
fail=0
|
||||
|
||||
# FIXME: find writable directories on other partitions
|
||||
# and run the test in those directories, too.
|
||||
|
||||
@@ -32,14 +37,14 @@ if test $framework_failure = 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
sleep $SLEEP_SECONDS
|
||||
for d in $TOUCH_DIR_LIST; do
|
||||
$TOUCH $d/a || fail=1
|
||||
set x `$LS -t $d/a $d/b`
|
||||
test "$*" = "x $d/a $d/b" || fail=1
|
||||
done
|
||||
|
||||
sleep 2
|
||||
sleep $SLEEP_SECONDS
|
||||
for d in $TOUCH_DIR_LIST; do
|
||||
$TOUCH $d/b
|
||||
set x `$LS -t $d/a $d/b`
|
||||
@@ -48,4 +53,14 @@ for d in $TOUCH_DIR_LIST; do
|
||||
$RM -rf $d/a $d/b
|
||||
done
|
||||
|
||||
if test $fail != 0; then
|
||||
cat 1>&2 <<EOF
|
||||
*** This test has just failed. That can happen when the test is run in an
|
||||
*** NFS-mounted directory on a system whose clock is not well synchronized
|
||||
*** with that of the NFS server. If you think that is the reason, set the
|
||||
*** environment variable SLEEP_SECONDS to some number of seconds larger than
|
||||
*** the default of $DEFAULT_SLEEP_SECONDS and rerun the test.
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit $fail
|
||||
|
||||
Reference in New Issue
Block a user