xfile

advertisement
Program:
xfile
Purpose:
General file extractor.
Category:
SYSTEM MANAGEMENT
File:
xfile.c
Author:
J.P. Terlouw
Use:
w<wc>]
xfile <fn> [-d<sym>] [-u<sym>] [-p<path>]
[-n<name>] [-
<fn>
<path>
<sym>
<name>
input file from which to extract files
path to where extracted files will be written
symbol to be (un)defined
only file names matching name will be
<wc>
Wildcards are allowed. Default all files will
be extracted.
set the wildcard in <name>. Default is *.
extracted.
Description:
Xfile extracts files from its input file. Files to be
extracted are indicated by: #>name or %#>name at the
beginning of an input line. The % in the second form can be
any character. This character is then used as a flag
character which must be the first character in subsequent
lines belonging to this file. It is not copied to the
output file, i.e. it is stripped off. Lines without the
flag character are simply discarded. The end of a file to
be
extracted is indicated by #< or %#< .
The input file can contain any number of files to be
extracted which can also be nested. The names of the
extracted files are written to standard output and are
exactly (!) the same as stated in the input file.
Conditional file extraction is also possible. A line
containing a conditional statement is indicated by:
#!<statement> or %#!<statement> at the beginning of an
input
line. The % in the second form can be any character. This
character is NOT a flag character! The conditional
statements
allowed are: IF
<symbol> [<symbol> [...] ]
ELIF <symbol> [<symbol> [...] ]
ELSE
ENDIF
A symbol can be any name (not containing white space) which
can be defined by the system (ALLIANT, CONVEX, SUN etc.) or
by the user on the command line.
Example:
File to be processed by xfile:
0a
#>
1a
*#>
*2a
*2b
2b'
*2c
#<
1b
1c
#<
##>
#1A
#1B
#1C
1C'
#1D
##<
0b
0c
xfile.ou1
xfile.ou2
xfile.ou3
Resulting files:
(xfile.ou1:)
1a
1b
1c
(xfile.ou2:)
2a
2b
2c
(xfile.ou3:)
1A
1B
1C
1D
Updates:
Sep
Oct
Apr
Sep
Jan
Jan
23,
11,
13,
16,
14,
14,
1989:
1989:
1991:
1991:
1993:
1998:
JPT,
KGB,
KGB,
KGB,
KGB,
JPT,
original document.
option -d and -t implemented.
conditional file extraction implemented.
unrecognized directives are skipped.
Bug in -n switch repaired.
Bug in checkLine repaired.
Download