build system: "make hosttools" doesn't exist, remove it from "make help"
[oweals/busybox.git] / modutils / rmmod.c
index 51390eb830a0090c98185eba6d26e91077ccb776..f13ff9eb6552c776ff4071f71d584a5750dd58c6 100644 (file)
@@ -8,7 +8,19 @@
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
-//applet:IF_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_DROP))
+//applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP))
+
+//usage:#if !ENABLE_MODPROBE_SMALL
+//usage:#define rmmod_trivial_usage
+//usage:       "[-wfa] [MODULE]..."
+//usage:#define rmmod_full_usage "\n\n"
+//usage:       "Unload kernel modules\n"
+//usage:     "\n       -w      Wait until the module is no longer used"
+//usage:     "\n       -f      Force unload"
+//usage:     "\n       -a      Remove all unused modules (recursively)"
+//usage:#define rmmod_example_usage
+//usage:       "$ rmmod tulip\n"
+//usage:#endif
 
 #include "libbb.h"
 #include "modutils.h"
@@ -22,9 +34,9 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
        /* Parse command line. */
        n = getopt32(argv, "wfas"); // -s ignored
        argv += optind;
-       if (n & 1)      // --wait
+       if (n & 1)  // --wait
                flags &= ~O_NONBLOCK;
-       if (n & 2)      // --force
+       if (n & 2)  // --force
                flags |= O_TRUNC;
        if (n & 4) {
                /* Unload _all_ unused modules via NULL delete_module() call */
@@ -48,7 +60,7 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
                        filename2modname(bname, modname);
                if (bb_delete_module(modname, flags))
                        bb_error_msg_and_die("can't unload '%s': %s",
-                                            modname, moderror(errno));
+                                       modname, moderror(errno));
        }
 
        return EXIT_SUCCESS;