fernly/cmd-hex.c
Sean Cross 72f92b7fd2 cmd: Split commands into their own files
Commands shouldn't all live in main.c.  Move everything except
"help" into its own command file.
2014-09-11 14:18:51 +08:00

24 lines
427 B
C

#include <string.h>
#include "bionic.h"
#include "memio.h"
#include "printf.h"
#include "serial.h"
#include "utils.h"
int cmd_hex(int argc, char **argv)
{
uint32_t offset;
int count = 0x200;
if (argc < 1) {
printf("Usage: hex [offset] [[count]]\n");
return -1;
}
offset = _strtoul(argv[0], NULL, 0);
if (argc > 1)
count = _strtoul(argv[1], NULL, 0);
serial_print_hex((const void *)offset, count);
return 0;
}