BSD 4_3 release
[unix-history] / usr / src / bin / diff / diffh.c
index 525265c..6a6ff49 100644 (file)
@@ -1,4 +1,4 @@
-static char sccsid[] = "@(#)diffh.c 4.1 10/9/80";
+static char sccsid[] = "@(#)diffh.c 4.4 11/27/85";
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -77,8 +77,8 @@ char **argv;
 {
        char *s0,*s1;
        FILE *dopen();
 {
        char *s0,*s1;
        FILE *dopen();
-       extern char _sobuf[];
-       setbuf(stdout, _sobuf);
+       register int status = 0;
+
        while(*argv[1]=='-') {
                argc--;
                argv++;
        while(*argv[1]=='-') {
                argc--;
                argv++;
@@ -98,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;
+               exit(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);
+       exit(1);
 }
 
        /* synch on C successive matches*/
 }
 
        /* synch on C successive matches*/
@@ -253,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*/