aboutsummaryrefslogtreecommitdiff
path: root/toys/other/modinfo.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-06-16 02:23:59 -0500
committerRob Landley <rob@landley.net>2013-06-16 02:23:59 -0500
commit5b2510562c26fbb41dd0f93326e4eb3f4f349b50 (patch)
tree37b40c14039ba3bdb6c4446980610c4041dac225 /toys/other/modinfo.c
parentbc9cfe08cfa2c47b2d106eda7b5d0ecc73f47238 (diff)
downloadtoybox-5b2510562c26fbb41dd0f93326e4eb3f4f349b50.tar.gz
Upgrade modinfo to support multiple modules, and add tests, from Isaac Dunham.
Diffstat (limited to 'toys/other/modinfo.c')
-rw-r--r--toys/other/modinfo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/toys/other/modinfo.c b/toys/other/modinfo.c
index da510a1d..501ba27b 100644
--- a/toys/other/modinfo.c
+++ b/toys/other/modinfo.c
@@ -16,6 +16,8 @@ config MODINFO
GLOBALS(
char *field;
+
+ long mod;
)
static char *modinfo_tags[] = {
@@ -69,10 +71,9 @@ static void modinfo_file(struct dirtree *dir)
static int check_module(struct dirtree *new)
{
if (S_ISREG(new->st.st_mode)) {
- char **ss;
+ char *s;
- for (ss = toys.optargs; *ss; ss++) {
- char *s = *ss;
+ for (s = toys.optargs[TT.mod]; *s; s++) {
int len = 0;
// The kernel treats - and _ the same, so we should too.
@@ -97,5 +98,7 @@ void modinfo_main(void)
if (uname(&uts) < 0) perror_exit("bad uname");
sprintf(toybuf, "/lib/modules/%s", uts.release);
- dirtree_read(toybuf, check_module);
+ for(TT.mod = 0; TT.mod<toys.optc; TT.mod++) {
+ dirtree_read(toybuf, check_module);
+ }
}