mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-21 14:11:36 +00:00
move cmd_get_data_size to command.c
add CMD_DATA_SIZE macro to enable it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
parent
507641d249
commit
8a40fb148e
8 changed files with 33 additions and 38 deletions
|
@ -654,3 +654,27 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CMD_DATA_SIZE
|
||||
int cmd_get_data_size(char* arg, int default_size)
|
||||
{
|
||||
/* Check for a size specification .b, .w or .l.
|
||||
*/
|
||||
int len = strlen(arg);
|
||||
if (len > 2 && arg[len-2] == '.') {
|
||||
switch(arg[len-1]) {
|
||||
case 'b':
|
||||
return 1;
|
||||
case 'w':
|
||||
return 2;
|
||||
case 'l':
|
||||
return 4;
|
||||
case 's':
|
||||
return -2;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return default_size;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue