diff options
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/modinfo.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/modutils/modinfo.c b/modutils/modinfo.c index c0910ffed..7c978d1da 100644 --- a/modutils/modinfo.c +++ b/modutils/modinfo.c | |||
@@ -24,9 +24,9 @@ | |||
24 | 24 | ||
25 | 25 | ||
26 | enum { | 26 | enum { |
27 | OPT_TAGS = (1 << 8) - 1, | 27 | OPT_TAGS = (1 << 12) - 1, /* shortcut count */ |
28 | OPT_F = (1 << 8), /* field name */ | 28 | OPT_F = (1 << 12), /* field name */ |
29 | OPT_0 = (1 << 9), /* \0 as separator */ | 29 | OPT_0 = (1 << 13), /* \0 as separator */ |
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct modinfo_env { | 32 | struct modinfo_env { |
@@ -49,13 +49,17 @@ static void modinfo(const char *path, const char *version, | |||
49 | { | 49 | { |
50 | static const char *const shortcuts[] = { | 50 | static const char *const shortcuts[] = { |
51 | "filename", | 51 | "filename", |
52 | "description", | ||
53 | "author", | ||
54 | "license", | 52 | "license", |
53 | "author", | ||
54 | "description", | ||
55 | "version", | ||
56 | "alias", | ||
57 | "srcversion", | ||
58 | "depends", | ||
59 | "uts_release", | ||
55 | "vermagic", | 60 | "vermagic", |
56 | "parm", | 61 | "parm", |
57 | "firmware", | 62 | "firmware", |
58 | "depends", | ||
59 | }; | 63 | }; |
60 | size_t len; | 64 | size_t len; |
61 | int j, length; | 65 | int j, length; |
@@ -97,8 +101,11 @@ static void modinfo(const char *path, const char *version, | |||
97 | if (ptr == NULL) /* no occurance left, done */ | 101 | if (ptr == NULL) /* no occurance left, done */ |
98 | break; | 102 | break; |
99 | if (strncmp(ptr, pattern, length) == 0 && ptr[length] == '=') { | 103 | if (strncmp(ptr, pattern, length) == 0 && ptr[length] == '=') { |
100 | ptr += length + 1; | 104 | /* field prefixes are 0x80 or 0x00 */ |
101 | ptr += display(ptr, pattern, (1<<j) != tags); | 105 | if ((ptr[-1] & 0x7F) == '\0') { |
106 | ptr += length + 1; | ||
107 | ptr += display(ptr, pattern, (1<<j) != tags); | ||
108 | } | ||
102 | } | 109 | } |
103 | ++ptr; | 110 | ++ptr; |
104 | } | 111 | } |
@@ -131,7 +138,7 @@ int modinfo_main(int argc UNUSED_PARAM, char **argv) | |||
131 | 138 | ||
132 | env.field = NULL; | 139 | env.field = NULL; |
133 | opt_complementary = "-1"; /* minimum one param */ | 140 | opt_complementary = "-1"; /* minimum one param */ |
134 | opts = getopt32(argv, "fdalvpF:0", &env.field); | 141 | opts = getopt32(argv, "nladvAsDumpF:0", &env.field); |
135 | env.tags = opts & OPT_TAGS ? opts & OPT_TAGS : OPT_TAGS; | 142 | env.tags = opts & OPT_TAGS ? opts & OPT_TAGS : OPT_TAGS; |
136 | argv += optind; | 143 | argv += optind; |
137 | 144 | ||