home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

18.3 Basic Operation

This section outlines the steps to follow when using SCCS:

  • Creating an SCCS file

  • Retrieving a file

  • Creating new releases and branches

  • Recording changes

  • Caveats

18.3.1 Creating an SCCS File

The admin command with the -i option creates and initializes SCCS files. For example:

admin -ich01 s.ch01

creates a new SCCS file and initializes it with the contents of ch01 , which becomes delta 1.1 . The message "No id keywords (cm7)" appears if you do not specify any keywords. In general, "id keywords" refer to variables in the files that are replaced with appropriate values by get , identifying the date and time of creation, the version retrieved, etc. A listing of identification keywords occurs later in this chapter.

Once the s.ch01 file is created, the original ch01 file can be removed, since it can be easily regenerated with the get command.

18.3.2 Retrieving a File

The get command can retrieve any version of a file from SCCS. Using the example above, you can retrieve ch01 by entering:

get -e s.ch01

and the messages:

new delta 1.2
272 lines

may appear. This indicates that you are "getting" delta 1.1 , and the resulting file has 272 lines of text. When the file is reentered into the SCCS file s.ch01 with the delta command, its changes are delta 1.2 .

The -e option indicates to SCCS that you intend to make more changes to the file and then reenter it into SCCS. Without this option, you will receive the file with read-only permissions. The -e option, besides releasing the file with read-write permissions, also creates a file p.ch01 , which records information that is used by SCCS when the file is returned.

18.3.3 Creating New Releases and Branches

The -r option to get tells SCCS what release and level number you want, but if no level is specified, it defaults to the highest level available. With the command:

get -r3.2 ch01

delta 3.2 is the release. However, the command:

get -r3 ch01

returns the highest-numbered level in release 3, for example, 3.8 . With the -r option omitted, get defaults to the highest release, highest level -- in other words, the latest version.

When major changes are in store for a file, you may want to begin a new release of the file by "getting" the file with the next highest release number. For example, if the latest release of a file is 3.2, and you want to start release 4, enter:

get -e -r4 ch01

You receive the message:

new delta 4.1
53 lines

If you want to make a change to an older version of the same file, you can enter:

get -e -r2.2 ch01

and receive the message:

new delta
121 lines

You have now created a new branch from the trunk, stemming from version 2.2. Changes in this delta will not affect those in the trunk deltas, i.e., 2.3, 3.1, etc.

18.3.4 Recording Changes

Once changes have been made to the SCCS file, return it to SCCS with:

delta s.ch01

You are prompted for comments on the changes. The delta command then does its own get and uses diff to compare the new version of the file with the most recent version. It then prints messages giving the new release number and the number of lines that were inserted, deleted, and unchanged.

18.3.5 Caveats

Here are some things to bear in mind when using SCCS:

  • You can't store binary data in an SCCS file. Solaris SCCS allows it by encoding the file using uuencode .

  • SCCS doesn't preserve the execute bit from the file permissions of files checked into it. This is important particularly for shell scripts: you have to explicitly make them executable after retrieving them from SCCS. This should be automated using make .

  • Using ID keywords (see the next section) in your printf (3S) format strings can lead to disaster. Find some indirect way to generate these strings for printing.

Previous: 18.2 Overview of Commands UNIX in a Nutshell: System V Edition Next: 18.4 Identification Keywords
18.2 Overview of Commands Book Index 18.4 Identification Keywords

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System