1: int ibuf1[259];
   2: int ibuf2[259];
   3: int eflg;
   4: int lflg    1;
   5: int line[2] {0, 1};
   6: int chr[2] { -1, -1};
   7: 
   8: main(argc, argv)
   9: char **argv;
  10: {
  11:     register c1, c2;
  12:     char *arg;
  13: 
  14:     if(argc < 3)
  15:         goto narg;
  16:     arg = argv[1];
  17:     if(arg[0] == '-' && arg[1] == 's') {
  18:         lflg--;
  19:         argv++;
  20:         argc--;
  21:     }
  22:     arg = argv[1];
  23:     if(arg[0] == '-' && arg[1] == 'l') {
  24:         lflg++;
  25:         argv++;
  26:         argc--;
  27:     }
  28:     if(argc < 3)
  29:         goto narg;
  30:     arg = argv[1];
  31:     if( arg[0]=='-' && arg[1]==0 )
  32:         ibuf1[0] = dup(0);
  33:     else if(fopen(arg, ibuf1) < 0)
  34:         goto barg;
  35:     arg = argv[2];
  36:     if(fopen(arg, ibuf2) < 0)
  37:         goto barg;
  38: 
  39: loop:
  40:     if (++chr[1]==0)
  41:         chr[0]++;
  42:     c1 = getc(ibuf1);
  43:     c2 = getc(ibuf2);
  44:     if(c1 == c2) {
  45:         if (c1 == '\n')
  46:             if (++line[1]==0)
  47:                 line[0]++;
  48:         if(c1 == -1) {
  49:             if(eflg)
  50:                 exit(1);
  51:             exit(0);
  52:         }
  53:         goto loop;
  54:     }
  55:     if(lflg == 0)
  56:         exit(1);
  57:     if(c1 == -1) {
  58:         arg = argv[1];
  59:         goto earg;
  60:     }
  61:     if(c2 == -1)
  62:         goto earg;
  63:     if(lflg == 1) {
  64:         printf("%s %s differ: char %s, line ", argv[1], arg,
  65:             locv(chr[0], chr[1]));
  66:         printf("%s\n", locv(line[0], line[1]));
  67:         exit(1);
  68:     }
  69:     eflg = 1;
  70:     printf("%5s %3o %3o\n", locv(chr[0], chr[1]), c1, c2);
  71:     goto loop;
  72: 
  73: narg:
  74:     printf("arg count\n");
  75:     exit(2);
  76: 
  77: barg:
  78:     printf("cannot open %s\n", arg);
  79:     exit(2);
  80: 
  81: earg:
  82:     printf("EOF on %s\n", arg);
  83:     exit(1);
  84: }
  85: 
  86: putchar(c)
  87: {
  88: 
  89:     write(1, &c, 1);
  90: }

Defined functions

main defined in line 8; never used
putchar defined in line 86; never used

Defined variables

chr defined in line 6; used 6 times
eflg defined in line 3; used 2 times
ibuf1 defined in line 1; used 3 times
ibuf2 defined in line 2; used 2 times
lflg defined in line 4; used 4 times
line defined in line 5; used 4 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 915
Valid CSS Valid XHTML 1.0 Strict