ifupdown: improve compatibility with Debian
[oweals/busybox.git] / networking / brctl.c
index a36ab45c39a2853db6b9280519f676c9eaab7221..19f474fce34d2a164ab9191db32be52d0c6bfc71 100644 (file)
@@ -7,11 +7,35 @@
  * Some helper functions from bridge-utils are
  * Copyright (C) 2000 Lennert Buytenhek
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 /* This applet currently uses only the ioctl interface and no sysfs at all.
  * At the time of this writing this was considered a feature.
  */
+
+//usage:#define brctl_trivial_usage
+//usage:       "COMMAND [BRIDGE [INTERFACE]]"
+//usage:#define brctl_full_usage "\n\n"
+//usage:       "Manage ethernet bridges\n"
+//usage:     "\nCommands:"
+//usage:       IF_FEATURE_BRCTL_SHOW(
+//usage:     "\n       show                    Show a list of bridges"
+//usage:       )
+//usage:     "\n       addbr BRIDGE            Create BRIDGE"
+//usage:     "\n       delbr BRIDGE            Delete BRIDGE"
+//usage:     "\n       addif BRIDGE IFACE      Add IFACE to BRIDGE"
+//usage:     "\n       delif BRIDGE IFACE      Delete IFACE from BRIDGE"
+//usage:       IF_FEATURE_BRCTL_FANCY(
+//usage:     "\n       setageing BRIDGE TIME           Set ageing time"
+//usage:     "\n       setfd BRIDGE TIME               Set bridge forward delay"
+//usage:     "\n       sethello BRIDGE TIME            Set hello time"
+//usage:     "\n       setmaxage BRIDGE TIME           Set max message age"
+//usage:     "\n       setpathcost BRIDGE COST         Set path cost"
+//usage:     "\n       setportprio BRIDGE PRIO         Set port priority"
+//usage:     "\n       setbridgeprio BRIDGE PRIO       Set bridge priority"
+//usage:     "\n       stp BRIDGE [1/yes/on|0/no/off]  STP on/off"
+//usage:       )
+
 #include "libbb.h"
 #include <linux/sockios.h>
 #include <net/if.h>
@@ -184,7 +208,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
                                                tabs = 1;
                                        printf("\t\t%s\n", ifname);
                                }
-                               if (!tabs)      /* bridge has no interfaces */
+                               if (!tabs)  /* bridge has no interfaces */
                                        bb_putchar('\n');
                        }
                        goto done;
@@ -271,7 +295,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
                                }
                        }
                        arg1 = port;
-                       arg2 = xatoi_u(*argv);
+                       arg2 = xatoi_positive(*argv);
                        if (key == ARG_setbridgeprio) {
                                arg1 = arg2;
                                arg2 = 0;