Hi there! I was just wondering how could I modify the strstr function in order to calculate the distance between the two strings. Supposing that we have the following code:
char *
str_find (buf, sub)
register char *buf;
register char *sub;
{
register char *bp;
register char *sp;
if (!*sub)
return buf;
while (*buf)
{
bp = buf;
sp = sub;
do {
if (!*sp)
return buf;
} while (*bp++ == *sp++);
buf += 1;
}
return 0;
}
Thanks and greetings from Spain ;D