drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / doc / manext.c
bloba62a944b75f9264c3191e3b3006ff6dceecc2512
1 /***********************************************************************/
2 /* MANEXT - Extract manual pages from C source code. */
3 /***********************************************************************/
4 /*
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>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
31 #define MAX_LINE 255
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 */
46 int i;
47 FILE *fp;
49 #ifdef __EMX__
50 _wildcard(&argc, &argv);
51 #endif
52 if (strcmp(argv[1], "-h") == 0)
54 display_info();
55 exit(1);
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]);
63 continue;
66 while (!feof(fp))
68 if (fgets(s, (int)sizeof(s), fp) == NULL)
70 if (ferror(fp) != 0)
72 fprintf(stderr, "*** Error reading %s. Exiting.\n",
73 argv[i]);
74 exit(1);
77 break;
80 /* check for manual entry marker at beginning of line */
82 if (strncmp(s, "/*man-start*", 12) != 0)
83 continue;
85 /* inner loop */
87 for (;;)
89 /* read next line of manual entry */
91 if (fgets(s, (int)sizeof(s), fp) == NULL)
93 if (ferror(fp) != 0)
95 fprintf(stderr, "*** Error reading %s. Exiting.\n",
96 argv[i]);
97 exit(1);
100 break;
103 /* check for end of entry marker */
105 if (strncmp(s, "**man-end", 9) == 0)
106 break;
108 printf("%s", s);
111 printf("\n\n-----------------------------------"
112 "---------------------------------------\n\n");
115 fclose(fp);
118 return 0;