| version 1.14, 2002/02/28 15:46:17 |
version 1.15, 2002/02/28 16:37:46 |
|
|
| |
|
| #endif |
#endif |
| |
|
| /* str_white_str() by Rastislav 'Crasher' Barlik <rbarlik@yahoo.com> */ |
|
| char * |
char * |
| str_white_str(str, substr, size) |
str_white_str(str, substr, size) |
| char *str; |
char *str; |
| Line 82 str_white_str(str, substr, size) |
|
| Line 81 str_white_str(str, substr, size) |
|
| /* Find start of pattern in string. */ |
/* Find start of pattern in string. */ |
| while (*start != *substr) { |
while (*start != *substr) { |
| |
|
| if (isspace(*start) && isspace(*substr)) |
if ((isspace(*start)) && (isspace(*substr))) |
| break; |
break; |
| |
|
| start++; |
start++; |
| Line 96 str_white_str(str, substr, size) |
|
| Line 95 str_white_str(str, substr, size) |
|
| sptr = start; |
sptr = start; |
| pptr = substr; |
pptr = substr; |
| |
|
| //while (*sptr == *pptr || (isspace(sptr) && isspace(pptr))) { |
|
| while (1) { |
while (1) { |
| if (! isspace(*sptr)) { |
|
| while (*sptr == *pptr) { |
|
| sptr++; |
|
| pptr++; |
|
| ssize++; |
|
| } |
|
| } |
|
| else { |
|
| |
|
| |
#ifdef DEBUG /* if str_white_str() works properly, delete this */ |
| |
printf("comparing %d [%s] with %d [%s]\n", |
| |
*sptr, sptr, *pptr, pptr); |
| |
#endif |
| |
|
| |
if ((isspace(*sptr)) && (isspace(*pptr))) { |
| while (isspace(*sptr)) { |
while (isspace(*sptr)) { |
| ++sptr; |
++sptr; |
| |
|
| Line 118 str_white_str(str, substr, size) |
|
| Line 114 str_white_str(str, substr, size) |
|
| ++ssize; |
++ssize; |
| } |
} |
| } |
} |
| |
else if (*sptr == *pptr) { |
| |
while (*sptr == *pptr && *sptr != '\0' && ! isspace(*sptr)) { |
| |
sptr++; |
| |
pptr++; |
| |
ssize++; |
| |
} |
| |
} |
| |
else { |
| |
break; |
| |
} |
| |
|
| /* If end of pattern then pattern was found. */ |
/* If end of pattern then pattern was found. */ |
| if (*pptr == '\0') { |
if (*pptr == '\0') { |