f2fs-tools: use either hex or decimal options

This patch supports both hex and decimal when using nid as option.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Changman Lee 2013-07-30 16:39:05 +09:00 committed by Jaegeuk Kim
parent 223fdf3e00
commit 932f9845f6

View File

@ -76,7 +76,10 @@ void f2fs_parse_options(int argc, char *argv[])
MSG(0, "Info: Debug level = %d\n", config.dbg_lv);
break;
case 'i':
sscanf(optarg, "%x", &dump_opt.nid);
if (strncmp(optarg, "0x", 2))
sscanf(optarg, "%d", &dump_opt.nid);
else
sscanf(optarg, "%x", &dump_opt.nid);
break;
case 's':
sscanf(optarg, "%d~%d", &dump_opt.start_sit, &dump_opt.end_sit);
@ -85,7 +88,10 @@ void f2fs_parse_options(int argc, char *argv[])
sscanf(optarg, "%d~%d", &dump_opt.start_ssa, &dump_opt.end_ssa);
break;
case 'b':
sscanf(optarg, "%d", &dump_opt.blk_addr);
if (strncmp(optarg, "0x", 2))
sscanf(optarg, "%d", &dump_opt.blk_addr);
else
sscanf(optarg, "%x", &dump_opt.blk_addr);
break;
default:
MSG(0, "\tError: Unknown option %c\n", option);