mckee@atanasoff.cs.iastate.edu (Bret McKee) (06/15/88)
I am on the info-minix mailing list and have been getting all of the 1.3 updates from the mailing list. The problem is that some of the IBM machines on bitnet feel perfectly content to changes tabs into spaces and to delete trailing blanks on lines. This makes the patch program fail when applying the diffs. As a result I have written a strcmp which is white-space insensitive and have change get_line to alwas add one space before the return on every line so that appending and deleting null lines will work. Since whitespace is ignored in all other cases this does not create a problem. Enjoy, Bret Mckee mckee%atanasoff.cs.iastate.edu ------------------------------------------------ Note that you must include #define strcmp strwcmp at the start of patch to use the whitespace insensitive version. as well, in patch the the getline routine should be: char * getline(fp, b) FILE *fp; char *b; { int slen; if (fgets(b, LINELEN, fp) == NULL) fatal("unexpected eof"); slen = strlen(b); b[slen+1] = '\0'; b[slen] = b[slen-1]; b[slen-1] = ' '; return b; } and the following should be added to the source: /* This routine is a white space insensitive version of strcmp. It is needed for testing things which might have undergone tab conversion at some time Bret Mckee June, 1988 */ #include <stdio.h> int strwcmp(s1,s2) char *s1,*s2; { char *x1=s2,*x2=s2; /* remove leading white space */ while(whitespace(*s1)) s1++; while(whitespace(*s2)) s2++; do { while((*s1 == *s2) && *s1 && *s2) { s1++; s2++; } ; /* consume identical characters */ while(whitespace(*s1)) s1++; while(whitespace(*s2)) s2++; } while (*s1 && *s2 && (*s1 == *s2)); if (*s1-*s2) fprintf(stderr,"Failing for (%x)[%s]\n (%x)[%s]\n", (int)*s1,x1,(int)*s2,x2); return(*s1-*s2); } int whitespace(ch) char ch; { switch(ch) { case ' ': case '\n': case '\t': return(1); default: return(0); } }