| 1 |
void abort (void); |
| 2 |
void exit (int); |
| 3 |
|
| 4 |
static char * |
| 5 |
begfield (int tab, char *ptr, char *lim, int sword, int schar) |
| 6 |
{ |
| 7 |
if (tab) |
| 8 |
{ |
| 9 |
while (ptr < lim && sword--) |
| 10 |
{ |
| 11 |
while (ptr < lim && *ptr != tab) |
| 12 |
++ptr; |
| 13 |
if (ptr < lim) |
| 14 |
++ptr; |
| 15 |
} |
| 16 |
} |
| 17 |
else |
| 18 |
{ |
| 19 |
while (1) |
| 20 |
; |
| 21 |
} |
| 22 |
|
| 23 |
if (ptr + schar <= lim) |
| 24 |
ptr += schar; |
| 25 |
|
| 26 |
return ptr; |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
main (void) |
| 31 |
{ |
| 32 |
char *s = ":ab"; |
| 33 |
char *lim = s + 3; |
| 34 |
if (begfield (':', s, lim, 1, 1) != s + 2) |
| 35 |
abort (); |
| 36 |
exit (0); |
| 37 |
} |