<div id="Using-keywords"></div>
<div class="header">
<p>
Next: [[cvs: Avoiding substitution#Avoiding substitution|Avoiding substitution]], Previous: [[cvs: Keyword List#Keyword List|Keyword list]], Up: [[cvs: Keyword substitution#Keyword substitution|Keyword substitution]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Using-keywords-1"></div>
=== Using keywords ===

To include a keyword string you simply include the
relevant text string, such as <code>$<i></i>Id$</code>, inside the
file, and commit the file.  <small>CVS</small> will automatically
expand the string as part of the commit operation.

It is common to embed the <code>$<i></i>Id$</code> string in
the source files so that it gets passed through to
generated files.  For example, if you are managing
computer program source code, you might include a
variable which is initialized to contain that string.
Or some C compilers may provide a <code>#pragma ident</code>
directive.  Or a document management system might
provide a way to pass a string through to generated
files.


<div id="index-Ident-_0028shell-command_0029"></div>
The <code>ident</code> command (which is part of the <small>RCS</small>
package) can be used to extract keywords and their
values from a file.  This can be handy for text files,
but it is even more useful for extracting keywords from
binary files.

<div class="example" style="margin-left: 3.2em">
 $ ident samp.c
 samp.c:
      $<i></i>Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
 $ gcc samp.c
 $ ident a.out
 a.out:
      $<i></i>Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
</div>

<div id="index-What-_0028shell-command_0029"></div>
S<small>CCS</small> is another popular revision control system.
It has a command, <code>what</code>, which is very similar to
<code>ident</code> and used for the same purpose.  Many sites
without <small>RCS</small> have <small>SCCS</small>.  Since <code>what</code>
looks for the character sequence <code>@(#)</code> it is
easy to include keywords that are detected by either
command.  Simply prefix the keyword with the
magic <small>SCCS</small> phrase, like this:

<div class="example" style="margin-left: 3.2em">
 static char *id=&quot;@(#) $<i></i>Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $&quot;;
</div>

This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
