1 /***********************************************************************/
2 /* MANEXT - Extract manual pages from C source code. */
3 /***********************************************************************/
5 * MANEXT - A program to extract manual pages from C source code.
6 * Copyright (C) 1991-1996 Mark Hessling
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * If you make modifications to this software that you feel increases
19 * it usefulness for the rest of the community, please email the
20 * changes, enhancements, bug fixes as well as any and all ideas to me.
21 * This software is going to be maintained and enhanced as deemed
22 * necessary by the community.
24 * Mark Hessling <mark@rexx.org>
33 void display_info(void)
35 fprintf(stderr
, "\nMANEXT 1.03 Copyright (C) 1991-1996 Mark Hessling\n"
36 "All rights reserved.\n"
37 "MANEXT is distributed under the terms of the GNU\n"
38 "General Public License and comes with NO WARRANTY.\n"
39 "See the file COPYING for details.\n"
40 "\nUsage: manext sourcefile [...]\n\n");
43 int main(int argc
, char **argv
)
45 char s
[MAX_LINE
+ 1]; /* input line */
50 _wildcard(&argc
, &argv
);
52 if (strcmp(argv
[1], "-h") == 0)
58 for (i
= 1; i
< argc
; i
++)
60 if ((fp
= fopen(argv
[i
], "r")) == NULL
)
62 fprintf(stderr
, "\nCould not open %s\n", argv
[i
]);
68 if (fgets(s
, (int)sizeof(s
), fp
) == NULL
)
72 fprintf(stderr
, "*** Error reading %s. Exiting.\n",
80 /* check for manual entry marker at beginning of line */
82 if (strncmp(s
, "/*man-start*", 12) != 0)
89 /* read next line of manual entry */
91 if (fgets(s
, (int)sizeof(s
), fp
) == NULL
)
95 fprintf(stderr
, "*** Error reading %s. Exiting.\n",
103 /* check for end of entry marker */
105 if (strncmp(s
, "**man-end", 9) == 0)
111 printf("\n\n-----------------------------------"
112 "---------------------------------------\n\n");