DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

vc(CP)


vc -- version control (SCCS)

Syntax

vc [-a] [-c[char]] [-s] [-t] [keyword=value ... keyword=value]

Description

The vc command copies lines from standard input to standard output under control of its arguments and control statements encountered in standard input. In the process of performing the copy operation, user declared keywords may be replaced by their string value when they appear in plain text and/or control statements.

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 ``\''.

Arguments


-a
Forces replacement of keywords surrounded by control characters with their assigned values in all text lines and not just in vc statements.

-t
All characters from the beginning of a line up to and including the first <Tab> character are ignored for the purpose of detecting a control statement. If one is found, all characters up to and including the <Tab> are discarded.

-cchar
Specifies a control character to be used in place of ``:''.

-s
Silences warning messages (not error messages) that are normally printed on the diagnostic output.

Version Control Statements


:dcl keywords[, ..., keywords]
Used to declare keywords. All keywords must be declared.

:asg keywords=values
Used to assign values to keywords. An asg statement overrides the assignment for the corresponding keyword on the vc command line and all previous asg's for that keyword. keywords declared, but not assigned values have null values.

The following construct is used to skip lines of the standard input:

   :if condition
   :end
If 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:


=
equal

!=
not equal

&
and

|
or

>
greater than

<
less than

( )
used for logical groupings

not
may only occur immediately after the if, and when present, inverts the values of the entire condition.

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.


::text
Used for keyword replacement on lines copied to standard output. The two leading control characters are removed, and keywords surrounded by control characters in text are replaced by their values before the line is copied to the output file. This action is independent of the -a option.

:on
:off
Turn keywords replacement on or off for all lines.

:ctl char
Change the control character to char.

:msg message
Prints the given message on the diagnostic output.

:err message
Prints the given message followed by:

ERROR: err statement on line ...

on the diagnostic output. vc halts execution and returns an exit code of 1.

Exit codes

0 - normal
1 - any error

See also

ed(C)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003