1: #ifndef lint
   2: static char sccsid[] = "@(#)run1.c	4.1 (Berkeley) 1/1/83";
   3: #endif
   4: 
   5: # include "stdio.h"
   6: # define LAST "\177\177"
   7: main (argc,argv)
   8:     char *argv[];
   9: {
  10:     FILE *rem, *loc, *cfil;
  11:     char namel[100], namer[100];
  12:     char cname[20], zname[20];
  13:     int mr, ml;
  14:     long suml, sumr;
  15: ml=mr=1;
  16: loc = fopen(argv[1], "r");
  17: rem = fopen (argv[2], "r");
  18: cfil = fopen (argv[3], "w");
  19: ml = fetch (loc, namel, &suml, ml);
  20: mr = fetch (rem, namer, &sumr, mr);
  21: while ( ml || mr)
  22:     {
  23:     int x;
  24:     x = strcmp(namel, namer);
  25:     if (x>0) x=1;
  26:     if (x<0) x= -1;
  27:     switch(x)
  28:         {
  29:         case -1: /* name l lower */
  30:             /* check that file is not our zz* tempfile */
  31:             if (notmp(namel, argv[2]))
  32:             printf("Missing on remote system: %s\n",namel);
  33:             ml = fetch (loc, namel, &suml, ml);
  34:             continue;
  35:         case 0: /* match names */
  36:             if (strcmp(namel, LAST)==0)
  37:                 exit(0);
  38:             if (suml == sumr)
  39:                 printf("Presumed identical: %s\n",namel);
  40:             else
  41:                 {
  42:                 printf("Differ: %s\n", namel);
  43:                 fprintf(cfil, "%s\n", namel);
  44:                 }
  45:             ml=fetch(loc, namel, &suml, ml);
  46:             mr=fetch(rem, namer, &sumr, mr);
  47:             continue;
  48:         case 1: /* name 2 lower */
  49:             printf("Extraneous file on remote system: %s\n",namer);
  50:             mr=fetch(rem, namer, &sumr, mr);
  51:             continue;
  52:         default:
  53:             printf("illegal case %d\n", strcmp(namel,namer));
  54:             exit(0);
  55:         }
  56:     }
  57: }
  58: fetch (f, s, lp, m)
  59:     FILE *f;
  60:     char *s;
  61:     long *lp;
  62: {
  63: char b[200];
  64: if (m==0 ||fgets(b, 200, f)==0)
  65:     {
  66:     strcpy (s, LAST);
  67:     return (0);
  68:     }
  69: sscanf(b, "%s %lo", s, lp);
  70: return (1);
  71: }
  72: notmp(s1, s2)
  73:     char *s1, *s2;
  74: {
  75: char bf1[20], bf2[20];
  76: strcpy (bf1, s1);
  77: strcpy (bf2, s2);
  78: bf1[2]= bf2[2] = '0';
  79: return (strcmp(bf1, bf2));
  80: }

Defined functions

fetch defined in line 58; used 6 times
main defined in line 7; never used
notmp defined in line 72; used 1 times
  • in line 31

Defined variables

sccsid defined in line 2; never used

Defined macros

LAST defined in line 6; used 2 times
Last modified: 1983-01-02
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1054
Valid CSS Valid XHTML 1.0 Strict