2 * cmd_strings.c - just like `strings` command
4 * Copyright (c) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
13 static char *start_addr, *last_addr;
15 int do_strings(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
20 if ((flag & CMD_FLAG_REPEAT) == 0) {
21 start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
23 last_addr = (char *)simple_strtoul(argv[2], NULL, 16);
25 last_addr = (char *)-1;
28 char *addr = start_addr;
32 addr += strlen(addr) + 1;
33 } while (addr[0] && addr < last_addr);
35 last_addr = addr + (last_addr - start_addr);
42 strings, 3, 1, do_strings,
44 "<addr> [byte count]\n"
45 " - display strings at <addr> for at least [byte count] or first double NUL"