1 /* vi: set sw=4 ts=4: */
3 * really dumb modprobe implementation for busybox
4 * Copyright (C) 2001 Lineo, davidm@lineo.com
17 extern int modprobe_main(int argc, char** argv)
20 int loadall = 0, showconfig = 0, debug = 0, autoclean = 0, list = 0;
21 int show_only = 0, quiet = 0, remove_opt = 0, do_syslog = 0, verbose = 0;
22 char *load_type = NULL, *config = NULL;
24 while ((ch = getopt(argc, argv, "acdklnqrst:vVC:")) != -1)
68 if (load_type || config) {
69 fprintf(stderr, "-t and -C not supported\n");
81 sprintf(cmd, "rmmod %s %s %s",
82 optind >= argc ? "-a" : "",
83 do_syslog ? "-s" : "",
84 optind < argc ? argv[optind] : "");
86 syslog(LOG_INFO, "%s", cmd);
87 if (show_only || verbose)
91 } while (++optind < argc);
96 fprintf(stderr, "No module or pattern provided\n");
100 sprintf(cmd, "insmod %s %s %s",
101 do_syslog ? "-s" : "",
103 autoclean ? "-k" : "");
104 while (optind < argc) {
105 strcat(cmd, argv[optind]);
110 syslog(LOG_INFO, "%s", cmd);
111 if (show_only || verbose)
118 exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);