home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.questions
- Subject: Re: How to add version id into a program?
- Date: 25 Jan 1993 21:05:33 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 25
- Distribution: world
- Message-ID: <1k1kmtINNgrl@early-bird.think.com>
- References: <1k10nvINNsnr@function.mps.ohio-state.edu>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1k10nvINNsnr@function.mps.ohio-state.edu> ren@math.ohio-state.edu (Liming Ren) writes:
- >I put lines such as
- >
- >/*@(#)RELEASE 1.0*/ or
- >
- >#define version_id "@(#)RELEASE 1.0"
- >
- >in my source program. Version does not work with this.
-
- You have to arrange for these to be incorporated into the *binary*, since
- that's what "version" looks at. Comments and preprocessor defines don't
- get included in the generated code. Try:
-
- #ifndef lint
- static char *version_id = "@(#)RELEASE 1.0"
- #endif
-
- The #ifndef shuts up lint, which would otherwise complain about this unused
- variable. You could also avoid this by providing an option to your program
- that makes it print its version, which would reference the variable.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-