Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4376 → Rev 4377

/branches/tracing/uspace/lib/libc/generic/io/io.c
36,6 → 36,9
#include <unistd.h>
#include <stdio.h>
#include <io/io.h>
#include <string.h>
#include <errno.h>
#include <console.h>
 
const static char nl = '\n';
 
47,8 → 50,9
return putnchars("(NULL)", 6);
for (count = 0; str[count] != 0; count++);
if (write_stdout((void *) str, count) == count) {
if (write_stdout(&nl, 1) == 1)
if (console_write((void *) str, count) == count) {
if (console_write(&nl, 1) == 1)
return 0;
}
62,7 → 66,7
*/
int putnchars(const char *buf, size_t count)
{
if (write_stdout((void *) buf, count) == count)
if (console_write((void *) buf, count) == count)
return 0;
return EOF;
79,7 → 83,7
return putnchars("(NULL)", 6);
 
for (count = 0; str[count] != 0; count++);
if (write_stdout((void *) str, count) == count)
if (console_write((void *) str, count) == count)
return 0;
return EOF;
87,10 → 91,16
 
int putchar(int c)
{
unsigned char ch = c;
if (write_stdout((void *) &ch, 1) == 1)
char buf[STR_BOUNDS(1)];
size_t offs;
 
offs = 0;
if (chr_encode(c, buf, &offs, STR_BOUNDS(1)) != EOK)
return EOF;
 
if (console_write((void *) buf, offs) == offs)
return c;
 
return EOF;
}
 
97,6 → 107,8
int getchar(void)
{
unsigned char c;
console_flush();
if (read_stdin((void *) &c, 1) == 1)
return c;
103,5 → 115,13
return EOF;
}
 
int fflush(FILE *f)
{
/* Dummy implementation */
(void) f;
console_flush();
return 0;
}
 
/** @}
*/