Changeset 0ffbed9 in mainline for uspace/lib/posix/stdio.c


Ignore:
Timestamp:
2011-06-19T17:49:29Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5974661
Parents:
f48b637 (diff), 32fb6944 (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.
Message:

Merge libposix.

File:
1 edited

Legend:

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

    rf48b637 r0ffbed9  
    11/*
    22 * Copyright (c) 2011 Jiri Zarevucky
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3334 */
    3435
    35 #define POSIX_INTERNAL
     36#define LIBPOSIX_INTERNAL
    3637
    3738#include <assert.h>
    38 #include "errno.h"
    39 #include "common.h"
     39#include <errno.h>
     40
     41#include "internal/common.h"
    4042#include "stdio.h"
    4143#include "string.h"
     44
    4245/* not the best of solutions, but freopen will eventually
    43    need to be implemented in libc anyway */
     46 * need to be implemented in libc anyway
     47 */
    4448#include "../c/generic/private/stdio.h"
    4549
    46 FILE *posix_freopen(const char *restrict filename,
    47                     const char *restrict mode,
    48                     FILE *restrict stream)
     50/**
     51 *
     52 * @param c
     53 * @param stream
     54 * @return
     55 */
     56int 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 */
     69FILE *posix_freopen(
     70    const char *restrict filename,
     71    const char *restrict mode,
     72    FILE *restrict stream)
    4973{
    5074        assert(mode != NULL);
     
    5579               
    5680                /* print error to stderr as well, to avoid hard to find problems
    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");
     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");
    6086                errno = ENOTSUP;
    6187                return NULL;
     
    6894        }
    6995        memcpy(copy, stream, sizeof(FILE));
    70         fclose(copy);   /* copy is now freed */
     96        fclose(copy); /* copy is now freed */
    7197       
    72         copy = fopen(filename, mode);         /* open new stream */
     98        copy = fopen(filename, mode); /* open new stream */
    7399        if (copy == NULL) {
    74100                /* fopen() sets errno */
     
    87113}
    88114
     115/**
     116 *
     117 * @param s
     118 */
    89119void 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 */
     132int 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 */
     143posix_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 */
     156int 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 */
     169int posix_sscanf(const char *s, const char *format, ...)
    90170{
    91171        // TODO
     
    95175/** @}
    96176 */
    97 
Note: See TracChangeset for help on using the changeset viewer.