home *** CD-ROM | disk | FTP | other *** search
- /*
- * MAKEPROTO.C
- */
- #include <string.h>
- #include <stdio.h>
-
- void ScanFile (char *);
-
- int
- main (int ac, char **av)
- {
- short i;
-
- for (i = 1; i < ac; ++i) {
- char *ptr = av[i];
- if (*ptr != '-') {
- ScanFile(ptr);
- continue;
- }
- ptr += 2;
- switch(ptr[-1]) {
- case 'o':
- freopen(ptr, "w", stdout);
- printf("\n/* MACHINE GENERATED */\n\n");
- break;
- }
- }
- return(0);
- }
-
- void
- ScanFile(file)
- char *file;
- {
- FILE *fi = fopen(file, "r");
- char buf[512];
-
- if (fi == NULL) {
- fprintf(stderr, "makeproto: couldn't open %s\n", file);
- return;
- }
- printf("\n/* %-20s */\n\n", file);
- while (fgets(buf, sizeof(buf), fi)) {
- if (strncmp(buf, "Prototype", 9) == 0)
- fputs(buf, stdout);
- else
- if (strncmp(buf, ";Prototype", 10) == 0)
- fputs(buf+1, stdout);
- }
- fclose(fi);
- }
-
-