|
|
1.1 ! root 1: .PP ! 2: RCS markers like "$Revision: 2.3 $" etc., can be pretty-printed (i.e., ! 3: without the leading keyword and the $-signs) as follows. ! 4: ! 5: In n/troff, define the following macro: ! 6: .nf ! 7: ! 8: .de VL ! 9: \\$2 ! 10: .. ! 11: ! 12: The call ! 13: .VL $Revision: 1.2 $ ! 14: .fi ! 15: picks out the number (actually, the value field of any RCS marker). ! 16: In all manual pages, I recommend the use an identification ! 17: section instead of an author section, which looks something like this: ! 18: .nf ! 19: ! 20: .SH IDENTIFICATION ! 21: Author: Walter F. Tichy, ! 22: Purdue University, West Lafayette, IN, 47907. ! 23: .sp 0 ! 24: Revision Number: ! 25: .VL $Revision: 3.0 $ ! 26: ; Release Date: ! 27: .VL $Date: 82/11/27 11:43:39 $ ! 28: \&. ! 29: .sp 0 ! 30: Copyright \(co 1982 by Walter F. Tichy. ! 31: ! 32: ! 33: .fi ! 34: One could use the same trick with C-macros, but, unfortunately, these macros ! 35: want commas separating the arguments. I can only offer sscanf instead: ! 36: .nf ! 37: ! 38: char * getkeyval(s) ! 39: char * s; ! 40: { static char keyval[100]; ! 41: sscanf(s,"%*s%s",keyval); ! 42: return keyval; ! 43: } ! 44: ! 45: An example use of getkeyval() is the following greeting message: ! 46: ! 47: printf("Program version %s\n",getkeyval("$Revision 1.2 $")); ! 48: ! 49: .fi ! 50: There is no option in RCS that strips off the keywords, for a good reason: ! 51: If the keyword is stripped off, it becomes impossible to update the ! 52: keyword value automatically. ! 53: ! 54: There is no way to suppress the keyword expansion, either. If you ! 55: absolutely need a keyword in RCS format unexpanded, piece it together from ! 56: two strings in C, or imbed the null-character \& in n/troff.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.