From: Erik M. <er...@us...> - 2002-02-08 12:55:19
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv24965/src/lib Modified Files: init.c util.c command.c error.c Log Message: Change a lot of code to printf() instead of SerialOutput*(). Index: init.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/init.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- init.c 3 Jan 2002 16:07:18 -0000 1.3 +++ init.c 8 Feb 2002 12:55:16 -0000 1.4 @@ -30,8 +30,8 @@ #include <blob/errno.h> #include <blob/error.h> #include <blob/init.h> -#include <blob/serial.h> #include <blob/types.h> +#include <blob/util.h> /* int and exit list start and end. filled in by the linker */ @@ -51,9 +51,8 @@ printerror(EMAGIC, NULL); #ifdef BLOB_DEBUG printerrprefix(); - SerialOutputString("Address = 0x"); - SerialOutputHex((u32)item); - serial_write('\n'); + printf(__FUNCTION__ "(): magic failed at 0x%08x\n", + (unsigned int)item); #endif return; } Index: util.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/util.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- util.c 3 Jan 2002 16:07:18 -0000 1.4 +++ util.c 8 Feb 2002 12:55:16 -0000 1.5 @@ -37,7 +37,6 @@ #include <blob/types.h> #include <blob/util.h> -#include <blob/serial.h> @@ -45,13 +44,8 @@ void MyMemCpy(u32 *dest, const u32 *src, int numWords) { #ifdef BLOB_DEBUG - SerialOutputString("\n### Now copying 0x"); - SerialOutputHex(numWords); - SerialOutputString(" words from 0x"); - SerialOutputHex((int)src); - SerialOutputString(" to 0x"); - SerialOutputHex((int)dest); - serial_write('\n'); + printf("### copying 0x%08x words from 0x%08x to 0x%08x ...", + (unsigned int)numWords, (unsigned int)src, (unsigned int)dest); #endif while(numWords--) { @@ -62,7 +56,7 @@ } #ifdef BLOB_DEBUG - SerialOutputString(" done\n"); + printf(" done\n"); #endif } /* MyMemCpy */ Index: command.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/command.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- command.c 4 Feb 2002 22:03:29 -0000 1.10 +++ command.c 8 Feb 2002 12:55:16 -0000 1.11 @@ -126,11 +126,7 @@ #ifdef BLOB_DEBUG for(i = 0; i < *argc; i++) { printerrprefix(); - SerialOutputString("argv["); - SerialOutputDec(i); - SerialOutputString("] = "); - SerialOutputString(argv[i]); - serial_write('\n'); + printf("argv[%i] = %s\n", i, argv[i]); } #endif } @@ -151,9 +147,8 @@ if(cmd->magic != COMMAND_MAGIC) { #ifdef BLOB_DEBUG printerrprefix(); - SerialOutputString(__FUNCTION__ "(): Address = 0x"); - SerialOutputHex((u32)cmd); - serial_write('\n'); + printf(__FUNCTION__ "(): Magic failed at 0x%08x\n", + (unsigned int)cmd); #endif return -EMAGIC; } @@ -201,9 +196,8 @@ if(cmd->magic != COMMAND_MAGIC) { #ifdef BLOB_DEBUG printerrprefix(); - SerialOutputString(__FUNCTION__ "(): Address = 0x"); - SerialOutputHex((u32)cmd); - serial_write('\n'); + printf(__FUNCTION__ "(): magic faild at 0x%08x\n", + (unsigned int)cmd); #endif return -EMAGIC; @@ -231,10 +225,8 @@ for(cmd = commands; cmd != NULL; cmd = cmd->next) { if(strncmp(cmd->name, argv[1], MAX_COMMANDLINE_LENGTH) == 0) { - SerialOutputString("Help for '"); - SerialOutputString(argv[1]); - SerialOutputString("':\n\nUsage: "); - SerialOutputString(cmd->help); + printf("Help for %s:\n\nUsage: %s\n", + argv[1], cmd->help); return 0; } } @@ -242,14 +234,12 @@ return -EINVAL; } - SerialOutputString("The following commands are supported:"); + printf("The following commands are supported:\n"); - for(cmd = commands; cmd != NULL; cmd = cmd->next) { - SerialOutputString("\n* "); - SerialOutputString(cmd->name); - } + for(cmd = commands; cmd != NULL; cmd = cmd->next) + printf("* %s\n", cmd->name); - SerialOutputString("\nUse \"help command\" to get help on a specific command\n"); + printf("Use \"help command\" to get help on a specific command\n"); return 0; } @@ -267,9 +257,9 @@ void DisplayPrompt(char *prompt) { if(prompt == NULL) { - SerialOutputString(PACKAGE "> "); + printf(PACKAGE "> "); } else { - SerialOutputString(prompt); + printf("%s", prompt); } } @@ -324,7 +314,7 @@ i--; numRead--; /* cursor one position back. */ - SerialOutputString("\b \b"); + printf("\b \b"); } } else { command[i++] = c; Index: error.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/error.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- error.c 3 Jan 2002 16:07:18 -0000 1.6 +++ error.c 8 Feb 2002 12:55:16 -0000 1.7 @@ -29,8 +29,8 @@ #include <blob/errno.h> #include <blob/error.h> -#include <blob/serial.h> #include <blob/types.h> +#include <blob/util.h> static char *error_strings[] = { @@ -73,19 +73,16 @@ void printerrprefix(void) { - SerialOutputString(errprefix); + printf("%s", errprefix); } void printerror(int errnum, char *s) { - printerrprefix(); - SerialOutputString(strerror(errnum)); - - if(s != NULL) { - SerialOutputString(": "); - SerialOutputString(s); - } + printf("%s%s", errprefix, strerror(errnum)); - serial_write('\n'); + if(s != NULL) + printf(": %s\n", s); + else + printf("\n"); } |