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

Natanael Copa natanael.copa at gmail.com
Fri Mar 31 09:51:52 UTC 2006


Rob Landley wrote:

> Do we really need to support both "delete" and "del"?  Does the mainline one
> support "delete"?
> 
> Yes it does.  It apparently also supports "de", "dele", and "delet"...
> 
> Ick.

sounds like a
  (strstr(cmd, arg) == cmd)

instead of
  (strcmp(cmd, arg) == 0)


If you really want that:

Index: ipaddress.c
===================================================================
--- ipaddress.c (revision 14709)
+++ ipaddress.c (working copy)
@@ -812,9 +812,15 @@
        };

        int command_num = 2;
+       int i = 0;

        if (*argv) {
-               command_num = compare_string_array(commands, *argv);
+               for (i = 0; *commands[i] != 0; i++ ) {
+                       if (strstr(commands[i], *argv) == commands[i]) {
+                               command_num = i;
+                               break;
+                       }
+               }
        }
        switch (command_num) {
                case 0: /* add */



--
Natanael Copa



More information about the busybox mailing list