Rev 954 | Rev 1010 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 954 | Rev 974 | ||
---|---|---|---|
Line 27... | Line 27... | ||
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <libc.h> |
29 | #include <libc.h> |
30 | #include <unistd.h> |
30 | #include <unistd.h> |
31 | #include <stdio.h> |
31 | #include <stdio.h> |
- | 32 | #include <io/io.h> |
|
32 | 33 | ||
33 | static char nl = '\n'; |
34 | static char nl = '\n'; |
34 | 35 | ||
35 | int puts(const char * str) |
36 | int puts(const char * str) |
36 | { |
37 | { |
Line 43... | Line 44... | ||
43 | } |
44 | } |
44 | 45 | ||
45 | return EOF; |
46 | return EOF; |
46 | } |
47 | } |
47 | 48 | ||
- | 49 | /** Put count chars from buffer to stdout without adding newline |
|
- | 50 | * @param buf Buffer with size at least count bytes |
|
- | 51 | * @param count |
|
- | 52 | * @return 0 on succes, EOF on fail |
|
- | 53 | */ |
|
- | 54 | int putnchars(const char * buf, size_t count) |
|
- | 55 | { |
|
- | 56 | if (write(1, (void * ) buf, count) == count) { |
|
- | 57 | return 0; |
|
- | 58 | } |
|
- | 59 | ||
- | 60 | return EOF; |
|
- | 61 | } |
|
- | 62 | ||
- | 63 | /** Same as puts, but does not print newline at end |
|
- | 64 | * |
|
- | 65 | */ |
|
- | 66 | int putstr(const char * str) |
|
- | 67 | { |
|
- | 68 | size_t count; |
|
- | 69 | ||
- | 70 | for (count = 0; str[count] != 0; count++); |
|
- | 71 | if (write(1, (void * ) str, count) == count) { |
|
- | 72 | return 0; |
|
- | 73 | } |
|
- | 74 | ||
- | 75 | return EOF; |
|
- | 76 | } |
|
- | 77 | ||
48 | ssize_t write(int fd, const void * buf, size_t count) |
78 | ssize_t write(int fd, const void * buf, size_t count) |
49 | { |
79 | { |
50 | return (ssize_t) __SYSCALL3(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count); |
80 | return (ssize_t) __SYSCALL3(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count); |
51 | } |
81 | } |
- | 82 | ||
- | 83 |