From owner-p4-projects@FreeBSD.ORG Fri Apr 28 05:58:14 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 03F9416A402; Fri, 28 Apr 2006 05:58:14 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8D4D316A400 for ; Fri, 28 Apr 2006 05:58:13 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5216743D48 for ; Fri, 28 Apr 2006 05:58:13 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3S5wCiH015790 for ; Fri, 28 Apr 2006 05:58:12 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3S5wBR2015779 for perforce@freebsd.org; Fri, 28 Apr 2006 05:58:11 GMT (envelope-from imp@freebsd.org) Date: Fri, 28 Apr 2006 05:58:11 GMT Message-Id: <200604280558.k3S5wBR2015779@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 96287 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2006 05:58:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=96287 Change 96287 by imp@imp_hammer on 2006/04/28 05:57:41 tighten up the source code a bit and fix some style issues. surprisingly, this doesn't change the generated code at all. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/loader_prompt.c#12 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/loader_prompt.c#12 (text+ko) ==== @@ -175,17 +175,14 @@ { int argc; - if ((argc = BreakCommand(buffer)) < 1) { - return ; - } + if ((argc = BreakCommand(buffer)) < 1) + return; switch (StringToCommand(argv[0])) { - case COMMAND_COPY: { - // "c " - // copy memory - + // "c " + // copy memory char *to, *from; unsigned size; @@ -195,20 +192,18 @@ size = p_ASCIIToHex(argv[3]); p_memcpy(to, from, size); } - + break; } - break; case COMMAND_DUMP: - // display boot commands + // display boot commands DumpBootCommands(); - break; + break; case COMMAND_EXEC: { - // "e
" - // execute at address - + // "e
" + // execute at address void (*execAddr)(unsigned, unsigned, unsigned); if (argc > 1) { @@ -217,35 +212,30 @@ p_ASCIIToHex(argv[1]); (*execAddr)(0, 612, tagAddress); } - + break; } - break; case COMMAND_TFTP: { - // "tftp " - // tftp download - + // "tftp " + // tftp download unsigned address = 0; if (argc > 2) address = p_ASCIIToHex(argv[1]); - TFTP_Download(address, argv[2]); - + break; } - break; case COMMAND_SERVER_IP: - // "server_ip " - // set download server address - + // "server_ip " + // set download server address if (argc > 4) SetServerIPAddress(BuildIP()); - break; + break; case COMMAND_HELP: - // dump command info + // dump command info printf("Commands:\r\n" "\tc\r\n" "\td\r\n" @@ -260,25 +250,22 @@ #endif "\tw\r\n" "\tx\r\n"); - break; + break; case COMMAND_LOCAL_IP: - // "local_ip - // set ip of this module - + // "local_ip + // set ip of this module if (argc > 4) SetLocalIPAddress(BuildIP()); - break; + break; case COMMAND_MAC: { - // "m - // set mac address using 6 byte values - + // "m + // set mac address using 6 byte values unsigned low_addr, high_addr; if (argc > 6) { - low_addr = (p_ASCIIToHex(argv[4]) << 24) | (p_ASCIIToHex(argv[3]) << 16) | (p_ASCIIToHex(argv[2]) << 8) | @@ -288,15 +275,13 @@ p_ASCIIToHex(argv[5]); SetMACAddress(low_addr, high_addr); } - + break; } - break; case COMMAND_SET: { - // s - // set the boot command at index (0-based) - + // s + // set the boot command at index (0-based) unsigned index; if (argc > 1) { @@ -304,45 +289,34 @@ index = p_ASCIIToHex(argv[1]); SetBootCommand(index, argv[2]); } - + break; } - break; #ifdef SUPPORT_TAG_LIST case COMMAND_TAG: - { - // t
- // create tag-list for linux boot - + // t
+ // create tag-list for linux boot if (argc > 2) { RestoreSpace(2); tagAddress = p_ASCIIToHex(argv[1]); InitTagList(argv[2], (void*)tagAddress); } - - } - break; + break; #endif case COMMAND_WRITE: - // write the command table to non-volatile - + // write the command table to non-volatile WriteCommandTable(); - break; + break; case COMMAND_XMODEM: { - // "x
" - // download X-modem record at address - - char *destAddr = 0; - - if (argc > 1) { - destAddr = (char *)p_ASCIIToHex(argv[1]); - xmodem_rx(destAddr); - } + // "x
" + // download X-modem record at address + if (argc > 1) + xmodem_rx((char *)p_ASCIIToHex(argv[1])); + break; } - break; default: break; @@ -366,21 +340,18 @@ if (p_char == '\r') p_char = 0; - if (p_char != 0x8) { - if (buffCount < MAX_INPUT_SIZE-1) { - inputBuffer[buffCount] = p_char; - ++buffCount; - putchar(p_char); + if (p_char == '\010') { + if (buffCount) { + /* handle backspace BS */ + inputBuffer[--buffCount] = 0; + printf(backspaceString); } - - } else if (buffCount) { - /* handle backspace BS */ - --buffCount; - inputBuffer[buffCount] = 0; - printf(backspaceString); - return ; + return; + } + if (buffCount < MAX_INPUT_SIZE - 1) { + inputBuffer[buffCount++] = p_char; + putchar(p_char); } - if (!p_char) { printf("\r\n"); ParseCommand(inputBuffer);