+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
/*
#include <common.h>
#include <command.h>
+#include <console.h>
#include <linux/ctype.h>
/*
/* find command table entry for a command */
cmd_tbl_t *find_cmd_tbl(const char *cmd, cmd_tbl_t *table, int table_len)
{
+#ifdef CONFIG_CMDLINE
cmd_tbl_t *cmdtp;
cmd_tbl_t *cmdtp_temp = table; /* Init value */
const char *p;
if (n_found == 1) { /* exactly one match */
return cmdtp_temp;
}
+#endif /* CONFIG_CMDLINE */
return NULL; /* not found or ambiguous command */
}
static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv, char *cmdv[])
{
+#ifdef CONFIG_CMDLINE
cmd_tbl_t *cmdtp = ll_entry_start(cmd_tbl_t, cmd);
const int count = ll_entry_count(cmd_tbl_t, cmd);
const cmd_tbl_t *cmdend = cmdtp + count;
cmdv[n_found] = NULL;
return n_found;
+#else
+ return 0;
+#endif
}
static int make_argv(char *s, int argvsz, char *argv[])
return len;
}
-static char tmp_buf[CONFIG_SYS_CBSIZE]; /* copy of console I/O buffer */
+static char tmp_buf[CONFIG_SYS_CBSIZE + 1]; /* copy of console I/O buffer */
int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
{
ulong addr;
addr = (ulong)(cmdtp->cmd) + gd->reloc_off;
-#if DEBUG_COMMANDS
+#ifdef DEBUG_COMMANDS
printf("Command \"%s\": 0x%08lx => 0x%08lx\n",
cmdtp->name, (ulong)(cmdtp->cmd), addr);
#endif