Open8

``$Id$'' とか ``@(#)'' とか

四ツ山伊吹四ツ山伊吹

@(#) はSCCS由来

https://en.wikipedia.org/wiki/Source_Code_Control_System

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. The what command is available to automate this search for version strings.

四ツ山伊吹四ツ山伊吹

@(#) がついた部分は what コマンドをつかって取り出せる

https://man.netbsd.org/what.1

NetBSD
# what /bin/cat
/bin/cat
         Copyright (c) 1989, 1993 The Regents of the University of California.  All rights reserved.
macOS
% what /bin/cat 
/bin/cat
	PROGRAM:cat  PROJECT:text_cmds-99
四ツ山伊吹四ツ山伊吹

$NetBSD: cat.c,v 1.60 2023/12/10 15:31:53 rillig Exp $ はRCS由来

https://man.netbsd.org/rcsintro.1

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.