See https://opensource.apple.com/source/file_cmds/file_cmds-82/touch/touch.c Line36:
__RCSID("$FreeBSD: src/usr.bin/touch/touch.c,v 1.20 2002/09/04 23:29:07 dwmalone Exp $");
What does this line mean? What is __RCSID
and what is the meaning of the string? Is this some standard message for version control?
In cdefs.h
I found
#ifndef __RCSID
#define __RCSID(s) __IDSTRING(rcsid,s)
#endif
and
#define __IDSTRING(name, string) static const char name[] __used = string
But I still don't know what they are for.
This comes from the Revision Control System, one of the earliest version control systems, and later adopted by some other version control systems. If a file contains a string of the form $keyword:...$
, the ..
portion is replaced automatically by information about the version of the file when the file is checked in and out.
This is typically put into a static variable so that you can then search the resulting object file for the string, to find out what version of the source code was used to generate it. See the ident command for how this is used.
I checked some of my Linux systems and they don't have ident
, but you can simply use strings
:
strings /usr/bin/touch | grep FreeBSD:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.