#-h- cd 1031 asc 02-apr-82 17:57:26 v1.1 (sw-tools v1.1) Cd (1) 02-May-81 Cd (1) NAME Cd - change working directory SYNOPSIS cd [directory] DESCRIPTION `cd' changes the working directory to `directory'. If no argument is given, the working directory is changed to the previous working directory. Since a new process is created to execute each command, `cd' would be ineffective if it were written as a normal command. As a result, it is recognized and executed by the shell. Valid forms of the directory on RSX-11M/IAS are /ddnn/ggg,mmm /ggg,mmm ddnn:[ggg,mmm] [ggg,mmm] FILES None SEE ALSO pwd - print working directory DIAGNOSTICS AUTHORS BUGS/DEFICIENCIES -1- #-h- acat 1213 asc 02-apr-82 17:57:27 v1.1 (sw-tools v1.1) Acat (1) 11-Mar-82 Acat (1) NAME Acat - concatenate nested archive entries on standard output SYNOPSIS acat archive`module[`module...] ... DESCRIPTION `acat' performs the equivalent function to `cat' on archive files created by the `ar' utility. The true power of `acat' lies in its ability to extract the modules from within nested archives. Some examples may help clarify its use. Suppose the file arch1 consists of the modules mod1a, mod1b and mod1c. In addition, mod1c is itself an archive, consisting of modules mod2a and mod2b. The command line % acat arch1`mod1a is equivalent to the `ar' command % ar p arch1 mod1a More importantly, if the user desires to see mod2a in mod1c in arch1, the command %acat arch1`mod1a`mod2a will do the trick. FILES SEE ALSO ar - archive file maintainer cat - concatenate files DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- alist 1138 asc 02-apr-82 17:57:28 v1.1 (sw-tools v1.1) Alist (1) 11-Jan-79 Alist (1) NAME Alist - generate paginated listing of source archive SYNOPSIS alist [file] ... DESCRIPTION `alist' generates a paginated listing of archive files. A table of contents with the relative page number in the listing is displayed first, with each element of the archive file starting on a new page. The second page of the listing contains a sorted index of entries, with the starting page number. If no files are specified, the standard input is read. `alist' considers each line which starts with the string "#-h-" to be the beginning of a new entry, so that nested archives will be handled reasonably. The listing is displayed on standard output, and may be piped into lpr to queue to the printer. FILES SEE ALSO pr - print files DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- admin 1471 asc 02-apr-82 17:57:29 v1.1 (sw-tools v1.1) Admin (1) 14-Sep-81 Admin (1) NAME Admin - administer TCS file. SYNOPSIS admin -ifile file.tcs DESCRIPTION Admin -i enters a text file into the TCS system for the first time. File is the source file to be entered into the system. Local convention is to use the name "file.tcs" for files maintained by TCS. The file is tagged as Version #1.1 and the user is prompted for initial comments concerning the development of the file. The date, time and user ID are recorded in the statistics portion of the file. FILES A scratch file is used while creating the output file and moved upon completion of input. SEE ALSO delta, get DIAGNOSTICS usage: admin -ifile file.tcs Correct calling format is provided when called without arguments. - flag missing Incorrect calling procedure. -i... filename missing The input filename is expected to be immediately adjacent to the -i flag. (no white-space) Invalid flag -i is the only valid flag at present. AUTHORS Neil Groundwater at ADI. BUGS/DEFICIENCIES -1- #-h- args 1905 asc 02-apr-82 17:57:30 v1.1 (sw-tools v1.1) Args (1) 25-Aug-80 Args (1) NAME Args - use standard input as arguments for command SYNOPSIS args [-v] tool [arguments] DESCRIPTION Args reads the standard input file and concatenates the words found there onto the arguments passed to it. It then spawns the tool "tool" with those arguments. The first argument to Args which does not start with a "-" is taken to be the name of the tool to be invoked. Args uses the same search path as the shell, and if "tool" is a script file, a copy of the shell will be spawned reading that file for its commands. The optional -v argument causes Args to display the final command line on ERROUT before spawning the sub-process. The most common use of Args is as a form of argument explosion, as in the following example: Suppose you wish to delete all files which have the string "tst" somewhere in the filename. This may be accomplished with the following shell command line: % ls tst | args rm -v All of the files matching the pattern "tst" will be fed to Args, which will concatenate the names onto Rm's command line. Rm will then be spawned, and will print the name of each file as it is deleted. If the information found on standard input is so voluminous as to cause the argument string to be too large, the command line is displayed on ERROUT and the process is NOT spawned. FILES none SEE ALSO sh - command line interpreter (for search path rules) AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- asam 1167 asc 02-apr-82 17:57:31 v1.1 (sw-tools v1.1) Asam (1) 11-Mar-82 Asam (1) NAME Asam - generate index for archive file SYNOPSIS asam file3 concatenates the first two files and places the result on the third. If no argument or '-' is given, `cat' reads the standard input. If the '-v' option is specified, all control characters are displayed as '^C', where C is the character that must be typed with the CTRL key when entering the character. If any DEL(RUB) characters are found, they are displayed as '^?'. A dollar sign character ('$') is displayed at the end of each line to aid in location of trailing blanks in lines. FILES none SEE ALSO The "Software Tools" book, p. 77. The UNIX tools cat, PR, CP DIAGNOSTICS A message is printed if a file cannot be opened; further processing is terminated. AUTHORS Dennis Hall, Debbie Scherrer and Wen-Sue Gee. BUGS/DEFICIENCIES Using the same file for output as well as input may cause strange results. -1- #-h- axref 2099 asc 02-apr-82 17:57:39 v1.1 (sw-tools v1.1) Axref (1) 11-Mar-82 Axref (1) NAME Axref - cross reference symbols in archive files SYNOPSIS axref [-fr] [file] ... DESCRIPTION `axref' produces a cross-reference list of the symbols found in each of the named files on the standard output. Each symbol is listed followed by the numbers of the lines in which it appears. If no files are specified, of the file "-" is specified, `axref' reads the standard input. `axref' differs from `xref' in that it generates a separate cross-reference list for each module found within an archive. Module boundaries are defined to be those lines which start with the string "#-h-", as generated by the file archiver. Each module is preceded with the label file/module_name: on the standard output. A symbol is defined as a string of letters, digits and underlines that begins with a letter. Symbols exceeding an internal limit are truncated. This limit is determined by the MAXTOK definition in the source code, and is currently set to 15. By default, `axref' differentiates between upper- and lower-case letters. The `-f' option causes all letters within symbols to be folded to a single case. Normally, the line numbers specified in the symbol table are relative to the current file being processed. The `-r' option causes the line numbers specified to be relative to the start of the current archive module. FILES SEE ALSO xref - make a cross reference of symbols DIAGNOSTICS AUTHORS Joe Sventek -1- Axref (1) 11-Mar-82 Axref (1) BUGS/DEFICIENCIES -2- #-h- bargraph 2713 asc 02-apr-82 17:57:41 v1.1 (sw-tools v1.1) BarGraph (1) 11-Nov-81 BarGraph (1) NAME BarGraph - draw a 0-100% bargraph of integer data SYNOPSIS bargraph -[cfFhmrRsw] file ... DESCRIPTION BarGraph draws a simple graph of integer data scaled to 0-100%. Each line of input is expected to contain two fields, a label and a number, both in ASCII. The label and its associated numeric value should be separated by one or more BLANKs or a TAB. There are several options for controlling the appearance of the graph: -c use as the character for plotting the ordinate instead of ``|'' (the default) -f use to fill the area under the bar -F use to fill the area over the bar -h output column headers -m[c] display the mean of the data, using ``c'' if specified instead of ``.'' (the default) -r[c] display ruling every 10% under the bar, using ``c'' if specified instead of ``:'' (the default) -R[c] display ruling every 10% over the bar, using ``c'' if specified instead of ``:'' (the default) -s plot the running sum of the data values rather than the values themselves -w make the graph 132 columns wide rather than 80 EXAMPLES bargraph -h -f* -w file would make a 132-column wide graph of the data in ``file'', with column headers and ``*'' characters filling under the bar. d "-f16n 9c" | bargraph "-f|" would graph the sizes of all files in the current directory using ``|'' as the fill character below the bar. Note that it is necessary to put quotes around character specification options when specifying characters that are special to the -1- BarGraph (1) 11-Nov-81 BarGraph (1) shell (the "-f|" in the above example). FILES none SEE ALSO DIAGNOSTICS ? Too much data: increase TABLE_SIZE AUTHORS Dave Martin (Hughes Aircraft) BUGS/DEFICIENCIES There is an upper limit to the number of points which may be graphed. This limit may be raised by increasing the value of TABLE_SIZE. Numeric values are currently limited to 7 digits or less. -2- #-h- banner 1032 asc 02-apr-82 17:57:42 v1.1 (sw-tools v1.1) Banner (1) 16-Mar-82 Banner (1) NAME Banner - generate large banner lines SYNOPSIS banner [string] DESCRIPTION `banner' formats the specified text strings into large banner lines on standard output. If a command argument is specified, then that string is output; otherwise, standard input is read, with each line being displayed on standard output, until an EOF is detected. Each character is printed in a 7 x 7 window, with the character occupying the central 5 x 5 portion. The file `~bin/bigchar' can be consulted for the format of the character file. FILES ~bin/bigchar SEE ALSO DIAGNOSTICS If a character is detected which has no correspondence in the character file, a blank is displayed. AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- ccnt 834 asc 02-apr-82 17:57:43 v1.1 (sw-tools v1.1) Ccnt (1) 11-Jan-79 Ccnt (1) NAME Ccnt - character count SYNOPSIS ccnt [file] ... DESCRIPTION ccnt counts characters in the named file(s). Newlines are counted as characters. If no file name or the file '-' is given, standard input will be read. FILES none SEE ALSO wcnt - count words lcnt - count lines the Unix command `wc' DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Original from Kernighan and Plauger's 'Software Tools', with minor modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- ch 5665 asc 02-apr-82 17:57:45 v1.1 (sw-tools v1.1) Ch (1) 7-Apr-78 Ch (1) NAME Ch - make changes in text files SYNOPSIS ch [-ax] [expression] ... fromexpr [toexpr] DESCRIPTION ch copies each line of the standard input to the standard output, globally substituting the text pattern "toexpr" for "fromexpr" on each line that satisfies matching criteria defined by the leading expressions "expression" and the switches. (A text pattern is a subset of a "regular expression"--see the "ed" writeup for a complete description.) Three possible courses of action are taken depending upon the number of text patterns(n) found in the command line: n=1 The text pattern is assumed to be "fromexpr" with a null "toexpr"; it is equivalent to the ed command g/fromexpr/s///g n=2 The first text pattern is "fromexpr", the second is "toexpr"; it is equivalent to the ed command g/fromexpr/s//toexpr/g n>=3 The (n-1)th pattern is "fromexpr", the nth is "toexpr" and patterns 1...n-2 are used to determine the lines upon which to perform the substitution. The default is that any line which matches any one of the n-2 leading expressions are eligible for substitution. If the -a flag is specified, only lines which match all n-2 leading expressions in any order are eligible. If the -x flag is specified, all lines which don't satisfy the above criteria are eligible. (See the writeup on find for more information.) In particular, if n=3, ch expr from to is equivalent to the ed command g/expr/s/from/to/g ch -x expr from to is equivalent to the ed command x/expr/s/from/to/g The substitution string "toexpr" may be a string of replacement characters, null to effect a deletion, or it may include the special "ditto" character "&" to put back the "fromexpr" string and thus effect an insertion. It may also contain the expressions `$1' ... `$9', which cause the corresponding tagged pattern in the input to be inserted. If a deletion is desired with the multiple leading tag expressions, a "toexpr" of "" -i.e. quotes around an empty string may be used. A text pattern consists of the following elements: -1- Ch (1) 7-Apr-78 Ch (1) c literal character ? any character except newline % beginning of line $ end of line (null string before newline) [...] character class (any one of these characters) [!...] negated character class (all but these characters) {expr} tagged pattern (referenced by $1 ... $9) * closure (zero or more occurrences of previous pattern) + anchored closure (one or more occurrences of previous pattern) @c escaped character (e.g., @%, @[, @*) Any special meaning of characters in a text pattern is lost when escaped, inside [...], or for: % not at beginning $ not at end * at beginning + at beginning A character class consists of zero or more of the following elements, surrounded by [ and ]: c literal character a-b range of characters (digits, lower or upper case) ! negated character class if at beginning @c escaped character (@! @- @ @]) Special meaning of characters in a character class is lost when escaped or for ! not at beginning - at beginning or end An escape sequence consists of the character @ followed by a single character: @f formfeed @l linefeed @n newline @r return @t tab @OOO the octal digit representation for an ASCII character for example, @001 for the ASCII character SOH @c c (including @) For a complete description, see "Software Tools" pages 135-154. Care should be taken when using the characters % $ [ ] ! * + @ and any shell characters in the text pattern. It is often necessary to enclose the entire substitution pattern in quotes. -2- Ch (1) 7-Apr-78 Ch (1) FILES none SEE ALSO The UNIX tool GRES The tools find and ed xch - extended change utility DIAGNOSTICS An error message is printed if the pattern given is illegal. AUTHORS 'CH' was originally implemented on BKY by Debbie Scherrer from Kernighan and Plauger's "Software Tools". Major modifications were performed by Joe Sventek. BUGS/DEFICIENCIES A minus sign(dash[-]) may not start an expression. -3- #-h- box 1922 asc 02-apr-82 17:57:47 v1.1 (sw-tools v1.1) Box (1) 23-Jul-81 Box (1) NAME Box - draw boxes around block structure of RatFor or C programs SYNOPSIS box [-e] [-d{device}] [-] file ... DESCRIPTION Box draws boxes around statement groups (beginning with "{" and ending with "}") to make them more legible. It is designed to be used as a pretty-printer for RatFor or C code that is indented as follows: level 0 { level 1 { level 2 } level 1 } level 0 For this input, box generates: level 0 +-------------+ | level 1 | | +---------+ | | | level 2 | | | +---------+ | | level 1 | +-------------+ level 0 The alignment of the "{" and "}" characters and the indentation of 2 spaces per level are required for proper operation. If TABs are present in the input, they are replaced with blanks, on the assumption of 8 spaces per TAB. The "-d" option takes advantage of the line-drawing character sets on certain devices; currently the DEC vt100 and the Heath h19 are supported. EXAMPLES box -dvt100 myfile box the file "myfile" to STDOUT (assumed to be a vt100) AUTHORS Dave Martin (Hughes Aircraft) -1- Box (1) 23-Jul-81 Box (1) BUGS/DEFICIENCIES -2- #-h- cmp 1215 asc 02-apr-82 17:57:48 v1.1 (sw-tools v1.1) Cmp (1) 6-Mar-78 Cmp (1) NAME Cmp - compare two files SYNOPSIS cmp file1 [file2] DESCRIPTION file1 is compared line-by-line with file2. If file2 is not specified, standard input is used. If any lines differ, cmp announces the line number and prints each file's offending line. FILES none SEE ALSO comm The UNIX commands cmp, diff, and comm DIAGNOSTICS If the end of one file is reached before the end of the other, a message is printed. AUTHORS Acquired from "Software Tools" by Kernighan and Plauger, with minor modifications made by Debbie Scherrer. BUGS/DEFICIENCIES If either file is binary, spurious results should be expected. Cmp cannot handle offset lines: line n of file1 is simply compared to line n of file2. Trailing blanks are significant, which will cause some lines to appear similar to the user which are actually different. -1- #-h- crt 1367 asc 02-apr-82 17:57:49 v1.1 (sw-tools v1.1) Crt (1) 15-Nov-81 Crt (1) NAME Crt - copy files to terminal a screen at a time SYNOPSIS crt [-n] [file] ... DESCRIPTION crt is similar to 'cat' except that it prints only n lines (default 22) at a time. After each set of lines are printed, crt will wait for instructions from the user. Hitting a SPACE or RETURN will cause the next n lines to appear, hitting a 'q' (quit) will cause crt to skip over to the next input file (if any), and hitting an end-of-file character (^Z) will cause crt to stop immediately. If no files are specified, or if the filename '-' is given, lines will be read from the standard input. The flag -n may be given, where n specifies the number of lines desired at a time. crt will stop at the end of each file (except the last), as well as after each n lines. FILES none SEE ALSO cat DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Debbie Scherrer; Modified to use RARE i/o by Dave Martin. BUGS/DEFICIENCIES -1- #-h- comm 1405 asc 02-apr-82 17:57:50 v1.1 (sw-tools v1.1) Comm (1) 11-Jan-79 Comm (1) NAME Comm - print lines common to two files SYNOPSIS comm [-123] file1 [file2] DESCRIPTION comm reads file1 and file2, which should be sorted, and produces a three column output: lines only in file1, lines only in file2, and lines in both files. The filename '-' means the standard input. If there is only one file argument, file2 refers to the standard input. The optional arguments -1, -2, and -3 specify the printing of only the corresponding column. Thus "comm -3" prints only the lines common to both files, and "comm -12" prints lines which are in either file, but not in both. The default is -123. FILES none SEE ALSO cmp - compare two files the Unix tool "diff" DIAGNOSTICS A message is printed if an input file cannot be opened. AUTHORS Debbie Scherrer BUGS/DEFICIENCIES The flags used by this tool are the reverse of those used by the Unix 'comm'. In Unix, the flags 1, 2, and 3 suppress printing of the corresponding column. Kernighan, on page 126 of 'Software Tools' suggests the version used above. -1- #-h- cpress 856 asc 02-apr-82 17:57:51 v1.1 (sw-tools v1.1) Cpress (1) 15-Jan-79 Cpress (1) NAME Cpress - compress input files SYNOPSIS cpress [file] ... DESCRIPTION cpress compresses runs of repeated characters in the input files. The output file can eventually be expanded with the tool 'expand'. If no input files are given, or the filename '-' appears, input will be from the standard input. FILES none SEE ALSO expand DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS From Kernighan & Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- crypt 1259 asc 02-apr-82 17:57:52 v1.1 (sw-tools v1.1) Crypt (1) 15-Jan-79 Crypt (1) NAME Crypt - crypt and decrypt standard input SYNOPSIS crypt key DESCRIPTION crypt encrypts characters on the standard input by using 'key'. The file can eventually be decrypted by running it back through crypt with the same key. Double encryption (encrypting a file with first one key and then another) is allowable, but on some systems the decryption must be done in the exact reverse order as encryption was done. The encryption algorithm used by 'crypt' is not a complicated one, so users requiring a great degree of protection should not rely on this tool. FILES none SEE ALSO DIAGNOSTICS AUTHORS Original from Kernighan & Plauger's 'Software Tools', with modifications by Debbie Scherrer. (NOTE: the original encryption algorithm has been altered slightly.) BUGS/DEFICIENCIES On IAS and VMS systems, double encryption must be decrypted in the exact reverse order as the encryption. -1- #-h- date 712 asc 02-apr-82 17:57:53 v1.1 (sw-tools v1.1) Date (1) 13-Jun-79 Date (1) NAME Date - print the date SYNOPSIS date [-n] DESCRIPTION The current day of the week, date, time, and time zone are printed in the format: day dd-mmm-yy hh:mm:ss zone if the -n switch is used the date is output in the following format: day mm/dd/yy hh:mm:ss zone FILES none SEE ALSO The Unix command 'date' DIAGNOSTICS none AUTHORS Debbie Scherrer BUGS/DEFICIENCIES -1- #-h- detab 989 asc 02-apr-82 17:57:54 v1.1 (sw-tools v1.1) Detab (1) 12-Aug-81 Detab (1) NAME Detab - convert tabs to spaces SYNOPSIS detab [...] [+] [file] ... DESCRIPTION detab converts tab characters (control-i) to equivalent strings of blanks. Tab stops are indicated by ... (default 8, 16, ...), while + indicates tab stops every columns. Thus the command detab 5 21 +5 supplies blanks for tabs terminating at column positions 5, 21, 26, etc. If no files are specified, the standard input is read. An isolated minus sign also indicates the standard input. SEE ALSO entab lpr AUTHORS Original from Kernighan & Plauger's 'Software Tools', with modifications by Dennis Hall and Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- dc 5168 asc 02-apr-82 17:57:55 v1.1 (sw-tools v1.1) Dc (1) 20-Jul-80 Dc (1) NAME Dc - desk calculator SYNOPSIS dc [file] ... DESCRIPTION dc evaluates integer expressions from the source files, one expression per input line. If no input files are given, or the filename '-' is specified, dc reads from the standard input. Ordinarily dc operates on decimal integer arithmetic expressions, but the user may specify an input base and output base other than decimal. Expressions may be simple arithmetic expressions or replacement expressions. The values of simple expressions are written on standard output when they are evaluated. Replacement expressions are used to hold temporary values, and are not automatically printed. A simple expression is a normal arithmetic expression using numbers, variables, parentheses, and the following operators, listed in order of precedence: + - unary plus and negation operators. These may only appear at the start of a simple expression or after a "(" ** exponentiation * / % multiply, divide, modulo (remainder) + - add, subtract == != relations - equals, not equal to, > >= greater than, greater than or equal to, < <= less than, less than or equal to (!=, ^=, ~= all treated as "not equal") ! unary logical not (also ~ and ^) | & logical or, and The logical operators ! | & and the relational operators result in the values 1 for true and 0 for false. A replacement expression is: name = simple expression -1- Dc (1) 20-Jul-80 Dc (1) where 'name' is a character string of (virtually) any length, starting with a letter and consisting of only letters and digits. (The characters a-f should not be considered letters when operating in hexadecimal mode.) Variables are automatically declared when they first appear to the left of an "=" sign, and they should not be used in a simple expression until they have been declared. Radix Control Radix control is available in 2 ways: 1) There are default radix values for both input and output which may be changed by setting the predefined variables 'ibase' (input base) and 'obase' (output base). (Radix 10 is always used to evaluate and/or print radix-defining expressions.) For example, ibase = 2 obase = 16 would accept input in binary and print results in hexadecimal. 2) The radix of individual numbers may be explicitly given by following the number with an underscore character and then the desired radix. For example, 100_16 would specify the hex number 100 (256 in decimal). EXAMPLES 10 + (-64 / 2**4) would print the answer "6" temp = 101_2 temp == 5 would print the answer "1" (true) ibase = 16 obase = 2 1a + f would print the answer "101001" ibase = 16 numa = 100_10 numb = 100 numa + numb would print the answer "356" -2- Dc (1) 20-Jul-80 Dc (1) FILES none SEE ALSO macro, the UNIX M4 macro package The UNIX tools dc and bc DIAGNOSTICS arith evaluation stack overflow arithmetic expressions have been nested too deeply. The size of the stack is set by the MAXSTACK definition in the source code. number error an input number has a number/character bigger than the current radix expression error invalid arithmetic expression AUTHORS Philip H. Scherrer (Stanford U.) BUGS/DEFICIENCIES dc only works with integers The maximum value allowed depends on the host machine and is the largest Fortran integer -3- #-h- echo 583 asc 02-apr-82 17:57:57 v1.1 (sw-tools v1.1) Echo (1) 7-Jul-78 Echo (1) NAME Echo - echo command line arguments SYNOPSIS echo [arg] ... DESCRIPTION Echo writes its arguments in order as a line on the standard output file. It is useful for producing messages and diagnostics in command files. FILES none SEE ALSO The Unix command "echo" DIAGNOSTICS none AUTHORS Debbie Scherrer -1- #-h- diff 4540 asc 02-apr-82 17:57:59 v1.1 (sw-tools v1.1) Diff (1) 20-Mar-80 Diff (1) NAME Diff - isolate differences between files SYNOPSIS diff [-{c|d|r|s|v}] old_file [new_file] DESCRIPTION 'Diff' compares the contents of two files and reports on the differences between them. The default behavior is to describe the insert, delete, and change operations that must be performed on `old_file' to convert its contents into those of `new_file'. The second file name argument is optional. If omitted, the standard input is read for the text of the `new_file'. The options currently available are: -c Perform a simple line-by-line comparison. 'Diff' will compare successive lines of the input files; if any corresponding lines differ, or if one file is shorter than the other, 'diff' prints the message "different" and exits. If the files are the same, 'diff' produces no output. When the "-v" option (see below) is specified, 'diff' prints the lines that differ along with their line number in the input file, and notifies the user if one file is shorter than the other. -d List the "differences" between the two files, by highlighting the insertions, deletions, and changes that will convert `old_file' into `new_file'. This is the default option. If the "verbose" option "-v" (see below) is specified, unchanged text will also be listed. -r Insert text formatter requests to mark the `new_file' with revision bars and deletion asterisks. This option is particularly useful for maintenance of large documents, like Software Tools reference manuals. (At present, only GT's version of 'format' can produce revision bars.) -s Output a "script" of commands for the text editor 'ed' that will convert `old_file' into `new_file'. This is handy for preparing updates to large programs or data files, since generally the volume of changes required will be much -1- Diff (1) 20-Mar-80 Diff (1) smaller than the new text in its entirety. -v Make output "verbose." This option applies to the "-c" and "-d" options discussed above. If not selected, 'diff' produces "concise" output; if selected, 'diff' produces more verbiage. 'Diff' is based on the algorithm found in Heckel, P., "A Technique for Isolating Differences Between Files", ____Comm. ___ACM 21, 4 (April 1978), 264-268. EXAMPLES To print the differences between two files on your terminal: diff -cv file maybe_the_same_file does a simple line-by-line comparison on the two files, printing lines which differ. (Expects no missing or extra lines.) Same as 'cmp file1 file2'. diff -s old_version new_version | ed - old_version make an ed script which changes 'old_version' into 'new_version' diff -r old_manual.fmt new_manual.fmt | format to mark changes in a document. Useful only if your version of 'format' has this capability. diff -s old new >>update_old_to_new to keep a list of changes made to an original source file DIAGNOSTICS ": can't open" if either `new_file' or `old_file' is not readable. "Usage: diff . . ." for illegal options. AUTHORS Allen Akin and friends, Georgia Institute of Technology BUGS/DEFICIENCIES The algorithm used has one quirk: a line or a block of lines which is not unique within a file will be labeled as an insertion (deletion) if its immediately adjacent neighbors both above and below are labeled as insertions (deletions). Fails on very large files (> 10000 lines on VMS). -2- #-h- delta 3511 asc 02-apr-82 17:58:01 v1.1 (sw-tools v1.1) Delta (1) 14-Sep-81 Delta (1) NAME Delta - make an TCS delta SYNOPSIS delta revision history [newhistory] DESCRIPTION Delta integrates the current "revision" of a file into its TCS "history" file or into a "newhistory" file. Differences between this version and the preceeding version are computed and the TCS file will be able to reproduce either version (or earlier versions) by means of the GET command. The user is requested to provide a reason-for-change when prompted by "History?". Multiple lines may be entered to describe changes and terminated by '.' on a line by itself. FILES A scratch file is created during processing, then copied onto the "history". If a "newhistory" is given, the result will be moved there instead. SEE ALSO admin, get DIAGNOSTICS usage: delta revision history [newhistory] Correct calling format is provided when called without arguments. TCS Version Number corrupted. Unexpected EOF on history-info scan. Unexpected EOF on history-data scan. The TCS code seems to be present but garbled. Refer to a guru. Sudden death in input An end-of-file was detected while requesting the "reason for change". Revision file is empty Perhaps an incorrect filename was given. History file is empty The first formal version is entered by means of the ADMIN command. Files are too big to handle The DIFF algorithm table-size has been exceeded. Current version supports files of approximately -1- Delta (1) 14-Sep-81 Delta (1) 15000-lines. Cannot locate TCS history file. Unable to read filename specified as the history file. Temp file error: (filename) The tempoary file created during processing disappeared unexpectedly. AUTHORS An Algorithm for Differential File Comparison by J.W.Hunt and M.D.McIlroy (BTL Computing Science Technical Report #41). Original code by Wil Baden; converted from MORTRAN by Dave Murray. Modifications and conversion to BTL-SCCS style by Neil Groundwater at ADI. The Source Code Control System was introduced by Marc J. Rochkind in the December, 1975, IEEE Transactions on Software Engineering. BUGS/DEFICIENCIES File permissions are NOT manipluated to restrict users from disturbing the maintained files. Version numbering ranges from 1.1 to 1.N where N is a very large number. Provision to increment the "primary" number upon demand is scheduled. Branching capabilities are scheduled to be implemented. -2- #-h- entab 1058 asc 02-apr-82 17:58:02 v1.1 (sw-tools v1.1) Entab (1) 12-Aug-81 Entab (1) NAME Entab - convert spaces to tabs and spaces SYNOPSIS entab [...] [+] [file] ... DESCRIPTION Entab replaces strings of blanks with equivalent tabs (control-i) and blanks. It can be used to read files and produce typewriter-like text, reducing file size. Tab stops are indicated by ... (default 8, 16, ...), while + indicates tab stops every columns. Thus the command entab 5 21 +5 would insert tab stops at columns 5, 21, 26, etc. If no files are specified, the standard input is read. An isolated minus sign also indicates the standard input. SEE ALSO detab lpr AUTHORS Original from Kernighan & Plauger's 'Software Tools', with modifications by Dennis Hall. BUGS/DEFICIENCIES -1- #-h- fd 857 asc 02-apr-82 17:58:03 v1.1 (sw-tools v1.1) Fd (1) 11-Mar-82 Fd (1) NAME Fd - fast directory list in sort order SYNOPSIS fd [path] ... DESCRIPTION `fd' lists the files matching the specified pattern in sort order, packed in 5 columns across the page. The packing occurs regardless of whether standard output is a terminal or not, in contrast to the actions of `ls'. If no `path' arguments are specified, all files in the current working directory are listed. The forms of `path' are identical to those for `ls'. FILES SEE ALSO ls - general directory listing tool DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- expand 768 asc 02-apr-82 17:58:04 v1.1 (sw-tools v1.1) Expand (1) 15-Jan-79 Expand (1) NAME Expand - uncompress input files SYNOPSIS expand [file] ... DESCRIPTION Expand expands files previously compressed by 'cpress'. If no input files are given, or if the filename '-' appears, input will be read from the standard input. FILES SEE ALSO cpress DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Original from Kernighan & Plauger's 'Software Tools', with minor modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- field 2789 asc 02-apr-82 17:58:05 v1.1 (sw-tools v1.1) Field (1) 10-Jul-80 Field (1) NAME Field - manipulate fields of data SYNOPSIS field [-t[c] | fieldlist] outputformat [file] ... DESCRIPTION field is used to manipulate data kept in formatted fields. It selects data from certain fields of the input files and copies it to certain places in the standard output. The 'fieldlist' parameter is used to describe the interesting columns on the input file. Fields are specified by naming the columns in which they occur (e.g. 5-10) or the columns in which they start and an indication of their length (e.g. 3+2, meaning a field which starts in column 3 and spans 2 columns). When specifying more than one field, separate the specs with commas (e.g. 5-10,16,72+8) Fields may overlap, and need not be in ascending numerical order (e.g. 1-25,10,3 is OK). If input fields do not fall in certain columns, but rather are separated by some character (such as a blank or a comma), describe the fields by using the '-tc' flag, replacing 'c' with the appropriate separator (a tab character is the default). Once fields have been described with either the '-tc' flag or a fieldlist, they can be arranged on output by the 'outputformat' argument. This argument is actually a picture of what the output line should look like. Fields from input are referred to as $1, $2, $3, etc., referring to the first, second, third, etc. fields that were specified. (Up to 9 fields are allowed, plus the argument $0 which refers to the whole line.) These $n symbols are placed in the output format wherever that field should appear, surrounded by whatever characters desired. For example, an outputformat of: "$2 somewords $1" would produce an output line such as: field2 somewords field1 If no input files are specified, or if the filename '-' is found, field will read from the standard input. DIAGNOSTICS illegal field specification The fieldlist specification was in error, probably because it contained letters or some other illegal characters SEE ALSO sedit -1- Field (1) 10-Jul-80 Field (1) AUTHORS David Hanson and friends (U. of Arizona) -2- #-h- find 4017 asc 02-apr-82 17:58:07 v1.1 (sw-tools v1.1) Find (1) 3-Mar-78 Find (1) NAME Find - search a file for text patterns SYNOPSIS find [-acix] expression [expression] ... DESCRIPTION find searches the standard input file for lines matching the text patterns "expression" (up to 9 patterns may be specified) according to the matching criterion specified by the switches. (A text pattern is a subset of a "regular expression"--see the writeup on "ed" for a complete description of regular expressions.) Unless the -c option is specified, each matching line is copied to the standard output. By default, any line which matches any one of the expressions is considered a matching line. If the -a flag is specified, only lines which match all expressions in any order are considered to match. If the -x flag is specified, all lines which don't satisfy the above criteria are considered matching lines. If the -c option is specified, matching lines are counted instead of being copied to the standard output, and the final count is written to the standard output. Finally, if the -i option is specified, the pattern matching becomes case insensitive. A text pattern consists of the following elements: c literal character ? any character except newline % beginning of line $ end of line (null string before newline) [...] character class (any one of these characters) [!...] negated character class (all but these characters) * closure (zero or more occurrences of previous pattern) + anchored closure (one or more occurrences of previous pattern) @c escaped character (e.g., @%, @[, @*) Any special meaning of characters in a text pattern is lost when escaped, inside [...], or for: % not at beginning $ not at end * at beginning + at beginning A character class consists of zero or more of the following elements, surrounded by [ and ]: c literal character, including [ -1- Find (1) 3-Mar-78 Find (1) a-b range of characters (digits, lower or upper case) ! negated character class if at beginning @c escaped character (@! @- @ @]) Special meaning of characters in a character class is lost when escaped or for ! not at beginning - at beginning or end An escape sequence consists of the character @ followed by a single character: @f formfeed @l linefeed @n newline @r carriage return @t tab @c c (including @) For a complete description, see "Software Tools" pages 135-154. Care should be taken when using the characters % $ [ ] ! * + @ and any shell characters in the text pattern. It is often necessary to enclose the entire substitution pattern in quotes. FILES none SEE ALSO tr, ed, ch and the UNIX grep command. xfind - extended find utility DIAGNOSTICS An error message is printed if one of the patterns given is illegal. AUTHORS Originally from Kernighan & Plauger's "Software Tools", with major modifications by Joe Sventek. BUGS/DEFICIENCIES An expression may not start with a minus sign(-). -2- #-h- fb 4111 asc 02-apr-82 17:58:10 v1.1 (sw-tools v1.1) Fb (1) 28-May-80 Fb (1) NAME Fb - search blocks of lines for text patterns SYNOPSIS fb [-acix] [-ln] [-sexpr [-sexpr]] expr [expr] ... DESCRIPTION "Fb" (find block) searches blocks or groups of lines in a file for text patterns. It is similar to 'find' except that if a pattern is found, the entire block of lines is copied to standard output, rather than simply the line in which the pattern occurred. Thus it is useful for searching mailing lists, bibliographies, and similar files where several lines are grouped together to form cohesive units. The search patterns may be any regular expression as described in the 'ed' and 'find' writeups. "Fb" assumes the blocks of lines are separated by an empty line or a line containing only blanks. When "fb" is called without any options, standard input is read and each line is checked to see if it matches any of the regular expressions given as arguments. If any matches are found, the entire block is printed on standard output. Other options include: -a Only print the block if ALL the arguments are found within it -x Only print the block if none of the arguments are found within it -c Only print a COUNT of the number of blocks found which match/don't match the expressions -i Perform the pattern matches ignoring case. -sexpr Use 'expr' as the block separator (instead of a blank or empty line). "Expr" can be a regular expression just as the search arguments can. If two "-sexpr" arguments are given, the first one is considered to be the pattern which starts a block (e.g. -ssubroutine) and the second is considered the pattern which ends a block (e.g. -send). If the -i flag has been seen before the -s flags, then the start and end expressions will be case-independent. -ln prints only the first 'n' lines of the block; if the -1- Fb (1) 28-May-80 Fb (1) block contains less than 'n' lines, the block is padded out with blank lines. Care should be taken when using the characters % $ [ ] ! * @ and any shell characters in the text pattern. It is often necessary to enclose the entire substitution pattern in quotes. FILES A scratch file ("fbt") is used if the internal line buffer becomes full. SEE ALSO find ed For a complete description of regular expressions, see "Software Tools" pages 135-154. DIAGNOSTICS Error messages are given if: a) One of the patterns given is illegal b) Too many separators are given (2 are allowed) c) The maximum number of expressions is exceeded (9 are allowed) d) There are problems opening the scratch file (when the block line buffer fills up). If the following messages show up, something is dreadfully wrong: a) "Illegal default separator" b) "Block buffer overflow" AUTHORS Debbie Scherrer (Lawrence Berkeley Laboratory) BUGS/DEFICIENCIES An expression may not start with a minus sign (-). Regular expressions cannot span line boundaries. -2- #-h- incl 1721 asc 02-apr-82 17:58:11 v1.1 (sw-tools v1.1) Incl (1) 10-Jul-78 Incl (1) NAME Incl - expand included files SYNOPSIS incl [file] ... DESCRIPTION Include copies the input files to the standard output. Whenever an input line begins with include filename the entire contents of filename will be copied to the standard output. If no input files are specified, the standard input is copied. An included file may include further includes. Multiple input files are allowed. Include is used to bring in much-used routines, common declarations or definitions, thus insuring use of the same version by all programs. FILES none SEE ALSO Kernighan and Plauger's "Software Tools", pages 74-77. The software tools "ratfor" tutorial DIAGNOSTICS includes nested too deeply The depth of included files allowed is dependent upon the maximum number of open files allowed in the following manner: MAXOFILES - 3 filename: can't open File could not be located or maximum number of opened files was exceeded. AUTHORS Original code by Kernighan and Plauger in "Software Tools", with modifications by Ardith Kenney. BUGS/DEFICIENCIES The depth of included files allowed is dependent upon the maximum number of open files allowed by the implementor of the primitives. -1- #-h- form 2136 asc 02-apr-82 17:58:13 v1.1 (sw-tools v1.1) Form (1) 1-Mar-79 Form (1) NAME Form - produce form letter by prompting user for information SYNOPSIS form [-c] [+c] file ... DESCRIPTION Form reads input files and writes them to the standard output. Any time it encounters some characters surrounded by angle brackets ('<' and '>') it prints the string between the characters as a prompt to the user. It then reads from the standard input and replaces the bracketed string with what was read. Normally only one line of input is accepted from the standard input. However, a response can be continued on succeeding lines by terminating each line to be continued with a minus ('-'). The prompts inside the file may also span line boundaries if so desired. The user's answers to prompts are remembered, so duplicate prompts are replaced without repeating the prompt to the user. If the standard input is not a terminal, no prompts are issued. The '-c' flag may be used to reset the initial character signalling a prompt. The character 'c' then replaces the '<'. The '+c' flag may be used to reset the terminating character of a prompt. The character 'c' then replaces '>'. FILES Your terminal is opened at READ access. SEE ALSO The Unix form-letter tool DIAGNOSTICS If an input file cannot be opened, a message is printed and execution is terminated. A message is also printed if either the prompt or the response is too long for the tool's internal buffer. AUTHORS Debbie Scherrer -1- Form (1) 1-Mar-79 Form (1) BUGS/DEFICIENCIES -2- #-h- grep 1513 asc 02-apr-82 17:58:14 v1.1 (sw-tools v1.1) Grep (1) 2-May-81 Grep (1) NAME Grep - search file[s] for a pattern SYNOPSIS grep [-chilx] expression [file] ... DESCRIPTION `grep' searches the names files (or standard input if none are specified) for occurrences of the expression. The set of valid expressions are the same as those for `find', `ch' and `ed'. The manual entries for those tools may be consulted for full details. The output of `grep' is dependent upon which switches are selected: None When one or more occurrences of the expression are found in a file, the file name is displayed, with each line in which the expression occurs listed below the file name. -c Only the number of matching lines in each file is displayed. -h Do not display the file names. -i Make comparisons case insensitive. -l Only the names of files which contain matching lines are displayed, one per line. -x Display (or count) only those lines which do NOT contain the expression. FILES none SEE ALSO find - find groups of expressions in a file ch - globally change expressions within a file ed - text editor DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- get 3401 asc 02-apr-82 17:58:16 v1.1 (sw-tools v1.1) Get (1) 14-Sep-81 Get (1) NAME Get - get generation from TCS file SYNOPSIS get [-h][-rM.N] historyfile [resultfile] DESCRIPTION Get retrieves earlier versions of text from "historyfile" as computed by DELTA. The possible flags are: (none) - The latest version of the file is retrieved. -h - Print out the history information associated with the versions. The dates, times, and user IDs will be retrieved, along with the comments added while performing the DELTAs. -rM.N - Retrieve the specified version M.N into the "result" file. The retrieved version will be put in the "result" file if specified, otherwise it is sent to the standard output. History informatin is always sent to the terminal. FILES SEE ALSO admin, delta DIAGNOSTICS usage: get [-h][-rM.N] historyfile [resultfile] Correct calling format is provided when called without arguments. Unexpected EOF on history-info scan. The source file does not contain the code which identifies it as a TCS history file. The code may be entered via the ADMIN command. Unexpected EOF on history-data scan. The file format has been tampered with and is no longer recognizable. Refer to a guru for repair. - missing from keyletter First argument is expected to qualify whether versions and/or histories are to be extracted. -1- Get (1) 14-Sep-81 Get (1) Illegal keyletter Only 'h' and 'r' are valid keys. Nonexistant revision level requested. The version number specified is not contained in the history. Try "get -h file.tcs" to view the versions available. Invalid history file The history file specifies impossible line-number correlations. Either out-of-sequence changes or line numbers in descending order. Cannot locate TCS history file. Could not find file supplied for historyfile. AUTHORS An Algorithm for Differential File Comparison by J.W.Hunt and M.D.McIlroy (BTL Computing Science Technical Report #41). Original code by Wil Baden; converted from MORTRAN by Dave Murray. Modifications and conversion to BTL-SCCS style by Neil Groundwater at ADI. The Source Code Control System was introduced by Marc J. Rochkind in the December, 1975, IEEE Transactions on Software Engineering. BUGS/DEFICIENCIES -2- #-h- intro 804 asc 23-apr-82 13:39:38 j (sventek j) Intro (1) 11-Jan-79 Intro (1) NAME Intro - list on-line documentation SYNOPSIS intro [-s] [-w] [-j] DESCRIPTION isam is used to generate an index for a text file such that the index may be used later to permit indexed-sequential access to the file. isam reads every `dif'th line (default is 1) from the standard input, noting its disk address with a call to note. It uses getwrd to retrieve the first "word" from the line and uses this as the primary key to the record. This key is then output to standard output in a field `width' wide (default is 25) and justified according to the -j switch (default left). The two-word address from note is then output as decimal integers before the index record is flushed. FILES SEE ALSO spell - spelling error finder; uses an isam-generated index asam - generate index for archives DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- kwic 1083 asc 02-apr-82 17:58:20 v1.1 (sw-tools v1.1) Kwic (1) 15-Jan-79 Kwic (1) NAME Kwic - make keyword in context index SYNOPSIS kwic [file] ... DESCRIPTION kwic rotates lines from the input files so that each word in the sentence appears at the beginning of a line, with a special character marking the original position of the end of the line. The output from kwic is typically sorted with 'sort' and then unrotated with 'unrot' to produce a keyword-in-context index. If no input files are given, or if the filename '-' appears, lines will be read from standard input. FILES SEE ALSO unrot; sort DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Original from Kernighan and Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- lcnt 964 asc 02-apr-82 17:58:21 v1.1 (sw-tools v1.1) Lcnt (1) 11-Jan-79 Lcnt (1) NAME Lcnt - line count SYNOPSIS lcnt [file] ... DESCRIPTION lcnt counts the number of lines of text in the named input files, or the standard input if no files are given or the filename '-' appears. A line is zero or more characters terminated by a NEWLINE marker. lcnt could also be implemented as a shell script file: tr '!@n' | ccnt FILES SEE ALSO ccnt; wcnt; the Unix command 'wc' DIAGNOSTICS A message is printed if an input file could not be opened; processing is terminated. AUTHORS Original from Kernighan and Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- format 9169 asc 02-apr-82 17:58:24 v1.1 (sw-tools v1.1) Format (1) 23-Dec-81 Format (1) NAME Format - format (roff) text SYNOPSIS format [+n] [-n] [-s] [-pon] [file] ... DESCRIPTION Format formats text according to request lines embedded in the text of the given files or standard input if no files are given. If nonexistent filenames are encountered they are ignored. The optional flags are as follows: +n Start printing at the first page with number "n". -n Stop printing at the first page numbered higher than "n". -s Stop before each page, including the first (useful for paper manipulation). The prompt "Type return to begin a page" is given just once before the first page. For each page thereafter, the terminal bell is rung to indicate that another sheet of paper is needed. -pon Move the entire document "n" spaces (default=0) to the right ("page offset"). Input consists of intermixed text lines, which contain information to be formatted, and request lines, which contain instructions about how to format the text lines. Request lines begin with a distinguishing "control character", normally a period. Output lines are automatically "filled"; that is, their right margins are justified, without regard to the format of the input text lines. (Right justification may be turned on and off through the use of the ".ju" and ".nj" commands, though.) Strings of embedded spaces are retained so that the output line will contain at least as many spaces between words as the input line. However, input lines beginning with a space are output without modification. Line "breaks" may be caused at specified places by certain commands, or by the appearance of an empty input line or an input line beginning with a space. Because of the nature of its output (backspace and tab characters and a fixed number of lines per page), it is generally necessary to have a tool developed especially for printing the output on the local printers. On most systems this is a combination of the tools 'os' and 'detab', plus some sort of page eject control of the printer. If such as tool -1- Format (1) 23-Dec-81 Format (1) exists, it should be described in Section 3 of this manual. The capabilities of format are specified in the attached Request Summary. Numerical values are denoted by "n", titles by "t", and single characters by "c". Numbers may be signed + or -, in which case they signify relative changes to a quantity; otherwise they signify an absolute setting. Missing "n" fields are ordinarily taken to be 1, missing "t" fields to be empty, and "c" fields to shut off the appropriate special interpretation. Running titles may appear at the top and bottom of every page. A title line consists of a line with three distinct fields: the first is text to be placed flush with the left margin, the second centered, and the third flush with the right margin. The first non-blank character in the title will be used as the delimiter to separate the three fields. Any "#" characters in a title are replaced by the current page number, and any "%" characters are replaced by the current date. The ".nr" defines number registers; there are 26 registers named a-z. The command ".nr x m" sets number register x to m; ".nr x +m" increments number register by m; and ".nr x -m" decrements x by m. The value of number register x is placed in the text by the appearance of @nx; a literal @ may be inserted using @@. Additional commands may be defined using ".de xx". For example, .de PG .sp .ti +3 .en defines a "paragraph" command PG. Defined commands may also be invoked with arguments. Arguments are separated by blanks or tabs. Within the definition of a defined command, arguments are referenced using $1, $2, etc. There is a maximum of 9 arguments. Omitted arguments default to the null string. $0 references the command name itself. For example, the following version of the paragraph command uses the argument to determine the amount of indentation. .de PG .sp .ti +$1 .en This command could be invoked by -2- Format (1) 23-Dec-81 Format (1) .PG 3 to get the same effect as the previous version. The ".so file" command causes the contents of file to be inserted in place of the ".so" command; ".so" commands may be nested. FILES none SEE ALSO Kernighan & Plauger's "Software Tools", pages 219-250 whatever tool has been devised for printing formatted output The roff and nroff/troff UNIX commands The "nroff" and "troff" users manuals by Joseph F. Ossana, Bell Laboratories, Murray Hill, New Jersey DIAGNOSTICS invalid number register name names of number registers must be a single letter a-z missing name in command definition a macro was defined using the '.de' command, but no 2-letter name for it was given so commands nested too deeply the limit for nesting included source files is dependent upon the MAXOFILES definition in the standard symbols definition file too many characters pushed back the buffer holding input characters has been exceeded; its size is determined by the BUFSIZE definition in the source code AUTHORS Original version by Kernighan and Plauger, with modifications by David Hanson and friends (U. of Arizona), Joe Sventek and Debbie Scherrer (Lawrence Berkeley Laboratory) -3- Format (1) 23-Dec-81 Format (1) REQUEST SUMMARY Request Initial Default Break Meaning .## start of comment line .bd n n=1 no boldface the next n lines .bp n n=1 n=+1 yes begin new page and number it n .br yes break .cc c c=. c=. no control character becomes c .ce n n=1 yes center the next n input lines .cu n n=1 no continuously underline in the next n .de xx no command xx; ends at .en .ef t t="" t="" no foots on even pages are t .eh t t="" t="" no heads on even pages are t .en no terminate command definition .fi yes yes begin filling output lines .fo /l/c/r f="" f="" no foot titles are l(eft), c(enter), r(ight) .he /l/c/r t="" t="" no head titles are l(eft), c(enter), r(ight) .in n n=0 n=0 yes set left margin to column n+1 .ju yes yes no begin justifying filled lines .ls n n=1 n=1 no set line spacing to n .m1 n n=3 n=3 no space between top of page and head .m2 n n=2 n=2 no space between head and text .m3 n n=2 n=2 no space between text and foot .m4 n n=3 n=3 no space between foot and bottom .ne n n=0 y/n need n lines; break if new page .nf no yes stop filling .nj no no stop justifying .nr x m x=0 m=0 no set number register x to m, -m, +m for decrement, increment .of t t="" t="" no foots on odd pages are t .oh t t="" t="" no heads on odd pages are t .pl n n=66 n=66 no set page length to n lines .po n n=0 n=0 no set page offset to n spaces .rm n n=65 n=65 no set right margin to column n .so file no switch input to file .sp n n=1 yes space n lines, except at top of page .st n n=0 yes space to line n from top; -n spaces to line n from bottom .ti n n=0 yes temporarily indent next output line n spaces .ul n n=1 no underline words in the next n input lines -4- #-h- ll 745 asc 02-apr-82 17:58:27 v1.1 (sw-tools v1.1) Ll (1) 15-Sep-78 Ll (1) NAME Ll - print line lengths SYNOPSIS ll [file] ... DESCRIPTION ll prints the lengths of the shortest and longest lines in the named files. The name "-" may be used to refer to the standard input. If no files are given, ll reads the standard input. NEWLINE characters are not counted as part of the length of a line. FILES none DIAGNOSTICS A message is issued if a named file could not be opened. AUTHORS David Hanson and friends (U. of Arizona) BUGS/DEFICIENCIES -1- #-h- msplit 1121 asc 02-apr-82 17:58:28 v1.1 (sw-tools v1.1) Msplit (1) 11-Jan-79 Msplit (1) NAME Msplit - utility for salvaging message files SYNOPSIS msplit The '[line]' specifies a line number or address in the buffer. Every command which requires addresses has default addresses, so the addresses can often be omitted. Line addresses may be formed from the following components: 17 an integer number . the current line $ the last line in the buffer .+n "n" lines past the current line -1- Ed (1) 21-Apr-78 Ed (1) .-n "n" lines before the current line // a forward context search \\ a backward context search Line numbers may be separated by commas or semicolons; a semicolon sets the current line to the previous address before the next address is interpreted. This feature can be used to determine the starting line for forward and backward context searches ("/" and "\"). REGULAR EXPRESSIONS Ed includes some additional capabilities such as the ability to search for patterns that match classes of characters, that match patterns only at particular positions on a line, or that match text of indefinite length. These pattern-seaching capabilities include a class of patterns called regular expressions. Regular expressions are used in addresses to specify lines and in the s command to specify a portion of a line which is to be replaced. To be able to express these more general patterns, some special characters (called metacharacters) are used. The regular expressions allowed by ed are constructed as follows: 1. An ordinary character (not one of those discussed below) is a regular expression and matches that character. 2. A percent "%" at the beginning of a regular expression matches the empty string at the beginning of a line. 3. A dollar sign "$" at the end of a regular expression matches the null character at the end of a line. 4. A question mark "?" matches any character except a newline character. 5. A regular expression followed by an asterisk "*" matches any number of adjacent occurrences (including zero) of the regular expression it follows. 6. A regular expression followed by a plus "+" matches one or more adjacent occurrences of the regular expression it follows (anchored closure). 7. A string of characters enclosed in square brackets "[ ]" matches any character in the string but no others. If, however, the first character of the string is an exclamation point "!" the regular expression matches any character except the characters in the string (and the newline). -2- Ed (1) 21-Apr-78 Ed (1) 8. A string of regular expressions enclosed in braces "{}" is known as a tagged pattern, and can be referenced positionally as $1...$9 in the replacement side of a substitute command. 9. The concatenation of regular expressions is a regular expression which matches the concatenation of the strings matched by the components of the regular expression. 10. The null regular expression standing alone is equivalent to the last regular expression encountered. If it is desired to use one of the regular expression metacharacters as an ordinary character, that character may be escaped by preceding it with an atsign "@". COMMANDS Following is a list of ed commands. Default addresses are shown in parentheses: (.)a . The append command reads the given text and appends it after the addressed line. '.' is left on the last line input, if there were any, otherwise at the addressed line. (.)b[+/./-][] The browse command is a shorthand command to print out a screenful of data. It has three basic forms, any of which may have a number("screensize") appended to it. The default screensize is 23. The b- form will print the screen of text preceding (and including) the addressed line; b. prints the screen centered on the addressed line; and b or b+ prints the current line and the screen after it. "." is left at the last line printed. If a screensize is specified, it becomes the default screensize for the rest of the editing session or until changed again. (.,.)c . The change command deletes the addressed lines, then -3- Ed (1) 21-Apr-78 Ed (1) accepts input text which replaces these lines. '.' is left at the last line input, if there were any, otherwise at the first line not deleted. (.,.)d The delete command deletes the addressed lines from the buffer. The line originally AFTER the last line deleted becomes the current line; however, if the lines deleted were originally at the end, the new last line becomes the current line. e filename The edit command causes the entire contents of the buffer to be deleted and then the named file to be read in. '.' is set to the last line of the buffer. The number of lines read is typed. 'Filename' is remembered for possible use as a default file name in a subsequent r or w command. If changes have been made to the current file since the last write command, you will be asked to repeat the edit command. f filename The filename command prints the currently remembered file name. If 'filename' is given, the currently remembered file name is changed to 'filename'. (1,$)g/regular expression/command In the global command, the given command is executed for every line which matches the given regular expression. Multiple commands may be executed by placing each on a preceding line and terminated each command except the last with an atsign '@'. h The help command causes a synopsis of the commands to be displayed on standard output. If no help is available, that fact is noted on error output. (.)i . The insert command inserts the given text BEFORE the addressed line. '.' is left at the last line input, or if there were none, at the addressed line. This command differs from the a command only in the placement of text. (.,.+1)j The join command joins the specified lines into one line. '.' is left at the new line created by the join. If the -4- Ed (1) 21-Apr-78 Ed (1) join would result in a line longer than MAXLINE characters, an error is reported and no changes are made to the file. A trailing p or l may be given on the join command to cause the merged line to be printed or listed. (.,.)k
The kopy command copies the range of lines after the line specified by
. The last of the copied lines becomes the current line. (.,.)l The list command prints the addressed lines, expanding all ASCII characters with values between 1 and 31 (^A - ^_) as the appropriate two character digraph, ^(character). The end of line is also indicated by a '$'. '.' is left at the last line listed. The l command may be placed on the same line after any other command to cause listing of the last line affected by the command. (.,.)m
The move command repositions the addressed lines after the line specified by
. The last of the moved lines becomes the current line. n[+/-/=][value] This command manipulates the number register maintained by ed. A bare `n' causes the current value of the register to be displayed. The `=' function causes the number register to be set to the value specified, or to 0 if left null. The `+' and `-' functions cause the register to be incremented/decremented by `value', or by 1 if value is null. (.,.)p The print command prints the addressed lines. '.' is left at the last line printed. The p command may be placed on the same line after any other command to cause printing of the last line affected by the command. q The quit command causes ed to exit. No automatic write of the file is done. If changes have been made to the current file since the last write command, you will be asked to repeat the quit command. (.)r filename The read command reads in the given file after the addressed line. If no file name is given, the remembered file name is used (see e and f commands). The remembered file name is not changed. Address '0' is legal -5- Ed (1) 21-Apr-78 Ed (1) for this command and causes the file to be read in at the beginning of the buffer. If the read is successful, the number of lines read is typed. '.' is left at the last line read in from the file. (.,.)s/regular expression/replacement/ or, (.,.)s/regular expression/replacement/g The substitute command searches each addressed line for an occurrence of the specified regular expression. On each line in which a match is found, the first occurrence of the expression is replaced by the replacement specified. If the global replacement indicator g appears after the command, all occurrences of the regular expression are replaced. Any character other than space or newline may be used instead of the slash '/' to delimit the regular expression and replacement. A question mark '?' is printed if the substitution fails on all addressed lines. '.' is left at the last line substituted. An ampersand '&' appearing in the replacement is replaced by the string matching the regular expression. (The special meaning of '&' in this context may be suppressed by preceding it by '@'.) The strings '$n', '$n+[d]' and '$n-[d]' appearing in the replacement string cause the current value of the number register to be placed in the line. The optional trailing increment/decrement syntax cause the number register value to incremented/decremented by `d' AFTER the value is placed in the string. If `d' is omitted, a value of 1 is used. Lines may be split or merged by using the symbol '@n' to stand for the newline character at the end of a line. t [format arguments] This command allows one to `typeset' the current buffer without leaving the editor. The current contents of the buffer are written to a scratch file, and `format' is invoked with a command line consisting of the scratch file name plus any trailing arguments in the `t' command line. For example: t +5 -7 causes format to be invoked on the buffer and pages 5 through 7 to be output. The value of '.' is not changed and the buffer is left intact. -6- Ed (1) 21-Apr-78 Ed (1) (.)u This causes the last line or range of lines which were deleted, either via a delete command or a substitute command, to be undeleted after the specified line. This is NOT an undo command. The last line or set of lines deleted are kept in a special place before recycling the line pointers, and may be recalled. (1,$)w [>[>]]filename The write command writes the addressed lines onto the given file. If the file does not exist, it is created. The remembered file name is not changed. If no file name is given, the remembered file name is used (see the e and f commands). '.' is left unchanged. If the command is successful, the number of lines written is typed. The form `>file' is equivalent to `file', while `>>file' causes the lines to be appended to `file'. (1,$)x/regular expression/command The except command is the same as the global command except that the command is executed for every line except those matching the regular expression. (.)= The line number of the addressed line is typed. '.' is left unchanged. # comment The remainder of the line after the "#" is a comment and ignored by the editor. This allows ed scripts to be commented for future enlightenment. ^shell command The remainder of the line after the "^" is sent to the shell as a command. If there is nothing else on the line but a bare "^", the shell will be spawned, allowing a number of commands to be performed; when that shell quits, the terminal is returned to the editor. "." is left unchanged. (.+1) An address alone on a line causes the addressed line to be printed. A blank line alone is equivalent to '.+1' and thus is useful for stepping through text. A minus '-' followed by a carriage return is equivalent to '.-1'. $1 * 0r $1 As another example, if you wish to make a copy of lines 1,5 after the last line in the buffer, do the following: * 1,5w $1 * $r $1 SEE ALSO The Unix command "ed" in the Unix manual The software tools tutorial "Edit" "Edit is for Beginners" by David A. Mosher (available from UC Berkeley Computer Science Library) "Edit: A Tutorial" (also available from the UC Berkeley Computer Science Library) "A Tutorial Introduction to the ED Text Editor" by B. W. Kernighan (UC Berkeley Computer Science Library) Kernighan and Plauger's "Software Tools", pages 163-217 DESCRIPTION The error message "?" is printed whenever an edit command fails or is not understood. AUTHORS Original code by Kernighan and Plauger with modifications by Debbie Scherrer, Dennis Hall, Joe Sventek and Dave Martin. BUGS/DEFICIENCIES At the present time the editor is still in a somewhat -9- Ed (1) 21-Apr-78 Ed (1) experimental There is a compiled-in limit to the maximum number of lines which a file being edited may contain. The line limit applies to all lines read in and subsequently changed. This problem can be partly alleviated by writing (w command) and re-editing (e command) the file after a lot of lines have been changed. There are several discrepancies between this editor and Unix's ed. These include: 1. Unix uses 'v' instead of 'x' for the except command. 2. Unix uses '^' instead of '%' for the beginning-of-line character. 3. Unix uses '.' instead of '?' to indicate a match of any character. 4. Unix uses '^' instead of '!' to indicate exclusion of a character class. 5. Unix uses '\' instead of '@' for the escape character. 6. Unix uses '?' instead of '\' to delimit a backward search pattern. 7. The Unix 'r' command uses the last line of the file, instead of the current line, as the default address. 8. The Unix editor prints the number of characters, rather than lines read or written when dealing with files. -10- #-h- ls 2852 asc 02-apr-82 17:58:46 v1.1 (sw-tools v1.1) Ls (1) 27-Jul-81 Ls (1) NAME Ls - list contents of directory SYNOPSIS ls [-1dhnrtv] [-fstring] [pathname] ... DESCRIPTION Ls lists information about each file argument. When no argument is given, the default directory is listed. The file arguments may include any of the legal regular expressions described in the man entry for the editor, with the added feature that the comparisons will be case insensitive. By default, the files are listed in the order in which they are found in the directory. There are seven options: -1 force single column output to the terminal. The default is multi-column output to the terminal, single to a disk file. -d print only directory files found in this directory -h print a header at the top of verbose listings -n sort the directory by name -v list in verbose format -t sort by time modified (oldest first) -r reverse the sense of the sort -f use `string' to specify the output format as follows: b size of file in blocks (normally 512 characters) c size of file in characters m modification date and time (dd-mmm-yy hh:mm:ss) n filename o file owner's username p protection codes (oooo|gggg|wwww) t file type (asc|bin|dir) The `b', `c', `n' and `o' options accept an integer prefix which specifies the field width to be used. The verbose option formats its output as if you had specified "-f17n p m 6b o" as a format string. It is necessary to surround the string (including the `-f') with quotes if it contains any BLANKs or TABs. -1- Ls (1) 27-Jul-81 Ls (1) EXAMPLES The following command will cause all of the files which contain the string tst anywhere in the file name to be deleted: % ls tst | args rm FILES lstemp1, lstemp2 AUTHORS Ls was written by Joe Sventek. The `-f' option was added by Dave Martin. SEE ALSO ed - text editor for description of regular expressions args - argument exploder d - directory lister (with different default format) fd - fast directory lister in sort order -2- #-h- mcol 2842 asc 02-apr-82 17:58:49 v1.1 (sw-tools v1.1) Mcol (1) 1-Oct-78 Mcol (1) NAME Mcol - multicolumn formatting SYNOPSIS mcol [-cn] [-ln] [-wn] [-gn] [-dn] [file] ... DESCRIPTION mcol reads the named files and formats them into multicolumn output on the standard output. If the filename "-" is given, or no files are specified, the standard input is read. The options are as follows. -cn Format the output into "n" columns. Default is 2. -ln Set the output page size to "n". Mcol produces its output in pages, but does not place separators between the pages on the assumption that some subsequent processor will do that. (The default page length is 55.) -wn Set the column width to "n" characters. Lines longer than "n" characters are truncated. (The default column width is 60.) -gn Set the "gutter" width to "n". The gutter is the white space between columns. (The default gutter width is 8.) -dn Assume output is to be printed on a display terminal. The column size is set to "n" characters and the page size is set to 24 lines. The number of columns and gutter width are computed to maximize the amount of information on a single screen. If "n" is omitted, 10 is used, which is useful for displaying lists of file names. FILES none SEE ALSO DIAGNOSTICS invalid column count invalid page size invalid column width invalid gutter width The value of one of the option flags is invalid or exceeds the limitations of mcol. ignoring invalid flag A command argument option flag was given which mcol didn't -1- Mcol (1) 1-Oct-78 Mcol (1) recognize. insufficient buffer space Mcol could not buffer an entire page. This is usually the result of options that specify a large page size or many columns. The buffer size is set by the MAXBUF definition in the source code. too many lines The number of lines per page times the number of columns exceeded mcol's line buffer space. The maximum number of lines allowed is set by the MAXPTR definition in the source code. BUGS/DEFICIENCIES AUTHORS Original by David Hanson and friends (U. of Arizona), with modifications by Debbie Scherrer (LBL). -2- #-h- mail 3122 asc 02-apr-82 17:58:51 v1.1 (sw-tools v1.1) Mail (1) 11-Nov-81 Mail (1) NAME Mail - utility for sending mail to local users SYNOPSIS mail [-er] [-llistfile] ... [addressee] ... DESCRIPTION mail is a tool designed to allow the user to send mail to fellow users of any system which supports the software tools. It operates as follows: The addressees specified in the command line and in any mailing list files specified are validated. If there were any valid users, the standard input is read up to an end-of-file and then mailed to each valid user with an appropriate postmark. (Note: if one wishes to terminate the mail session without sending any mail, type a line consisting of only the letter q [for quit] during the input of mail.) Mailing list files are specified with the -l switch in the command line. The structure of the mailing list files is described below. The -r switch indicates to mail that the user wishes to be notified as the mail is posted to each addressee ('posted' implying that the mail has been appended successfully to the addressee's mail file). The names of valid users may be obtained by prior invocation of the users command. The -e flag will cause the editor "ed" to be invoked, allowing the user to perform complex mail composition. The mailing list files have a very simple structure: user names separated by blanks and tabs, with as many users per line as desired. A pound sign (#) appearing anywhere on a line indicates the start of a comment field, and the rest of the line is ignored by mail. This allows the user complete flexibility in commenting her/his mailing lists for informational purposes. Broadcast mailings are supported, also. One must merely specify `all' as an addressee in the command line. If the persons you are sending mail to are currently logged in, they will receive the message [You have new mail] if it is possible to support this feature on your system. FILES -1- Mail (1) 11-Nov-81 Mail (1) mymail - file for storage of each users mail mbox - file for storage of saved mail three temporary files are used by mail SEE ALSO users - a program to list users on current host postmn - a program which notifies user of existence of mail msg - the utility for reading and sorting one's mail sndmsg - expanded mail utility AUTHORS Joe Sventek BUGS/DEFICIENCIES -2- #-h- man 3746 asc 23-apr-82 13:39:55 j (sventek j) Man (1) 11-Jan-79 Man (1) NAME Man - run off section of users manual SYNOPSIS man [-] [-s
] [-a] [name] ... DESCRIPTION man locates and displays the manual entries for the particular utility or function names found in the argument list. If no names are supplied, a list of those entries known to man in the section specified is supplied. The manual currently consists of four sections: 1 The writeups for the utilities are contained here. This is the default section if none is specified. A valid synonym for `1' is `cmd'. 2 The writeups for the primitive functions are contained here. The primitive functions are those which represent the virtual system calls for the Software Tools Virtual Machine. A valid synonym for `2' is `prim'. 3 The writeups for the portable library functions are found in this section. Routines for manipulating archive modules, in-memory storage, push-back stacks, pattern matching, and many others are described here. Many times a problem which you are trying to solve has been solved before, with the code for the solution appearing in the library. A valid synonym for `3' is `lib'. 4 Primers for using various utilities and function libraries appear here. A valid synonym for `4' is `primer'. In addition, site-dependent sections can be added by creating the necessary known files in ~man. The section on FILES below describes the structure of the known files. If the -a flag is specified, all of the manual entries for the particular section are displayed on standard output. When displaying to the terminal, excess white space is removed from the entries. The output is also paged when to a terminal, with the default page length being 22 lines. This value may be changed through the use of the '-' option. Specifying a pagelength of 0 turns the paging off. When in paging mode, the user will be asked if the next screenful of the current entry is desired. In addition, if more than one entry was requested, the user is asked if the next entry is desired. -1- Man (1) 11-Jan-79 Man (1) FILES Accesses the known files for each section in the ~man directory. Each section consists of two files in ~man: * s is an archive of the `format' output files for each entry, with each archive module having the name of the entry. For example, s1 has the entries for the commands, with the entry for `ar' being ar. * i is an index of the s-file above generated by `asam'. This index must be sorted, and is generated by asam | sort >i There is no restriction of `' to integers, such that if one wishes to create a local man section, simply archive the formatted entries in ~man/slocal and generate the index in ~man/slocal. SEE ALSO The tool 'intro'; the Unix command 'man' DIAGNOSTICS A message is printed if the entry specified by 'name' cannot be located. AUTHORS Joe Sventek -2- #-h- mv 785 asc 02-apr-82 17:58:55 v1.1 (sw-tools v1.1) Mv (1) 11-Jan-79 Mv (1) NAME Mv - move (or rename) a file SYNOPSIS mv old new DESCRIPTION mv changes the name of `old' to `new'. If `new' already exists, it is removed before `old' is renamed. On networks or other systems where a simple rename is impossible, mv copies the file and then deletes the original. FILES none SEE ALSO The Unix command 'mv' DIAGNOSTICS A message is printed if `old' does not exist. AUTHORS Joe Sventek, Debbie Scherrer BUGS/DEFICIENCIES Mv may only be used with ASCII files on many systems. -1- #-h- os 989 asc 02-apr-82 17:58:55 v1.1 (sw-tools v1.1) Os (1) 16-Jan-79 Os (1) NAME Os - convert backspaces into multiple lines for "printers" SYNOPSIS os [file] ... DESCRIPTION os (overstrike) looks for backspaces in the files specified and generates a sequence of print lines with carriage control codes to reproduce the effect of the backspaces. If no files are given, or the filename '-' appears, input is taken from the standard input. FILES SEE ALSO lpr - queue file to line printer ul - process overstrikes for "terminals" DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Original from Kernighan & Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- pack 1004 asc 02-apr-82 17:58:56 v1.1 (sw-tools v1.1) Pack (1) 29-Oct-80 Pack (1) NAME Pack - pack words into columns SYNOPSIS pack [-n] [file] ... DESCRIPTION pack takes the words (groups of characters separated by blanks or tabs) found on the specified files (standard input if none are specified) and outputs them to standard output in columns, 16 spaces wide, ordered from left to right. The characters used to achieve the separation of columns are TAB characters, such that those terminals which support hardware tabs can be driven efficiently. By default, five (5) columns are generated; this value can be overridden through the specification of the -n switch, where n is a decimal number. FILES SEE ALSO DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- number 1027 asc 02-apr-82 17:58:57 v1.1 (sw-tools v1.1) Number (1) 21-Oct-81 Number (1) NAME Number - number lines SYNOPSIS number [-f] [-z] [-i] [-s] [-d] [-] file ... DESCRIPTION Number copies its input to STDOUT, adding line numbers to each line. The options are: - read input from STDIN. -f (Fortran) start numbers in column 73. Default is 1. The number of digits is set to 8 ("-d8"). -z zero-fill numbers. Default is blank-fill. -i set line number increment to . -s start numbering with . -d make numbers digits long. default is 7. FILES none DIAGNOSTICS none AUTHORS Dave Martin (Hughes Aircraft) BUGS/DEFICIENCIES Tabs are assumed to be 8 spaces wide starting in column 9. The -f option assumes lines are less than 73 columns long. -1- #-h- pl 1997 asc 02-apr-82 17:58:59 v1.1 (sw-tools v1.1) Pl (1) 18-Sep-79 Pl (1) NAME Pl - print specified lines/pages in a file SYNOPSIS pl [-pn] numbers [file] ... DESCRIPTION pl prints the specified lines from each of the named files on the standard output. If no files are given, or if the name "-" is specified, pl reads the standard input. The "numbers" argument is a list of line numbers separated by commas, e.g. pl 4,5,26,55 foo bazrat prints lines 4, 5, 26, and 55 in file "foo" and "bazrat". The line numbers may be given in any order. Repeated numbers cause the specified lines to be printed once for each occurrence of the line number. Line number ranges can also be given, e.g. 4-15. The "-p" option causes pl to print pages instead of lines, and the numbers refer to page numbers. If an integer follows the "-p", it is taken as the page size; the default is 23. Repeated numbers cause the specified pages to be printed once for each occurrence of the page number. DIAGNOSTICS bad page size Invalid page size specified after '-p' flag bad number Invalid number given as argument bad range Invalid range given as argument too many numbers Number of lines/pages specified overflowed the buffer. Maximum number of lines is determined by the MAXLINES definition in the source code. ignoring invalid argument An invalid flag was specified. Processing continues. AUTHORS David Hanson and friends (U. of Arizona) BUGS/DEFICIENCIES There is a limit to the size of pages which can be buffered. This is set by the MAXBUF definition in the source code. -1- #-h- msg 1758 asc 02-apr-82 17:59:00 v1.1 (sw-tools v1.1) Msg (1) 11-Jan-79 Msg (1) NAME Msg - utility for manipulating message files SYNOPSIS msg [-fn] [-p[n]] [file] DESCRIPTION `msg' is a message file editor. The message files which it can work on are those used by the utility `sndmsg', as well as files created by `msg'. There are two files in a user's home directory which are used by `sndmsg' and `msg' - mymail and mbox. If `msg' is invoked without a file argument, `msg' will initially read mymail. mbox is the file where the messages from mymail are saved by default. The -f switch is used to change the number of fill characters written to the terminal whenever a carriage-return, line-feed pair is written. The -p switch can be used to change the page size (number of lines per screenful) for `msg' to use when displaying long output. The default is 22 lines. A primer is available, and may be had by the execution of the following shell script: % msgprim This will cause a copy of the primer to be displayed on standard output. FILES mymail - messages sent using the `sndmsg' utility reside here. mbox - default file for saving messages from mymail. one scratch file is used by `msg'. SEE ALSO sndmsg - the utility for sending mail to other users msplit - the utility for salvaging message files mail - old utility for sending mail AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- postmn 885 asc 02-apr-82 17:59:01 v1.1 (sw-tools v1.1) Postmn (1) 25-Aug-80 Postmn (1) NAME Postmn - report the presence of mail SYNOPSIS postmn DESCRIPTION postmn looks to see if the requestor has received any mail. If so, it reports that fact upon the standard output file with the comment "You have mail [type ``msg'' to read]". FILES Uses the file address in the mail directory to determine your home directory. SEE ALSO sndmsg - utility for sending mail mail - old utility for sending mail msg - utility for reading and filing mail resolve - utility for querying the mail database about users users - utility for listing valid mail users AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- prlabl 1394 asc 02-apr-82 17:59:02 v1.1 (sw-tools v1.1) Prlabl (1) 11-Mar-82 Prlabl (1) NAME Prlabl - format labels for printing SYNOPSIS prlabl [-width] ] [file] ... DESCRIPTION pr paginates the named files to standard output. Each file is printed as a sequence of pages. Each page is 66 lines long, including a 6-line header and 3-line footer. The header includes the file name, possibly the date, and the page number. If the file '-' is specified, or no file names are given, the standard input is read. Option flags include: -l Sets the page length to ''. Default page length is 66. SEE ALSO os, detab, mcol, format, cat DIAGNOSTICS ignoring invalid argument An option flag was specified which pr did not understand A message is printed if an input file could not be opened AUTHORS Original from the Kernighan-Plauger 'Software Tools' book, with modifications by David Hanson and friends (U. of Arizona) and Debbie Scherrer (LBL) BUGS/DEFICIENCIES The header and trailer spacing can be modified by adjusting the MARGIN1, MARGIN2, and BMARGIN definitions in the source code. -1- #-h- pwd 808 asc 02-apr-82 17:59:04 v1.1 (sw-tools v1.1) Pwd (1) 12-Aug-81 Pwd (1) NAME Pwd - print working directory name on standard output SYNOPSIS pwd [-l] DESCRIPTION pwd prints the pathname of the working (current default) directory. If the -l switch is present, the current working directory is printed out in the local parlance. This path name is of the form /device/directory For example, /u/usrlib is equivalent to u:[usrlib] on VMS SEE ALSO cd - change working directory DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- resolve 806 asc 02-apr-82 17:59:05 v1.1 (sw-tools v1.1) Resolve (1) 8-Jun-79 Resolve (1) NAME Resolve - resolve mail system user names SYNOPSIS resolve expression [expression ...] DESCRIPTION resolve searches the mail database for lines matching the text pattern "expression". (Valid text patterns are the same as for find.) Resolve will display on the standard output all lines which match any one of the given expressions. FILES SEE ALSO find - search a file for text patterns mail - software tools mail facility users - list users to whom mail may be sent DIAGNOSTICS none AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- rar 1553 asc 02-apr-82 17:59:06 v1.1 (sw-tools v1.1) Rar (1) 2-May-81 Rar (1) NAME Rar - rearrange archive SYNOPSIS rar [-cv] archive DESCRIPTION `rar' permits the rearrangement of the modules of an archive, `archive'. `rar' opens `archive' and notes the names and starting address of each module. It then reads the names of modules from standard input and outputs each module so indicated to standard output. Upon detecting an EOF on standard input, any modules not yet output are written out in the order found in the original archive. Switches: -c Suppresses the output of modules not specified on the standard input. This permits the selection of only a subset of the original archive's modules. -v Print the name of each module on error output after it has been successfully output to the standard output. Example of use: Suppose that you wish to create a new version (newarch) of an archive (oldarch) with all of the modules sorted by name. The following shell command will suffice: ar t oldarch | sort | rar -v oldarch >newarch FILES none SEE ALSO ar - archive file maintainer DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- ratfor 22889 asc 02-apr-82 17:59:11 v1.1 (sw-tools v1.1) Ratfor (1) 21-Dec-81 Ratfor (1) NAME Ratfor - RatFor preprocessor SYNOPSIS ratfor [file] ... >outfile DESCRIPTION Ratfor translates the ratfor programs in the named files into Fortran. If no input files are given, or the filename '-' appears, the standard input will be read. A file containing general purpose software tools definitions (e.g. EOF, EOS, etc.) will be automatically opened and processed before any of the files specified are read. Syntax: Ratfor has the following syntax: prog: stmt prog stmt stmt: if (expr) stmt if (expr) stmt else stmt while (expr) stmt repeat (expr) stmt repeat stmt until (expr) for (init clause; test expr; incr clause) stmt do expr stmt do n expr stmt break break n next next n return (expr) select (expr) { case expr: stmt ... default: stmt } digits stmt { prog } or [ prog ] other other: anything unrecognizable (i.e. fortran) clause: other {mother} or [mother] mother: other other; mother where 'stmt' is any Fortran or Ratfor statement. A statement -1- Ratfor (1) 21-Dec-81 Ratfor (1) is terminated by an end-of-line or a semicolon. Character Translation: The following character translations are performed: < .lt. <= .le. == .eq. != .ne. ^= .ne. ~= .ne. >= .ge. > .gt. | .or. & .and. ! .not. ^ .not. ~ .not. Included files: The statement include file or include "file" will insert the contents of the specified file into the ratfor input in place of the 'include' statement. Quotes must surround the file name if it contains characters other than alphanumerics or underscores. Macro Definitions: The statement define(name,replacement text) defines 'name' as a macro which will be replaced with the indicated text when encountered in the source files. Any occurrences of the strings '$n' in the replacement text, where 1 <= n <= 9, will be replaced with the nth argument when the macro is actually invoked. For example: define(bump, $1 = $1 + 1) will cause the source line bump(i) to be expanded into i = i + 1 -2- Ratfor (1) 21-Dec-81 Ratfor (1) The names of macros may contain letters, digits and underline characters, but must start with a letter. Upper case is not equivalent to lower case in macro names. The replacement text is copied directly into the lookup table with no intepretation of the arguments, which differs from the procedure used in the macro utility. This "deferred evaluation" has the effect of eliminating the need for bracketing strings to get them through the macro processor unchanged. A side effect of the deferred evaluation is that defined names cannot be forced through the processor - i.e. the string "define" will never be output from the preprocessor. The inequivalence of upper and lower case in macro names may be used in this case to force the name of a user defined macro onto the output - i.e. if the user has defined a macro named mymac, the replacement text may contain the string MYMAC, which is not defined, and will pass through the processor. (For compatibility, an "mdefine" macro call has been included which interprets definitions before stacking them, as does the macro tool. When using this version, use "$(" and "$)" to indicate deferred evaluation, rather than the "[" and "]" used by the macro tool.) In addition to define, four other built-in macros are provided: arith(x,op,y) performs the "integer" arithmetic specified by op (+,-,*,/) on the two numeric operands and returns the result as its replacement. incr(x) converts the string x to a number, adds one to it, and returns the value as its replacement (as a character string). ifelse(a,b,c,d) compares a and b as character strings; if they are the same, c is pushed back onto the input, else d is pushed back. substr(s,m,n) produces the substring of s which starts at position m (with origin one), of length n. If n is omitted or too big, the rest of the string is used, while if m is out of range the result is a null string. Note: the statement define name text may also be used, but will not always perform correctly for macros with parameters or multi-line replacement text. The functional form is preferred. -3- Ratfor (1) 21-Dec-81 Ratfor (1) Conditional Preprocessing: The statements ifdef(macro) ifnotdef(macro) . . . . . . elsedef elsedef . . . . . . enddef enddef conditionalize the preprocessing upon whether the macro has been previously defined or not. The `elsedef' portions of the conditionals may be omitted, if desired. The conditional bodies may be nested, up to 10 levels deep. String Data Types: The statements string name "character string" or string name(size) "character string" declare 'name' to be a character array long enough to accomodate the ascii codes for the given character string, one per array element. The array is then filled by data statements. The last word of 'name' is initialized to the symbolic parameter EOS, and indicates the end of a string. EOS must be defined either in the standard definitions file or by the user. If a size is given, name is declared to be a character array of 'size' elements. If several string declarations appear consecutively, the generated declarations for the arrays will precede the data statements that initialize them. The normal escape sequences are supported in strings; in addition, to embed a quote (") in the string, one must type @". String Literals: Conversion of in-line quoted strings to hollerith constants is performed in the following manner: "str" nHstr (where 'n' is the number of characters in str) -4- Ratfor (1) 21-Dec-81 Ratfor (1) String literals can be continued across line boundaries by ending the line to be continued with an underline. The underline is not included as part of the literal. Leading blanks and tabs on the next line are ignored. If a quote (") is to be embedded in an hollerith string, one must type, for example, "@"" ==> 1h". Character Literals: Character constants of the form 'c' are converted to the decimal integer representation of that character in the ASCII character set. For example: call putc('!') would become call putc(33) The normal escape characters are supported as character constants. For example '@n' is a NEWLINE (10). Integer Constants: Integer constants in bases other than decimal may be specified as n%dddd... where 'n' is a decimal number indicating the base and 'dddd...' are digits in that base. For bases > 10, letters are used for digits above 9. Examples include: 8%77 (=63), 16%2ff (=767), 2%0010011 (=19). The number is converted to the equivalent decimal value using multiplication; this may cause sign problems if the number has too many digits. Lines and Continuation: Input is free-format; that is, statements may appear anywhere on a line, and the end of the line is generally considered the end of the statement. However, lines ending in special characters such as comma, +, -, and * are assumed to be continued on the next line. An exception to this rule is within a condition; the line is assumed to be continued if the condition does not fit on one line. Explicit continuation is indicated by ending a line with an underline character (_). The underline character is not copied to the output file. -5- Ratfor (1) 21-Dec-81 Ratfor (1) Comments: Comments are preceded by '#' signs and may appear anywhere in the code. Literal (unprocessed) Lines: Lines can be passed through ratfor without being processed by putting a percent "%" as the first character on the line. The percent will be removed and the line shifted one position to the left, but otherwise will be output without change. Macro invocations, long names, etc., appearing in the line will not be processed. CHANGES This ratfor preprocessor differs from the original (as released by Kernighan and Plauger) in the following ways: The code has been rewritten and reorganized. Hash tables have been added for increased efficiency in searching for macro definitions and Ratfor keywords. The 'string' declaration has been included. The define processor has been augmented to support macros with arguments. Conditional preprocessing upon the definition (or lack therof) of a symbol has been included. Many extraneous gotos have been avoided. Blanks have been included in the output for increased readability. Multi-level 'break' and 'next' statements have been included. The Fortran 'DO' is allowed, as well as the ratfor one. The capability of specifying integer constants in bases other than decimal has been added. Underscores have been allowed in names. The 'define' syntax has been expanded to include the form: -6- Ratfor (1) 21-Dec-81 Ratfor (1) define name value The 'return(value)' feature has been added. Quoted file names following 'include' statements have been added to allow for special characters in file names. A method for allowing lines to pass through un-processed has been added. Continuation lines have been implemented. Brackets have been allowed to replace braces (but NOT $( and $) ) Character constants are now supported. Groups of FORTRAN statements are permitted in the init and re-init clauses of the for statement. FILES A generalized definition file (e.g. 'symbols') is automatically opened and read. SEE ALSO Kernighan and Plauger's "Software Tools" Kernighan's "RATFOR - A Preprocessor for a Rational Fortran" The Unix command rc in the Unix Manual The tools 'incl' and 'macro' DIAGNOSTICS (The errors marked with asterisk '*' are fatal; all others are simply warning messages.) * arg stack overflow The argument stack for the macro processor has been exceeded. The size of the stack is determined by the symbol ARGSIZE in the source definitions file. * buffer overflow One of the preprocessor's internal buffers overflowed, possibly, but not necessarily, because the string buffers were exceeded. The definition SBUFSIZE in the preprocessor symbols file determines the size of the string buffers. * call stack overflow The call stack (used to store call frames) in the macro processor has been exceeded. The definition CALLSIZE in the source definition file determines the size of this stack. -7- Ratfor (1) 21-Dec-81 Ratfor (1) can't open standard definitions file The special file containing general purpose ratfor definitions could not be opened, possibly because it did not exist or the user did not have access to the directory on which it resides. can't open include File to be included could not be located, the user did not have privilege to access it, or the file could not be opened due to some problem in the local primitives. * definition too long The number of characters in the name to be defined exceeded Ratfor's internal array size. The size is defined by the MAXTOK definition in the preprocessor symbols file. * EOF in string The macro processor detected an EOF in the current input file while evaluating a macro. * evaluation stack overflow The evaluation stack for the macro processor has been exceeded. This stack's size is determined by the symbol EVALSIZE in the source definition file. * for clause too long The internal buffer used to hold the clauses for the 'for' statement was exceeded. Size of this buffer is determined by the MAXFORSTK definition in the preprocessor symbols file. * getdef is confused There were horrendous problems when attempting to access the definition table illegal break Break did not occur inside a valid "while", "for", or "repeat" loop illegal else Else clause probably did not follow an "if" clause illegal next "Next" did not occur inside a valid "for", "while", or "repeat" loop illegal right brace A right brace was found without a matching left brace * in dsget: out of dynamic storage space There is insufficient memory for macro definitions, etc. Increase the MEMSIZE definition in the preprocessor. includes nested too deeply There is a limit to the level of nesting of included files. It is dependent upon the maximum number of opened files allowed at a time, and is set by the NFILES definition in the preprocessor symbols file. invalid for clause The "for" clause did not contain a valid init, condition, and/or increment section -8- Ratfor (1) 21-Dec-81 Ratfor (1) invalid string size The string format 'string name(size) "..."' was used, but the size was given improperly. * missing comma in define Definitions of the form 'define(name,defn)' must include the comma as a separator. missing function name There was an error in declaring a function missing left paren A parenthesis was expected, probably in an "if" statement, but not found missing parenthesis in condition A right parenthesis was expected, probably in an "if" statement, but not found missing quote A quoted string was not terminated by a quote missing right paren A right parenthesis was expected in a Fortran (as opposed to Ratfor) statement but not found missing string token No array name was given when declaring a string variable * non-alphanumeric name Definitions may contain only alphanumeric characters and underscores. * stack overflow in parser Statements were nested at too deep a level. The stack depth is set by the MAXSTACK definition in the preprocessor symbols file. token too long A token (word) in the source code was too long to fit into one of Ratfor's internal arrays. The maximum size is set by the MAXTOK definition in the preprocessor symbols file. * too many characters pushed back The source code has illegally specified a Ratfor command, or has used a Ratfor keyword in an illegal manner, and the parser has attempted but failed to make sense out of it. The size of the push-back buffer is set by BUFSIZE in the preprocessor symbols file. unbalanced parentheses Unbalanced parentheses detected in a Fortran (as opposed to Ratfor) statement unexpected brace or EOF A brace occurred after a Fortran (but not Ratfor) statement or an end-of-file was reached before the end of a statement unexpected EOF An end-of-file was reached before all braces had been accounted for. This is usually caused by unmatched braces somewhere deep in the source code. -9- Ratfor (1) 21-Dec-81 Ratfor (1) warning: possible label conflict This message is printed when the user has labeled a statement with a label in the 23000-23999 range. Ratfor statements are assigned in this range and a user-defined one may conflict with a Ratfor-generated one. "file": cannot open Ratfor could not open an input file specified by the user on the command line. AUTHORS Original by B. Kernighan and P. J. Plauger, with rewrites and enhancements by David Hanson and friends (U. of Arizona), Joe Sventek and Debbie Scherrer (Lawrence Berkeley Laboratory), and Allen Akin (Georgia Institute of Technology). BUGS/DEFICIENCIES Missing parentheses or braces may cause erratic behavior. Eventually Ratfor should be taught to terminate parenthesis/brace checking at the end of each subroutine. Although one bug was fixed which caused line numbers in error messages to be incorrect, they still aren't quite right. (newlines in macro text are difficult to handle properly). Use them only as a general area in which to look for errors. Extraneous 'continue' statements are generated within Fortran 'do' statements. The 'next' statement does not work properly when used within Fortran 'do' statements. There is no way to explicitly cause a statement to begin in column 6 (i.e. a Fortran continued statement), although implicit continuation is performed. Ratfor is very slow, principally in the lexical analysis, character input, and macro processing routines (in that order). Attempts to speed it up should concentrate on the routines 'gtok', 'ngetch', and 'deftok'. An even better approach would be to re-work the lexical analyzer and parser completely. -10- #-h- rev 592 asc 02-apr-82 17:59:18 v1.1 (sw-tools v1.1) Rev (1) 11-Jul-79 Rev (1) NAME Rev - reverse lines SYNOPSIS rev [file] ... DESCRIPTION Rev copies the named files to the standard output, reversing the order of the characters in every line. If no files are given, or the filename '-' is specified, rev reads from the standard input. AUTHORS David Hanson and friends (U. of Arizona) DIAGNOSTICS BUGS/DEFICIENCIES -1- #-h- rc 2283 asc 02-apr-82 17:59:19 v1.1 (sw-tools v1.1) Rc (1) 12-Aug-81 Rc (1) NAME Rc - RatFor compiler SYNOPSIS rc [-cdforv] [-l[libr]] [-pproc] file ... DESCRIPTION rc is the ratfor compiler. It accepts the following types of arguments: 1. Files whose names end in '.r' are assumed to be ratfor source programs; they are preprocessed into fortran and compiled. The preprocessed file for name.r is placed on name.f and the compiled object code appears on name.obj. The name.f file is removed unless -f is specified (see below). 2. Six flags which affect the actions of the compiler are: -c suppress the loading phase, as does any preprocessing or compilation error -d do whatever is necessary to prepare the fortran files for the system debugger. In addition, pass the -d on to fc. -r ratfor only; don't compile fortran; implies -f and -c -f save fortran intermediate files; usually for debugging purposes -v verbose option; prints name of each file as it is preprocessed and prints name of each '.f' file as it is compiled -o generates fortran listing for name.f on name.l 3. Files whose names end in '.f' are assumed to be fortran source programs, and are compiled. Other arguments are assumed to be loader flags, or object files, typically created by an earlier rc or fc run. These files, together with the results of any compilations, are loaded to produce an executable process. SEE ALSO ratfor, the ratfor preprocessor, for descriptions of the language and for a more general way of performing the preprocessing. fc, the fortran compiler ld, the loader, for loader flags and process naming conventions AUTHORS Joe Sventek wrote the interface of rc to ratfor, fc, and ld. BUGS/DEFICIENCIES -1- #-h- ruler 747 asc 02-apr-82 17:59:20 v1.1 (sw-tools v1.1) Ruler (1) 29-Oct-80 Ruler (1) NAME Ruler - display ruler on terminal screen SYNOPSIS ruler [n] DESCRIPTION ruler displays a ruler on the terminal. This is especially useful when using field or other utilities which require knowledge of the column positions of portions of the screen. The optional numeric argument indicates how many columns to format in the ruler. FILES SEE ALSO field - utility for field manipulation sort - file sorter DIAGNOSTICS AUTHORS Dave Martin BUGS/DEFICIENCIES -1- #-h- rm 1206 asc 02-apr-82 17:59:21 v1.1 (sw-tools v1.1) Rm (1) 29-Oct-81 Rm (1) NAME Rm - remove files SYNOPSIS rm [-fiv] [file] ... DESCRIPTION rm removes the files specified. If none are specified and standard input is not a terminal, `rm' reads the names of the files to delete from the standard input. The options are: -v (verbose) display each file's name as it is deleted -f (force) attempt deletion regardless of protection -i (interactive) prompt for confirmation before deleting unless the "-f" option is in effect. If a file is protected from delete access, you are asked if you want to try anyway. If you respond with a "y", rm will try to unprotect the file and then delete it. FILES SEE ALSO The Unix command 'rm' DIAGNOSTICS A message is printed if the file could not be removed. AUTHORS Joe Sventek (DEC machines); Debbie Scherrer (CDC machines) The "-f" and "-i" options were added by Dave Martin. BUGS/DEFICIENCIES -1- #-h- sched 1108 asc 02-apr-82 17:59:22 v1.1 (sw-tools v1.1) Sched (1) 29-Oct-80 Sched (1) NAME Sched - a way to repetitively invoke a command SYNOPSIS sched [-r] [-t] "shell command" DESCRIPTION sched causes the command typed in quotes to be repetitively invoked. The defaults are to invoke the command once, and to wait 1 second before each invocation. This utility is quite nice for statistics gathering, since sched may be run in the background, with the diagnostic output being appended to some log file. For example: % sched -r144 -t600 "who | lcnt >>usrcnt" would generate a log of the number of users on the system for one day, running at 10-minute intervals. The resulting list of numbers could then be fed to a suitable analysis or plotting program. FILES SEE ALSO DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- sepfor 1788 asc 02-apr-82 17:59:23 v1.1 (sw-tools v1.1) Sepfor (1) 22-Dec-81 Sepfor (1) NAME Sepfor - Split FORTRAN programs into multiple files SYNOPSIS sepfor [-v] file ... DESCRIPTION Sepfor is useful for cracking large FORTRAN programs into separate files. Each subroutine or function is placed in a file of the same name. Names are stripped of any ``$'' and ``_'' characters they may contain. The main program (which is assumed to precede the subroutines in the source file) is named ``main'' where is the number of the file argument. In most cases there is only one file specified and the main program is thus named ``main1''. If the ``-v'' (verbose) option is specifed, Sepfor echoes the name of each routine on STDOUT as it is processed. EXAMPLES sepfor -v spice.for FILES none IMPLEMENTATION Sepfor decides it has found a subroutine when it finds the keyword ``subroutine'' as the first word on a line. It decides it has found a function when it finds the keyword ``function'' as the the second OR third word on a line. The name is taken to be the first word following the keyword. Sepfor decides it has found the end of a module when it discovers the keyword ``end'' at the beginning of a line and it does NOT find the keyword ``do'' or ``if'' immediately thereafter. AUTHORS Dave Martin (Hughes Aircraft) BUGS/DEFICIENCIES Sepfor does not recognize ENDDO or ENDIF; you must separate the keywords with a blank. -1- #-h- sleep 784 asc 02-apr-82 17:59:24 v1.1 (sw-tools v1.1) Sleep (1) 29-Oct-80 Sleep (1) NAME Sleep - cause process to suspend itself for a period of time SYNOPSIS sleep seconds DESCRIPTION sleep causes the process to suspend itself for the indicated number of seconds. This facility is generally useful when sending formatted output to a high-quality terminal, and you need time to change the paper from the time you invoke the command until it starts printing on the good paper. FILES SEE ALSO sched - a way to repetitively invoke a command DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- sedit 6065 asc 02-apr-82 17:59:26 v1.1 (sw-tools v1.1) Sedit (1) 30-Nov-79 Sedit (1) NAME Sedit - stream editor SYNOPSIS sedit [-n] {[-e script | -f sfile]... | script} [file]... DESCRIPTION sedit copies the named input files to the standard output, performing editing as directed by sedit commands in "script" or in "sfile". The -e flag indicates that the next argument is to be interpreted as an sedit command (see below). The -f flag indicates that the next argument is the name of a file in which sedit commands appear one per line. The -e and -f arguments may be intermixed in any order. The order of command execution is the order in which commands are read. If no -e or -f flags are given, the first argument is used as an sedit command. Normally, sedit writes each line of input to the output after editing; the -n option suppresses this action. As a result, the only output is that resulting from sedit commands. When the first argument not in the scope of a flag is encountered, it and all succeeding arguments are taken as input files. If no files are given, or if the name "-" is specified, the standard input is read. Sedit commands have the general form line1 [, line2] command arguments A line number (line1 or line2) is either a decimal number that refers to a specific input line (input lines are counted cumulatively across files), a "$" that refers to the last line of input, or a /pattern/ where pattern is a regular expression (as in edit). Line number 0 may be used to specify commands that should be executed before any input is read. A command with no line numbers is applied to every line of input. A command with one line number is applied to every line of input that matches the line number. A command with two line numbers is applied to every line of input beginning with the first line that matches line1 through the next line that matches line2. Thereafter, the process is repeated, looking again for a line that matches line1. Sedit accepts the following commands. Each command may be used with 0, 1, or 2 line numbers. The a, c, and i commands may not appear in command line scripts. a . -1- Sedit (1) 30-Nov-79 Sedit (1) Append. The is placed on the output after each selected line. The does not change the line number nor is it subject to subsequent sedit commands. c . Change. The selected lines are deleted and is placed on the output in their place. The does not change the line number nor is it subject to subsequent sedit commands. d Delete. The selected lines are deleted. i . Insert. The is placed on the output before each selected line. The does not change the line number nor is it subject to subsequent sedit commands. p Print. The selected lines are printed on the standard output. r file Read file. The contents of "file" are placed on the output after each selected line exactly as if the contents were given as in an a command. The new lines do not change the line number nor are they subject to subsequent sedit commands. s/pat/new/gp Substitute. The leftmost occurrences of pat in the selected lines is changed to new. If g is specified, all occurrences are changed. If p is specified, the resulting line is printed. w file Write file. The selected lines are appended to "file". Files mentioned in w commands are created before processing begins. The limit on the number of w commands depends on the number of files that can be opened at the same time. = Print line number. The current line number is printed on the output as a line. Text appended by a, c, or r commands is placed on the output in -2- Sedit (1) 30-Nov-79 Sedit (1) the same order as the execution of the commands. Similar comments apply to text inserted by i commands. Sedit can accomodate commands totaling approximately 5000 characters (including arguments), and lines up to 120 characters in length. SEE ALSO edit, change, find, tr DIAGNOSTICS In addition to the usual error messages resulting from file access failure, sedit issues the following messages preceeding by the offending command line. bad line numbers indicates that the line number expressions are invalid. invalid command indicates that the command preceeding the message is illegal. This message is issued for a, i, or c commands if they appear in command string scripts. too many commands indicates exhaustion of space to hold commands. The size of the command buffer is determined by the MAXBUF definition in the source code. AUTHORS Chris Fraser (U. of Arizona) BUGS/DEFICIENCIES The '$' indicator for end-of-file doesn't always work. -3- #-h- split 896 asc 02-apr-82 17:59:28 v1.1 (sw-tools v1.1) Split (1) 11-Jan-79 Split (1) NAME Split - split a file into pieces SYNOPSIS split [-n] [file [name] ] DESCRIPTION Split reads `file' and writes it in n-line pieces (default 1000), as many as necessary, onto a set of output files. The name of the output file is `name' with `aa' appended, and so on lexicographically. If no output name is given, `x' is default. If no input file is given, or if - is given in its stead, then the standard input file is used. FILES SEE ALSO The Unix command 'split' DIAGNOSTICS A message is printed if the input file could not be opened. AUTHORS Debbie Scherrer BUGS/DEFICIENCIES -1- #-h- spell 1271 asc 02-apr-82 17:59:29 v1.1 (sw-tools v1.1) Spell (1) 11-Jan-79 Spell (1) NAME Spell - find spelling errors SYNOPSIS spell [-ddictname] [file] ... DESCRIPTION Spell copies the named files (or standard input if none are specified) to standard output while looking up each word in a dictionary. If any spelling errors are found in a particular line, an additional line will be printed immediately following the line with asterisks (*) beneath the offending words. If the -d switch is used, `spell' will use the files `dictname' and `dictname'dx for the dictionary and index. FILES dict - a dictionary file dictdx - the index generated by isam for the dictionary SEE ALSO isam - generate an index for pseudo-indexed-sequential access ospell - the script pipeline suggested in K&P for spelling errors DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES This is a skeleton spelling error detector. It is expected that various modifications to flesh it out will be performed for local use. -1- #-h- tail 960 asc 02-apr-82 17:59:30 v1.1 (sw-tools v1.1) Tail (1) 26-Aug-79 Tail (1) NAME Tail - print last lines of a file SYNOPSIS tail [-n] [file] ... DESCRIPTION Tail prints the last "n" lines of the indicated file. If 'n' is omitted, the last 23 lines are printed. If "file" is omitted or is "-", tail reads the standard input. SEE ALSO split AUTHORS David Hanson and friends (U. of Arizona) BUGS/DEFICIENCIES An internal buffer of MAXBUF characters is kept. If the value of "n" would require buffering more characters than the buffer can hold, tail prints the last MAXBUF characters of the file. In this case, the first line of output may not be an entire line. MAXBUF is a definition in the source code which may be adjusted. -1- #-h- sort 5029 asc 02-apr-82 17:59:32 v1.1 (sw-tools v1.1) Sort (1) 14-Apr-78 Sort (1) NAME Sort - sort and/or merge text files SYNOPSIS sort [-bdfimr] [+ofile] [+sn] [file] ... DESCRIPTION Sort sorts lines of all the named files together and writes the result on the standard output. The name '-' means the standard input. The standard input is also used if no input file names are given. Thus sort may be used as a filter. The sort key is an entire line. Default ordering is alphabetic by characters as they are represented in ASCII format. The ordering is affected by the following flags, one or more of which may appear. -b Leading blanks are not included in keys. -d 'Dictionary' order: only letters, digits and blanks are significant in comparisons. -f Fold all letters to a single case. -i Ignore all nonprinting nonblank characters. -m Merge only, the input files are already sorted. -r Reverse the sense of the sort +o Cause final output to be placed on `file'. This permits one of the input files to be the output file. This switch is necessary since using the redirection `>file' will cause `file' to be unreadable when `sort' is generating the initial runs. +sn Sort according to the subfield starting on column n FILES A series of scratch files are generated and subsequently deleted. Presently the files are named "STn" where "n" is a sequence number. SEE ALSO The Unix command "sort" in the Unix User's Manual. DIAGNOSTICS A message is printed if a file cannot be located. -1- Sort (1) 14-Apr-78 Sort (1) AUTHORS Original design from Kernighan and Plauger's "Software Tools", with modifications by Debbie Scherrer. The external merge phase of sort was completely rewritten by Joe Sventek. BUGS/DEFICIENCIES The merge phase is performed with a polyphase merge/sort algorithm, which requires an end-of-run delimiter on the scratch files. The one chosen is a bare ^D(ASCII code 4) on a line. If this is in conflict with your data files, the symbol CTRLD in sortsym should be redefined and sort built again. Eventually all the Unix "sort" flags should be implemented. These include: sort [-mubdfinrtx] [+pos] [-pos] [-o file] [file] ... The additional flags are: n An initial numeric string, consisting of optional minus sign, digits and optionally included decimal point, is sorted by arithmetic value. tx Tab character between fields is x. +pos -pos Selected parts of the line, specified by +pos and -pos, may be used as sort keys. Pos has the form m.n optionally followed by one or more of the flags bdfinr, where m specifies a number of fields to skip, n a number of characters to skip further into the next field, and the flags specify a special ordering rule for the key. A missing .n is taken to be 0. +pos denotes the beginning of the key; -pos denotes the first position after the key (end of line by default). Later keys are compared only when all earlier keys compare equal. Note: The first field of a line is numbered zero. When no tab character has been specified, a field consists of nonblanks and any preceding blanks. Under the -b flag, leading blanks are excluded from a field. When a tab character has been specified, fields are strings separated by tab characters. Lines that otherwise compare equal are ordered with all bytes significant. -o The next argument is the name of an output file to use instead of the standard output. This file may be the same as one of the inputs, except under the merge flag -m. {Note--it is not clear why this flag is needed.] -2- Sort (1) 14-Apr-78 Sort (1) -u Suppress all but one in each set of contiguous equal lines. Ignored bytes and bytes outside keys do not participate in this comparison. -3- #-h- sndmsg 2557 asc 02-apr-82 17:59:34 v1.1 (sw-tools v1.1) Sndmsg (1) 11-Nov-81 Sndmsg (1) NAME Sndmsg - utility for sending mail to other users SYNOPSIS sndmsg DESCRIPTION `sndmsg' is the utility used to send mail to other users of the mail system. The user is prompted for all of the necessary input in the following manner: 1. The list of To addresses. 2. The list of Cc (carbon copy) addresses 3. The subject of the message 4. The body of the message The responses to the To and Cc prompts consist of user-names separated by commas. If it is necessary to continue the list of addresses onto another line, a comma typed at the end of the line causes `sndmsg' to prompt for another line of addresses. If the string `all' is typed as an address, all users of the mail system will receive a copy of the message. If the address consists of `', `?', `>>', `??', (and sometimes `-'). An argument of the form `name' causes file `name' to be used as the standard output. An argument of the form `?name' causes the file `name' to be used as the standard error output. Arguments of the form `>>name' or `??name' cause program output to be appended to `name' for standard output or error output respectively. If `name' does not exist, it will be created. Most tools have the capability to read their input from a series of files. In this case, the list of files overrides reading from standard input. However, many of the tools allow you to read from both a list of files and from input by specifying the filename `-' for standard input. For example: format file1 - file2 would read its input from `file1', then from the standard input, then from `file2'. o FILTERS AND PIPES The output from one command may be directed to the input of another. A sequence of commands separated by vertical bars (`|') or carets (`^') causes the shell to arrange that the standard output of each command be delivered to the standard input of the next command in sequence. Thus in the command line: sort list | uniq | crt `Sort' sorts the contents of file `list'; its output is passed to `uniq', which strips out duplicate lines. The output from `uniq' is then input to `crt', which prepares the lines for viewing on your crt terminal. The vertical bar is called a `pipe'. Programs such as `sort', `uniq', and `crt', which copy standard input to standard output (making some changes along the way) are called `filters'. -2- Sh (1) 27-Jul-81 Sh (1) o COMMAND SEPARATORS Commands need not be on different lines; instead they may be separated by semicolons: ar t file; ed The above command will first list the contents of the archived file `file', then enter the editor. The shell also allows commands to be grouped together with parentheses, where the group can then be used as a filter. For example: (date; cat chocolate) | comm vanilla writes first the date and then the file `chocolate' to standard output, which is then read as input by `comm'. This tool compares the results with existing file `vanilla' to see which lines the two files have in common. o MULTITASKING On many systems the shell also allows processes to be executed in the background. If a command is followed by `&', the shell will not wait for the command to finish before prompting again; instead, it is ready immediately to accept a new command. For instance: ratfor ambrose >george & preprocesses the file `ambrose', putting the output on `george'. No matter how long the compilation takes, the shell returns immediately. The identification number of the process running that command is printed. This identification may be used to wait for the completion of the command or to terminate it. The `&' may be used several times in a line. Parentheses and pipes are also allowed (within the same background process). o SCRIPT FILES The shell itself is a command, and may be called recursively, either implicitly or explicitly. This is primarily useful for executing files containing lines of shell commands. For instance, suppose you had a file named `nbrcount.sh' which looked like this: -3- Sh (1) 27-Jul-81 Sh (1) echo "Counting strings of digits" tr $4 ar u loveletters $4 Then, executing the command: private Dan John Harold fair would merge the files `Dan', `John', and `Harold', encrypt them, and store them away in an archive under the name `fair'. Script files may be used as filters in pipelines just like regular commands. Script files sometimes require in-line data to be available to them. A special input redirection notation `<<' is used to achieve this effect. For example, the editor normally takes its commands from the standard input. However, within a shell procedure commands could be embedded this way: ed file <', where is the character one needs to type in conjunction with the CTRL key to generate the control character. !b[rowse] [n][l] This command is a synonym for history. It is included to increase the similiarity of function with the editor. -1- Hsh (1) 2-May-81 Hsh (1) 2. history recall ![line_number][;line_number]... This command permits the recall of a command from the history for re-execution. The command so recalled is displayed to the user and then passed on to the shell for execution. This command is then entered at the bottom of the history. Valid line_numbers are the same as those for the editor. For example, a line_number may be the number listed next to the command in the history display, a pattern of the form "\pattern[\]", which indicates a backward search in the 25 line history window, or a pattern of the form "/pattern[/]", indicating a search forward, wrapping to the start of the 25 line window. The trailing '\' or '/' are optional when specifying a single pattern. The semi-colon syntax is the same as that in `ed', indicating that the search for the second pattern is to start at the line where the first pattern was found. If the pattern specified was illegal, or a line matching the pattern could not be found, or an invalid line_number was specified, a comment is displayed to the user # invalid line number and the user is prompted for more input. The history is not modified in this case. All sequences of patterns resolve into a single line number. It is not possible to request a range of lines from the history. It should be noted that the line_numbering is completely regular with `ed'. In particular, "!" followed by nothing maps into a fetch of the current line (last command typed). See the writeup on `ed' for more details on the specification of line_numbers. 3. history recall and modification ![line_number]s/pat/repl[/[g]] Upon successfully recalling a command from the history, it may be modified before it is passed on to `hsh' for execution. This is performed with the 's' command, which is exactly the same as that for `ed'. The delimiters for -2- Hsh (1) 2-May-81 Hsh (1) `pat' and `repl' may be any character, the remembered pattern feature is available, and the trailing delimiter after the replacement pattern is optional. The optional trailing 'g' indicates substitution for all occurrences of 'pat' in the line. See the `ed' manual entry for more information on the substitute command. If the substitution fails for any reason, a comment is displayed to the user # illegal substitution and the user is prompted for more input. The history is not modified in this case. 4. history archiving !w[rite] [>[>]]file This command permits the user to archive (save) the entire transcript of activity to a file. It also passes an EOF to `hsh', which causes `hsh' to terminate execution. The commands !w file !w >file both cause `file' to be overwritten with the transcript, while >>file causes the transcript to be appended to `file'. It should be noted that the !w command causes ALL of the input given to `hsh' in this session to be saved, not just the current 25 line window. It also passes an EOF to `hsh', which will terminate execution. 5. history deletion !q[uit] ^Z These commands cause an EOF to be sent to `hsh' and the deletion of the log of activity. -3- Hsh (1) 2-May-81 Hsh (1) Lines consisting solely of a carriage return are NOT logged in the history. If the user needs to perform several edits on a command before having it executed, he can exploit the fact that lines beginning with a sharp (#) are comments to the shell. For example: !\%ed\s/%/#/ !s/pat1/repl1/ . . . . . . !s/patn/repln/ !s/%#// All of the intermediate comment lines will be placed in the history, displacing other lines from the window which may possibly be needed. Of course, it may be simpler in such cases to just enter the command by hand. FILES Creates a scratch file ~tmp/pid.log for the command transcript. SEE ALSO sh - command line interpreter esh - shell with file recognition and RAW tty I/O ed - text editor DIAGNOSTICS # invalid line number # invalid substitution AUTHORS Joe Sventek BUGS/DEFICIENCIES -4- #-h- ul 1090 asc 02-apr-82 17:59:55 v1.1 (sw-tools v1.1) Ul (1) 18-Aug-81 Ul (1) NAME Ul - convert backspaces into multiple lines for "terminals" SYNOPSIS ul [file] ... DESCRIPTION ul (underline) converts lines with BACKSPACE-UNDERLINE pairs into two lines; one with the text and one with only BLANK and UNDERLINE characters. These two lines are output separated by a CR with no associated LF. This approach works with printing terminals and some line printers, most notably Printronix and Trilog. If no files are given, or the filename '-' appears, input is taken from the standard input. FILES SEE ALSO lpr - queue file to line printer os - process overstrikes for "printers" DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Paul Johnstone (Hughes Aircraft) BUGS/DEFICIENCIES -1- #-h- tr 3071 asc 02-apr-82 17:59:56 v1.1 (sw-tools v1.1) Tr (1) 6-Jul-78 Tr (1) NAME Tr - transliterate characters SYNOPSIS tr from [to] DESCRIPTION tr copies the standard input to the standard output with substitution or deletion of selected characters. Input characters found in `from' are mapped into the corresponding characters of `to'. Ranges of characters may be specified by separating the extremes by a dash. For example, a-z stands for the string of characters whose ascii codes run from character a through character z. If the number of characters in `from' is the same as in `to', a one to one corresponding translation will be performed on all occurrences of the characters in `from'. If the number of characters in `from' is more than in `to', the implication is that the last character in the `to' string is to be replicated as often as necessary to make a string as long as the `from' string, and that this replicated character should be collapsed into only one. If the `to' string is missing or empty, "TR" will take this condition as a request to delete all occurrences of characters in the `from' string. "TR" differs from the tool "CH" since it deals only with single characters or ranges of characters, while "CH" deals with character strings. For example tr xy yx would change all x's into y's and all y's into x's, whereas ch xy yx change all the patterns "xy" into "yx". One of the most common functions of "TR" is to translate upper case letters to lower case, and vice versa. Thus, tr A-Z a-z would map all upper case letters to lower case. Users of systems which cannot pass both upper and lower case characters on a command line should remember to include the appropriate escape flags. FILES none SEE ALSO Tools "find" and "ch". The "Software Tools" book, p.51-61. The "UNIX Programmer's Manual", p. TR(I). -1- Tr (1) 6-Jul-78 Tr (1) DIAGNOSTICS "usage: tr from [to]." The command line passed to transit is in error. "from: too large." The string for "from" is too large. Current limit is 100 characters including E0S. "to: too large." The string for "to" is too large. Current limit is 100 characters including EOS. AUTHORS Original code from Kernighan and Plaugers's "Software Tools", with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -2- #-h- tsort 2223 asc 02-apr-82 17:59:58 v1.1 (sw-tools v1.1) Tsort (1) 1-Oct-78 Tsort (1) NAME Tsort - topologically sort symbols SYNOPSIS tsort [file] ... DESCRIPTION tsort topologically sorts the symbols in the named files. If no files are specified, or the filename '-' is given, tsort reads the standard input. A symbol is considered any string of characters delimited by blanks or tabs. Each line of the input is assumed to be of the form a b c ... which states that a precedes b, a precedes c, and so on. Note that there is nothing implied about the ordering of b and c. A line consisting of a single symbol simply "declares" that symbol without specifying any ordering relations about it. The output is a topologically sorted list of symbols, one per line. For example, suppose you have trouble getting up in the morning because you can't quite remember what actions have to be performed in which order. However, you do know that the first action in the following list precedes all others on the line: set_alarm turn_off_alarm wake_up get_out_of_bed turn_off_alarm set_alarm wake_up Using tsort to sort the above list would produce the following set of actions for getting out of bed: set_alarm wake_up turn_off_alarm get_out_of_bed DIAGNOSTICS circular The input specifies a graph that contains at least one cycle. out of storage The input is too large. The size of tsort's buffer is determined by the MAXBUF definition in the source code. -1- Tsort (1) 1-Oct-78 Tsort (1) SEE ALSO sort AUTHORS David Hanson and friends (U. of Arizona) BUGS/DEFICIENCIES -2- #-h- ttt 594 asc 02-apr-82 17:59:59 v1.1 (sw-tools v1.1) Ttt (1) 15-Nov-81 Ttt (1) NAME Ttt - 3-dimensional tic tac toe SYNOPSIS ttt DESCRIPTION TTT is a 3-dimensional tic tac toe game played against the computer. The program will explain the rules. SEE ALSO The UNIX ``ttt'' program. AUTHORS Original Basic version by Joseph Roehrig. Converted to C by Dave Conroy. Converted to RatFor by Dave Martin. BUGS/DEFICIENCIES -1- #-h- uniq 947 asc 02-apr-82 18:00:00 v1.1 (sw-tools v1.1) Uniq (1) 11-Jan-79 Uniq (1) NAME Uniq - strip adjacent repeated lines from a file SYNOPSIS uniq [-c] [file] ... DESCRIPTION uniq reads the input file(s), comparing adjacent lines. Second and succeeding copies of repeated lines are removed; the remainder is written to standard output. If the '-c' flag is given, each line is preceded by a count of the number of occurrences of that line. FILES SEE ALSO The tool 'comm'; the Unix command 'uniq' DIAGNOSTICS A message is printed if an input file cannot be opened and processing is terminated. AUTHORS Originally from Kernighan and Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- txtrpl 1858 asc 02-apr-82 18:00:01 v1.1 (sw-tools v1.1) Txtrpl (1) 11-Mar-82 Txtrpl (1) NAME Txtrpl - perform generalized text replacement SYNOPSIS txtrpl patfile ... DESCRIPTION `txtrpl' provides a general way to perform text replacement (NOT regular expressions) without embedding the (text,replacement text) pairs in the source file. After loading the (text,replacement text) pairs from the named pattern files in the command line, `txtrpl' reads words from standard input, looks each word up in a lookup table, and either writes out the replacement text on standard output or the word, depending upon whether it was found in the table or not. Only a single lookup is done. Words consist of letters, digits and underline ('_') characters, starting with a letter. The form of the pattern files is quite simple; each (text,replacement text) pair occupies a line. Leading blanks on the line are ignored, the token to be scanned for is the first word found, any intevening blanks are ignored, and the replacement text is everything else up to the end of line. In the regular language expression of the tools, each line is of the form %*[A-Za-z][A-Za-z0-9_]**??*$ where represents a blank character. Case is important in the comparisons. FILES SEE ALSO macro - macro processor ed - text editor for description of regular expressions xch - extended change utility DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- wc 1083 asc 02-apr-82 18:00:02 v1.1 (sw-tools v1.1) Wc (1) 15-Feb-79 Wc (1) NAME Wc - count lines, words, and characters in files SYNOPSIS wc [-lwc] [file] ... DESCRIPTION wc prints the number of lines, words, and characters in the named files. The filename "-" specifies the standard input. A total is also printed. A "word" is any sequence of characters delimited by white space. The options -l, -w, and -c specify, respectively, that only the line, word, or character count be printed. For example, wc -lc foo prints the number of lines and characters in "foo". If no files are given, wc reads its standard input and the total count is suppressed. FILES DIAGNOSTICS name: can't open Printed when an input file can't be opened; processing ceases AUTHORS David Hanson and friends (U. of Arizona) BUGS/DEFICIENCIES -1- #-h- unrot 930 asc 02-apr-82 18:00:03 v1.1 (sw-tools v1.1) Unrot (1) 15-Jan-79 Unrot (1) NAME Unrot - unrotate lines rotated by kwic SYNOPSIS unrot [-n] [file] ... DESCRIPTION unrot processes the rotated output of 'kwic' to generate a keyword-in-context index. The -n flag may be used to specify the width of the output lines. The default is 80. If no input files are given, or the filename '-' appears, lines will be read from standard input. FILES SEE ALSO kwic; sort DIAGNOSTICS A message is printed if an input file cannot be opened; further processing is terminated. AUTHORS Original from Kernighan and Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- users 1296 asc 02-apr-82 18:00:04 v1.1 (sw-tools v1.1) Users (1) 25-Aug-80 Users (1) NAME Users - list valid mail users SYNOPSIS users [-1] DESCRIPTION users lists the valid user name to which mail may be sent on the standard output. If the standard output has been redirected to a file or pipeline, the names are listed one per line. If the standard output is to a terminal, then the names are listed in five columns across the terminal, sorted alphabetically from left to right. If single-column output is desired, the -1 switch will force a single column to the terminal. The output of users may be edited and used as a mailing list file for the utility sndmsg. FILES users uses the file "address" in the mail directory to obtain the names of valid users of the mail system. SEE ALSO sndmsg - utility to send mail msg - utility for reading and filing mail postmn - utility to check for the existence of mail resolve - utility to query information concering mail users AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- wcnt 932 asc 02-apr-82 18:00:05 v1.1 (sw-tools v1.1) Wcnt (1) 11-Jan-79 Wcnt (1) NAME Wcnt - (character) word count SYNOPSIS wcnt [file] ... DESCRIPTION wcnt counts (character) words in the named files, or in the standard input if no name appears. A word is a string of characters delimited by spaces, tabs, or newlines. wcnt could also be implemented as a shell script file: tr ' @t@n' '@n' | tr '!@n' | ccnt FILES SEE ALSO lcnt; ccnt; the Unix command 'wc' DIAGNOSTICS A message is printed if an input file could not be opened; further processing is terminated. AUTHORS Original from Kernighan and Plauger's 'Software Tools', with modifications by Debbie Scherrer. BUGS/DEFICIENCIES -1- #-h- xch 2029 asc 02-apr-82 18:00:06 v1.1 (sw-tools v1.1) Xch (1) 11-Mar-82 Xch (1) NAME Xch - extended change utility SYNOPSIS xch [-gpat] [-v] patfile ... DESCRIPTION `xch' permits several global changes to be performed during one pass over the input data. During initialization, `xch' compiles the "/pat/sub/" lines found in the one (or more) pattern files specified in the arguments list. Then, standard input is read, and the equivalent of % ch "pat" "sub" is performed on each line. Normally, the substitutions are attempted on each input line. If the `-gpat' option is selected, then the substitutions are attempted on only those lines which match `pat'. When the number of substitutions are large, this can substantially speed up the process. If the `-v' flag is specified, for each line in which a substitution has occurred, the line number, followed by the old and new lines are displayed on error output. The format of the pattern files is quite simple: each "/pat/sub/" pair occupies a single line, with the first character of the line assumed to be the delimeter character. The complete regular expression syntax is supported, such that the lines in the pattern files are exactly equivalent to the `ed' command with "s" prepended and "g" appended to the line. FILES SEE ALSO ch - change regular expressions find - find regular expressions xfind - extended find utility ed - text editor DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- Xch (1) 11-Mar-82 Xch (1) -2- #-h- xfind 1046 asc 02-apr-82 18:00:08 v1.1 (sw-tools v1.1) Xfind (1) 11-Mar-82 Xfind (1) NAME Xfind - entended find utility SYNOPSIS xfind patfile ... DESCRIPTION `xfind' permits one to search for more than 10 expressions in one pass of the standard input file. During initialization, `xfind' compiles the patterns found in the one (or more) pattern files specified in the argument list. Then, standard input is read, and each input line which matches any one of the patterns is output on standard output. The format of the pattern fils is quite simple: each line is taken to represent a single pattern. The complete regular expression syntax is supported. FILES SEE ALSO find - find regular expressions xch - extended change utility DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- xref 1811 asc 02-apr-82 18:00:09 v1.1 (sw-tools v1.1) Xref (1) 1-Jan-79 Xref (1) NAME Xref - make a cross reference of symbols SYNOPSIS xref [-b] [-f] [file] ... DESCRIPTION xref produces a cross-reference list of the symbols in each of the named files on the standard output. Each symbol is listed followed by the numbers of the lines in which it appears. If no files are given, or the file "-" is specified, xref reads the standard input. A symbol is defined as a string of letters, digits, underlines, or periods that begins with a letter. Symbols exceeding an internal limit are truncated. This limit is determined by the MAXTOK definition in the source code, and is currently set to 15. Normally, xref treats upper- and lower-case letters as different characters. The -f option causes all letters to be folded to lower-case. Normally, the line numbers specified in the symbol table are relative to the current file being processed. Specification of the `-b' flag causes `' to be added to each line number. DIAGNOSTICS out of storage The file contains too many symbols or references to fit within the current limitations of xref. The size of the buffer is determined by the MAXBUF definition in the source code. SEE ALSO axref - cross reference generator for archives AUTHORS David Hanson and friends (U. of Arizona) BUGS/DEFICIENCIES There should be a means of suppressing "junk" symbols such as "the", "a", etc. -1- #-h- chd 972 asc 02-apr-82 18:00:10 v1.1 (sw-tools v1.1) Chd (1) 12-Mar-82 Chd (1) NAME Chd - change working disk and directory from MCR SYNOPSIS chd dev:[dir] OR chd /dev/dir DESCRIPTION `chd', when installed as "...CHD", permits the user to change both disk device and directory at one time from MCR, in the same manner as the `cd' command to the shell. If the change is successful, `chd' will display the new disk and directory to the user before exiting. If the disk name is not specified, then only the directory (UIC) will be changed. Note that `chd' will NOT permit you to change to a directory (UIC) which does not exist. FILES SEE ALSO cd - change working directory DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- lsd 1100 asc 02-apr-82 18:00:11 v1.1 (sw-tools v1.1) Lsd (1) 12-Mar-82 Lsd (1) NAME Lsd - list alpha-numeric directory names SYNOPSIS lsd [-lv] [device] DESCRIPTION `lsd' lists the alpha-numeric directory names which have been established through the use of the `mkd' utility. Given the device to list (or SY: if not specified), `lsd' simply lists the full path for all known alpha-numeric directories. If the `-l' option is specified, the names are displayed in local format (ddn:[name]) instead of the default path format (/ddn/name). Specification of the `-v' option causes the corresponding UIC to be displayed to the right of the directory name. FILES ddn:[0,377]*.dir SEE ALSO mkd - establish alpha-numeric directory prd - print current alpha-numeric directory name DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- fell 1094 asc 02-apr-82 18:00:12 v1.1 (sw-tools v1.1) Fell (1) 25-Aug-80 Fell (1) NAME Fell - fell a process tree SYNOPSIS fell [process-id] ^C MCR>FELL DESCRIPTION `fell' fells the process tree hanging from `process-id'. If no `process-id' is specified, the tree growing from the shell invoked from MCR is felled. In this latter case, the user will see termination messages of the subprocesses as they are felled, followed by the shell's prompt. If the terminal is currently operating in half duplex and the bottom process in the tree is reading the terminal, the user may have to type an extra carriage return in order to cause the tree to topple. Using an escape as the terminator for the FELL command eliminates an extra MCR prompt which garbages up the screen. SEE ALSO AUTHORS fell was written by Joe Sventek -1- #-h- fc 1965 asc 02-apr-82 18:00:13 v1.1 (sw-tools v1.1) Fc (1) 12-Aug-81 Fc (1) NAME Fc - fortran compiler SYNOPSIS fc [-cdov] [-l[libr]] [-pproc] file ... DESCRIPTION fc is the fortran compiler callable from the software tools shell. It accepts the following types of arguments: 1. Files whose names end in '.f' are assumed to be fortran source programs. They are compiled, and the object file is left on a file whose name is that of the source with '.obj' substituted for '.f'. 2. Other arguments (except for the flags listed in 3 below) are assumed to be either loader flags, or object files, typically created by an earlier fc run. These programs, together with the results of any compilations, are loaded (in the order given) to produce an executable program. 3. Four flags which affect the actions of the compiler are: -c suppress the loading phase, as does any compilation error in any routine -d do whatever is necessary to prepare the object files for the system-specific debugger. This flag is passed on to `ld' if the -c switch is not specified. -o generates a fortran listing for 'file.f' on 'file.l' -v verbose option; prints name of file as it is compiled at the terminal SEE ALSO rc, the ratfor compiler, which provides a more pleasant programming dialect and environment ld, the loader, for descriptions of loader flags and process naming conventions AUTHORS Joe Sventek wrote the interface of fc to the DEC ForTran compiler. BUGS/DEFICIENCIES -1- #-h- mcrbck 1243 asc 02-apr-82 18:00:14 v1.1 (sw-tools v1.1) Mcrbck (1) 12-Mar-82 Mcrbck (1) NAME Mcrbck - spawn MCR commands in the background SYNOPSIS mcrbck "MCR command line" DESCRIPTION `mcrbck', when installed with a "...XXX" style name, permits MCR commands to be spawned in the background. This capability already exists in the shell, since any command can be spawned in the background just by appending an ampersand (&) to the command. If the spawn was successful, the command will be redisplayed to the user. If any embedded blanks are needed in the MCR command, the command must be surrounded by quotes. For example, if mcrbck is installed as "...MBK", then >mbk "pip vd3.lst=vd3:[*,*]/li" will cause the pip command to be performed in the background, permitting the requestor to continue with other work. FILES SEE ALSO sh - the writeup on the shell for information on background processing DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- ld 2039 asc 02-apr-82 18:00:15 v1.1 (sw-tools v1.1) Ld (1) 12-Aug-81 Ld (1) NAME Ld - loader SYNOPSIS ld [-dv] [-l[libname]] [-ptaskname] name ... DESCRIPTION ld links together the named modules in the order given, searches the system libraries to resolve global references and generates an executable process. ld understands three flags: -d causes `ld' to do whatever is necessary to incorporate a system-specific debugger into the image. -l signifies that the filename concatenated to the flag is a library name. -l alone stands for the ratfor system library, `rlib'. A library is searched when its name is encountered, so the placement of -l is significant. If the ratfor system library is not explicitly mentioned, it is searched after all other files have been linked. The fortran system library is searched at the very end. -p signifies that the file name concatenated to the flag is to be the process name. If this option is not specified, the process name is determined in one of two ways: 1. The first non-library file name (eg. format.obj) is found, and the file's extension is replaced by the appropriate extension for the given system (format.tsk for RSX/IAS). This is then the resulting process name. 2. Failing 1 (implying that all files listed in the argument list are libraries), the process image is placed on the file a.out, overwriting the previous contents of that file. SEE ALSO rc, fc AUTHORS Joe Sventek wrote the interface of ld to the DEC linker. BUGS/DEFICIENCIES -1- #-h- mkd 3695 asc 02-apr-82 18:00:17 v1.1 (sw-tools v1.1) Mkd (1) 12-Mar-82 Mkd (1) NAME Mkd - make alpha-numeric directory for ODS-1 SYNOPSIS mkd name g,m DESCRIPTION `mkd' permits the association of an alph-numeric name with an UIC. After this association, the tools I/O system is able to reference files as dd:[name]filespec instead of using the G,M UIC format. This association is made WITHOUT modifying any RSX-11M software, and only uses the capability of creating directory entries which point to existing files. The UIC [0,377] on the current disk (SY:) is used to keep two types of files: 1. name.dir, which has been created via the following pip command pip [0,377]name.dir=[0,0]gggmmm.dir/en This simply causes a directory entry in [0,377] to be created which points to the directory file in [0,0]. 2. mkd.cmd, which is a composite of all of the above pip commands used, to permit regeneration of the aliases after backups (see below). To make an alias for a directory, issue the following command: mkd name g,m Upon receiving the command, `mkd' performs the following steps: 1. Check to see if sy:[0,377] exists. If not, format up an UFD command to execute and display to the requestor. The user is prompted if he/she wishes to continue. If the answer is affirmative, UFD is spawned and waited for to create [0,377]. 2. Check to see if sy:[g,m] exists. If not, the procedure in 1 is repeat, only for [g,m]. 3. Format up the pip command and display to the requestor. If the user specifies that he/she wishes to continue, then the pip command to create the alias is spawned and waited for, as well as the pip command is also appended to sy:[0,377]mkd.cmd. -1- Mkd (1) 12-Mar-82 Mkd (1) The only "gotcha" to this whole procedure concerns BRU backups, since BRU does not handle multiple directory entries to the same file in a coherent fashion. This is the reason that the file sy:[0,377]mkd.cmd is kept. When doing a backup, the suggested procedure is as follows: 1. Run the following pip command >pip sy:[0,377]*.dir/rm Note the use of the "rm" switch and NOT the "de" switch, as this only removes the directory entry and NOT the directory itself, which could be critical. 2. Do whatever backups you wish. 3. After backup completion, execute the following command on the disks which been created as well as the source disk >asn ddn:=sy: >@[0,377]mkd This should be performed for each such disk. This re-establishes the aliases on the disks. This procedure is NOT needed for DSC, as it is intelligent in its handling of file aliases, whatever other faults it has. FILES sy:[0,377]mkd.cmd sy:[0,377]name.dir SEE ALSO lsd - list alpha-numeric directories prd - print current working alpha-numeric directory DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -2- #-h- mubld 2226 asc 02-apr-82 18:00:19 v1.1 (sw-tools v1.1) Mubld (1) 2-May-81 Mubld (1) NAME Mubld - build a multi-user task for RSX-11M SYNOPSIS mubld [-dv] task DESCRIPTION `mubld' builds a multi-user task for RSX-11M. It does so by manipulating the task image label blocks as discussed by Eric Levy of JPL in the April 1981 issue of the Multi-tasker. `mubld' requires one input file (`task'mu.tsk) and generates three output files (mu`task'.tsk, ro`task'.tsk and ro`task'.stb). ro`task'.tsk is a resident common containing all of the read-only code and data of `task', with ro`task'.stb being its symbol table file. mu`task'.tsk is a task image which contains the impure data of `task' and is mapped over ro`task'.tsk as a resident common for its code. To use mu`task', one must VMR a partition for ro`task' with the name ro`task' into your system image and install ro`task'.tsk into it. Then one may use mu`task' at will. A file `mushbld.cmd' is provided in [307,31] for building a multi-user version of the shell. Switches: -v Causes verbose mutterings at the user's terminal while `mubld' is working. It is suggested that one use this switch, since one of the gems of wisdom appearing on your terminal is the size of the common partition needed for ro`task'. -d Debug option: causes all files created during the run to be kept around on the current UIC. FILES `task'mu.tsk,mu`task'.tsk,ro`task'.tsk,ro`task'.stb SEE ALSO objfix - Fortran object module fixer DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES Once I get a chance to experiment with the LDLIB package from the Fall '80 DECUS SIG tape, `mubld' will be enhanced to generage images which can participate in the dynamic loading of the shared common regions. -1- #-h- objfix 1235 asc 02-apr-82 18:00:20 v1.1 (sw-tools v1.1) Objfix (1) 2-May-81 Objfix (1) NAME Objfix - fixup object modules for building multi-user tasks SYNOPSIS objfix output.obj [psect_file] ... DESCRIPTION `objfix' converts one object module to another, flagging as read-only those psects which have been specified in the psect files specified in the command line. Each psect name, along with its attributes, is displayed on error output as each record is written to standard output. The format of the psect files are quite simple: each line is taken to be the name of one psect to be flagged as read only. `objfix' can be used to list the psects and their attributes of an object file using the following command line: objfix nl: You can cause `objfix' to stop reporting the psect information by typing control-O (^O). FILES None SEE ALSO mubld - build a multi-user task DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- prd 893 asc 02-apr-82 18:00:21 v1.1 (sw-tools v1.1) Prd (1) 12-Mar-82 Prd (1) NAME Prd - print current working directory in alpha-numeric mode SYNOPSIS prd [-l] DESCRIPTION `prd' displays the current working disk and directory on standard output. If the current directory has an alpha-numeric alias created by `mkd', that name is displayed instead of the UIC. If the `-l' option is specified, the output is formatted as ddn:[name] instead of the default /ddn/name. FILES sy:[0,377]*.dir SEE ALSO mkd - make an alpha-numeric directory lsd - list alpha-numeric directories pwd - print current working directory DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1- #-h- whereis 1028 asc 02-apr-82 18:00:22 v1.1 (sw-tools v1.1) Whereis (1) 20-May-81 Whereis (1) NAME Whereis - search for file matching regular expression SYNOPSIS whereis pat [anchor] DESCRIPTION `whereis' searches for the specified pattern (regular expression) in the search path defined by anchor. If no anchor is specified, the current directory is searched. If a device and directory are specified, only that directory is searched. If only a device is specified, all of the directories on that disk are searched in the order in which they appear in [0,0]. The files matching the pattern are output on standard output, in a fully resolved pathname format. FILES SEE ALSO ls - directory lister find - for regular expression syntax DIAGNOSTICS AUTHORS Joe Sventek BUGS/DEFICIENCIES -1-