1: int count   1000;
   2: int fnumber;
   3: int ibuf[259];
   4: int obuf[259];
   5: char    fname[100];
   6: char    *ifil;
   7: char    *ofil;
   8: 
   9: main(argc, argv)
  10: char *argv[];
  11: {
  12:     register i, c, f;
  13: 
  14:     for(i=1; i<argc; i++)
  15:     if(argv[i][0] == '-')
  16:     switch(argv[i][1]) {
  17: 
  18:     case '\0':
  19:         ifil = 1;
  20:         continue;
  21: 
  22:     case '0':
  23:     case '1':
  24:     case '2':
  25:     case '3':
  26:     case '4':
  27:     case '5':
  28:     case '6':
  29:     case '7':
  30:     case '8':
  31:     case '9':
  32:         count = number(argv[i]+1);
  33:         continue;
  34: 
  35:     } else
  36:     if(ifil)
  37:         ofil = argv[i]; else
  38:         ifil = argv[i];
  39:     if(ifil != 0 && ifil != 1)
  40:         if(fopen(ifil, ibuf) < 0) {
  41:             write(2, "cannot open input\n", 18);
  42:             exit();
  43:         }
  44:     if(ofil == 0)
  45:         ofil = "x";
  46: 
  47: loop:
  48:     f = 1;
  49:     for(i=0; i<count; i++)
  50:     do {
  51:         c = getc(ibuf);
  52:         if(c < 0) {
  53:             if(f == 0)
  54:                 fflush(obuf);
  55:             exit();
  56:         }
  57:         if(f) {
  58:             for(f=0; ofil[f]; f++)
  59:                 fname[f] = ofil[f];
  60:             fname[f++] = fnumber/26 + 'a';
  61:             fname[f++] = fnumber%26 + 'a';
  62:             fname[f] = '\0';
  63:             fnumber++;
  64:             if(fcreat(fname, obuf) < 0) {
  65:                 write(2, "Cannot create output\n", 20);
  66:                 exit();
  67:             }
  68:             f = 0;
  69:         }
  70:         putc(c, obuf);
  71:     } while(c != '\n');
  72:     fflush(obuf);
  73:     close(obuf[0]);
  74:     goto loop;
  75: }
  76: 
  77: number(str)
  78: char *str;
  79: {
  80:     register n;
  81:     register char *s;
  82: 
  83:     n = 0;
  84:     for(s = str; *s; s++)
  85:         if(*s>='0' && *s<='9')
  86:             n = n*10 + *s-'0';
  87:     return(n);
  88: }

Defined functions

main defined in line 9; never used
number defined in line 77; used 1 times
  • in line 32

Defined variables

count defined in line 1; used 2 times
fname defined in line 5; used 5 times
fnumber defined in line 2; used 3 times
ibuf defined in line 3; used 2 times
ifil defined in line 6; used 6 times
obuf defined in line 4; used 5 times
ofil defined in line 7; used 5 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 558
Valid CSS Valid XHTML 1.0 Strict