The copying of lines from the standard input to standard output is conditional, based on tests (in control statements) of keyword values specified in control statements or as vc command arguments.
A control statement is a single line beginning with a control character, except as modified by the -t option (see below). The default control character is a colon (``:''), except as modified by the -c option (see below). Input lines beginning with a backslash (``\'') followed by a control character are not control lines and are copied to standard output with the backslash removed. Lines beginning with a backslash followed by a non-control character are copied in their entirety.
A keyword is composed of nine or fewer alphanumerics; the first must be alphabetic. A value is any ASCII string that can be created with ed(C); a numeric value is an unsigned string of digits. keyword values may not contain blanks or tabs.
The vc command is awk-like tool used for version control of sets of files. While it is distributed as part of the SCCS package, it does not require the files it operates on to be under SCCS control.
Replacement of keywords by values is done whenever a keyword surrounded by control characters is encountered on a version control statement. The -a option (see below) forces replacement of keywords in all lines of text. An uninterpreted control character may be included in a value by preceding it with ``\''. If a literal ``\'' is desired, then it too must be preceded by ``\''.
The following construct is used to skip lines of the standard input:
:if condition :endIf condition is true, all lines between the if statement and the matching end statement are copied to standard output. If condition is false, all intervening lines are discarded, including control statements. Intervening if statements and matching end statements are recognized solely for the purpose of maintaining the proper if-end matching.
The syntax of a condition is:
<cond> ::= [ "not" ] <or>
<or> ::= <and> | <and> "|" <or>
<and> ::= <exp> | <exp> "&" <and>
<exp> ::= "(" <or> ")" | <value> <op> <value>
<op> ::= "=" | "!=" | "<" | ">"
<value> ::= <arbitrary ASCII string> | <numeric string>
The available operators and their meanings are:
The ``\>'' and ``\<'' operate only on unsigned integer
values (for example, : 012 > 12 is false).
All other operators take strings as arguments (for example,
: 012 != 12 is true).
The precedence of the operators (from highest to lowest) is:
= != > < all of equal precedence
Parentheses may be used to alter the order of precedence.
Values must be separated from operators or parentheses by at least one blank or tab.
on the diagnostic output. vc halts execution and returns an exit code of 1.