[patch] add ip addr del alias for delete [was: Re: ipaddr applet query]

Natanael Copa natanael.copa at gmail.com
Fri Mar 31 12:12:28 PST 2006


Rob Landley wrote:
> 
> We need a library function that does some variant of:
> 
> int submatch(char *test, char *str)
> {
>   if (!*test) return 0;
>   for(;;) {
>     if (!*test) return 1;
>     if (!*str) return 0;
>     if (*(test++) != *(str++)) return 0;
>   }
> }
> 
> And then submatch(input,"walrus") should match "walrus", "walru", "walr",
> "wal", "wa", and "w".

isn't that exactly the same as using strstr?

const char *walrus = "walrus";
if (strstr(walrus, input) == walrus) {
  /* match! */
}

--
Natanael Copa


More information about the busybox mailing list