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