``$Id$'' とか ``@(#)'' とか
これらの記号は何者なわけ?というはなし
例
NetBSD プロジェクトの src/bin/cat/cat.c
(GitHub mirror) のファイル冒頭
/* $NetBSD: cat.c,v 1.60 2023/12/10 15:31:53 rillig Exp $ */
とか、ライセンス条項部の下
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
@(#)
はSCCS由来
A characteristic feature of SCCS is the sccsid string that is embedded into source code, and automatically updated by SCCS for each revision. This example illustrates its use in the C programming language:
static char sccsid[] = "@(#)ls.c 8.1 (Berkeley) 6/11/93";
This string contains the file name, date, and can also contain a comment. After compilation, the string can be found in binary and object files by looking for the pattern
@(#)
and can be used to determine which source code files were used during compilation. Thewhat
command is available to automate this search for version strings.
$NetBSD: cat.c,v 1.60 2023/12/10 15:31:53 rillig Exp $
はRCS由来
Automatic Identification
RCS can put special strings for identification into your source and object code. To obtain such identification, place the marker
$Id$
into your text, for instance inside a comment. RCS will replace this marker with a string of the form
$Id: filename revision date time author state $
With such a marker on the first page of each module, you can always see with which revision you are working. RCS keeps the markers up to date automatically. To propagate the markers into your object code, simply put them into literal character strings. In C, this is done as follows:
static char rcsid[] = "$Id$";
The command ident extracts such markers from any file, even object code and dumps. Thus, ident lets you find out which revisions of which modules were used in a given program.
You may also find it useful to put the marker $Log$ into your text, inside a comment. This marker accumulates the log messages that are requested during check-in. Thus, you can maintain the complete history of your file directly inside it. There are several additional identification markers; see co(1) for details.