+ if (cmdtp != NULL) {
+ /* Check if this command has subcommands */
+ if (cmdtp->subcmd && argc > 1) {
+
+ /* Look up subcommand in subcommand table */
+ cmd_tbl_t *cmdtpsub = find_cmd(argv[1], cmdtp->subcmd);
+ if (cmdtpsub == NULL) {
+ printf_P(PSTR("Unknown '%s' subcommand '%s' - try '%s help'\n"), argv[0], argv[1], argv[0]);
+ return CMD_RET_FAILURE;
+ }
+ cmdtp = cmdtpsub;
+ --argc;
+ ++argv;
+ }
+ } else {
+ /* Search subcommands */
+ cmdtp = find_cmd_sub(argv[0], cmd_tbl);
+ }
+