我继承了一堆文件,这些文件的顶部以以下语句开头
Ident:/some/path/to/a/file
Ident 似乎与 C 编码和 make 文件有关,但我不太确定。我拥有的文件都不是源代码或类似的文件。只是文本文件。
身份识别有什么用?
答案1
C 中的 ident 提供有关已编译程序或函数的信息,例如其版本、创建或编辑日期等。一个实用程序,what,可以像这样使用:例如,what func.o,来显示该信息。该信息由 SCCS、RCS 或 CVS 等源代码管理系统填充。
所以假设当你编程时,你将启动一个这样的程序:
识别“$Id$”
/*
* Copyright (C) 2000-2012 Your Name
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General
* Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
/*
* Name: $Source$
* Purpose:
* Version: $Revision$
* Modified: $Date$
* Author: Your Name
* Date:
* $Log$
*/
所以这里发生的是与文件相关的所有信息,例如版本号、作者姓名等都被记录下来以供将来参考。
当包含这些 $token$ 字符串的文件被放入 CVS 中时,这些标记将像这样被翻译:
#ident "$Id: histfile.c,v 1.1.1.1 2011/10/07 18:06:40 trona Exp $"
/*
* Copyright (C) 2000-2012 Your Name
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General
* Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*
* Name: $Source: /usr/local/cvsroot/utils/histfile.c,v $
* Purpose: display content of a user's .sh_history file
* Version: $Revision: 1.1.1.0 $
* Modified: $Date: 2012/10/07 18:06:40 $
* Author: Your Name
* Date: 24 Jun 2012
* $Log: histfile.c,v $
* Revision 1.1.1.1 2012/10/07 18:06:40 trona
* initial installation Slackware 13.0
*
*/
$Log$ 令牌非常重要;在一个由多人编辑代码的项目中,每次编辑都会记录一条注释,描述所做的事情、为什么这样做以及何时完成。
不幸的是,what 实用程序尚未移植到 Linux,但如果您感兴趣,可以从 Sourceforge 托管的 The Heirloom 项目中获取。
它有点大,但我希望你能得到你正在寻找的信息。
您也可以参考这个链接:http://www.unix.com/programming/26107-what-ident.html