Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/stdio.c

    r9b1503e rab547063  
    11/*
    22 * Copyright (c) 2011 Jiri Zarevucky
    3  * Copyright (c) 2011 Petr Koupy
    43 * All rights reserved.
    54 *
     
    3433 */
    3534
    36 #define LIBPOSIX_INTERNAL
     35#define POSIX_INTERNAL
    3736
    3837#include <assert.h>
    39 #include <errno.h>
    40 
    41 #include "internal/common.h"
     38#include "errno.h"
     39#include "common.h"
    4240#include "stdio.h"
    4341#include "string.h"
    44 
    4542/* not the best of solutions, but freopen will eventually
    46  * need to be implemented in libc anyway
    47  */
     43   need to be implemented in libc anyway */
    4844#include "../c/generic/private/stdio.h"
    4945
    50 /**
    51  *
    52  * @param c
    53  * @param stream
    54  * @return
    55  */
    56 int posix_ungetc(int c, FILE *stream)
    57 {
    58         // TODO
    59         not_implemented();
    60 }
    61 
    62 /**
    63  *
    64  * @param filename
    65  * @param mode
    66  * @param stream
    67  * @return
    68  */
    69 FILE *posix_freopen(
    70     const char *restrict filename,
    71     const char *restrict mode,
    72     FILE *restrict stream)
     46FILE *posix_freopen(const char *restrict filename,
     47                    const char *restrict mode,
     48                    FILE *restrict stream)
    7349{
    7450        assert(mode != NULL);
     
    7955               
    8056                /* print error to stderr as well, to avoid hard to find problems
    81                  * with buggy apps that expect this to work
    82                  */
    83                 fprintf(stderr,
    84                     "ERROR: Application wants to use freopen() to change mode of opened stream.\n"
    85                     "       libposix does not support that yet, the application may function improperly.\n");
     57                   with buggy apps that expect this to work */
     58                fprintf(stderr, "ERROR: Application wants to use freopen() to change mode of opened stream.\n"
     59                                "       libposix does not support that yet, the application may function improperly.\n");
    8660                errno = ENOTSUP;
    8761                return NULL;
     
    9468        }
    9569        memcpy(copy, stream, sizeof(FILE));
    96         fclose(copy); /* copy is now freed */
     70        fclose(copy);   /* copy is now freed */
    9771       
    98         copy = fopen(filename, mode); /* open new stream */
     72        copy = fopen(filename, mode);         /* open new stream */
    9973        if (copy == NULL) {
    10074                /* fopen() sets errno */
     
    11387}
    11488
    115 /**
    116  *
    117  * @param s
    118  */
    11989void posix_perror(const char *s)
    120 {
    121         // TODO
    122         not_implemented();
    123 }
    124 
    125 /**
    126  *
    127  * @param stream
    128  * @param offset
    129  * @param whence
    130  * @return
    131  */
    132 int posix_fseeko(FILE *stream, posix_off_t offset, int whence)
    133 {
    134         // TODO
    135         not_implemented();
    136 }
    137 
    138 /**
    139  *
    140  * @param stream
    141  * @return
    142  */
    143 posix_off_t posix_ftello(FILE *stream)
    144 {
    145         // TODO
    146         not_implemented();
    147 }
    148 
    149 /**
    150  *
    151  * @param s
    152  * @param format
    153  * @param ...
    154  * @return
    155  */
    156 int posix_sprintf(char *s, const char *format, ...)
    157 {
    158         // TODO
    159         not_implemented();
    160 }
    161 
    162 /**
    163  *
    164  * @param s
    165  * @param format
    166  * @param ...
    167  * @return
    168  */
    169 int posix_sscanf(const char *s, const char *format, ...)
    17090{
    17191        // TODO
     
    17595/** @}
    17696 */
     97
Note: See TracChangeset for help on using the changeset viewer.