9
0
Fork 0

- putc is now putchar for better standard conformity

- make printf return int
This commit is contained in:
Sascha Hauer 2007-09-21 09:09:06 +02:00
parent c36aba6101
commit 0dd68e795e
11 changed files with 33 additions and 30 deletions

View File

@ -54,9 +54,9 @@ static int do_cat(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
while((ret = read(fd, buf, 1024)) > 0) {
for(i = 0; i < ret; i++) {
if (isprint(buf[i]) || buf[i] == '\n' || buf[i] == '\t')
putc(buf[i]);
putchar(buf[i]);
else
putc('.');
putchar('.');
}
if(ctrlc()) {
err = 1;

View File

@ -88,12 +88,12 @@ int memory_display(char *addr, ulong offs, ulong nbytes, int size)
cp = (u_char *)linebuf;
for (i=0; i<linebytes; i++) {
if ((*cp < 0x20) || (*cp > 0x7e))
putc ('.');
putchar('.');
else
printf("%c", *cp);
cp++;
}
putc ('\n');
putchar('\n');
nbytes -= linebytes;
if (ctrlc()) {
return -EINTR;

View File

@ -131,10 +131,10 @@ void u_boot_cmd_usage(cmd_tbl_t *cmdtp)
puts (cmdtp->help);
} else {
puts (cmdtp->name);
putc (' ');
putchar (' ');
puts ("- No help available.\n");
}
putc ('\n');
putchar ('\n');
#else /* no long help available */
if (cmdtp->usage) {
puts (cmdtp->usage);
@ -473,7 +473,7 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
if (i == 0) {
if (argc > 1) /* allow tab for non command */
return 0;
putc('\a');
putchar('\a');
return 1;
}
@ -500,7 +500,7 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
k = len + seplen;
/* make sure it fits */
if (n + k >= CONFIG_CBSIZE - 2) {
putc('\a');
putchar('\a');
return 1;
}
@ -515,7 +515,7 @@ int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
col += k;
puts(t - k);
if (sep == NULL)
putc('\a');
putchar('\a');
*np = n;
*colp = col;
} else {

View File

@ -27,7 +27,6 @@
#include <malloc.h>
#include <param.h>
#include <console.h>
#include <exports.h>
#include <driver.h>
#include <fs.h>
#include <reloc.h>
@ -211,7 +210,7 @@ int fputc(int fd, char c)
}
if (fd == 1)
putc(c);
putchar(c);
else if (fd == 2)
eputc(c);
else
@ -259,7 +258,7 @@ void fprintf (int file, const char *fmt, ...)
fputs (file, printbuffer);
}
void printf (const char *fmt, ...)
int printf (const char *fmt, ...)
{
va_list args;
uint i;
@ -275,10 +274,12 @@ void printf (const char *fmt, ...)
/* Print the string */
puts (printbuffer);
return i;
}
void vprintf (const char *fmt, va_list args)
int vprintf (const char *fmt, va_list args)
{
uint i;
char printbuffer[CFG_PBSIZE];
@ -290,6 +291,8 @@ void vprintf (const char *fmt, va_list args)
/* Print the string */
puts (printbuffer);
return i;
}
/* test if ctrl-c was pressed */

View File

@ -385,7 +385,7 @@ int flash_erase_one (flash_info_t * info, long sect)
(info, sect, info->erase_blk_tout, "erase")) {
rcode = 1;
} else
putc ('.');
putchar('.');
return rcode;
}
@ -407,7 +407,7 @@ int cfi_erase(struct device_d *dev, size_t count, unsigned long offset)
goto out;
}
out:
putc('\n');
putchar('\n');
return ret;
}
@ -428,7 +428,7 @@ int cfi_protect(struct device_d *dev, size_t count, unsigned long offset, int pr
goto out;
}
out:
putc('\n');
putchar('\n');
return ret;
}
@ -529,7 +529,7 @@ void cfi_info (struct device_d* dev)
info->protect[i] ? "RO" : " ");
#endif
}
putc ('\n');
putchar('\n');
return;
}

View File

@ -23,12 +23,12 @@ static inline void puts(const char *s) {
return console_puts(CONSOLE_STDOUT, s);
}
static inline void putc(char c) {
static inline void putchar(char c) {
console_putc(CONSOLE_STDOUT, c);
}
void printf(const char *fmt, ...);
void vprintf(const char *fmt, va_list args);
int printf(const char *fmt, ...);
int vprintf(const char *fmt, va_list args);
int sprintf(char * buf, const char *fmt, ...);
int vsprintf(char *buf, const char *fmt, va_list args);

View File

@ -21,7 +21,7 @@ extern char console_buffer[CONFIG_CBSIZE]; /* console I/O buffer */
#define DEL7 ((char)127)
#define CREAD_HIST_CHAR ('!')
#define getcmd_putch(ch) putc(ch)
#define getcmd_putch(ch) putchar(ch)
#define getcmd_getch() getc()
#define getcmd_cbeep() getcmd_putch('\a')
@ -189,7 +189,7 @@ int readline(const char *prompt, char *buf, int len)
ichar = read_key();
if ((ichar == '\n') || (ichar == '\r')) {
putc('\n');
putchar('\n');
break;
}

View File

@ -370,7 +370,7 @@ void panic(const char *fmt, ...)
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
putc('\n');
putchar('\n');
va_end(args);
#if defined (CONFIG_PANIC_HANG)
hang();

View File

@ -253,13 +253,13 @@ static void BootpVendorProcess (u8 * ext, int size)
if (NetOurSubnetMask) {
puts ("NetOurSubnetMask : ");
print_IPaddr (NetOurSubnetMask);
putc ('\n');
putchar('\n');
}
if (NetOurGatewayIP) {
puts ("NetOurGatewayIP : ");
print_IPaddr (NetOurGatewayIP);
putc ('\n');
putchar('\n');
}
if (NetBootFileSize) {
@ -827,7 +827,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
dhcp_state = BOUND;
puts ("DHCP client bound to address ");
print_IPaddr(NetOurIP);
putc ('\n');
putchar('\n');
NetState = NETLOOP_SUCCESS;
return;

View File

@ -1267,7 +1267,7 @@ NetReceive(uchar * inpkt, int len)
return;
puts (" ICMP Host Redirect to ");
print_IPaddr(icmph->un.gateway);
putc(' ');
putchar(' ');
return;
#ifdef CONFIG_NET_PING
case ICMP_ECHO_REPLY:

View File

@ -210,7 +210,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
printf ("\n\t %lu MB received\n\t ", TftpBlockWrapOffset>>20);
} else {
if (((TftpBlock - 1) % 10) == 0) {
putc ('#');
putchar('#');
} else if ((TftpBlock % (10 * HASHES_PER_LINE)) == 0) {
puts ("\n\t ");
}
@ -330,7 +330,7 @@ TftpStart (void)
print_IPaddr (NetOurGatewayIP) ;
}
}
putc ('\n');
putchar('\n');
printf ("Filename '%s'.", tftp_filename);
@ -339,7 +339,7 @@ TftpStart (void)
print_size (NetBootFileSize<<9, "");
}
putc ('\n');
putchar('\n');
puts ("Loading: *\b");