From: Wolfgang Denk Date: Tue, 06 Mar 2012 21:11:01 +0100 Subject: [U-Boot] [PATCH v5 8/9] Add cmd_process() to process commands in one place In-Reply-To: <1329285566-30386-9-git-send-email-sjg@chromium.org> References: <1329285566-30386-1-git-send-email-sjg@chromium.org> <1329285566-30386-9-git-send-email-sjg@chromium.org> Message-ID: <20120306201101.A8076202D76@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Simon Glass, In message <1329285566-30386-9-git-send-email-sjg@chromium.org> you wrote: > We currently have the same code in hush.c and main.c. This brings the > code into one place. > > As an added feature, if the command function returns CMD_RET_USAGE then > cmd_process() will print a usage message for the command before > returning the standard failure code of 1. > > ARM code size increases about 32 bytes with this clean-up. > > Signed-off-by: Simon Glass > --- > Changes in v4: > - Add a 'repeatable' parameter to cmd_process() > - Make cmd_process() return only success (0) or failure (1) > - Rationalise return codes to 0, 1 and usage > > Changes in v5: > - Use existing #ifdef __ASSEMBLY__ rather than create a new one > > common/command.c | 41 ++++++++++++++++++++++++++++++++++++++++- > common/hush.c | 52 ++++++++++++---------------------------------------- > common/main.c | 37 +------------------------------------ > include/command.h | 29 ++++++++++++++++++++++++++++- > 4 files changed, 81 insertions(+), 78 deletions(-) Applied, thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de ... bacteriological warfare ... hard to believe we were once foolish enough to play around with that. -- McCoy, "The Omega Glory", stardate unknown