Changeset 080ad7f in mainline for uspace/lib/libc/generic/io/io.c


Ignore:
Timestamp:
2009-06-09T11:10:00Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ebe70f1
Parents:
bd8bfcbd
Message:

simple implementation of fdopen() and rewind()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/io/io.c

    rbd8bfcbd r080ad7f  
    193193}
    194194
     195FILE *fdopen(int fd, const char *mode)
     196{
     197        /* Open file. */
     198        FILE *stream = malloc(sizeof(FILE));
     199        if (stream == NULL) {
     200                errno = ENOMEM;
     201                return NULL;
     202        }
     203       
     204        stream->fd = fd;
     205        stream->error = false;
     206        stream->eof = false;
     207        stream->klog = false;
     208        stream->phone = -1;
     209       
     210        list_append(&stream->link, &files);
     211       
     212        return stream;
     213}
     214
    195215FILE *fopen_node(fdi_node_t *node, const char *mode)
    196216{
     
    379399}
    380400
     401void rewind(FILE *stream)
     402{
     403        (void) fseek(stream, 0, SEEK_SET);
     404}
     405
    381406int fflush(FILE *stream)
    382407{
Note: See TracChangeset for help on using the changeset viewer.