[TriLUG] Equivalent to Solaris "what" command

Don Jerman djerman at pobox.com
Tue Feb 26 11:53:52 EST 2008


Actually it's a compiled-in feature of the version control system, and
dependent upon using the same version control system (VCS) for all
your source.

This particular tool is a holdover from SCCS (which can still be
implemented with CVS, SVN, what-have-you) where one would by
convention put the source control tags into a version string in one's
files, for example:

static char SccsId[ ] = "%W%\t%G%";

Every time the file is checked out (for a build) the VCS spots and
updates the keyword-strings.  You see in your example the strings
defined in those headers that were #included into the library object
modules.  Anything that can parse the strings in a library can get
this information out, what(1) just happens to be geared for finding
SCCS-format strings.

On the other hand, if you don't have those strings defined in the
headers you're using, it's useless.  In a well-maintained shop the
strings will be deleted or converted when you change VCS but I've seen
them left alone while revisions continue, because the current
developers didn't know what they do.  So there's a risk in relying on
the what information for old code that's been changing hands.

So the usefullness of what and its cousins would depend on which
conventions your programming group is following.  They can tell you
what "what" utiltity applies to their binaries.  For your own stuff,
you can look at your preferred VCS tools and see if there is something
applicable.


On 2/26/08, Brian Henning <Brian.Henning at datadirect.com> wrote:
> Hi Gang,
>
> A friend of mine is asking about the "linux equivalent of the what
> command on Solaris."  Apparently, there's a command included with the
> Solaris C compiler called "what", which can extract information from a
> binary file about source code revisions, for example:
>
> $ what libodbc.so
> libodbc.so:
>          qeunix.hpp $Revision:   1.3  $,$Date::   Dec 05 20$
>          ucnvconv.hpp     $Revision: 1.4 $     $Date:: Apr 03 2006$
>          bug.hpp     $Revision: 1.1 $     $Date:: Dec 04 2006$
>          noansi.hpp     $Revision: 1.0 $     $Date:: Oct 07 2005$
>          bos.hpp     $Revision: 1.17 $     $Date:: Jun 27 2007$
>                [...]
>
> This strikes me as a compiler feature.  Googling with the word "what" is
> not a very efficient endeavor, so I thought I would ask here.  Does GCC
> include such a feature, and if so, how is it used?
>
> Many thanks,
> ~Brian
>
> ----------------
> Brian A. Henning
>   DataDirect
> Support Engineer
>  888-332-6797
> ----------------
>
>
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



More information about the TriLUG mailing list