Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Erik Andersen | 0210432 | 1999-12-17 18:57:34 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Mini insmod implementation for busybox |
Eric Andersen | 2835efe | 2001-07-25 16:58:58 +0000 | [diff] [blame] | 4 | * |
Denis Vlasenko | ba1315d | 2008-09-13 14:59:38 +0000 | [diff] [blame] | 5 | * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi> |
Erik Andersen | 0210432 | 1999-12-17 18:57:34 +0000 | [diff] [blame] | 6 | * |
Bernhard Reutner-Fischer | c2cb0f3 | 2006-04-13 12:45:04 +0000 | [diff] [blame] | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
Erik Andersen | 0210432 | 1999-12-17 18:57:34 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Denis Vlasenko | b6adbf1 | 2007-05-26 19:00:18 +0000 | [diff] [blame] | 10 | #include "libbb.h" |
Denis Vlasenko | ba1315d | 2008-09-13 14:59:38 +0000 | [diff] [blame] | 11 | #include "modutils.h" |
Eric Andersen | e704788 | 2003-12-11 01:42:13 +0000 | [diff] [blame] | 12 | |
Denis Vlasenko | b68979a | 2007-11-02 23:31:10 +0000 | [diff] [blame] | 13 | int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
Denis Vlasenko | a60f84e | 2008-07-05 09:18:54 +0000 | [diff] [blame] | 14 | int insmod_main(int argc UNUSED_PARAM, char **argv) |
Eric Andersen | e704788 | 2003-12-11 01:42:13 +0000 | [diff] [blame] | 15 | { |
Denis Vlasenko | ba1315d | 2008-09-13 14:59:38 +0000 | [diff] [blame] | 16 | char *filename; |
| 17 | int rc; |
| 18 | |
| 19 | USE_FEATURE_2_4_MODULES( |
| 20 | getopt32(argv, INSMOD_OPTS INSMOD_ARGS); |
| 21 | argv += optind-1; |
| 22 | ); |
Eric Andersen | 3b1a744 | 2003-12-24 20:30:45 +0000 | [diff] [blame] | 23 | |
Denis Vlasenko | 9229794 | 2006-11-21 11:58:14 +0000 | [diff] [blame] | 24 | filename = *++argv; |
| 25 | if (!filename) |
Eric Andersen | e704788 | 2003-12-11 01:42:13 +0000 | [diff] [blame] | 26 | bb_show_usage(); |
Eric Andersen | e704788 | 2003-12-11 01:42:13 +0000 | [diff] [blame] | 27 | |
Denis Vlasenko | ba1315d | 2008-09-13 14:59:38 +0000 | [diff] [blame] | 28 | rc = bb_init_module(filename, parse_cmdline_module_options(argv)); |
| 29 | if (rc) |
| 30 | bb_error_msg("cannot insert '%s': %s", filename, moderror(rc)); |
Eric Andersen | e704788 | 2003-12-11 01:42:13 +0000 | [diff] [blame] | 31 | |
Denis Vlasenko | ba1315d | 2008-09-13 14:59:38 +0000 | [diff] [blame] | 32 | return rc; |
Eric Andersen | e704788 | 2003-12-11 01:42:13 +0000 | [diff] [blame] | 33 | } |