version 1.5, 2000/10/12 10:01:18 |
version 1.6, 2001/11/19 19:02:15 |
|
|
look(string, front, back) |
look(string, front, back) |
char *string, *front, *back; |
char *string, *front, *back; |
{ |
{ |
register int ch; |
int ch; |
register char *readp, *writep; |
char *readp, *writep; |
|
|
/* Reformat string string to avoid doing it multiple times later. */ |
/* Reformat string string to avoid doing it multiple times later. */ |
for (readp = writep = string; ch = *readp++;) { |
for (readp = writep = string; ch = *readp++;) { |
|
|
|
|
char * |
char * |
binary_search(string, front, back) |
binary_search(string, front, back) |
register char *string, *front, *back; |
char *string, *front, *back; |
{ |
{ |
register char *p; |
char *p; |
|
|
p = front + (back - front) / 2; |
p = front + (back - front) / 2; |
SKIP_PAST_NEWLINE(p, back); |
SKIP_PAST_NEWLINE(p, back); |
|
|
*/ |
*/ |
void |
void |
print_from(string, front, back) |
print_from(string, front, back) |
register char *string, *front, *back; |
char *string, *front, *back; |
{ |
{ |
for (; front < back && compare(string, front, back) == EQUAL; ++front) { |
for (; front < back && compare(string, front, back) == EQUAL; ++front) { |
for (; front < back && *front != '\n'; ++front) |
for (; front < back && *front != '\n'; ++front) |
|
|
*/ |
*/ |
int |
int |
compare(s1, s2, back) |
compare(s1, s2, back) |
register char *s1, *s2, *back; |
char *s1, *s2, *back; |
{ |
{ |
register int ch; |
int ch; |
|
|
for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) { |
for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) { |
ch = *s2; |
ch = *s2; |