Date: Fri, 28 Apr 2006 05:58:11 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96287 for review Message-ID: <200604280558.k3S5wBR2015779@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <to> <from> <size in bytes>" - // copy memory - + // "c <to> <from> <size in bytes>" + // 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 <address>" - // execute at address - + // "e <address>" + // 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 <local_dest_addr filename>" - // tftp download - + // "tftp <local_dest_addr filename>" + // 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 <server IP 192 200 1 20>" - // set download server address - + // "server_ip <server IP 192 200 1 20>" + // 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 <local IP 192 200 1 21> - // set ip of this module - + // "local_ip <local IP 192 200 1 21> + // set ip of this module if (argc > 4) SetLocalIPAddress(BuildIP()); - break; + break; case COMMAND_MAC: { - // "m <mac address 12 34 56 78 9a bc> - // set mac address using 6 byte values - + // "m <mac address 12 34 56 78 9a bc> + // 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 <index> <new boot command> - // set the boot command at index (0-based) - + // s <index> <new boot command> + // 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 <address> <boot command line> - // create tag-list for linux boot - + // t <address> <boot command line> + // 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 <address>" - // download X-modem record at address - - char *destAddr = 0; - - if (argc > 1) { - destAddr = (char *)p_ASCIIToHex(argv[1]); - xmodem_rx(destAddr); - } + // "x <address>" + // 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604280558.k3S5wBR2015779>