2 * cmd_strings.c - just like `strings` command
4 * Copyright (c) 2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
13 #ifdef CONFIG_CFG_STRINGS
15 static char *start_addr, *last_addr;
17 int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
20 printf("Usage:\n%s\n", cmdtp->usage);
24 if ((flag & CMD_FLAG_REPEAT) == 0) {
25 start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
27 last_addr = (char *)simple_strtoul(argv[2], NULL, 16);
29 last_addr = (char *)-1;
32 char *addr = start_addr;
35 addr += strlen(addr) + 1;
36 } while (addr[0] && addr < last_addr);
38 last_addr = addr + (last_addr - start_addr);
44 U_BOOT_CMD(strings, 3, 1, do_strings,
45 "strings - display strings\n",
46 "<addr> [byte count]\n"
47 " - display strings at <addr> for at least [byte count] or first double NUL\n");