Changeset 566f4cfb in mainline for uspace/lib/libc/generic/io/stream.c
- Timestamp:
- 2009-04-24T08:01:05Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 402de0c
- Parents:
- ab1861a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/io/stream.c
rab1861a r566f4cfb 50 50 #include <sys/types.h> 51 51 52 ssize_t write_stderr(const void *buf, size_t count)53 {54 return count;55 }56 57 52 ssize_t read_stdin(void *buf, size_t count) 58 53 { 59 int cons_phone = console_ phone_get(false);60 54 int cons_phone = console_open(false); 55 61 56 if (cons_phone >= 0) { 62 57 kbd_event_t ev; 63 58 int rc; 64 59 size_t i = 0; 65 60 66 61 while (i < count) { 67 62 do { … … 69 64 if (rc < 0) return -1; 70 65 } while (ev.c == 0 || ev.type == KE_RELEASE); 71 66 72 67 ((char *) buf)[i++] = ev.c; 73 68 } 74 69 return i; 75 } else {70 } else 76 71 return -1; 77 }78 }79 80 ssize_t write_stdout(const void *buf, size_t count)81 {82 int cons_phone = console_phone_get(false);83 int left, rc;84 85 if (cons_phone >= 0) {86 int i;87 88 left = count;89 while (left > 0) {90 rc = console_write(buf, left);91 if (rc < 0)92 break;93 buf += rc;94 left -= rc;95 }96 97 return count;98 } else99 return __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, count);100 }101 102 int flush_stdout(void)103 {104 console_flush();105 return 0;106 72 } 107 73
Note:
See TracChangeset
for help on using the changeset viewer.