Creating, editing, and updating an SCCS file

You can create, edit, and update an SCCS file using the admin, get, and delta commands.

Creating an SCCS File

admin
Creates an SCCS file or changes an existing SCCS file.
  • To create an empty SCCS file named s.test.c, enter:
    admin -n s.test.c
    Using the admin command with the -n flag creates an empty SCCS file.
  • To convert an existing text file into an SCCS file, enter:
    admin -itest.c s.test.c
    There are no SCCS identification keywords in the file (cm7)
       
    ls
    s.test.c test.c
    If you use the -i flag, the admin command creates delta 1.1 from the specified file. Once delta 1.1 is created, rename the original text file so it does not interfere with SCCS commands (it will act as a backup):
    mv test.c back.c
    The message There are no SCCS identification keywords in the file (cm7) does not indicate an error.
  • To start the test.c file with a release number of 3.1, use the -r flag with the admin command, as follows:
    admin -itest.c -r3 s.test.c

Editing an SCCS file

Attention: Do not edit SCCS files directly with non-SCCS commands, or you can damage the SCCS files.

get
Gets a specified version of an SCCS file for editing or compiling.
  1. To edit an SCCS file, enter the get command with the -e flag to produce an editable version of the file:
    get -e s.test.c
    1.3
    new delta 1.4
    67 lines
      
    ls
    p.test.c s.test.c test.c
    The get command produces two new files, p.test.c and test.c. The editable file is test.c. The p.test.c file is a temporary, uneditable file used by SCCS to keep track of file versions. It will disappear when you update your changes to the SCCS file. Notice also that the get command prints the SID of the version built for editing, the SID assigned to the new delta when you update your changes, and the number of lines in the file.
  2. Use any editor to edit test.c, for example:
    ed test.c
    You can now work on your actual file. Edit this file as often as you wish. Your changes will not affect the SCCS file until you choose to update it.
  3. To edit a specific version of an SCCS file with multiple versions, enter the get command with the -r flag :
    get -r1.3 s.test.c
    1.3
    67 lines
      
    get -r1.3.1.4 s.test.c
    1.3.1.4
    50 lines

Updating an SCCS File

delta
Adds a set of changes (deltas) to the text of an SCCS file.
  1. To update the SCCS file and create a new delta with the changes you made while editing, use the delta command:
    $delta s.test.c
    Type comments, terminated with EOF or a blank line:
  2. The delta command prompts you for comments to be associated with the changes you made. For example, enter your comments, and then press the Enter key twice:
    No id keywords (cm7)
    1.2
    5 lines inserted
    6 lines deleted
    12 lines unchanged
    The delta command updates the s.prog.c file with the changes you made to the test.c file. The delta command tells you that the SID of the new version is 1.2, and that the edited file inserted 5 lines, deleted 6 lines, and left 12 lines unchanged from the previous version.