Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/modutils/modinfo.c

    r2725 r3232  
    77 */
    88
    9 //applet:IF_MODINFO(APPLET(modinfo, _BB_DIR_SBIN, _BB_SUID_DROP))
     9//applet:IF_MODINFO(APPLET(modinfo, BB_DIR_SBIN, BB_SUID_DROP))
    1010
    1111//kbuild:lib-$(CONFIG_MODINFO) += modinfo.o modutils.o
     
    1414//config:   bool "modinfo"
    1515//config:   default y
     16//config:   select PLATFORM_LINUX
    1617//config:   help
    1718//config:     Show information about a Linux Kernel module
     
    2425
    2526enum {
    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 */
    2930};
    3031
     
    4546
    4647static void modinfo(const char *path, const char *version,
    47             struct modinfo_env *env)
     48            const struct modinfo_env *env)
    4849{
    4950    static const char *const shortcuts[] = {
    5051        "filename",
     52        "license",
     53        "author",
    5154        "description",
    52         "author",
    53         "license",
     55        "version",
     56        "alias",
     57        "srcversion",
     58        "depends",
     59        "uts_release",
    5460        "vermagic",
    5561        "parm",
     62        "firmware",
    5663    };
    5764    size_t len;
     
    8188        tags |= OPT_F;
    8289    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;
    8495        if ((1<<j) & OPT_TAGS)
    8596            pattern = shortcuts[j];
    86         if (!((1<<j) & tags))
    87             continue;
    8897        length = strlen(pattern);
    8998        ptr = the_module;
     
    93102                break;
    94103            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                }
    97109            }
    98110            ++ptr;
     
    105117//usage:       "[-adlp0] [-F keyword] MODULE"
    106118//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'"
    109120//usage:     "\n    -d      Shortcut for '-F description'"
    110121//usage:     "\n    -l      Shortcut for '-F license'"
     
    128139    env.field = NULL;
    129140    opt_complementary = "-1"; /* minimum one param */
    130     opts = getopt32(argv, "fdalvpF:0", &env.field);
     141    opts = getopt32(argv, "nladvAsDumpF:0", &env.field);
    131142    env.tags = opts & OPT_TAGS ? opts & OPT_TAGS : OPT_TAGS;
    132143    argv += optind;
Note: See TracChangeset for help on using the changeset viewer.