|HP-UX Reference > C
co(1)HP-UX 11i Version 3: February 2007
co — check out RCS revisions
co retrieves revisions from RCS files. Each file name ending in ,v is taken to be an RCS file. All other files are assumed to be working files. co retrieves a revision from each RCS file and stores it in the corresponding working file (see also rcsintro(5)).
Revisions of an RCS file can be checked out locked or unlocked. Locking a revision prevents overlapping updates. A revision checked out for reading or processing (e.g., compiling) need not be locked. A revision checked out for editing and later checked in must normally be locked. Locking a revision currently locked by another user fails (a lock can be broken with the rcs command, but poses inherent risks when independent changes are being made simultaneously (see rcs(1)). co with locking requires the caller to be on the access list of the RCS file unless: he is the owner of the file, a user with appropriate privileges, or the access list is empty. co without locking is not subject to access list restrictions.
A revision is selected by number, check-in date/time, author, or state. If none of these options are specified, the latest revision on the trunk is retrieved. When the options are applied in combination, the latest revision that satisfies all of them is retrieved. The options for date/time, author, and state retrieve a revision on the selected branch. The selected branch is either derived from the revision number (if given), or is the highest branch on the trunk. A revision number can be attached to the options -l, -p, -q, or -r.
The caller of the command must have write permission in the working directory, read permission for the RCS file, and either read permission (for reading) or read/write permission (for locking) in the directory that contains the RCS file.
The working file inherits the read and execute permissions from the RCS file. In addition, the owner write permission is turned on, unless the file is checked out unlocked and locking is set to strict (see rcs(1)).
If a file with the name of the working file exists already and has write permission, co aborts the check out if -q is given, or asks whether to abort if -q is not given. If the existing working file is not writable, it is deleted before the check out.
A number of temporary files are created. A semaphore file is created in the directory of the RCS file to prevent simultaneous update.
A co command applied to an RCS file with no revisions creates a zero-length file. co always performs keyword substitution (see below).
Strings of the form $keyword$ and $keyword:...$ embedded in the text are replaced with strings of the form $keyword: value $, where keyword and value are pairs listed below. Keywords may be embedded in literal strings or comments to identify a revision.
Initially, the user enters strings of the form $keyword$. On check out, co replaces these strings with strings of the form $keyword: value $. If a revision containing strings of the latter form is checked back in, the value fields are replaced during the next checkout. Thus, the keyword values are automatically updated on checkout.
Keywords and their corresponding values:
The RCS file name, the working file name, and the revision number retrieved are written to the diagnostic output. The exit status always refers to the last file checked out, and is 0 if the operation was successful, 1 if unsuccessful.
Assume the current directory contains a subdirectory named RCS with an RCS file named io.c,v. Each of the following commands retrieves the latest revision from RCS/io.c,v and stores it into io.c:
co io.c co RCS/io.c,v co io.c,v co io.c RCS/io.c,v co io.c io.c,v co RCS/io.c,v io.c co io.c,v io.c
Check out version 1.1 of RCS file foo.c,v:
co -r1.1 foo.c,v
Check out version 1.1 of RCS file foo.c,v to the standard output:
co -p1.1 foo.c,v
Check out the version of file foo.c,v that existed on September 18, 1992:
co -d"09/18/92" foo.c,v
The co command generates the working file name by removing the ,v from the end of the RCS file name. If the given RCS file name is too long for the file system on which the RCS file should reside, co terminates with an error message.
There is no way to suppress the expansion of keywords, except by writing them differently. In nroff and troff, this is done by embedding the null-character \& into the keyword.
The -d option gets confused in some circumstances, and accepts no date before 1970.
The -j option does not work for files containing lines consisting of a single period (.).
RCS is designed to be used with text files only. Attempting to use RCS with nontext (binary) files results in data corruption.
ci(1), ident(1), rcs(1), rcsdiff(1), rcsmerge(1), rlog(1), rcsfile(4), acl(5), rcsintro(5).