Home | History | Annotate | Download | only in look

Lines Matching defs:back

101 	char *back, *front, *string, *p;
152 back = front + len;
153 exit(look(string, front, back));
157 look(char *string, char *front, char *back)
173 front = binary_search(string, front, back);
174 front = linear_search(string, front, back);
177 print_from(string, front, back);
183 * Binary search for "string" in memory between "front" and "back".
193 * back points to the beginning of a line at or after the first
198 * back = EOF;
202 * p = first newline after halfway point from front to back.
205 * p is the new front. Otherwise it is the new back.
212 * In fact, it returns when the chosen "p" equals "back". This
214 * (back - front), which in turn implies that a linear search will
220 #define SKIP_PAST_NEWLINE(p, back) \
221 while (p < back && *p++ != '\n') continue;
224 binary_search(char *string, char *front, char *back)
228 p = front + (back - front) / 2;
229 SKIP_PAST_NEWLINE(p, back);
235 while (p < back && back > front) {
236 if (compare(string, p, back) == GREATER)
239 back = p;
240 p = front + (back - front) / 2;
241 SKIP_PAST_NEWLINE(p, back);
248 * to back.
258 linear_search(char *string, char *front, char *back)
260 while (front < back) {
261 switch (compare(string, front, back)) {
271 SKIP_PAST_NEWLINE(front, back);
280 print_from(char *string, char *front, char *back)
282 for (; front < back && compare(string, front, back) == EQUAL; ++front) {
283 for (; front < back && *front != '\n'; ++front)
302 * "back" terminated).
305 compare(char *s1, char *s2, char *back)
309 for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) {