home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15933 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.2 KB  |  38 lines

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: How to add version id into a program?
  5. Date: 25 Jan 1993 21:05:33 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 25
  8. Distribution: world
  9. Message-ID: <1k1kmtINNgrl@early-bird.think.com>
  10. References: <1k10nvINNsnr@function.mps.ohio-state.edu>
  11. NNTP-Posting-Host: telecaster.think.com
  12.  
  13. In article <1k10nvINNsnr@function.mps.ohio-state.edu> ren@math.ohio-state.edu (Liming Ren) writes:
  14. >I put  lines such as
  15. >
  16. >/*@(#)RELEASE 1.0*/  or
  17. >
  18. >#define version_id "@(#)RELEASE 1.0"
  19. >
  20. >in my source program. Version does not work with this.
  21.  
  22. You have to arrange for these to be incorporated into the *binary*, since
  23. that's what "version" looks at.  Comments and preprocessor defines don't
  24. get included in the generated code.  Try:
  25.  
  26. #ifndef lint
  27. static char *version_id = "@(#)RELEASE 1.0"
  28. #endif
  29.  
  30. The #ifndef shuts up lint, which would otherwise complain about this unused
  31. variable.  You could also avoid this by providing an option to your program
  32. that makes it print its version, which would reference the variable.
  33. -- 
  34. Barry Margolin
  35. System Manager, Thinking Machines Corp.
  36.  
  37. barmar@think.com          {uunet,harvard}!think!barmar
  38.