Hi Mike, On Tue, Oct 25, 2011 at 6:57 AM, Mike Frysinger <[email protected]> wrote: > On Mon, Oct 24, 2011 at 23:52, Simon Glass wrote: >> +int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) >> +{ >> + int result; >> + >> + result = (cmdtp->cmd)(cmdtp, flag, argc, argv); >> + if (result) >> + debug("Command failed, result=%d", result); >> + return result; >> +} > > i don't think this goes for enough. it should integrate the "if (argc >> cmdtp->maxargs) return cmd_usage(cmdtp);". >
Yes, that might turn this into a patch worth accepting on its merits. > and perhaps even the find_cmd(argv[0]) lookup ... > -mike > How about if the commands return error codes, one of which means 'print usage'? Then we might remove 265 calls to cmd_usage and even reduce code size :-O Continuing down the slippery slope, for find_cmd() there is sometimes a secondary command, and there are also argument to decode. We could devise a printf-style command description to specify the arguments for many/most commands. Even less code. More complicated. Regards, Simon _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

