Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc

09.06.2013 Views

XENIX Programming SCCS: Source Code Control System Using Identification Keywords sees provides several special symbols, called identification keywords, that can be used in the text of a program or document to represent predefined values. Keywords represent values ranging from the creation date and time of a given file to the name of the module containing the keyword. When a user retrieves the file for reading, sees automatically replaces each keyword it finds in a given version of a file with the keyword's value. This section explains how keywords are treated by the various SCCS commands and how you may use the keywords in your own files. Only a few keywords are described in this section. For a complete list of the keywords, see get in Appendix B, "Programming Commands." Inserting a Keyword into a File You may insert a keyword into any text file. A keyword is simply an uppercase letter enclosed in percent signs {%}. For example, 96196 is the keyword representing the SID of the current version, and 96H96 is the keyword representing the current date. When a file is retrieved for reading using the get command, the keywords are replaced by their current values. For example, if the 96M96, 96196, and 96H96 keywords are used in place of the module name, the SID, and the current date in the program statement char header( 100) = {" %M% %1% %H% "}; then these keywords are expanded in the retrieved version of the program char header( 1 00) = {" MODNAME 2.3 07107177 "}; The get command does not replace keywords when retrieving a version for editing. SCCS assumes that you wish to keep the keywords (and not their values) when you save the new version of the file. To indicate that a file has no keywords, the get, delta, and admin commands display the message No id keywords (cm7) This message is normally treated as a warning, letting you know that no keywords are present. However, you may change the operation of the system to make this a fatal error as explained later in this chapter. 5-13

SCCS: Source Code Control System XENIX Programming Assigning Values to Keywords The values of most keywords are predefined by the system, but some, such as the value for the 96M96 keyword, can be explicitly defined by the user. To assign a value to a keyword, you must set the corresponding s-file flag to the desired value. You can do this by using the -f option of the admin command. For example, to set the 96M96 keyword to "cdemo", set the m flag as in the command admin -fmcdemo s.demo.c This command records "cdemo" as the current value of the 96M96 keyword. Note that if you do not set the m flag, SCCS uses the name of the original text file for 96M96 by default. The t and q flags are also associated with keywords. A description of these flags and the corresponding keywords can be found in the entry get in Appendix B, "Programming Commands." You can change keyword values at any time. Forcing Keywords You can force a fatal error if a version is found to contain no keywords by setting the i flag in the given s-file. The flag causes the delta and admin commands to stop processing of the given version and report an error if no keywords are found. The flag is useful for ensuring that keywords are used properly in a given file. To set the i flag, you must use the -f option of the admin command. For example, the command admin -fi s.demo.c sets the i flag in the s-file s.demo.c. Subsequent delta or admin commands that access this file print an error message if the given version does not contain keywords. Note that if you attempt to set the i flag at the same time you create an s-file and if the initial text file contains no keywords, the admin command displays a fatal error message and stops without creating the s-file. Using s-file Flags An s-file flag is a special value that defines how SCCS will operate on the corresponding s-file. The s-file flags are stored in the s-file and are read by each SCCS command before it operates on the file. The s-file flags affect keyword checking, keyword replacement values, and default values for commands. This section explains how to set and use s-file flags. It also describes the action of commonly used flags. For a complete description of all flags, see the entry admin in Appendix B, "Programming Commands." 5-14

<strong>XENIX</strong> Programming SCCS: Source Code Control System<br />

Using Identification Keywords<br />

sees provides several special symbols, called identification keywords, that can be used<br />

in the text of a program or document to represent predefined values. Keywords<br />

represent values ranging from the creation date and time of a given file to the name of<br />

the module containing the keyword. When a user retrieves the file for reading, sees<br />

automatically replaces each keyword it finds in a given version of a file with the<br />

keyword's value.<br />

This section explains how keywords are treated by the various SCCS commands and how<br />

you may use the keywords in your own files. Only a few keywords are described in this<br />

section. For a complete list of the keywords, see get in Appendix B, "Programming<br />

Commands."<br />

Inserting a Keyword into a File<br />

You may insert a keyword into any text file. A keyword is simply an uppercase letter<br />

enclosed in percent signs {%}. For example, 96196 is the keyword representing the SID of<br />

the current version, and 96H96 is the keyword representing the current date.<br />

When a file is retrieved for reading using the get command, the keywords are replaced<br />

by their current values. For example, if the 96M96, 96196, and 96H96 keywords are used in<br />

place of the module name, the SID, and the current date in the program statement<br />

char header( 100) = {" %M% %1% %H% "};<br />

then these keywords are expanded in the retrieved version of the program<br />

char header( 1 00) = {" MODNAME 2.3 07107177 "};<br />

The get command does not replace keywords when retrieving a version for editing. SCCS<br />

assumes that you wish to keep the keywords (and not their values) when you save the<br />

new version of the file.<br />

To indicate that a file has no keywords, the get, delta, and admin commands display the<br />

message<br />

No id keywords (cm7)<br />

This message is normally treated as a warning, letting you know that no keywords are<br />

present. However, you may change the operation of the system to make this a fatal<br />

error as explained later in this chapter.<br />

5-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!