home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / uucp / amigauucpsrc / lib / makeproto.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  723 b   |  51 lines

  1.  
  2. /*
  3.  *  MAKEPROTO.C
  4.  */
  5.  
  6. #include <stdio.h>
  7.  
  8. void ScanFile();
  9.  
  10. main(ac, av)
  11. char *av[];
  12. {
  13.     short i;
  14.  
  15.     for (i = 1; i < ac; ++i) {
  16.     char *ptr = av[i];
  17.     if (*ptr != '-') {
  18.         ScanFile(ptr);
  19.         continue;
  20.     }
  21.     ptr += 2;
  22.     switch(ptr[-1]) {
  23.     case 'o':
  24.         freopen(ptr, "w", stdout);
  25.         printf("\n/* MACHINE GENERATED */\n\n");
  26.         break;
  27.     }
  28.     }
  29.     return(0);
  30. }
  31.  
  32. void
  33. ScanFile(file)
  34. char *file;
  35. {
  36.     FILE *fi = fopen(file, "r");
  37.     char buf[512];
  38.  
  39.     if (fi == NULL) {
  40.     fprintf(stderr, "makeproto: couldn't open %s\n", file);
  41.     return;
  42.     }
  43.     printf("\n/* %-20s */\n\n", file);
  44.     while (fgets(buf, sizeof(buf), fi)) {
  45.     if (strncmp(buf, "Prototype", 9) == 0)
  46.         fputs(buf, stdout);
  47.     }
  48.     fclose(fi);
  49. }
  50.  
  51.