정체성에 혼란스러워

정체성에 혼란스러워

맨 위에 다음 명령문으로 시작하는 여러 파일을 상속받았습니다.

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

Ident는 C 인코딩 및 파일 만들기와 관련이 있는 것 같지만 잘 모르겠습니다. 내가 가지고 있는 파일 중 소스 코드나 그와 유사한 것은 없습니다. 그냥 텍스트 파일.

신분증의 용도는 무엇입니까?

답변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

관련 정보