Rev 505 | Rev 954 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 505 | Rev 713 | ||
---|---|---|---|
Line 28... | Line 28... | ||
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 | 32 | ||
- | 33 | static char nl = '\n'; |
|
- | 34 | ||
33 | int puts(const char * str) |
35 | int puts(const char * str) |
34 | { |
36 | { |
35 | size_t count; |
37 | size_t count; |
36 | 38 | ||
37 | for (count = 0; str[count] != 0; count++); |
39 | for (count = 0; str[count] != 0; count++); |
38 | if (write(1, (void * ) str, count) == count) |
40 | if (write(1, (void * ) str, count) == count) { |
- | 41 | if (write(1, &nl, 1) == 1) |
|
39 | return 0; |
42 | return 0; |
40 | else |
43 | } |
- | 44 | ||
41 | return EOF; |
45 | return EOF; |
42 | } |
46 | } |
43 | 47 | ||
44 | ssize_t write(int fd, const void * buf, size_t count) |
48 | ssize_t write(int fd, const void * buf, size_t count) |
45 | { |
49 | { |
46 | return (ssize_t) __syscall(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count); |
50 | return (ssize_t) __syscall(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count); |