Changeset 3dbe2d1f in mainline for uspace/libc/generic/io/io.c
- Timestamp:
- 2007-04-07T18:00:18Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2a98e58
- Parents:
- 5b303ba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/generic/io/io.c
r5b303ba r3dbe2d1f 38 38 #include <io/io.h> 39 39 40 static char nl = '\n';40 const static char nl = '\n'; 41 41 42 int puts(const char * 42 int puts(const char *str) 43 43 { 44 44 size_t count; 45 45 46 if (str == NULL) { 47 return putnchars("(NULL)",6 ); 48 } 46 if (str == NULL) 47 return putnchars("(NULL)", 6); 49 48 50 49 for (count = 0; str[count] != 0; count++); 51 if (write(1, (void * 50 if (write(1, (void *) str, count) == count) { 52 51 if (write(1, &nl, 1) == 1) 53 52 return 0; … … 62 61 * @return 0 on succes, EOF on fail 63 62 */ 64 int putnchars(const char * 63 int putnchars(const char *buf, size_t count) 65 64 { 66 if (write(1, (void * ) buf, count) == count) {65 if (write(1, (void *) buf, count) == count) 67 66 return 0; 68 }69 67 70 68 return EOF; … … 74 72 * 75 73 */ 76 int putstr(const char * 74 int putstr(const char *str) 77 75 { 78 76 size_t count; 79 77 80 if (str == NULL) { 81 return putnchars("(NULL)",6 ); 82 } 78 if (str == NULL) 79 return putnchars("(NULL)", 6); 83 80 84 81 for (count = 0; str[count] != 0; count++); 85 if (write(1, (void * ) str, count) == count) {82 if (write(1, (void *) str, count) == count) 86 83 return 0; 87 }88 84 89 85 return EOF; … … 93 89 { 94 90 unsigned char ch = c; 95 if (write(1, (void *) &ch , 1) == 1) {91 if (write(1, (void *) &ch, 1) == 1) 96 92 return c; 97 }98 93 99 94 return EOF; … … 103 98 { 104 99 unsigned char c; 105 if (read(0, (void *) &c , 1) == 1) {100 if (read(0, (void *) &c, 1) == 1) 106 101 return c; 107 }108 102 109 103 return EOF;
Note:
See TracChangeset
for help on using the changeset viewer.