Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/modutils/modinfo.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/modutils/modinfo.c
r2725 r3232 7 7 */ 8 8 9 //applet:IF_MODINFO(APPLET(modinfo, _BB_DIR_SBIN, _BB_SUID_DROP))9 //applet:IF_MODINFO(APPLET(modinfo, BB_DIR_SBIN, BB_SUID_DROP)) 10 10 11 11 //kbuild:lib-$(CONFIG_MODINFO) += modinfo.o modutils.o … … 14 14 //config: bool "modinfo" 15 15 //config: default y 16 //config: select PLATFORM_LINUX 16 17 //config: help 17 18 //config: Show information about a Linux Kernel module … … 24 25 25 26 enum { 26 OPT_TAGS = (1 << 6) - 1,27 OPT_F = (1 << 6), /* field name */28 OPT_0 = (1 << 7),/* \0 as separator */27 OPT_TAGS = (1 << 12) - 1, /* shortcut count */ 28 OPT_F = (1 << 12), /* field name */ 29 OPT_0 = (1 << 13), /* \0 as separator */ 29 30 }; 30 31 … … 45 46 46 47 static void modinfo(const char *path, const char *version, 47 struct modinfo_env *env)48 const struct modinfo_env *env) 48 49 { 49 50 static const char *const shortcuts[] = { 50 51 "filename", 52 "license", 53 "author", 51 54 "description", 52 "author", 53 "license", 55 "version", 56 "alias", 57 "srcversion", 58 "depends", 59 "uts_release", 54 60 "vermagic", 55 61 "parm", 62 "firmware", 56 63 }; 57 64 size_t len; … … 81 88 tags |= OPT_F; 82 89 for (j = 1; (1<<j) & (OPT_TAGS + OPT_F); j++) { 83 const char *pattern = field; 90 const char *pattern; 91 92 if (!((1<<j) & tags)) 93 continue; 94 pattern = field; 84 95 if ((1<<j) & OPT_TAGS) 85 96 pattern = shortcuts[j]; 86 if (!((1<<j) & tags))87 continue;88 97 length = strlen(pattern); 89 98 ptr = the_module; … … 93 102 break; 94 103 if (strncmp(ptr, pattern, length) == 0 && ptr[length] == '=') { 95 ptr += length + 1; 96 ptr += display(ptr, pattern, (1<<j) != tags); 104 /* field prefixes are 0x80 or 0x00 */ 105 if ((ptr[-1] & 0x7F) == '\0') { 106 ptr += length + 1; 107 ptr += display(ptr, pattern, (1<<j) != tags); 108 } 97 109 } 98 110 ++ptr; … … 105 117 //usage: "[-adlp0] [-F keyword] MODULE" 106 118 //usage:#define modinfo_full_usage "\n\n" 107 //usage: "Options:" 108 //usage: "\n -a Shortcut for '-F author'" 119 //usage: " -a Shortcut for '-F author'" 109 120 //usage: "\n -d Shortcut for '-F description'" 110 121 //usage: "\n -l Shortcut for '-F license'" … … 128 139 env.field = NULL; 129 140 opt_complementary = "-1"; /* minimum one param */ 130 opts = getopt32(argv, " fdalvpF:0", &env.field);141 opts = getopt32(argv, "nladvAsDumpF:0", &env.field); 131 142 env.tags = opts & OPT_TAGS ? opts & OPT_TAGS : OPT_TAGS; 132 143 argv += optind;
Note:
See TracChangeset
for help on using the changeset viewer.