have local stdio.h file to avoid newlib issues

... we should move to -nostdinc at some point :/
This commit is contained in:
Harald Welte 2017-02-28 01:25:12 +01:00
parent adba0ce80b
commit c430ac1f2a
3 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,32 @@
#pragma once
#include <stddef.h>
#include <stdarg.h>
#ifndef EOF
#define EOF (-1)
#endif
struct File;
typedef struct File FILE;
extern FILE* const stdin;
extern FILE* const stdout;
extern FILE* const stderr;
signed int vsnprintf(char *pStr, size_t length, const char *pFormat, va_list ap);
signed int snprintf(char *pString, size_t length, const char *pFormat, ...);
signed int vsprintf(char *pString, const char *pFormat, va_list ap);
signed int vfprintf(FILE *pStream, const char *pFormat, va_list ap);
signed int vprintf(const char *pFormat, va_list ap);
signed int fprintf(FILE *pStream, const char *pFormat, ...);
signed int printf(const char *pFormat, ...);
signed int sprintf(char *pStr, const char *pFormat, ...);
signed int puts(const char *pStr);
int fputc(int c, FILE *stream);
int fputs(const char *s, FILE *stream);
#define putc(c, stream) fputc(c, stream)
#define putchar(c) fputc(c, stdout)

View File

@ -19,6 +19,7 @@
//#define TRACE_LEVEL 6
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <string.h>

View File

@ -59,10 +59,11 @@
//------------------------------------------------------------------------------
// Global Variables
//------------------------------------------------------------------------------
//
FILE* const stdin = NULL;
FILE* const stdout = NULL;
FILE* const stderr = NULL;
// Required for proper compilation.
struct _reent r = {0, (FILE *) 0, (FILE *) 1, (FILE *) 0};
struct _reent *_impure_ptr = &r;
//------------------------------------------------------------------------------
// Local Functions