Changeset 04803bf in mainline for uspace/lib/c/include/stdio.h


Ignore:
Timestamp:
2011-03-21T22:00:17Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e3
Parents:
b50b5af2 (diff), 7308e84 (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 mainline changes (needs fixes).

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/stdio.h

    rb50b5af2 r04803bf  
    3838#include <sys/types.h>
    3939#include <stdarg.h>
    40 #include <string.h>
     40#include <str.h>
    4141#include <adt/list.h>
     42
     43#ifndef NVERIFY_PRINTF
     44
     45#define PRINTF_ATTRIBUTE(start, end) \
     46        __attribute__((format(gnu_printf, start, end)))
     47
     48#else /* NVERIFY_PRINTF */
     49
     50#define PRINTF_ATTRIBUTE(start, end)
     51
     52#endif /* NVERIFY_PRINTF */
    4253
    4354#define EOF  (-1)
     
    5667#ifndef SEEK_SET
    5768        #define SEEK_SET  0
     69#endif
     70
     71#ifndef SEEK_CUR
    5872        #define SEEK_CUR  1
     73#endif
     74
     75#ifndef SEEK_END
    5976        #define SEEK_END  2
    6077#endif
     
    6986};
    7087
     88enum _buffer_state {
     89        /** Buffer is empty */
     90        _bs_empty,
     91
     92        /** Buffer contains data to be written */
     93        _bs_write,
     94
     95        /** Buffer contains prefetched data for reading */
     96        _bs_read
     97};
     98
    7199typedef struct {
    72100        /** Linked list pointer. */
     
    88116        int phone;
    89117
     118        /**
     119         * Non-zero if the stream needs sync on fflush(). XXX change
     120         * console semantics so that sync is not needed.
     121         */
     122        int need_sync;
     123
    90124        /** Buffering type */
    91125        enum _buffer_type btype;
     126
    92127        /** Buffer */
    93128        uint8_t *buf;
     129
    94130        /** Buffer size */
    95131        size_t buf_size;
     132
     133        /** Buffer state */
     134        enum _buffer_state buf_state;
     135
    96136        /** Buffer I/O pointer */
    97137        uint8_t *buf_head;
     138
     139        /** Points to end of occupied space when in read mode. */
     140        uint8_t *buf_tail;
    98141} FILE;
    99142
     
    104147/* Character and string input functions */
    105148extern int fgetc(FILE *);
    106 extern char *fgets(char *, size_t, FILE *);
     149extern char *fgets(char *, int, FILE *);
    107150
    108151extern int getchar(void);
     
    117160
    118161/* Formatted string output functions */
    119 extern int fprintf(FILE *, const char*, ...);
     162extern int fprintf(FILE *, const char*, ...)
     163    PRINTF_ATTRIBUTE(2, 3);
    120164extern int vfprintf(FILE *, const char *, va_list);
    121165
    122 extern int printf(const char *, ...);
     166extern int printf(const char *, ...)
     167    PRINTF_ATTRIBUTE(1, 2);
    123168extern int vprintf(const char *, va_list);
    124169
    125 extern int snprintf(char *, size_t , const char *, ...);
    126 extern int asprintf(char **, const char *, ...);
     170extern int snprintf(char *, size_t , const char *, ...)
     171    PRINTF_ATTRIBUTE(3, 4);
     172extern int asprintf(char **, const char *, ...)
     173    PRINTF_ATTRIBUTE(2, 3);
    127174extern int vsnprintf(char *, size_t, const char *, va_list);
    128175
     
    135182extern size_t fwrite(const void *, size_t, size_t, FILE *);
    136183
    137 extern int fseek(FILE *, long, int);
     184extern int fseek(FILE *, off64_t, int);
    138185extern void rewind(FILE *);
    139 extern int ftell(FILE *);
     186extern off64_t ftell(FILE *);
    140187extern int feof(FILE *);
     188extern int fileno(FILE *);
    141189
    142190extern int fflush(FILE *);
Note: See TracChangeset for help on using the changeset viewer.