[patch] add ip addr del alias for delete [was: Re: ipaddr
applet query]
Rob Landley
rob at landley.net
Fri Mar 31 12:42:53 PST 2006
On Friday 31 March 2006 2:50 pm, Robert P. J. Day wrote:
> On Fri, 31 Mar 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".
>
> it's not that simple. what you *really* want is a feature that allows
> one to use the shortest unique prefix across all possible keywords.
> and, no, i'm not about to submit a patch. :-)
Not too hard, but you have to pass in an array then. But that's only if you
want to go out of your way to reject ambiguous matches rather than just
accepting that ambiguously short abbreviations have an ordering dependency:
whatever gets checked for first gets the shorter matches.
> rday
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list