- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Source code header question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 06:39 PM
11-02-2005 06:39 PM
#ifndef lint
static char ModuleId[] = "@(#)FTAM: ftm_conn.c $Revision: 9.1 $ $Date: 94/11/17 17:36:21 $";
#endif
What does this mean? It looks strange. And the time was so accurate. Is this generated by some program?
Please help!
Thanks in advance.
Fei
Solved! Go to Solution.
- Tags:
- rcs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 06:48 PM
11-02-2005 06:48 PM
Re: Source code header question
If you want for HP-UX 11i, download from
http://hpux.connect.org.uk/hppd/hpux/Development/Tools/lclint-2.5q/
http://www.splint.org/
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 07:06 PM
11-02-2005 07:06 PM
Re: Source code header question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 07:57 PM
11-02-2005 07:57 PM
Re: Source code header question
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 08:05 PM
11-02-2005 08:05 PM
Re: Source code header question
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 08:55 PM
11-02-2005 08:55 PM
SolutionThe construction "#ifndef lint" ... "#endif" means that the lines between them are excluded when a macro named "lint" is defined.
Source code analyzers like lint and splint define that macro to allow the programmer to exclude things that would confuse the analyzer program and produce useless error messages.
The "static char ModuleId[] = ..." line looks like it contains automatic version numbering directives. These are used when the source code is stored in an automated version control system, like RCS, CVS, Subversion, BitKeeper and others. When this kind of software is used, it is often said that the source code is in a "repository".
The programmer writes just the "$Revision: $" and "$Date: $" parts. The revision control system automatically increments the version numbers and updates the date/time values each time the programmer stores a changed version of the file into the repository. This is often called a "commit".
Because the string is declared as a static one-dimensional table of characters (a string in C programming language), this string gets included in the compiled program, even if it is not actually used anywhere in the program code.
When a program is being tested, the testers may need to know which exact version of each source code file was used in compiling the program. This is just a way to embed the information in the program binary.
You can check it out yourself: on most unix-like operating systems you can try to extract all the readable strings from a program binary using the "strings" command.
For example, on HP-UX 11.11 I can enter the command:
strings /bin/ls |more
The first line contains a text that looks familiar:
$Revision: 92453-07 linker linker crt0.o B.11.16 000601 $
Because it mentions "linker" and "crt0.o" I believe this tells us the version of the C compiler used in producing the "ls" command.
On HP-UX, you might need the "-a" option to get all the strings in the program:
strings -a /bin/ls |more
Now you get (among other things) something like this:
ls.c $Date: 2003/03/13 02:04:47 $Revision: r11.11/2 PATCH_11.11 (PHCO_27415)
$Revision: @(#) all CUP11.11_BL2003_0504_1 PATCH_11.11 PHCO_27415\n @(#) Sun May 4 22:44:52 PDT 2003 $
This describes the exact version of "ls" command source code, if someone ever needs to know.
- Tags:
- strings
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 09:16 PM
11-02-2005 09:16 PM
Re: Source code header question
Thank you.
Fei
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2005 02:48 PM
11-03-2005 02:48 PM
Re: Source code header question
Tools like cvs can be used to automatically update version strings in source file. For scripts you can just have the $Header entry in comments but if you want the header to to persisist into binaries and executables it needs to be a statically defined string so it does not get stripped out.
Here is a string that has been inserted by cvs into a Perl script:
# "$Header: /opt/cvs/CCT/scripts/sendMime.pl,v 1.1 2005/10/26 05:19:58 daavid Exp $";
In some of my make files I have them append a line to a source file which is the name of the final compiled binary, so that it will always be updated in the cvs repository. The only "source" in this file is the statically defined string. This automatically maintains the version number for the binary every time the code is updated in cvs. A combination of ident and grep quickly and reliably allows this version number to be extracted. eg (this binary is called "legacy"):
> ident legacy | grep legacy
legacy:
$Header: /opt/cvs/CCT/servers/legacy/legacy.cpp,v 1.38 2005/05/24 03:12:38 daavid Exp $
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2006 06:05 PM
07-04-2006 06:05 PM