shell: flash: use base 0 to use base 10 by default or base 16 when a 0x prefix is used
This commit is contained in:
parent
7c44691059
commit
b1d94ce1d0
1 changed files with 12 additions and 12 deletions
|
@ -127,17 +127,17 @@ static int do_flash_read(struct console *con, size_t argc, const char **argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
addr = strtoull(argv[0], NULL, 16);
|
||||
addr = strtoull(argv[0], NULL, 0);
|
||||
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
fprintf(con->fp, "error: expected hexadecimal value for addr\n");
|
||||
fprintf(con->fp, "error: expected integer value for addr\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strtoull(argv[1], NULL, 16);
|
||||
len = strtoull(argv[1], NULL, 0);
|
||||
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
fprintf(con->fp, "error: expected hexadecimal value for len\n");
|
||||
fprintf(con->fp, "error: expected integer value for len\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -171,17 +171,17 @@ static int do_flash_write(struct console *con, size_t argc, const char **argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
addr = strtoull(argv[0], NULL, 16);
|
||||
addr = strtoull(argv[0], NULL, 0);
|
||||
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
fprintf(con->fp, "error: expected hexadecimal value for addr\n");
|
||||
fprintf(con->fp, "error: expected integer value for addr\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strtoull(argv[1], NULL, 16);
|
||||
len = strtoull(argv[1], NULL, 0);
|
||||
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
fprintf(con->fp, "error: expected hexadecimal value for len\n");
|
||||
fprintf(con->fp, "error: expected integer value for len\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -219,17 +219,17 @@ static int do_flash_erase(struct console *con, size_t argc, const char **argv)
|
|||
return -1;
|
||||
}
|
||||
|
||||
addr = strtoull(argv[0], NULL, 16);
|
||||
addr = strtoull(argv[0], NULL, 0);
|
||||
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
fprintf(con->fp, "error: expected hexadecimal value for addr\n");
|
||||
fprintf(con->fp, "error: expected integer value for addr\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strtoull(argv[1], NULL, 16);
|
||||
len = strtoull(argv[1], NULL, 0);
|
||||
|
||||
if (errno == EINVAL || errno == ERANGE) {
|
||||
fprintf(con->fp, "error: expected hexadecimal value for len\n");
|
||||
fprintf(con->fp, "error: expected integer value for len\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue