Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!zaphod.mps.ohio-state.edu!rpi!crdgw1!barnett From: barnett@grymoire.crd.ge.com (Bruce Barnett) Newsgroups: comp.unix.programmer Subject: Re: Extracting documentation from C code. Message-ID: Date: 16 May 91 20:39:26 GMT References: Sender: news@crdgw1.crd.ge.com Reply-To: barnett@crdgw1.ge.com Distribution: comp Organization: GE Corp. R & D, Schenectady, NY Lines: 35 In-reply-to: benny@vlss.amdahl.com's message of 16 May 91 01:54:47 GMT In article benny@vlss.amdahl.com (Benny Schnaider) writes: > I am looking for a utility to extract documentation from a "C" > program. I want to have the documentation source as part of the "C" code > (comments) which can be easily extracted in a troff (man page) > format. The output should be similar to man 3 output format. I suggest you use the convention that comments always have a "*" as the second character on the line: /* This is a comment * more ... */ etc. Then if you want to include nroff code in a program, use another convention, say - If the second character is a "*", and the third is a "|", then it's nroff text: /* nroff document *|.\" @(#)ease.l (FLUKE) 25-feb-87 *|.\" *|.TH EASE LOCAL "Feb 13, 1991" */ Then you can use grep/sed to get the documents: grep '^.\*|' file | sed 's/^.\*|//' >file.man You can get fancier, but you have to set up these policies yourself ahead of time. -- Bruce G. Barnett barnett@crdgw1.ge.com uunet!crdgw1!barnett