アイデンティティに混乱

アイデンティティに混乱

先頭に、次の文で始まる複数のファイルを継承しました。

Ident:/some/path/to/a/file

IdentはCエンコーディングとファイルの作成に関連しているようですが、よくわかりません。私が持っているファイルのうち、ソースコードやそれに似たものはありません。ちょうどテキストファイル。

IDの使用は何ですか?

ベストアンサー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

おすすめ記事