dave@sq.UUCP (10/09/86)
In article <4353@brl-smoke.ARPA> abrams@MITRE.arpa (Marshall D. Abrams) writes: >I am using troff with the ms macros to produce hardcopy of a file >which is getting many updates. When I print it I am using the DA >directive to get the date printed on the hardcopy. But this is the >date printed. I would much rather have the date that the file >was last revised. Any suggestion on how to do this would be >appreciated. The following troff macro, gR (GetReviseTime), assigns the latest revision-date of the file in which it appears to the string whose name is the argument in a call to gR: .de gR .sy echo ".ds \\$1 `ls -l \n(.F | awk '{print $5, $6, $7}'`">/tmp/date\n($$ .so /tmp/date/\n($$ .sy rm /tmp/date\n($$ After the above, in the file which is being formatted by ms, the following: .gR dR \*(dR would place the respective date in the output. It also works independent of the ms macros. Note: the .sy request is available in DWB and ditroff. -------------------------------------------------------------- SoftQuad Toronto, Ontario, Canada (416) 963-8337 David Seaman utzoo!sq!dave
dave@sq.UUCP (10/09/86)
In article <1986Oct8.182034.4245@sq.uucp> dave@sq.UUCP I write: > The following troff macro, gR (GetReviseTime), assigns the latest > revision-date of the file in which it appears to the string whose name > is the argument in a call to gR: > > .de gR > .sy echo ".ds \\$1 `ls -l \n(.F | awk '{print $5, $6, $7}'`">/tmp/date\n($$ > .so /tmp/date/\n($$ > .sy rm /tmp/date\n($$ > > After the above, in the file which is being formatted by ms, the > following: > > .gR dR > \*(dR > > would place the respective date in the output. It also works independent > of the ms macros. > > Note: the .sy request is available in DWB and ditroff. Sorry folks. (Apologies in particular to beginners.) The macro definition, above (gR), contains two typos: 1. There should be a line ".." at the bottom, to end the definition. 2. An extra forward-slash appears in the ".so ..." line following the word "date". The true definition is: .de gR .sy echo ".ds \\$1 `ls -l \n(.F | awk '{print $5, $6, $7}'`">/tmp/date\n($$ .so /tmp/date\n($$ .sy rm /tmp/date\n($$ ..