Ignore:
File:
1 edited

Legend:

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

    r32b3a12 rfdf97f6  
    3737#define POSIX_STDIO_H_
    3838
     39#ifndef __POSIX_DEF__
     40#define __POSIX_DEF__(x) x
     41/* DEBUG macro does not belong to POSIX stdio.h. Its unconditional
     42 * definition in the native stdio.h causes unexpected behaviour of
     43 * applications which uses their own DEBUG macro (e.g. debugging
     44 * output is printed even if not desirable). */
     45#undef DEBUG
     46#endif
     47
    3948#include "stddef.h"
    4049#include "unistd.h"
     
    97106extern size_t fwrite(const void *, size_t, size_t, FILE *);
    98107
    99 extern int fseek(FILE *, off64_t, int);
    100108extern void rewind(FILE *);
    101 extern off64_t ftell(FILE *);
    102109extern int feof(FILE *);
    103110extern int fileno(FILE *);
     
    115122#undef L_ctermid
    116123#define L_ctermid PATH_MAX
    117 extern char *posix_ctermid(char *s);
     124extern char *__POSIX_DEF__(ctermid)(char *s);
    118125
    119126/* Error Recovery */
    120 extern void posix_clearerr(FILE *stream);
     127extern void __POSIX_DEF__(clearerr)(FILE *stream);
    121128
    122129/* Input/Output */
    123130#undef putc
    124131#define putc fputc
    125 extern int posix_fputs(const char *restrict s, FILE *restrict stream);
     132extern int __POSIX_DEF__(fputs)(const char *restrict s, FILE *restrict stream);
    126133#undef getc
    127134#define getc fgetc
    128 extern int posix_ungetc(int c, FILE *stream);
    129 extern ssize_t posix_getdelim(char **restrict lineptr, size_t *restrict n,
     135extern int __POSIX_DEF__(ungetc)(int c, FILE *stream);
     136extern ssize_t __POSIX_DEF__(getdelim)(char **restrict lineptr, size_t *restrict n,
    130137    int delimiter, FILE *restrict stream);
    131 extern ssize_t posix_getline(char **restrict lineptr, size_t *restrict n,
     138extern ssize_t __POSIX_DEF__(getline)(char **restrict lineptr, size_t *restrict n,
    132139    FILE *restrict stream);
    133140
    134141/* Opening Streams */
    135 extern FILE *posix_freopen(const char *restrict filename,
     142extern FILE *__POSIX_DEF__(freopen)(const char *restrict filename,
    136143    const char *restrict mode, FILE *restrict stream);
    137144
    138145/* Error Messages */
    139 extern void posix_perror(const char *s);
     146extern void __POSIX_DEF__(perror)(const char *s);
    140147
    141148/* File Positioning */
    142 typedef struct _posix_fpos posix_fpos_t;
    143 extern int posix_fsetpos(FILE *stream, const posix_fpos_t *pos);
    144 extern int posix_fgetpos(FILE *restrict stream, posix_fpos_t *restrict pos);
    145 extern int posix_fseek(FILE *stream, long offset, int whence);
    146 extern int posix_fseeko(FILE *stream, posix_off_t offset, int whence);
    147 extern long posix_ftell(FILE *stream);
    148 extern posix_off_t posix_ftello(FILE *stream);
     149typedef struct _posix_fpos __POSIX_DEF__(fpos_t);
     150extern int __POSIX_DEF__(fsetpos)(FILE *stream, const __POSIX_DEF__(fpos_t) *pos);
     151extern int __POSIX_DEF__(fgetpos)(FILE *restrict stream, __POSIX_DEF__(fpos_t) *restrict pos);
     152extern int __POSIX_DEF__(fseek)(FILE *stream, long offset, int whence);
     153extern int __POSIX_DEF__(fseeko)(FILE *stream, __POSIX_DEF__(off_t) offset, int whence);
     154extern long __POSIX_DEF__(ftell)(FILE *stream);
     155extern __POSIX_DEF__(off_t) __POSIX_DEF__(ftello)(FILE *stream);
    149156
    150157/* Flushing Buffers */
    151 extern int posix_fflush(FILE *stream);
     158extern int __POSIX_DEF__(fflush)(FILE *stream);
    152159
    153160/* Formatted Output */
    154 extern int posix_dprintf(int fildes, const char *restrict format, ...)
     161extern int __POSIX_DEF__(dprintf)(int fildes, const char *restrict format, ...)
    155162    PRINTF_ATTRIBUTE(2, 3);
    156 extern int posix_vdprintf(int fildes, const char *restrict format, va_list ap);
    157 extern int posix_sprintf(char *restrict s, const char *restrict format, ...)
     163extern int __POSIX_DEF__(vdprintf)(int fildes, const char *restrict format, va_list ap);
     164extern int __POSIX_DEF__(sprintf)(char *restrict s, const char *restrict format, ...)
    158165    PRINTF_ATTRIBUTE(2, 3);
    159 extern int posix_vsprintf(char *restrict s, const char *restrict format, va_list ap);
     166extern int __POSIX_DEF__(vsprintf)(char *restrict s, const char *restrict format, va_list ap);
    160167
    161168/* Formatted Input */
    162 extern int posix_fscanf(
     169extern int __POSIX_DEF__(fscanf)(
    163170    FILE *restrict stream, const char *restrict format, ...);
    164 extern int posix_vfscanf(
     171extern int __POSIX_DEF__(vfscanf)(
    165172    FILE *restrict stream, const char *restrict format, va_list arg);
    166 extern int posix_scanf(const char *restrict format, ...);
    167 extern int posix_vscanf(const char *restrict format, va_list arg);
    168 extern int posix_sscanf(
     173extern int __POSIX_DEF__(scanf)(const char *restrict format, ...);
     174extern int __POSIX_DEF__(vscanf)(const char *restrict format, va_list arg);
     175extern int __POSIX_DEF__(sscanf)(
    169176    const char *restrict s, const char *restrict format, ...);
    170 extern int posix_vsscanf(
     177extern int __POSIX_DEF__(vsscanf)(
    171178    const char *restrict s, const char *restrict format, va_list arg);
    172179
    173180/* File Locking */
    174 extern void posix_flockfile(FILE *file);
    175 extern int posix_ftrylockfile(FILE *file);
    176 extern void posix_funlockfile(FILE *file);
    177 extern int posix_getc_unlocked(FILE *stream);
    178 extern int posix_getchar_unlocked(void);
    179 extern int posix_putc_unlocked(int c, FILE *stream);
    180 extern int posix_putchar_unlocked(int c);
     181extern void __POSIX_DEF__(flockfile)(FILE *file);
     182extern int __POSIX_DEF__(ftrylockfile)(FILE *file);
     183extern void __POSIX_DEF__(funlockfile)(FILE *file);
     184extern int __POSIX_DEF__(getc_unlocked)(FILE *stream);
     185extern int __POSIX_DEF__(getchar_unlocked)(void);
     186extern int __POSIX_DEF__(putc_unlocked)(int c, FILE *stream);
     187extern int __POSIX_DEF__(putchar_unlocked)(int c);
    181188
    182189/* Deleting Files */
    183 extern int posix_remove(const char *path);
     190extern int __POSIX_DEF__(remove)(const char *path);
    184191
    185192/* Renaming Files */
    186 extern int posix_rename(const char *old, const char *new);
     193extern int __POSIX_DEF__(rename)(const char *old, const char *new);
    187194
    188195/* Temporary Files */
    189196#undef L_tmpnam
    190197#define L_tmpnam PATH_MAX
    191 extern char *posix_tmpnam(char *s);
    192 extern char *posix_tempnam(const char *dir, const char *pfx);
    193 extern FILE *posix_tmpfile(void);
    194 
    195 #ifndef LIBPOSIX_INTERNAL
    196         /* DEBUG macro does not belong to POSIX stdio.h. Its unconditional
    197          * definition in the native stdio.h causes unexpected behaviour of
    198          * applications which uses their own DEBUG macro (e.g. debugging
    199          * output is printed even if not desirable). */
    200         #undef DEBUG
    201 
    202         #define ctermid posix_ctermid
    203 
    204         #define clearerr posix_clearerr
    205 
    206         #define fputs posix_fputs
    207         #define ungetc posix_ungetc
    208         #define getdelim posix_getdelim
    209         #define getline posix_getline
    210 
    211         #define freopen posix_freopen
    212 
    213         #define perror posix_perror
    214 
    215         #define fpos_t posix_fpos_t
    216         #define fsetpos posix_fsetpos
    217         #define fgetpos posix_fgetpos
    218         #define fseek posix_fseek
    219         #define fseeko posix_fseeko
    220         #define ftell posix_ftell
    221         #define ftello posix_ftello
    222 
    223         #define fflush posix_fflush
    224 
    225         #define dprintf posix_dprintf
    226         #define vdprintf posix_vdprintf
    227         #define sprintf posix_sprintf
    228         #define vsprintf posix_vsprintf
    229 
    230         #define fscanf posix_fscanf
    231         #define vfscanf posix_vfscanf
    232         #define vscanf posix_vscanf
    233         #define scanf posix_scanf
    234         #define sscanf posix_sscanf
    235         #define vsscanf posix_vsscanf
    236 
    237         #define flockfile posix_flockfile
    238         #define ftrylockfile posix_ftrylockfile
    239         #define funlockfile posix_funlockfile
    240 
    241         #define getc_unlocked posix_getc_unlocked
    242         #define getchar_unlocked posix_getchar_unlocked
    243         #define putc_unlocked posix_putc_unlocked
    244         #define putchar_unlocked posix_putchar_unlocked
    245 
    246         #define remove posix_remove
    247 
    248         #define rename posix_rename
    249 
    250         #define tmpnam posix_tmpnam
    251         #define tempnam posix_tempnam
    252         #define tmpfile posix_tmpfile
    253 #endif
     198extern char *__POSIX_DEF__(tmpnam)(char *s);
     199extern char *__POSIX_DEF__(tempnam)(const char *dir, const char *pfx);
     200extern FILE *__POSIX_DEF__(tmpfile)(void);
     201
    254202
    255203#endif /* POSIX_STDIO_H_ */
Note: See TracChangeset for help on using the changeset viewer.