blob: 61ee5009b9bee281e8eb1a6c1887b31eeec4d59c [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Erik Andersen02104321999-12-17 18:57:34 +00002/*
3 * Mini insmod implementation for busybox
Eric Andersen2835efe2001-07-25 16:58:58 +00004 *
Denis Vlasenkoba1315d2008-09-13 14:59:38 +00005 * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi>
Erik Andersen02104321999-12-17 18:57:34 +00006 *
Bernhard Reutner-Fischerc2cb0f32006-04-13 12:45:04 +00007 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Erik Andersen02104321999-12-17 18:57:34 +00008 */
9
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000010#include "libbb.h"
Denis Vlasenkoba1315d2008-09-13 14:59:38 +000011#include "modutils.h"
Eric Andersene7047882003-12-11 01:42:13 +000012
Denis Vlasenkob68979a2007-11-02 23:31:10 +000013int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denis Vlasenkoa60f84e2008-07-05 09:18:54 +000014int insmod_main(int argc UNUSED_PARAM, char **argv)
Eric Andersene7047882003-12-11 01:42:13 +000015{
Denis Vlasenkoba1315d2008-09-13 14:59:38 +000016 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 Andersen3b1a7442003-12-24 20:30:45 +000023
Denis Vlasenko92297942006-11-21 11:58:14 +000024 filename = *++argv;
25 if (!filename)
Eric Andersene7047882003-12-11 01:42:13 +000026 bb_show_usage();
Eric Andersene7047882003-12-11 01:42:13 +000027
Denis Vlasenkoba1315d2008-09-13 14:59:38 +000028 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 Andersene7047882003-12-11 01:42:13 +000031
Denis Vlasenkoba1315d2008-09-13 14:59:38 +000032 return rc;
Eric Andersene7047882003-12-11 01:42:13 +000033}