Stripped down the library to something approaching the ANSI C minimum and replaced most of the header files, to provide a reasonably consistent base to work up from.

This commit is contained in:
dtrg
2007-04-24 19:42:24 +00:00
parent 740940c9fc
commit bfeb736c35
32 changed files with 590 additions and 792 deletions

View File

@@ -6,9 +6,11 @@
*/
/* $Id$ */
#if !defined(_STDIO_H)
#ifndef _STDIO_H
#define _STDIO_H
#include <stddef.h>
/*
* Focus point of all stdio activity.
*/
@@ -33,86 +35,72 @@ typedef struct __iobuf {
#define _IOWRITING 0x100
#define _IOAPPEND 0x200
/* The following definitions are also in <unistd.h>. They should not
* conflict.
*/
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define stdin (&__stdin)
#define stdout (&__stdout)
#define stderr (&__stderr)
#define stdin (&__stdin)
#define stdout (&__stdout)
#define stderr (&__stderr)
#define BUFSIZ 1024
#define NULL ((void *)0)
#define EOF (-1)
#define BUFSIZ 1024
#define EOF (-1)
#define FOPEN_MAX 20
#if defined(__BSD4_2)
#define FILENAME_MAX 255
#else
#define FILENAME_MAX 14
#endif /* __BSD4_2 */
#define TMP_MAX 999
#define L_tmpnam (sizeof("/tmp/") + 15)
#define FILENAME_MAX 255
#define TMP_MAX 999
#define L_tmpnam (sizeof("/tmp/") + 15)
typedef long int fpos_t;
#if !defined(_SIZE_T)
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _SIZE_T */
typedef long int fpos_t;
extern FILE *__iotab[FOPEN_MAX];
extern FILE __stdin, __stdout, __stderr;
int remove(const char *_filename);
int rename(const char *_old, const char *_new);
FILE *tmpfile(void);
char *tmpnam(char *_s);
int fclose(FILE *_stream);
int fflush(FILE *_stream);
FILE *fopen(const char *_filename, const char *_mode);
FILE *freopen(const char *_filename, const char *_mode, FILE *_stream);
void setbuf(FILE *_stream, char *_buf);
int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
int fprintf(FILE *_stream, const char *_format, ...);
int fscanf(FILE *_stream, const char *_format, ...);
int printf(const char *_format, ...);
int scanf(const char *_format, ...);
int sprintf(char *_s, const char *_format, ...);
int sscanf(const char *_s, const char *_format, ...);
int vfprintf(FILE *_stream, const char *_format, char *_arg);
int vprintf(const char *_format, char *_arg);
int vsprintf(char *_s, const char *_format, char *_arg);
int fgetc(FILE *_stream);
char *fgets(char *_s, int _n, FILE *_stream);
int fputc(int _c, FILE *_stream);
int fputs(const char *_s, FILE *_stream);
int getc(FILE *_stream);
int getchar(void);
char *gets(char *_s);
int putc(int _c, FILE *_stream);
int putchar(int _c);
int puts(const char *_s);
int ungetc(int _c, FILE *_stream);
size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
int fgetpos(FILE *_stream, fpos_t *_pos);
int fseek(FILE *_stream, long _offset, int _whence);
int fsetpos(FILE *_stream, fpos_t *_pos);
long ftell(FILE *_stream);
void rewind(FILE *_stream);
void clearerr(FILE *_stream);
int feof(FILE *_stream);
int ferror(FILE *_stream);
void perror(const char *_s);
int __fillbuf(FILE *_stream);
int __flushbuf(int _c, FILE *_stream);
extern int remove(const char *_filename);
extern int rename(const char *_old, const char *_new);
extern FILE *tmpfile(void);
extern char *tmpnam(char *_s);
extern int fclose(FILE *_stream);
extern int fflush(FILE *_stream);
extern FILE *fopen(const char *_filename, const char *_mode);
extern FILE *freopen(const char *_filename, const char *_mode, FILE *_stream);
extern void setbuf(FILE *_stream, char *_buf);
extern int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
extern int fprintf(FILE *_stream, const char *_format, ...);
extern int fscanf(FILE *_stream, const char *_format, ...);
extern int printf(const char *_format, ...);
extern int scanf(const char *_format, ...);
extern int sprintf(char *_s, const char *_format, ...);
extern int sscanf(const char *_s, const char *_format, ...);
extern int vfprintf(FILE *_stream, const char *_format, char *_arg);
extern int vprintf(const char *_format, char *_arg);
extern int vsprintf(char *_s, const char *_format, char *_arg);
extern int fgetc(FILE *_stream);
extern char *fgets(char *_s, int _n, FILE *_stream);
extern int fputc(int _c, FILE *_stream);
extern int fputs(const char *_s, FILE *_stream);
extern int getc(FILE *_stream);
extern int getchar(void);
extern char *gets(char *_s);
extern int putc(int _c, FILE *_stream);
extern int putchar(int _c);
extern int puts(const char *_s);
extern int ungetc(int _c, FILE *_stream);
extern size_t fread(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
extern size_t fwrite(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream);
extern int fgetpos(FILE *_stream, fpos_t *_pos);
extern int fseek(FILE *_stream, long _offset, int _whence);
extern int fsetpos(FILE *_stream, fpos_t *_pos);
extern long ftell(FILE *_stream);
extern void rewind(FILE *_stream);
extern void clearerr(FILE *_stream);
extern int feof(FILE *_stream);
extern int ferror(FILE *_stream);
extern void perror(const char *_s);
extern int __fillbuf(FILE *_stream);
extern int __flushbuf(int _c, FILE *_stream);
#define getchar() getc(stdin)
#define putchar(c) putc(c,stdout)
@@ -126,10 +114,10 @@ int __flushbuf(int _c, FILE *_stream);
#define ferror(p) (((p)->_flags & _IOERR) != 0)
#define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
#if defined(__BSD4_2) || defined(__USG) || defined(_POSIX_SOURCE)
int fileno(FILE *_stream);
FILE *fdopen(int fildes, const char *type);
#define fileno(stream) ((stream)->_fd)
#endif /* __BSD4_2 || __USG || _POSIX_SOURCE */
/* Non-standard extensions */
extern int fileno(FILE *_stream);
extern FILE* fdopen(int fildes, const char *type);
#define fileno(stream) ((stream)->_fd)
#endif /* _STDIO_H */