fix return codes so 0=same, 1=differ, 2=problem as documented.
authorRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Thu, 3 Jan 1985 05:53:52 +0000 (21:53 -0800)
committerRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Thu, 3 Jan 1985 05:53:52 +0000 (21:53 -0800)
SCCS-vsn: usr.bin/diff/diffh/diffh.c 4.3

usr/src/usr.bin/diff/diffh/diffh.c

index 384f0ce..d2c2d4c 100644 (file)
@@ -1,4 +1,4 @@
-static char sccsid[] = "@(#)diffh.c 4.2 %G%";
+static char sccsid[] = "@(#)diffh.c 4.3 %G%";
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -77,6 +77,8 @@ char **argv;
 {
        char *s0,*s1;
        FILE *dopen();
 {
        char *s0,*s1;
        FILE *dopen();
+       register int status = 0;
+
        while(*argv[1]=='-') {
                argc--;
                argv++;
        while(*argv[1]=='-') {
                argc--;
                argv++;
@@ -96,17 +98,19 @@ char **argv;
                if(cmp(s0,s1)!=0) {
                        if(!easysynch()&&!hardsynch())
                                progerr("5");
                if(cmp(s0,s1)!=0) {
                        if(!easysynch()&&!hardsynch())
                                progerr("5");
+                       status = 1;
                } else {
                        clrl(0,n0);
                        clrl(1,n1);
                }
        }
        if(s0==NULL&&s1==NULL)
                } else {
                        clrl(0,n0);
                        clrl(1,n1);
                }
        }
        if(s0==NULL&&s1==NULL)
-               return;
+               return(status);
        if(s0==NULL)
                output(-1,INF);
        if(s1==NULL)
                output(INF,-1);
        if(s0==NULL)
                output(-1,INF);
        if(s1==NULL)
                output(INF,-1);
+       return(1);
 }
 
        /* synch on C successive matches*/
 }
 
        /* synch on C successive matches*/
@@ -251,7 +255,7 @@ error(s,t)
 char *s,*t;
 {
        fprintf(stderr,"diffh: %s%s\n",s,t);
 char *s,*t;
 {
        fprintf(stderr,"diffh: %s%s\n",s,t);
-       exit(1);
+       exit(2);
 }
 
        /*stub for resychronization beyond limits of text buf*/
 }
 
        /*stub for resychronization beyond limits of text buf*/