1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * The 'exception' command can be used for testing exception handling.
5 * Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk@gmx.de>
8 static int do_exception(cmd_tbl_t *cmdtp, int flag, int argc,
16 /* drop sub-command parameter */
20 cp = find_cmd_tbl(argv[0], cmd_sub, ARRAY_SIZE(cmd_sub));
23 return cp->cmd(cmdtp, flag, argc, argv);
28 static int exception_complete(int argc, char * const argv[], char last_char,
29 int maxv, char *cmdv[])
39 len = strlen(argv[1]);
44 for (cmdtp = cmd_sub; cmdtp != cmd_sub + ARRAY_SIZE(cmd_sub); cmdtp++) {
47 if (!strncmp(argv[1], cmdtp->name, len))
48 cmdv[i++] = cmdtp->name;
55 exception, 2, 0, do_exception,
56 "Forces an exception to occur",
57 exception_help_text, exception_complete