diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-04-08 17:58:55 +0300 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-04-09 17:49:22 +0300 |
commit | 924862c864da0b62cf93ba7abf2dc78a7e6ac48f (patch) | |
tree | 4d47039b5a095966b2551ffd9dfd0400fdbaeb55 /ubi-utils/src/ubidetach.c | |
parent | dd2a035dd6cb7408a99fac2052b6812e7f489de8 (diff) |
mtd-utils: switch ubi and ubifs tools to use common strtoX funcs
Instead of using strtol and Co directly, use our share simple_strtoX()
helpers. This is just a cleanup.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src/ubidetach.c')
-rw-r--r-- | ubi-utils/src/ubidetach.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ubi-utils/src/ubidetach.c b/ubi-utils/src/ubidetach.c index dfd6485..5ee55f1 100644 --- a/ubi-utils/src/ubidetach.c +++ b/ubi-utils/src/ubidetach.c @@ -82,8 +82,7 @@ static const struct option long_options[] = { static int parse_opt(int argc, char * const argv[]) { while (1) { - int key; - char *endp; + int key, error = 0; key = getopt_long(argc, argv, "p:m:d:hV", long_options, NULL); if (key == -1) @@ -94,15 +93,15 @@ static int parse_opt(int argc, char * const argv[]) args.dev = optarg; break; case 'd': - args.devn = strtoul(optarg, &endp, 0); - if (*endp != '\0' || endp == optarg || args.devn < 0) + args.devn = simple_strtoul(optarg, &error); + if (error || args.devn < 0) return errmsg("bad UBI device number: \"%s\"", optarg); break; case 'm': - args.mtdn = strtoul(optarg, &endp, 0); - if (*endp != '\0' || endp == optarg || args.mtdn < 0) + args.mtdn = simple_strtoul(optarg, &error); + if (error || args.mtdn < 0) return errmsg("bad MTD device number: \"%s\"", optarg); break; |