/*
- * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2014,2016 Leo C. <erbl259-lmu@yahoo.de>
*
* SPDX-License-Identifier: GPL-2.0
*/
#include "debug.h"
#include "common.h"
-#include <stdlib.h>
+#include <stdlib.h> /* __malloc_margin */
#include <string.h>
#include <ctype.h>
#include <avr/eeprom.h>
#include "command.h"
#include "cli_readline.h"
+#include "eval_arg.h"
#include "print-utils.h"
/*
}
/* Address is specified since argc > 1 */
- addr = strtoul(argv[1], NULL, 16);
+ addr = eval_arg(argv[1], NULL);
/* If another parameter, it is the length to display. */
if (argc > 2)
- length = (uint16_t) strtoul(argv[2], NULL, 16);
+ length = (uint16_t) eval_arg(argv[2], NULL);
/* Print the lines. */
dump_mem(addr, addr, length, readwhat, NULL);
if (argc != 4)
return CMD_RET_USAGE;
- src = (size_t) strtoul(argv[1], NULL, 16);
- dest = (size_t) strtoul(argv[2], NULL, 16);
- count = (size_t) strtoul(argv[3], NULL, 16);
+ src = (size_t) eval_arg(argv[1], NULL);
+ dest = (size_t) eval_arg(argv[2], NULL);
+ count = (size_t) eval_arg(argv[3], NULL);
if (src > E2END) {
debug("src > EEPROM size: 0x%04x\n", src);
/* Address is specified since argc > 1
*/
- addr = (uint8_t *) (size_t) strtoul(argv[1], NULL, 16);
+ addr = (uint8_t *) (size_t) eval_arg(argv[1], NULL);
}
/* Print the address, followed by value. Then accept input for
} else {
char *endp;
- data = strtoul(console_buffer, &endp, 16);
+ data = eval_arg(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
*addr = data;