Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I inherited a bunch of files that begin with the following statement at the top

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

Ident seems to be related to C coding and make files but I am not really sure. None of the files I have are source code or anything like that. Just text files.

What is the usage of Ident?

share|improve this question
    
Which is it? "Ident" or "#ident"? –  Jim Paris Sep 27 '12 at 19:26
    
My apologies. "#ident" is a typo. I meant Ident –  Chris Sep 27 '12 at 19:30
    
It's probably just a convention used by the person who created the files. I'm not aware of any tool or standard that uses that syntax. Where did the files come from? Can you ask the author(s)? –  Keith Thompson Sep 28 '12 at 0:05
    
The files come from a colleague who left the job. The guy relocated to this home country. –  Chris Sep 28 '12 at 15:00
add comment

1 Answer

up vote 3 down vote accepted

ident in C provides information about a compiled program or function such as its version, date created or edited and the like. A utility, what, can be used like: e.g., what func.o, to display that information. The information is filled-in by a source code management system such as SCCS, RCS or CVS .

So suppose when you are programming, you will start a program like this :

ident "$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$
     */

So what happens here is that all the information related to the file such as it's version no, author name etc are all recorded for future reference.

When a file containing these $token$ strings is placed into, say, CVS, those tokens will be translated like this :

    #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
     *
     */

The $Log$ token is very important; in a project where code is edited by many hands, every edit is recorded with a comment described by what was done, why it was done and when it was done.

Unfortunately, the what utility is not ported to Linux but can be gotten from The Heirloom Project hosted at Sourceforge if you're interested.

It' a little big, but i hope you get the info you are looking for .

You can also refer this link : http://www.unix.com/programming/26107-what-ident.html

share|improve this answer
3  
Some versioning systems automatically expand keywords like this (SCCS, CSSC, RCS, CVS); most these days do not. I've never used $Log$ myself. The information is available from the version control system; putting it into the file is just clutter IMHO. And given the revised question, the line is Ident:/some/path/to/a/file, which doesn't look much like what you're referring to. I don't think this answer is correct (even though the OP accepted it). –  Keith Thompson Sep 28 '12 at 0:04
    
This may not be 100% related to C programming but the link TDK provided in his reply discusses another option with what utility. This is good enough for me. –  Chris Sep 28 '12 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.