home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume42 / c2man-2.0 / part05 < prev    next >
Internet Message Format  |  1994-05-06  |  50KB

  1. From: greyham@research.canon.oz.au (Graham Stoney)
  2. Newsgroups: comp.sources.misc
  3. Subject: v42i059:  c2man-2.0 - automatic C documentation generator, Part05/09
  4. Date: 25 Apr 1994 22:30:56 -0500
  5. Organization: Canon Information Systems Research Australia
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2pi1tg$joh@sparky.sterling.com>
  9. References: <csm-v42i055=c2man-2.0.222803@sparky.sterling.com>
  10. Summary: a complete posting of the latest c2man: version 2.0 patchlevel 27
  11. X-Md4-Signature: 723f2058a5c92d388d09119a195db630
  12.  
  13. Submitted-by: greyham@research.canon.oz.au (Graham Stoney)
  14. Posting-number: Volume 42, Issue 59
  15. Archive-name: c2man-2.0/part05
  16. Environment: UNIX, DOS, OS/2, lex, yacc
  17.  
  18. #! /bin/sh
  19. #
  20. # This is c2man version 2.0 at patchlevel 27.
  21. # Make a new directory for the c2man sources, cd to it, and run kits 1 up
  22. # to 9 through sh.  When all 9 kits have been run, read README.
  23. #
  24. echo " "
  25. cat <<EOM
  26. This is c2man 2.0 at patchlevel 27, kit 5 (of 9):
  27. If this shell archive is complete, the line "End of kit 5 (of 9)"
  28. will echo at the end.
  29. EOM
  30. export PATH || (echo "Please use sh to unpack this archive." ; kill $$)
  31. mkdir eg pc 2>/dev/null
  32. echo Extracting c2man.1
  33. sed >c2man.1 <<'!STUFFY!FUNK!' -e 's/X//'
  34. X.\" $Id: c2man.1,v 2.0.1.36 1994/01/13 05:20:40 greyham Exp $
  35. X.de EX          \"Begin example
  36. X.br
  37. X.if \\$1 .ne \\$1
  38. X.if !"\\$2"" \{
  39. X.if n .sp 1
  40. X.if t .sp .5
  41. X\\$2
  42. X\}
  43. X.if n .sp 1
  44. X.if t .sp .5
  45. X.nf
  46. X.in +.5i
  47. X..
  48. X.de EE        \"End example
  49. X.fi
  50. X.in -.5i
  51. X.if n .sp 1
  52. X.if t .sp .5
  53. X..
  54. X.de CS        \"Begin shell command
  55. X.br
  56. X.if n .sp 1
  57. X.if t .sp .5
  58. X.in +.5i
  59. X%
  60. X.ft B
  61. X..
  62. X.de CE        \"End shell command
  63. X.br
  64. X.ft R
  65. X.in -.5i
  66. X.if n .sp 1
  67. X.if t .sp .5
  68. X..
  69. X.de CD        \"Shell command
  70. X.CS
  71. X\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  72. X.CE
  73. X..
  74. X.\"    The IF & IE macros cannot be combined due to flatten.sed
  75. X.de IF        \"Begin Include a file
  76. X.if n .sp 1
  77. X.if t .sp .5
  78. X.ne 10
  79. X.nf
  80. X.RS 0.25in
  81. X..
  82. X.de IE        \"End Include a file
  83. X.RE
  84. X.if n .sp 1
  85. X.if t .sp .5
  86. X.fi
  87. X..
  88. X.TH C2MAN 1 "January 12, 1994"
  89. X.BY "CISRA"
  90. X.SH NAME
  91. Xc2man \- generate manual pages from C source code
  92. X.SH SYNOPSIS
  93. X.B c2man
  94. X[ 
  95. X.I option \fP...\fI
  96. X] [
  97. X.I file \fP...\fI
  98. X]
  99. X.SH DESCRIPTION
  100. X.B c2man
  101. Xreads C source code files in which comments have been strategically placed,
  102. Xand outputs manual page(s) documenting each function defined or declared (via
  103. Xa prototype), and optionally each variable with global scope.
  104. XFunction definitions and declarations may be in the old style or ISO/ANSI style.
  105. XIf no
  106. X.I file
  107. Xargument is given,
  108. X.B c2man
  109. Xtakes its input from the standard input.
  110. X.PP
  111. XIf a
  112. X.B .h
  113. Xfile is written as a formal interface description when preparing an
  114. Xinterface spec,
  115. X.B c2man
  116. Xcan generate all the manual pages required for the spec at one fell swoop,
  117. Xand then keep them up to date automatically as the interface changes.
  118. X.PP
  119. XSince
  120. X.B c2man
  121. Xwill accept either function definitions or prototypes, it can be used on
  122. Xeither
  123. X.B .c
  124. Xor
  125. X.B .h
  126. Xfiles.
  127. XIf the input is a
  128. X.B header
  129. Xfile, any files specified by
  130. X.B \-i
  131. Xoptions are
  132. Xassumed to be prerequisites, and get parsed before the input file.
  133. X(Any file whose extension begins with
  134. X.RB `` h '',
  135. Xmatched case-insensitively,
  136. Xis considered a
  137. X.B header
  138. Xfile.)
  139. X.PP
  140. XThis is potentially a huge win for most programmers that just love documenting
  141. Xtheir functions, and updating the documentation every time it changes.
  142. XHere's an example, named example.h:
  143. X.IF
  144. X.so example.h
  145. X.IE
  146. X.PP
  147. XWhen:
  148. X.CD c2man example.h
  149. Xis run,
  150. Xthis produces a file named
  151. X.B dowork.3
  152. Xwhich can be processed by man(1) or used as:
  153. X.CD "nroff -man dowork.3"
  154. Xto produce:
  155. X.IF
  156. X.ne 34
  157. X.so example.inc
  158. X.IE
  159. X.SS "Output Generation"
  160. XBy default, a separate output file is generated for each global identifier
  161. X(i.e. function or variable) documented by c2man.
  162. X.PP
  163. XMuch of
  164. X.BR c2man 's
  165. Xinformation is extracted from the comment placed immediately before the
  166. Xdeclaration/definition of the identifier being documented; this comment
  167. Xis taken to describe the identifier and
  168. X.B must
  169. Xbe present, or the identifier will be ignored entirely.
  170. XIn the case of a variable declaration/definition, this comment may instead be
  171. Xplaced after it starting on the same line.
  172. X.PP
  173. XGlobal variables are not documented, unless the
  174. X.B \-v
  175. Xoption is used.
  176. X.PP
  177. XIdentifiers declared
  178. X.B static
  179. Xare ignored by default unless the file is a
  180. X.B header
  181. Xfile (which is most useful with
  182. X.B inline
  183. Xfunctions) or the
  184. X.B -s
  185. Xoption is used.
  186. X.PP
  187. XDeclarations with the
  188. X.B extern
  189. Xkeyword are ignored unless they appear in a
  190. X.B header
  191. Xfile; note that this does not include function definitions.
  192. X.SS "Sections Generated Automatically"
  193. XEach manual page starts with a
  194. X.B NAME
  195. Xsection, listing the name(s) of the identifier(s) documented, along with a
  196. Xterse description.
  197. XBy default, this description is the first line or sentence of the
  198. Xcomment describing the identifier.
  199. XWith the
  200. X.B \-g
  201. Xoption, it is found after the first dash
  202. X.RB ( \- )
  203. Xin the first comment of the file, and the
  204. X.B \-G
  205. Xoption specifies it explicitly.
  206. X.PP
  207. XThe
  208. X.B SYNOPSIS
  209. Xsection
  210. Xbegins with an
  211. X.B #include
  212. Xline
  213. Xif the source file is a
  214. X.BR header .
  215. XAfter this is an external declaration for the
  216. Xidentifier(s) being documented.
  217. X.PP
  218. XInformation in the
  219. X.B PARAMETERS
  220. Xsection is gleaned from the comments immediately before or after each
  221. Xparameter declaration. A comment after a parameter can follow the comma that
  222. Xseparates that parameter from the next, if the comment starts on the same line
  223. Xand is the only remaining thing on that line. Leading underscores in a
  224. Xparameter name are stripped when printed in the manual page.
  225. X.PP
  226. XIf the manual page is for a group of functions (ie:
  227. X.B \-g
  228. Xor
  229. X.B \-G
  230. Xoptions),
  231. Xidentical parameters (in both name and type) common to more than one function
  232. Xare described only once if only one has a comment (as in the ctype
  233. Xexample below).
  234. X.PP
  235. XIf a parameter is an
  236. X.B enumerated
  237. X.BR type ,
  238. Xall the possible values it can take are output, along with their descriptions.
  239. XThese descriptions are gleaned from the comments surrounding the
  240. X.B enum
  241. Xidentifiers where the type was defined.
  242. XComments describing
  243. X.B enum
  244. Xidentifiers are placed in a similar manner to those that describe function
  245. Xparameters.
  246. X.B enum
  247. Xidentifiers that begin with an underscore are ignored, which is useful for
  248. Xpadding or
  249. X.I _NUMBER_OF_...
  250. Xvalues which aren't normally used by someone calling
  251. Xthe function.
  252. XIf none of the identifiers in an enumerated type has a comment,
  253. X.B c2man
  254. Xwill bunch them together to save space.
  255. X.PP
  256. XThe
  257. X.B DESCRIPTION
  258. Xsection contains everything
  259. Xafter the first line or sentence
  260. Xof the comment describing the identifier,
  261. Xup until the word
  262. X.RB `` returns ''
  263. Xat the start of a line, matched case-insensitively and optionally followed by
  264. Xa colon
  265. X.RB ( : ).
  266. XIn the case of a variable of
  267. X.B enumerated
  268. X.BR type ,
  269. Xit will also list all the values it can hold.
  270. X.PP
  271. XThe
  272. X.B RETURNS
  273. Xsection contains anything after that. Any of these lines that begin with a
  274. Xsingle word followed by a colon or a tab generate tagged paragraphs so that
  275. Xlists of possible return values and error codes look neat.
  276. XIf the function is void, don't put anything like "Returns: nothing" in
  277. Xthe comment, since it's a waste of space. If the identifier is a function
  278. Xreturning an
  279. X.B enumerated
  280. X.BR type ,
  281. Xits possible values will be listed here.
  282. X.PP
  283. XFinally, a
  284. X.B "SEE ALSO"
  285. Xsection is generated, referencing all the other manual pages generated, if any.
  286. X.PP
  287. XThe
  288. X.BR RETURNS ,
  289. X.B PARAMETERS
  290. Xand
  291. X.B "SEE ALSO"
  292. Xsections are omitted entirely if they aren't needed.
  293. X.SS "Processing of Comment Contents"
  294. XBasic punctuation and capitalisation corrections are made in each section for
  295. Xneatness, and the typesetting program used to process the output will generally
  296. Xreformat line breaks according to the width of the output device. Blank lines
  297. Xin a comment will be preserved, and lines starting with a character that is
  298. Xneither alphanumeric nor a single nor double quote will cause a line break,
  299. Xallowing simple bulleted lists.
  300. X.PP
  301. XTypesetter specific commands may be included for more complex processing.
  302. X.SS "Comment Style and Placement"
  303. XBoth
  304. X.B C
  305. Xand
  306. X.B C++
  307. Xstyle comments are recognized,
  308. Xwith seperate consecutive single-line comments coalesced into a single block.
  309. XWhen looking at comments,
  310. X.B c2man
  311. Xignores everything before the first alpha-numeric character. After that, it
  312. Xignores leading white-space, leading asterisks and leading slashes
  313. Xon all subsequent
  314. Xlines, and ignores all trailing lines thus rendered blank. If that leaves
  315. Xnothing, the comment is ignored entirely.
  316. XThis makes it very flexible in supporting popular comment boxing.
  317. X.PP
  318. XComments can be placed with considerable flexibility so that most commenting
  319. Xstyles are supported.
  320. X.EX 13 "The following variations of the enum definition in the \fBdowork.h\fR\
  321. X example are all equivalent:"
  322. X/* commas after the comments. */
  323. Xenum Place
  324. X{
  325. X    HOME       /* Home, Sweet Home */,
  326. X    WORK       /* where I spend lots of time */,
  327. X    MOVIES     /* Saturday nights mainly */,
  328. X    CITY       /* New York, New York */,
  329. X    COUNTRY    /* Bob's Country Bunker */
  330. X};
  331. X.EE
  332. X.EX 16
  333. X/* the comment needn't go on the same line,
  334. X * if the comma goes after the comment.
  335. X */
  336. Xenum Place
  337. X{
  338. X    HOME
  339. X        /* Home, Sweet Home */,
  340. X    WORK
  341. X        /* where I spend lots of time */,
  342. X    MOVIES
  343. X        /* Saturday nights mainly */,
  344. X    CITY
  345. X        /* New York, New York */,
  346. X    COUNTRY
  347. X        /* Bob's Country Bunker */
  348. X};
  349. X.EE
  350. X.EX 14
  351. X/* the comment can go before it too. */
  352. Xenum Place
  353. X{
  354. X    /* Home, Sweet Home */
  355. X    HOME,
  356. X    /* where I spend lots of time */
  357. X    WORK,
  358. X    /* Saturday nights mainly */
  359. X    MOVIES,
  360. X    /* New York, New York */
  361. X    CITY,
  362. X    /* Bob's Country Bunker */
  363. X    COUNTRY
  364. X};
  365. X.EE
  366. XBut the following example is
  367. X.B NOT
  368. Xequivalent because the commas are between the identifier and the its
  369. Xassociated comment, and the comment is on a different line.
  370. XEach comment actually applies to the wrong identifier, so this will result in
  371. Xvery misleading output.
  372. X.EX 16 "Don't do this:"
  373. Xenum Place
  374. X{
  375. X    HOME,
  376. X        /* Home, Sweet Home */
  377. X    WORK,
  378. X        /* where I spend lots of time */
  379. X    MOVIES,
  380. X        /* Saturday nights mainly */
  381. X    CITY,
  382. X        /* New York, New York */
  383. X    COUNTRY
  384. X        /* Bob's Country Bunker */
  385. X};
  386. X.EE
  387. X.PP
  388. XSince enum identifiers sometimes fall into logical groups, a comment before
  389. Xsuch an identifier will be taken to apply to the next few in the list,
  390. Xprovided that the comments describing each individual identifier
  391. Xare placed after them. Also, there must be a blank line separating the comment
  392. Xdescribing the next logical group and the comment at the end of the previous
  393. Xline, or the two will be coalesced and incorrectly treated as a single comment
  394. Xfor the previous enumerator.
  395. X.EX 17 "In other words, you can go:"
  396. X/* include logical grouping comments. */
  397. Xenum Place
  398. X{
  399. X    /* These take up most of the week */
  400. X    HOME,      /* Home, Sweet Home */
  401. X    WORK,      /* where I spend lots of time */
  402. X
  403. X    /* More for special occasions */
  404. X    MOVIES,     /* Saturday nights mainly */
  405. X    CITY,      /* New York, New York */
  406. X
  407. X    /* The real favourite */
  408. X    COUNTRY    /* Bob's Country Bunker */
  409. X};
  410. X.EE
  411. X.PP
  412. XThat may all sound a bit complex, but the upshot is that
  413. X.B c2man
  414. Xwill usually know which identifier a comment is associated with, unless you do
  415. Xsomething truly bizarre.
  416. X.SS "Grouped Manual Pages"
  417. XSimple, closely related objects can be grouped together onto a single page with the
  418. X.B \-g
  419. Xor
  420. X.B \-G
  421. Xoptions. By default, this results in a single output file with multiple links
  422. Xso that it can be accessed by the name of the input file, or of any identifier
  423. Xdocumented.
  424. XFor example, if ctype.h contains:
  425. X.IF
  426. X.so ctype_ex.h
  427. X.IE
  428. X.PP
  429. Xthen using:
  430. X.CD c2man -g ctype.h
  431. Xyields:
  432. X.IF
  433. X.so ctype_ex.inc
  434. X.IE
  435. X.SS "Extra Sections"
  436. XAdditional sections not otherwise recognized by
  437. X.B c2man
  438. Xcan be included in the manual page by including them in the comment
  439. Xdescribing the identifier.
  440. XA section heading is preceded in the comment by an empty line (after
  441. Xremoval of leading asterisks), and is the only word on it's line, or is followed
  442. Xby a colon
  443. X.RB ( : ).
  444. XSection heading names are capitalized, and the names
  445. X.BR DESCRIPTION ,
  446. X.B RETURNS
  447. Xand
  448. X.B NAME
  449. Xare recognized specially so you can name them explicitly if you like.
  450. X.BR FUNCTION ,
  451. X.B PROCEDURE
  452. Xand
  453. X.B ROUTINE
  454. Xare also recognised, and treated identically to
  455. X.BR NAME .
  456. X.EX 9 "For example:"
  457. X/*
  458. X * Have a quick puff.
  459. X * 
  460. X * Warning: Smoking causes lung cancer
  461. X */
  462. Xvoid go_for_a_smoke();
  463. X.EE
  464. XGenerates a manual page with a
  465. X.B WARNING
  466. Xsection.
  467. X.EE
  468. X.SH OPTIONS
  469. X.TP
  470. X.BI \-o dir
  471. XWrite generated files into directory
  472. X.B dir
  473. Xrather than the current directory.
  474. XIf
  475. X.B dir
  476. Xis specified as
  477. X.BR \- ,
  478. Xgenerated pages are written to the standard output, separated by form-feeds.
  479. X.TP
  480. X.B \-v
  481. XAlso output declarations for variables defined in the file.
  482. X.TP
  483. X.B \-s
  484. XOutput manual pages for all
  485. X.B static
  486. Xidentifiers.
  487. X.TP
  488. X.B \-g
  489. XGroup all the info generated together into a single
  490. Xpage (ala ctype(3)), reading the single-line terse description for the
  491. X.B NAME
  492. Xsection from the line of the first comment in the file.
  493. XIf this first line contains a dash
  494. X.RB ( \- )
  495. Xsurrounded by whitespace, the terse description is taken starting after the
  496. Xdash.
  497. XIf multiple files are specified,
  498. Xthe first such suitable comment encountered is used. A link to
  499. Xthe output file is made for each identifier documented, according to the
  500. X.B \-l
  501. Xoption.
  502. X.TP
  503. X.BI \-G terse
  504. XLike
  505. X.BR \-g ,
  506. Xbut using the specified terse description rather than reading it from the
  507. Xfile.
  508. X.TP
  509. X.B \-l h|s|f|n|r
  510. XSelect how the output for a grouped manual page is linked to files named after
  511. Xall identifiers documented on the page.
  512. XHard link
  513. X.RB ( h )
  514. Xis the default, as it uses the least space.
  515. XSoft link
  516. X.RB ( s ),
  517. Xwhere supported, allows a
  518. X.BR find (1)
  519. Xcommand with
  520. X.RB `` "\-type f" ''
  521. Xto easily skip the duplicated pages.
  522. XSeparate file
  523. X.RB ( f )
  524. Xcontaining a file include
  525. Xdirective is the traditional
  526. X.SM UNIX
  527. Xmethod.
  528. XNo link
  529. X.RB ( n )
  530. Xis useful for generating printed documentation without duplicated pages; only
  531. Xa single file, named according to the
  532. X.B \-n
  533. Xoption, is generated.
  534. XRemove
  535. X.RB ( r )
  536. Xis like No link, but also removes any previously generated links/files named
  537. Xafter the identifiers documented. Useful for cleaning up after accidents with
  538. Xthe other link options.
  539. X.sp
  540. XIn all cases, any existing links will be removed before being rewritten.
  541. X.TP
  542. X.B \-n
  543. XName the documentation output file after the input file.
  544. XWhen generating grouped manual pages, this will be the file to which others
  545. Xare linked. 
  546. XFor non-grouped manual pages, if documentation for more than one
  547. Xidentifier is generated, information about the last identifier will overwrite
  548. Xinformation about all the previous ones.
  549. X.PP
  550. X.BI \-i file
  551. X.PP
  552. X\fB\-i\fI\{"file"\}
  553. X.TP
  554. X.BI \-i <file>
  555. XInsert a
  556. X.B #include
  557. Xline referencing the specified file in the
  558. X.B SYNOPSIS
  559. Xsection, using the ``<file>'' form by default.
  560. XAny number of
  561. X.B \-i
  562. Xoptions may be specified to build up a list of prerequisites.
  563. XIf using the second form, you may need to quote the quotation marks, lest they
  564. Xget removed by the shell.
  565. X.TP
  566. X.BI \-H header-path
  567. XPrepend
  568. X.B header-path
  569. Xto the name of the
  570. X.B header
  571. Xfile when an
  572. X.B #include
  573. Xline is automatically generated in the
  574. X.B SYNOPSIS
  575. Xsection.
  576. X.TP
  577. X.BI \-L
  578. XLazy option: Only list parameters in the
  579. X.B PARAMETERS
  580. Xsection if they are documented by a comment in the source. By default,
  581. Xparameters with no comment are described as ``Not Documented.'', to encourage
  582. Xthe programmer to comment them.
  583. X.TP
  584. X.B \-T n|l|t
  585. XSet the output typesetting language.
  586. X.B Nroff
  587. X.RB ( n )
  588. Xis the default, 
  589. X.B LaTeX
  590. X.RB ( l )
  591. X, or
  592. X.B texinfo
  593. X.RB ( t ).
  594. X.TP
  595. X.BI \-e
  596. XPrepares the output so it can be embedded in texts of the output typesetting
  597. Xlanguage.
  598. X.TP
  599. X.BI \-M name
  600. XSet the name of the manual in which the page will go.
  601. X.TP
  602. X.BI \-S section
  603. XSet the default manual section, used as the extension on the output files.
  604. X.I section
  605. Xdefaults to ``3'' for
  606. X.BR nroff ,
  607. X``texi'' for
  608. X.B TeXinfo
  609. Xand ``tex'' for
  610. X.B LaTeX
  611. Xoutput, as specified via the
  612. X.B \-T
  613. Xoption.
  614. XThis setting can be overridden by the
  615. X.BI \-O? .ext
  616. Xoptions for finer control.
  617. X.TP
  618. X.BI \-Of|v|F|V[ subdir ][. ext ]
  619. XProvides for finer control of the output files, allowing a different output
  620. Xsubdirectory and extension to be specified for these different classes of
  621. Xobjects:
  622. Xfunctions
  623. X.RB ( f ),
  624. Xvariables
  625. X.RB ( v ),
  626. Xstatic functions
  627. X.RB ( F )
  628. Xand static variables
  629. X.RB ( V ).
  630. X.sp
  631. XIf
  632. X.I subdir
  633. Xis specified, the selected class of output will be written in that
  634. Xsubdirectory under the directory given by the
  635. X.B \-o
  636. Xoption if specified, otherwise under the current directory.
  637. X.sp
  638. XIf
  639. X.I .ext
  640. Xis specified, it will be used as the extension on the output files of the
  641. Xselected class, instead of the default based on the
  642. X.B \-S
  643. Xoption (if specified), or the typesetting output format specified by the
  644. X.B \-T
  645. Xoption.
  646. X.sp
  647. XFor example, the following command will generate
  648. X.BR nroff (1)
  649. Xstyle output under the /usr/local/man hierarchy, documenting functions in
  650. Xsection 3 (/usr/local/man/man3/*.3), global variables in section 3v
  651. X(/usr/local/man/man3/*.3v), static functions in section 9
  652. X(/usr/local/man/man9/*.9) and
  653. Xstatic variables in section 9v (/usr/local/man/man9/*.9v):
  654. X.CD c2man -o/usr/local/man -v -s -Ofman3.3 -Ovman3.3v -OFman9.9 -OVman9.9v input.c
  655. XThe
  656. X.B \-O
  657. Xoptions will have no effect if
  658. X.B \-o-
  659. Xis used to write to standard output, and
  660. X.BR \-Ov ,
  661. X.B \-OF
  662. Xand
  663. X.B \-OV
  664. Xwill have no effect unless their classes of output are enabled via the
  665. Xappropriate
  666. X.B \-v
  667. Xand
  668. X.B \-s
  669. Xoptions.
  670. X.TP
  671. X.BI \-F template
  672. XSet the format used to output the prototype for functions with more than 1
  673. Xparameter
  674. Xin each manual page;
  675. Xfunctions with zero or 1 parameters are always output as one line.
  676. XThe format is specified by a template in the form
  677. X.EX
  678. X" int f ( a, b )"
  679. X.EE
  680. Xbut you may replace each space in this string with any number of
  681. Xwhitespace characters.
  682. XFor example, the option
  683. X.EX
  684. X-F"int f(\\n\\ta,\\n\\tb\\n\\t)"
  685. X.EE
  686. X.EX 5 "will produce:"
  687. Xint main(
  688. X        int argc,
  689. X        char *argv[]
  690. X        )
  691. X.EE
  692. X.EX 5 "The default output format is:"
  693. Xint main
  694. X(
  695. X        int argc,
  696. X        char *argv[]
  697. X);
  698. X.EE
  699. X.TP
  700. X.BI \-P preprocessor
  701. XRun a different C preprocessor than normal (use
  702. X.B \-V
  703. Xto determine the configured default).
  704. XYou must include any options required to prevent it from stripping comments,
  705. Xwhich is normally the default preprocessor behaviour.
  706. XFor example, to use
  707. X.BR gcc 's
  708. Xcpp instead:
  709. X.CD c2man -P \{"gcc -E -C"\}
  710. X.TP
  711. X.BI \-D name[=value]
  712. XThis option is passed through to the preprocessor and is used to define 
  713. Xsymbols for use with conditionals such as
  714. X.I #ifdef.
  715. X.TP
  716. X.BI \-U name
  717. XThis option is passed through to the preprocessor and is used to remove
  718. Xany definitions of this symbol.
  719. X.TP
  720. X.BI \-I directory
  721. XThis option is passed through to the preprocessor and is used to specify
  722. Xa directory to search for files that are referenced with 
  723. X.I #include.
  724. X.TP
  725. X.B \-V
  726. XPrint version information and cpp parameters.
  727. X.SH FILES
  728. X.TP
  729. X$(privlib)/eg/*.[ch]
  730. XA few example input files, showing different commenting styles.
  731. X.SH "SEE ALSO"
  732. Xman(1),
  733. Xapropos(1),
  734. Xcatman(8),
  735. Xcproto(1),
  736. Xcc(1),
  737. Xcpp(1)
  738. X.SH DIAGNOSTICS
  739. X.BR c2man 's
  740. Xerror messages are not very helpful. Make sure your code compiles before
  741. Xtrying
  742. X.BR c2man .
  743. XIf the code compiles OK but
  744. X.B c2man
  745. Xrejects it, it may be because a comment is in a position
  746. X.B c2man
  747. Xdoes not accept, or you are using a compiler extension not strictly conforming
  748. Xto standard C.
  749. X.B c2man
  750. Xdefines the preprocessor symbol
  751. X.B __C2MAN__
  752. Xwith its major version number
  753. Xto allow you to work around such problems by surrounding them with
  754. X.BR "#ifndef __C2MAN__" .
  755. X.PP
  756. XAn error at the very end of a function may indicate that the comments at the
  757. Xbeginning are badly placed.
  758. X.SH HISTORY
  759. X.B c2man
  760. Xwas written by:
  761. X.EX 4
  762. XGraham Stoney
  763. XCanon Information Systems Research Australia
  764. Xgreyham@research.canon.oz.au
  765. X(please send bug reports here)
  766. X.EE
  767. Xbut was heavily derived from
  768. X.B cproto
  769. Xwritten by:
  770. X.EX 2
  771. XChin Huang
  772. Xchin.huang@canrem.com
  773. X.EE
  774. X.SH BUGS
  775. XThe
  776. X.B \-F
  777. Xoption only interprets the following
  778. Xcharacter escape sequences:
  779. X.EX 2
  780. X\\n    newline
  781. X\\t    tab
  782. X.EE
  783. X.PP
  784. XA comment before a preprocessor directive will be considered to apply
  785. Xto the identifier that immediately follows, if it has no
  786. Xcomment of its own.
  787. XThis is because the preprocessor directive gets removed by cpp before
  788. Xc2man looks at it.
  789. X.PP
  790. XComments aren't legal in some of the more obscure places that they are in C.
  791. X.PP
  792. XHeavy use of
  793. X.B #define
  794. Xin a program may yield somewhat obscure manual pages.
  795. !STUFFY!FUNK!
  796. echo Extracting pc/COPYING
  797. sed >pc/COPYING <<'!STUFFY!FUNK!' -e 's/X//'
  798. X            GNU GENERAL PUBLIC LICENSE
  799. X               Version 2, June 1991
  800. X
  801. X Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  802. X                          675 Mass Ave, Cambridge, MA 02139, USA
  803. X Everyone is permitted to copy and distribute verbatim copies
  804. X of this license document, but changing it is not allowed.
  805. X
  806. X                Preamble
  807. X
  808. X  The licenses for most software are designed to take away your
  809. Xfreedom to share and change it.  By contrast, the GNU General Public
  810. XLicense is intended to guarantee your freedom to share and change free
  811. Xsoftware--to make sure the software is free for all its users.  This
  812. XGeneral Public License applies to most of the Free Software
  813. XFoundation's software and to any other program whose authors commit to
  814. Xusing it.  (Some other Free Software Foundation software is covered by
  815. Xthe GNU Library General Public License instead.)  You can apply it to
  816. Xyour programs, too.
  817. X
  818. X  When we speak of free software, we are referring to freedom, not
  819. Xprice.  Our General Public Licenses are designed to make sure that you
  820. Xhave the freedom to distribute copies of free software (and charge for
  821. Xthis service if you wish), that you receive source code or can get it
  822. Xif you want it, that you can change the software or use pieces of it
  823. Xin new free programs; and that you know you can do these things.
  824. X
  825. X  To protect your rights, we need to make restrictions that forbid
  826. Xanyone to deny you these rights or to ask you to surrender the rights.
  827. XThese restrictions translate to certain responsibilities for you if you
  828. Xdistribute copies of the software, or if you modify it.
  829. X
  830. X  For example, if you distribute copies of such a program, whether
  831. Xgratis or for a fee, you must give the recipients all the rights that
  832. Xyou have.  You must make sure that they, too, receive or can get the
  833. Xsource code.  And you must show them these terms so they know their
  834. Xrights.
  835. X
  836. X  We protect your rights with two steps: (1) copyright the software, and
  837. X(2) offer you this license which gives you legal permission to copy,
  838. Xdistribute and/or modify the software.
  839. X
  840. X  Also, for each author's protection and ours, we want to make certain
  841. Xthat everyone understands that there is no warranty for this free
  842. Xsoftware.  If the software is modified by someone else and passed on, we
  843. Xwant its recipients to know that what they have is not the original, so
  844. Xthat any problems introduced by others will not reflect on the original
  845. Xauthors' reputations.
  846. X
  847. X  Finally, any free program is threatened constantly by software
  848. Xpatents.  We wish to avoid the danger that redistributors of a free
  849. Xprogram will individually obtain patent licenses, in effect making the
  850. Xprogram proprietary.  To prevent this, we have made it clear that any
  851. Xpatent must be licensed for everyone's free use or not licensed at all.
  852. X
  853. X  The precise terms and conditions for copying, distribution and
  854. Xmodification follow.
  855. X
  856. X            GNU GENERAL PUBLIC LICENSE
  857. X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  858. X
  859. X  0. This License applies to any program or other work which contains
  860. Xa notice placed by the copyright holder saying it may be distributed
  861. Xunder the terms of this General Public License.  The "Program", below,
  862. Xrefers to any such program or work, and a "work based on the Program"
  863. Xmeans either the Program or any derivative work under copyright law:
  864. Xthat is to say, a work containing the Program or a portion of it,
  865. Xeither verbatim or with modifications and/or translated into another
  866. Xlanguage.  (Hereinafter, translation is included without limitation in
  867. Xthe term "modification".)  Each licensee is addressed as "you".
  868. X
  869. XActivities other than copying, distribution and modification are not
  870. Xcovered by this License; they are outside its scope.  The act of
  871. Xrunning the Program is not restricted, and the output from the Program
  872. Xis covered only if its contents constitute a work based on the
  873. XProgram (independent of having been made by running the Program).
  874. XWhether that is true depends on what the Program does.
  875. X
  876. X  1. You may copy and distribute verbatim copies of the Program's
  877. Xsource code as you receive it, in any medium, provided that you
  878. Xconspicuously and appropriately publish on each copy an appropriate
  879. Xcopyright notice and disclaimer of warranty; keep intact all the
  880. Xnotices that refer to this License and to the absence of any warranty;
  881. Xand give any other recipients of the Program a copy of this License
  882. Xalong with the Program.
  883. X
  884. XYou may charge a fee for the physical act of transferring a copy, and
  885. Xyou may at your option offer warranty protection in exchange for a fee.
  886. X
  887. X  2. You may modify your copy or copies of the Program or any portion
  888. Xof it, thus forming a work based on the Program, and copy and
  889. Xdistribute such modifications or work under the terms of Section 1
  890. Xabove, provided that you also meet all of these conditions:
  891. X
  892. X    a) You must cause the modified files to carry prominent notices
  893. X    stating that you changed the files and the date of any change.
  894. X
  895. X    b) You must cause any work that you distribute or publish, that in
  896. X    whole or in part contains or is derived from the Program or any
  897. X    part thereof, to be licensed as a whole at no charge to all third
  898. X    parties under the terms of this License.
  899. X
  900. X    c) If the modified program normally reads commands interactively
  901. X    when run, you must cause it, when started running for such
  902. X    interactive use in the most ordinary way, to print or display an
  903. X    announcement including an appropriate copyright notice and a
  904. X    notice that there is no warranty (or else, saying that you provide
  905. X    a warranty) and that users may redistribute the program under
  906. X    these conditions, and telling the user how to view a copy of this
  907. X    License.  (Exception: if the Program itself is interactive but
  908. X    does not normally print such an announcement, your work based on
  909. X    the Program is not required to print an announcement.)
  910. X
  911. XThese requirements apply to the modified work as a whole.  If
  912. Xidentifiable sections of that work are not derived from the Program,
  913. Xand can be reasonably considered independent and separate works in
  914. Xthemselves, then this License, and its terms, do not apply to those
  915. Xsections when you distribute them as separate works.  But when you
  916. Xdistribute the same sections as part of a whole which is a work based
  917. Xon the Program, the distribution of the whole must be on the terms of
  918. Xthis License, whose permissions for other licensees extend to the
  919. Xentire whole, and thus to each and every part regardless of who wrote it.
  920. X
  921. XThus, it is not the intent of this section to claim rights or contest
  922. Xyour rights to work written entirely by you; rather, the intent is to
  923. Xexercise the right to control the distribution of derivative or
  924. Xcollective works based on the Program.
  925. X
  926. XIn addition, mere aggregation of another work not based on the Program
  927. Xwith the Program (or with a work based on the Program) on a volume of
  928. Xa storage or distribution medium does not bring the other work under
  929. Xthe scope of this License.
  930. X
  931. X  3. You may copy and distribute the Program (or a work based on it,
  932. Xunder Section 2) in object code or executable form under the terms of
  933. XSections 1 and 2 above provided that you also do one of the following:
  934. X
  935. X    a) Accompany it with the complete corresponding machine-readable
  936. X    source code, which must be distributed under the terms of Sections
  937. X    1 and 2 above on a medium customarily used for software interchange; or,
  938. X
  939. X    b) Accompany it with a written offer, valid for at least three
  940. X    years, to give any third party, for a charge no more than your
  941. X    cost of physically performing source distribution, a complete
  942. X    machine-readable copy of the corresponding source code, to be
  943. X    distributed under the terms of Sections 1 and 2 above on a medium
  944. X    customarily used for software interchange; or,
  945. X
  946. X    c) Accompany it with the information you received as to the offer
  947. X    to distribute corresponding source code.  (This alternative is
  948. X    allowed only for noncommercial distribution and only if you
  949. X    received the program in object code or executable form with such
  950. X    an offer, in accord with Subsection b above.)
  951. X
  952. XThe source code for a work means the preferred form of the work for
  953. Xmaking modifications to it.  For an executable work, complete source
  954. Xcode means all the source code for all modules it contains, plus any
  955. Xassociated interface definition files, plus the scripts used to
  956. Xcontrol compilation and installation of the executable.  However, as a
  957. Xspecial exception, the source code distributed need not include
  958. Xanything that is normally distributed (in either source or binary
  959. Xform) with the major components (compiler, kernel, and so on) of the
  960. Xoperating system on which the executable runs, unless that component
  961. Xitself accompanies the executable.
  962. X
  963. XIf distribution of executable or object code is made by offering
  964. Xaccess to copy from a designated place, then offering equivalent
  965. Xaccess to copy the source code from the same place counts as
  966. Xdistribution of the source code, even though third parties are not
  967. Xcompelled to copy the source along with the object code.
  968. X
  969. X  4. You may not copy, modify, sublicense, or distribute the Program
  970. Xexcept as expressly provided under this License.  Any attempt
  971. Xotherwise to copy, modify, sublicense or distribute the Program is
  972. Xvoid, and will automatically terminate your rights under this License.
  973. XHowever, parties who have received copies, or rights, from you under
  974. Xthis License will not have their licenses terminated so long as such
  975. Xparties remain in full compliance.
  976. X
  977. X  5. You are not required to accept this License, since you have not
  978. Xsigned it.  However, nothing else grants you permission to modify or
  979. Xdistribute the Program or its derivative works.  These actions are
  980. Xprohibited by law if you do not accept this License.  Therefore, by
  981. Xmodifying or distributing the Program (or any work based on the
  982. XProgram), you indicate your acceptance of this License to do so, and
  983. Xall its terms and conditions for copying, distributing or modifying
  984. Xthe Program or works based on it.
  985. X
  986. X  6. Each time you redistribute the Program (or any work based on the
  987. XProgram), the recipient automatically receives a license from the
  988. Xoriginal licensor to copy, distribute or modify the Program subject to
  989. Xthese terms and conditions.  You may not impose any further
  990. Xrestrictions on the recipients' exercise of the rights granted herein.
  991. XYou are not responsible for enforcing compliance by third parties to
  992. Xthis License.
  993. X
  994. X  7. If, as a consequence of a court judgment or allegation of patent
  995. Xinfringement or for any other reason (not limited to patent issues),
  996. Xconditions are imposed on you (whether by court order, agreement or
  997. Xotherwise) that contradict the conditions of this License, they do not
  998. Xexcuse you from the conditions of this License.  If you cannot
  999. Xdistribute so as to satisfy simultaneously your obligations under this
  1000. XLicense and any other pertinent obligations, then as a consequence you
  1001. Xmay not distribute the Program at all.  For example, if a patent
  1002. Xlicense would not permit royalty-free redistribution of the Program by
  1003. Xall those who receive copies directly or indirectly through you, then
  1004. Xthe only way you could satisfy both it and this License would be to
  1005. Xrefrain entirely from distribution of the Program.
  1006. X
  1007. XIf any portion of this section is held invalid or unenforceable under
  1008. Xany particular circumstance, the balance of the section is intended to
  1009. Xapply and the section as a whole is intended to apply in other
  1010. Xcircumstances.
  1011. X
  1012. XIt is not the purpose of this section to induce you to infringe any
  1013. Xpatents or other property right claims or to contest validity of any
  1014. Xsuch claims; this section has the sole purpose of protecting the
  1015. Xintegrity of the free software distribution system, which is
  1016. Ximplemented by public license practices.  Many people have made
  1017. Xgenerous contributions to the wide range of software distributed
  1018. Xthrough that system in reliance on consistent application of that
  1019. Xsystem; it is up to the author/donor to decide if he or she is willing
  1020. Xto distribute software through any other system and a licensee cannot
  1021. Ximpose that choice.
  1022. X
  1023. XThis section is intended to make thoroughly clear what is believed to
  1024. Xbe a consequence of the rest of this License.
  1025. X
  1026. X  8. If the distribution and/or use of the Program is restricted in
  1027. Xcertain countries either by patents or by copyrighted interfaces, the
  1028. Xoriginal copyright holder who places the Program under this License
  1029. Xmay add an explicit geographical distribution limitation excluding
  1030. Xthose countries, so that distribution is permitted only in or among
  1031. Xcountries not thus excluded.  In such case, this License incorporates
  1032. Xthe limitation as if written in the body of this License.
  1033. X
  1034. X  9. The Free Software Foundation may publish revised and/or new versions
  1035. Xof the General Public License from time to time.  Such new versions will
  1036. Xbe similar in spirit to the present version, but may differ in detail to
  1037. Xaddress new problems or concerns.
  1038. X
  1039. XEach version is given a distinguishing version number.  If the Program
  1040. Xspecifies a version number of this License which applies to it and "any
  1041. Xlater version", you have the option of following the terms and conditions
  1042. Xeither of that version or of any later version published by the Free
  1043. XSoftware Foundation.  If the Program does not specify a version number of
  1044. Xthis License, you may choose any version ever published by the Free Software
  1045. XFoundation.
  1046. X
  1047. X  10. If you wish to incorporate parts of the Program into other free
  1048. Xprograms whose distribution conditions are different, write to the author
  1049. Xto ask for permission.  For software which is copyrighted by the Free
  1050. XSoftware Foundation, write to the Free Software Foundation; we sometimes
  1051. Xmake exceptions for this.  Our decision will be guided by the two goals
  1052. Xof preserving the free status of all derivatives of our free software and
  1053. Xof promoting the sharing and reuse of software generally.
  1054. X
  1055. X                NO WARRANTY
  1056. X
  1057. X  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  1058. XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  1059. XOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  1060. XPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  1061. XOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  1062. XMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  1063. XTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  1064. XPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  1065. XREPAIR OR CORRECTION.
  1066. X
  1067. X  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  1068. XWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  1069. XREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  1070. XINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  1071. XOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  1072. XTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  1073. XYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  1074. XPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  1075. XPOSSIBILITY OF SUCH DAMAGES.
  1076. X
  1077. X             END OF TERMS AND CONDITIONS
  1078. X
  1079. X    Appendix: How to Apply These Terms to Your New Programs
  1080. X
  1081. X  If you develop a new program, and you want it to be of the greatest
  1082. Xpossible use to the public, the best way to achieve this is to make it
  1083. Xfree software which everyone can redistribute and change under these terms.
  1084. X
  1085. X  To do so, attach the following notices to the program.  It is safest
  1086. Xto attach them to the start of each source file to most effectively
  1087. Xconvey the exclusion of warranty; and each file should have at least
  1088. Xthe "copyright" line and a pointer to where the full notice is found.
  1089. X
  1090. X    <one line to give the program's name and a brief idea of what it does.>
  1091. X    Copyright (C) 19yy  <name of author>
  1092. X
  1093. X    This program is free software; you can redistribute it and/or modify
  1094. X    it under the terms of the GNU General Public License as published by
  1095. X    the Free Software Foundation; either version 2 of the License, or
  1096. X    (at your option) any later version.
  1097. X
  1098. X    This program is distributed in the hope that it will be useful,
  1099. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  1100. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1101. X    GNU General Public License for more details.
  1102. X
  1103. X    You should have received a copy of the GNU General Public License
  1104. X    along with this program; if not, write to the Free Software
  1105. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1106. X
  1107. XAlso add information on how to contact you by electronic and paper mail.
  1108. X
  1109. XIf the program is interactive, make it output a short notice like this
  1110. Xwhen it starts in an interactive mode:
  1111. X
  1112. X    Gnomovision version 69, Copyright (C) 19yy name of author
  1113. X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  1114. X    This is free software, and you are welcome to redistribute it
  1115. X    under certain conditions; type `show c' for details.
  1116. X
  1117. XThe hypothetical commands `show w' and `show c' should show the appropriate
  1118. Xparts of the General Public License.  Of course, the commands you use may
  1119. Xbe called something other than `show w' and `show c'; they could even be
  1120. Xmouse-clicks or menu items--whatever suits your program.
  1121. X
  1122. XYou should also get your employer (if you work as a programmer) or your
  1123. Xschool, if any, to sign a "copyright disclaimer" for the program, if
  1124. Xnecessary.  Here is a sample; alter the names:
  1125. X
  1126. X  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  1127. X  `Gnomovision' (which makes passes at compilers) written by James Hacker.
  1128. X
  1129. X  <signature of Ty Coon>, 1 April 1989
  1130. X  Ty Coon, President of Vice
  1131. X
  1132. XThis General Public License does not permit incorporating your program into
  1133. Xproprietary programs.  If your program is a subroutine library, you may
  1134. Xconsider it more useful to permit linking proprietary applications with the
  1135. Xlibrary.  If this is what you want to do, use the GNU Library General
  1136. XPublic License instead of this License.
  1137. !STUFFY!FUNK!
  1138. echo Extracting pc/config.h
  1139. sed >pc/config.h <<'!STUFFY!FUNK!' -e 's/X//'
  1140. X/*
  1141. X * This file was produced by running the config_h.SH script, which
  1142. X * gets its values from config.sh, which is generally produced by
  1143. X * running Configure.
  1144. X *
  1145. X * Feel free to modify any of this as the need arises.  Note, however,
  1146. X * that running config.h.SH again will wipe out any changes you've made.
  1147. X * For a more permanent change edit config.sh and rerun config.h.SH.
  1148. X *
  1149. X * $Id: config.h,v 2.0.1.3 1993/09/15 03:53:49 greyham Exp $
  1150. X */
  1151. X
  1152. X/* Configuration time: Sun Aug 22 08:23:18 CDT 1993
  1153. X * Configured by: hankedr
  1154. X * Target system: SunOS lab1 4.1.2 2 sun4c
  1155. X */
  1156. X
  1157. X#ifndef _config_h_
  1158. X#define _config_h_
  1159. X
  1160. X/* HAS_ACCESS:
  1161. X *    This manifest constant lets the C program know that the access()
  1162. X *    system call is available to check for accessibility using real UID/GID.
  1163. X *    (always present on UNIX.)
  1164. X */
  1165. X#define HAS_ACCESS        /**/
  1166. X
  1167. X/* HASCONST :
  1168. X *    This symbol, if defined, indicates that this C compiler knows about
  1169. X *    the const type. There is no need to actually test for that symbol
  1170. X *    within your programs. The mere use of the "const" keyword will
  1171. X *    trigger the necessary tests.
  1172. X */
  1173. X#define HASCONST    /**/
  1174. X#ifndef HASCONST
  1175. X#define const
  1176. X#endif
  1177. X
  1178. X/* FLEXFILENAMES:
  1179. X *    This symbol, if defined, indicates that the system supports filenames
  1180. X *    longer than 14 characters.
  1181. X */
  1182. X#define    FLEXFILENAMES        /**/
  1183. X
  1184. X/* HAS_OPEN3
  1185. X *    This manifest constant lets the C program know that the three
  1186. X *    argument form of open(2) is available.
  1187. X */
  1188. X#define HAS_OPEN3        /**/
  1189. X
  1190. X/* HAS_STRCHR:
  1191. X *    This symbol is defined to indicate that the strchr()/strrchr()
  1192. X *    functions are available for string searching. If not, try the
  1193. X *    index()/rindex() pair.
  1194. X */
  1195. X#define HAS_STRCHR    /**/
  1196. X
  1197. X/* HAS_STRFTIME:
  1198. X *    This symbol, if defined, indicates that the strftime routine is
  1199. X *    available to format locale-specific times.
  1200. X */
  1201. X#define HAS_STRFTIME    /**/
  1202. X
  1203. X/* HAS_STRSTR
  1204. X *    This symbol, if defined, indicates that the strstr routine is
  1205. X *    available to find substrings.
  1206. X */
  1207. X#define HAS_STRSTR    /**/
  1208. X
  1209. X/* HAS_LINK
  1210. X *    This symbol, if defined, indicates that the link routine is available
  1211. X *    to create hard links. OS/2 and DOS stupidity.
  1212. X/*#define HAS_LINK      /**/
  1213. X
  1214. X/* HAS_SYMLINK
  1215. X *    This symbol, if defined, indicates that the symlink routine is available
  1216. X *    to create symbolic links.
  1217. X */
  1218. X/*#define HAS_SYMLINK    /**/
  1219. X
  1220. X/* Time_t
  1221. X *    This symbol holds the type returned by time(). It can be long,
  1222. X *    or time_t on BSD sites (in which case <sys/types.h> should be
  1223. X *    included).
  1224. X */
  1225. X#define Time_t long        /* Time type */
  1226. X
  1227. X/* HASVOLATILE :
  1228. X *    This symbol, if defined, indicates that this C compiler knows about
  1229. X *    the volatile declaration.
  1230. X */
  1231. X#define    HASVOLATILE    /**/
  1232. X#ifndef HASVOLATILE
  1233. X#define volatile
  1234. X#endif
  1235. X
  1236. X/* I_FCNTL
  1237. X *    This manifest constant tells the C program to include <fcntl.h>.
  1238. X */
  1239. X#define I_FCNTL    /**/
  1240. X
  1241. X/* I_STDARG:
  1242. X *    This symbol, if defined, indicates that <stdarg.h> exists and should
  1243. X *    be included.
  1244. X */
  1245. X#define I_STDARG        /**/
  1246. X
  1247. X/* I_STDDEF:
  1248. X *    This symbol, if defined, indicates that <stddef.h> exists and should
  1249. X *    be included.
  1250. X */
  1251. X#define I_STDDEF    /**/
  1252. X
  1253. X/* I_STDLIB:
  1254. X *    This symbol, if defined, indicates that <stdlib.h> exists and should
  1255. X *    be included.
  1256. X */
  1257. X#define I_STDLIB        /**/
  1258. X
  1259. X/* I_STRING:
  1260. X *    This symbol, if defined, indicates to the C program that it should
  1261. X *    include <string.h> (USG systems) instead of <strings.h> (BSD systems).
  1262. X */
  1263. X#define I_STRING        /**/
  1264. X
  1265. X/* I_SYS_FILE
  1266. X *    This symbol, if defined, indicates to the C program that it should
  1267. X *    include <sys/file.h> to get definition of R_OK and friends.
  1268. X */
  1269. X#ifdef _MSC_VER
  1270. X#define W_OK 2
  1271. X#else
  1272. X#define I_SYS_FILE        /**/
  1273. X#endif
  1274. X
  1275. X/* I_SYS_TYPES
  1276. X *    This symbol, if defined, indicates to the C program that it should
  1277. X *    include <sys/types.h>.
  1278. X */
  1279. X#define    I_SYS_TYPES        /**/
  1280. X
  1281. X/* I_TIME
  1282. X *    This symbol, if defined, indicates to the C program that it should
  1283. X *    include <time.h>.
  1284. X */
  1285. X/* I_SYS_TIME
  1286. X *    This symbol, if defined, indicates to the C program that it should
  1287. X *    include <sys/time.h>.
  1288. X */
  1289. X#define I_TIME        /**/
  1290. X/*#define I_SYS_TIME        /**/
  1291. X
  1292. X/* I_UNISTD:
  1293. X *    This symbol, if defined, indicates to the C program that it should
  1294. X *    include <unistd.h>.
  1295. X */
  1296. X/*#define    I_UNISTD        /**/
  1297. X
  1298. X/* I_VARARGS:
  1299. X *    This symbol, if defined, indicates to the C program that it should
  1300. X *    include <varargs.h>.
  1301. X */
  1302. X/*#define I_VARARGS        /**/
  1303. X
  1304. X/* CAN_PROTOTYPE :
  1305. X *    If defined, this macro indicates that the C compiler can handle
  1306. X *    function prototypes.
  1307. X */
  1308. X/* DOTS :
  1309. X *    This macro is used to specify the ... in function prototypes which
  1310. X *    have arbitrary additional arguments.
  1311. X */
  1312. X/* NXT_ARG :
  1313. X *    This macro is used to separate arguments in the declared argument list.
  1314. X */
  1315. X/* P_FUNC :
  1316. X *    This macro is used to declare "private" (static) functions.
  1317. X *    It takes three arguments: the function type and name, a parenthesized
  1318. X *    traditional (comma separated) argument list, and the declared argument
  1319. X *    list (in which arguments are separated with NXT_ARG, and additional
  1320. X *    arbitrary arguments are specified with DOTS).  For example:
  1321. X *
  1322. X *        P_FUNC(int foo, (bar, baz), int bar NXT_ARG char *baz[])
  1323. X */
  1324. X/* P_FUNC_VOID :
  1325. X *    This macro is used to declare "private" (static) functions that have
  1326. X *    no arguments.  The macro takes one argument: the function type and name.
  1327. X *    For example:
  1328. X *
  1329. X *        P_FUNC_VOID(int subr)
  1330. X */
  1331. X/* V_FUNC :
  1332. X *    This macro is used to declare "public" (non-static) functions.
  1333. X *    It takes three arguments: the function type and name, a parenthesized
  1334. X *    traditional (comma separated) argument list, and the declared argument
  1335. X *    list (in which arguments are separated with NXT_ARG, and additional
  1336. X *    arbitrary arguments are specified with DOTS).  For example:
  1337. X *
  1338. X *        V_FUNC(int main, (argc, argv), int argc NXT_ARG char *argv[])
  1339. X */
  1340. X/* V_FUNC_VOID :
  1341. X *    This macro is used to declare "public" (non-static) functions that have
  1342. X *    no arguments.  The macro takes one argument: the function type and name.
  1343. X *    For example:
  1344. X *
  1345. X *        V_FUNC_VOID(int fork)
  1346. X */
  1347. X/* _
  1348. X *    This macro is used to declare function parameters for folks who want
  1349. X *    to make declarations with prototypes using a different style than
  1350. X *    the above macros.  Use double parentheses.  For example:
  1351. X *
  1352. X *        int main _((int argc, char *argv[]));
  1353. X */
  1354. X#define    CAN_PROTOTYPE    /**/
  1355. X#ifdef CAN_PROTOTYPE
  1356. X#define    NXT_ARG ,
  1357. X#define    DOTS , ...
  1358. X#define    V_FUNC(name, arglist, args)name(args)
  1359. X#define    P_FUNC(name, arglist, args)static name(args)
  1360. X#define    V_FUNC_VOID(name)name(VOID)
  1361. X#define    P_FUNC_VOID(name)static name(VOID)
  1362. X#define    _(args) args
  1363. X#else
  1364. X#define    NXT_ARG ;
  1365. X#define    DOTS
  1366. X#define    V_FUNC(name, arglist, args)name arglist args;
  1367. X#define    P_FUNC(name, arglist, args)static name arglist args;
  1368. X#define    V_FUNC_VOID(name)name()
  1369. X#define    P_FUNC_VOID(name)static name()
  1370. X#define    _(args) ()
  1371. X#endif
  1372. X
  1373. X/* CAN_VAPROTO :
  1374. X *    This variable is defined on systems supporting prototype declaration
  1375. X *    of functions with a variable number of arguments.
  1376. X */
  1377. X/* _V :
  1378. X *    This macro is used to declare function parameters in prototypes for
  1379. X *    functions with a variable number of parameters. Use double parentheses.
  1380. X *    For example:
  1381. X *
  1382. X *        int printf _V((char *fmt, ...));
  1383. X *
  1384. X *    Remember to use the plain simple _() macro when declaring a function
  1385. X *    with no variable number of arguments, since it might be possible to
  1386. X *    have a non-effect _V() macro and still get prototypes via _().
  1387. X */
  1388. X#define CAN_VAPROTO    /**/
  1389. X#ifdef CAN_VAPROTO
  1390. X#define    _V(args) args
  1391. X#else
  1392. X#define    _V(args) ()
  1393. X#endif
  1394. X
  1395. X/* VOIDFLAGS :
  1396. X *    This symbol indicates how much support of the void type is given by this
  1397. X *    compiler.  What various bits mean:
  1398. X *
  1399. X *        1 = supports declaration of void
  1400. X *        2 = supports arrays of pointers to functions returning void
  1401. X *        4 = supports comparisons between pointers to void functions and
  1402. X *            addresses of void functions
  1403. X *        8 = suports declaration of generic void pointers
  1404. X *
  1405. X *    The package designer should define VOIDUSED to indicate the requirements
  1406. X *    of the package.  This can be done either by #defining VOIDUSED before
  1407. X *    including config.h, or by defining defvoidused in Myinit.U.  If the
  1408. X *    latter approach is taken, only those flags will be tested.  If the
  1409. X *    level of void support necessary is not present, defines void to int.
  1410. X */
  1411. X#ifndef VOIDUSED
  1412. X#define VOIDUSED 9
  1413. X#endif
  1414. X#define VOIDFLAGS 9
  1415. X#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
  1416. X#define void int        /* is void to be avoided? */
  1417. X#define M_VOID            /* Xenix strikes again */
  1418. X#endif
  1419. X
  1420. X/* CPP_FILE_COM
  1421. X *    This symbol contains the first part of the string which will invoke
  1422. X *    the C preprocessor a file and produce to standard output, preserving
  1423. X *    comments. Typical value of "cc -E -C" or "/lib/cpp -C".
  1424. X */
  1425. X/* CPP_STDIN_FLAGS
  1426. X *    This variable contains any flags necessary to get CPP_FILE_COM to
  1427. X *    read from the standard input.
  1428. X */
  1429. X/* CPP_IGN_HDRS
  1430. X *    This symbol is defined if CPP_FILE_COM ignores *.h files.
  1431. X */
  1432. X/* CPP_CAN_STDIN
  1433. X *    This symbol is defined if CPP_FILE_COM can read standard input
  1434. X *    directly.
  1435. X */
  1436. X#ifdef _MSC_VER
  1437. X#define CPP_FILE_COM "cl -nologo -E -C"
  1438. X#else
  1439. X#define CPP_FILE_COM "gcc -E -C"
  1440. X#endif
  1441. X#define CPP_STDIN_FLAGS ""
  1442. X/*#define CPP_IGN_HDRS        /* does CPP ignore .h files? */
  1443. X/*#define CPP_CAN_STDIN     /* can CPP read stdin directly? */
  1444. X
  1445. X#endif
  1446. !STUFFY!FUNK!
  1447. echo Extracting eg/returnlist.h
  1448. sed >eg/returnlist.h <<'!STUFFY!FUNK!' -e 's/X//'
  1449. X/* generate a lot of silly values
  1450. X * Returns: Quite a number of things, as follows:
  1451. X *    0    nothing
  1452. X *    1    something small
  1453. X *    2    a little larger
  1454. X *    3    done in triplicate
  1455. X *    4    getting larger
  1456. X *    5    quintuplets
  1457. X *    6    that'll do now, although I think this one is going to get
  1458. X *        very long and even cover multiple lines. let's just hope that
  1459. X *        it gets it right, including the capitalisation. maybe this is
  1460. X *        not a super thorough test, so including some
  1461. X * .B bold
  1462. X *        stuff might help
  1463. X */
  1464. Xint returnlist();
  1465. !STUFFY!FUNK!
  1466. echo "End of kit 5 (of 9)"
  1467. echo " "
  1468. cat /dev/null >kit5isdone
  1469. run=''
  1470. config=''
  1471. for iskit in 1 2 3 4 5 6 7 8 9; do
  1472.     if test -f kit${iskit}isdone; then
  1473.         run="$run $iskit"
  1474.     else
  1475.         todo="$todo $iskit"
  1476.     fi
  1477. done
  1478. case $todo in
  1479.     '')
  1480.         echo "You have run all your kits."
  1481.         if test -f PACKNOTES; then
  1482.             sh PACKNOTES
  1483.         else
  1484.             echo "You have to rebuild split files by hand (see PACKLIST)."
  1485.         fi
  1486.         echo "Please read README and then type Configure."
  1487.         chmod 755 Configure
  1488.         rm -f kit*isdone
  1489.         ;;
  1490.     *)  echo "You have run$run."
  1491.         echo "You still need to run$todo."
  1492.         ;;
  1493. esac
  1494. : Someone might mail this, so exit before signature...
  1495. exit 0
  1496. -- 
  1497. Graham Stoney, Hardware/Software Engineer
  1498. Canon Information Systems Research Australia
  1499. Ph: + 61 2 805 2909    Fax: + 61 2 805 2929
  1500.  
  1501. exit 0 # Just in case...
  1502.