Changeset 1916d1f in mainline for uspace/lib/posix/stdio.c
- Timestamp:
- 2011-07-12T13:41:26Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 50fc490
- Parents:
- 11809eab (diff), 6817eba (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdio.c
r11809eab r1916d1f 89 89 90 90 /** 91 * Put a string on the stream. 92 * 93 * @param s String to be written. 94 * @param stream Output stream. 95 * @return Non-negative on success, EOF on failure. 96 */ 97 int posix_fputs(const char *restrict s, FILE *restrict stream) 98 { 99 int rc = fputs(s, stream); 100 if (rc == 0) { 101 return EOF; 102 } else { 103 return 0; 104 } 105 } 106 107 /** 91 108 * Push byte back into input stream. 92 109 * … … 100 117 101 118 bool can_unget = 102 119 /* Provided character is legal. */ 103 120 c != EOF && 104 121 /* Stream is consistent. */ 105 122 !stream->error && 106 123 /* Stream is buffered. */ 107 124 stream->btype != _IONBF && 108 125 /* Last operation on the stream was a read operation. */ 109 126 stream->buf_state == _bs_read && 110 111 112 127 /* Stream buffer is already allocated (i.e. there was already carried 128 * out either write or read operation on the stream). This is probably 129 * redundant check but let's be safe. */ 113 130 stream->buf != NULL && 114 115 116 117 131 /* There is still space in the stream to retreat. POSIX demands the 132 * possibility to unget at least 1 character. It should be always 133 * possible, assuming the last operation on the stream read at least 1 134 * character, because the buffer is refilled in the lazily manner. */ 118 135 stream->buf_tail > stream->buf; 119 136 … … 230 247 * stream with a changed mode. NULL otherwise. 231 248 */ 232 FILE *posix_freopen( 233 const char *restrict filename, 234 const char *restrict mode, 235 FILE *restrict stream) 249 FILE *posix_freopen(const char *restrict filename, 250 const char *restrict mode, FILE *restrict stream) 236 251 { 237 252 assert(mode != NULL); … … 393 408 { 394 409 return (posix_off_t) ftell(stream); 410 } 411 412 /** 413 * Discard prefetched data or write unwritten data. 414 * 415 * @param stream Stream that shall be flushed. 416 * @return Zero on success, EOF on failure. 417 */ 418 int posix_fflush(FILE *stream) 419 { 420 int rc = fflush(stream); 421 if (rc < 0) { 422 errno = -rc; 423 return EOF; 424 } else { 425 return 0; 426 } 395 427 } 396 428
Note:
See TracChangeset
for help on using the changeset viewer.