1*30014Sminshall /* 2*30014Sminshall * Copyright (c) 1984, 1985, 1986 by the Regents of the 3*30014Sminshall * University of California and by Gregory Glenn Minshall. 4*30014Sminshall * 5*30014Sminshall * Permission to use, copy, modify, and distribute these 6*30014Sminshall * programs and their documentation for any purpose and 7*30014Sminshall * without fee is hereby granted, provided that this 8*30014Sminshall * copyright and permission appear on all copies and 9*30014Sminshall * supporting documentation, the name of the Regents of 10*30014Sminshall * the University of California not be used in advertising 11*30014Sminshall * or publicity pertaining to distribution of the programs 12*30014Sminshall * without specific prior permission, and notice be given in 13*30014Sminshall * supporting documentation that copying and distribution is 14*30014Sminshall * by permission of the Regents of the University of California 15*30014Sminshall * and by Gregory Glenn Minshall. Neither the Regents of the 16*30014Sminshall * University of California nor Gregory Glenn Minshall make 17*30014Sminshall * representations about the suitability of this software 18*30014Sminshall * for any purpose. It is provided "as is" without 19*30014Sminshall * express or implied warranty. 20*30014Sminshall */ 21*30014Sminshall 22*30014Sminshall #ifndef lint 23*30014Sminshall static char sccsid[] = "@(#)genbsubs.c 3.1 10/29/86"; 24*30014Sminshall #endif /* ndef lint */ 25*30014Sminshall 26*30014Sminshall /* The output of bunequal is the offset of the byte which didn't match; 27*30014Sminshall * if all the bytes match, then we return n. 28*30014Sminshall * bunequal(s1, s2, n) */ 29*30014Sminshall 30*30014Sminshall int 31*30014Sminshall bunequal(s1, s2, n) 32*30014Sminshall register char *s1, *s2; 33*30014Sminshall register n; 34*30014Sminshall { 35*30014Sminshall register int i = 0; 36*30014Sminshall 37*30014Sminshall while (i++ < n) { 38*30014Sminshall if (*s1++ != *s2++) { 39*30014Sminshall break; 40*30014Sminshall } 41*30014Sminshall } 42*30014Sminshall return(i-1); 43*30014Sminshall } 44*30014Sminshall 45*30014Sminshall /* bskip(s1, n, b) : finds the first occurrence of any byte != 'b' in the 'n' 46*30014Sminshall * bytes beginning at 's1'. 47*30014Sminshall */ 48*30014Sminshall 49*30014Sminshall int 50*30014Sminshall bskip(s1, n, b) 51*30014Sminshall register char *s1; 52*30014Sminshall register int n; 53*30014Sminshall register int b; 54*30014Sminshall { 55*30014Sminshall register int i = 0; 56*30014Sminshall 57*30014Sminshall while (i++ < n) { 58*30014Sminshall if (*s1++ != b) { 59*30014Sminshall break; 60*30014Sminshall } 61*30014Sminshall } 62*30014Sminshall return(i-1); 63*30014Sminshall } 64