Olaf Hering
2003-Nov-22 10:39 UTC
[klibc] [PATCH] option parsing in kinit/kinit.c get_arg()
what is the purpose of get_arg()? should it return the option itself and/or the arguments passed to an option? this patch returns either 'rw' or '/dev/nfs' if name was root=/dev/nfs --- usr/klibc/klibc-0.81.orig/kinit/kinit.c 2003-06-01 08:18:41.000000000 +0200 +++ usr/klibc/klibc-0.81/kinit/kinit.c 2003-11-22 19:19:17.000000000 +0100 @@ -181,10 +181,15 @@ char *get_arg(int argc, char *argv[], co int i; for (i = 1; i < argc; i++) { - if (argv[i] && strncmp(argv[i], name, len) == 0 && - (argv[i][len] == '\0')) { - ret = argv[i] + len; - break; + if (argv[i] && strncmp(argv[i], name, len) == 0) { + if (argv[i][len] == '\0') { + ret = argv[i]; + break; + } + if (len && argv[i][len-1] == '=') { + ret = argv[i] + len; + break; + } } } -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG