Rev 4201 | Rev 4537 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4201 | Rev 4296 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #include <libc.h> |
35 | #include <libc.h> |
36 | #include <unistd.h> |
36 | #include <unistd.h> |
37 | #include <stdio.h> |
37 | #include <stdio.h> |
38 | #include <io/io.h> |
38 | #include <io/io.h> |
- | 39 | #include <string.h> |
|
- | 40 | #include <errno.h> |
|
39 | 41 | ||
40 | const static char nl = '\n'; |
42 | const static char nl = '\n'; |
41 | 43 | ||
42 | int puts(const char *str) |
44 | int puts(const char *str) |
43 | { |
45 | { |
Line 85... | Line 87... | ||
85 | return EOF; |
87 | return EOF; |
86 | } |
88 | } |
87 | 89 | ||
88 | int putchar(int c) |
90 | int putchar(int c) |
89 | { |
91 | { |
- | 92 | char buf[STR_BOUNDS(1)]; |
|
90 | unsigned char ch = c; |
93 | size_t offs; |
- | 94 | ||
- | 95 | offs = 0; |
|
- | 96 | if (chr_encode(c, buf, &offs, STR_BOUNDS(1)) != EOK) |
|
- | 97 | return EOF; |
|
- | 98 | ||
91 | if (write_stdout((void *) &ch, 1) == 1) |
99 | if (write_stdout((void *) buf, offs) == offs) |
92 | return c; |
100 | return c; |
93 | 101 | ||
94 | return EOF; |
102 | return EOF; |
95 | } |
103 | } |
96 | 104 | ||
97 | int getchar(void) |
105 | int getchar(void) |
98 | { |
106 | { |