1: /* Copyright (c) 1979 Regents of the University of California */
   2: #ifdef V6
   3: #include <retrofit.h>
   4: #endif
   5: #include <stdio.h>
   6: 
   7: main(argc, argv)
   8:     int argc;
   9:     char *argv[];
  10: {
  11: 
  12:     argc--, argv++;
  13:     while (argc > 0)
  14:         getfrom(*argv++), argc--;
  15:     exit(0);
  16: }
  17: 
  18: getfrom(name)
  19:     char *name;
  20: {
  21:     char headbuf[BUFSIZ];
  22:     char linbuf[BUFSIZ];
  23:     register char *cp;
  24:     int i = 0;
  25: 
  26:     if (freopen(name, "r", stdin) == 0) {
  27:         perror(name);
  28:         exit(1);
  29:     }
  30:     for (;;) {
  31:         if (fgets(headbuf, sizeof headbuf, stdin) == NULL)
  32:             return;
  33:         if (headbuf[0] != '.')
  34:             continue;
  35:         if (headbuf[1] == 'T' && headbuf[2] == 'H')
  36:             break;
  37:         if (headbuf[1] == 't' && headbuf[2] == 'h')
  38:             break;
  39:     }
  40:     for (;;) {
  41:         if (fgets(linbuf, sizeof linbuf, stdin) == NULL)
  42:             return;
  43:         if (linbuf[0] != '.')
  44:             continue;
  45:         if (linbuf[1] == 'S' && linbuf[2] == 'H')
  46:             break;
  47:         if (linbuf[1] == 's' && linbuf[2] == 'h')
  48:             break;
  49:     }
  50:     trimln(headbuf);
  51:     printf("%s\t", headbuf);
  52:     for (;;) {
  53:         if (fgets(linbuf, sizeof linbuf, stdin) == NULL)
  54:             break;
  55:         if (linbuf[0] == '.') {
  56:             if (linbuf[1] == 'S' && linbuf[2] == 'H')
  57:                 break;
  58:             if (linbuf[1] == 's' && linbuf[2] == 'h')
  59:                 break;
  60:         }
  61:         trimln(linbuf);
  62:         if (i != 0)
  63:             printf(" ");
  64:         i++;
  65:         printf("%s", linbuf);
  66:     }
  67:     printf("\n");
  68: }
  69: 
  70: trimln(cp)
  71:     register char *cp;
  72: {
  73: 
  74:     while (*cp)
  75:         cp++;
  76:     if (*--cp == '\n')
  77:         *cp = 0;
  78: }

Defined functions

getfrom defined in line 18; used 1 times
  • in line 14
main defined in line 7; never used
trimln defined in line 70; used 2 times
Last modified: 1981-02-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 708
Valid CSS Valid XHTML 1.0 Strict