--- modprobe.c-orig Thu Nov 28 13:18:37 2002 +++ modprobe.c Thu Nov 28 13:34:55 2002 @@ -53,6 +53,9 @@ #define MODULE_DIR "/lib/modules" +int show_only = 0; +int verbose = 0; + static void fatal(const char *fmt, ...) __attribute__ ((noreturn, format (printf, 1, 2))); @@ -384,7 +387,7 @@ for (dep = mod->dependencies; dep != NULL; dep = dep->next) insmod(dep->module, options, NULL, 0, &call_history); - /* If we fail to load after this piont, we abort the whole program. */ + /* If we fail to load after this point, we abort the whole program. */ mod->state = LOADED; /* Now, it may already be loaded: check /proc/modules */ @@ -428,13 +431,18 @@ if (newname) rename_module(mod, map, st.st_size, newname); - ret = syscall(__NR_init_module, map, st.st_size, options); - if (ret != 0) { - if (dont_fail) - fatal("Error inserting %s (%s): %s\n", - modname, mod->filename, moderror(errno)); - warn("Error inserting %s (%s): %s\n", - modname, mod->filename, moderror(errno)); + if (verbose) + printf ("insmod %s\n", mod->filename); + + if (!show_only) { + ret = syscall(__NR_init_module, map, st.st_size, options); + if (ret != 0) { + if (dont_fail) + fatal("Error inserting %s (%s): %s\n", + modname, mod->filename, moderror(errno)); + warn("Error inserting %s (%s): %s\n", + modname, mod->filename, moderror(errno)); + } } free(map); out_fd: @@ -505,6 +513,7 @@ { "showconfig", 0, NULL, 'c' }, { "autoclean", 0, NULL, 'k' }, { "quiet", 0, NULL, 'q' }, + { "show", 0, NULL, 'n' }, { "syslog", 0, NULL, 's' }, { NULL, 0, NULL, 0 } }; @@ -515,7 +524,6 @@ struct utsname buf; int opt; int dump_only = 0; - int verbose = 0; const char *config = NULL; char *dirname, *optstring = NOFAIL(strdup("")); char *modname, *newname = NULL; @@ -523,7 +531,7 @@ try_old_version("modprobe", argv); - while ((opt = getopt_long(argc, argv, "vVC:o:kqsc", options, NULL)) != -1){ + while ((opt = getopt_long(argc, argv, "vVC:o:knqsc", options, NULL)) != -1){ switch (opt) { case 'v': verbose = 1; @@ -543,6 +551,9 @@ case 'k': /* FIXME: This should actually do something */ break; + case 'n': + show_only = 1; + break; case 'q': /* FIXME: This should actually do something */ break; @@ -550,7 +561,7 @@ /* FIXME: This should actually do something */ break; default: - fprintf(stderr, "Unknown option `%s'\n", argv[optind]); + fprintf(stderr, "Unknown option `%c'\n", opt); print_usage(argv[0]); } }