3

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?

4
  • Which is it? "Ident" or "#ident"?
    – Jim Paris
    Sep 27, 2012 at 19:26
  • My apologies. "#ident" is a typo. I meant Ident
    – Chris
    Sep 27, 2012 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)? Sep 28, 2012 at 0:05
  • The files come from a colleague who left the job. The guy relocated to this home country.
    – Chris
    Sep 28, 2012 at 15:00

1 Answer 1

4

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

3
  • 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). Sep 28, 2012 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, 2012 at 15:02
  • As an aside (for anybody else like me that winds up here), the ident utility searches for strings like $Id: something $ Observe, there is a colon after the Id and a space before the final dollar. Dec 5, 2018 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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