home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
clib
/
h
/
stdio
< prev
next >
Wrap
Text File
|
1994-02-26
|
4KB
|
191 lines
/* stdio.h (c) Copyright 1990 H.Rogers */
#ifndef __STDIO_H
#define __STDIO_H
#ifndef __STDARG_H
#include <stdarg.h>
#endif
#ifndef __SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define OPEN_MAX 64
#define FOPEN_MAX 64
#define FILENAME_MAX 252
#define BUFSIZ 4096
#define EOF (-1)
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
typedef struct __iobuf
{
unsigned char *i_ptr;
unsigned char *i_base;
int i_cnt;
unsigned char *o_ptr;
unsigned char *o_base;
int o_cnt;
int flag;
int fd;
fpos_t pos;
int bufsiz;
} __FILE;
#define FILE __FILE
extern FILE __iob[FOPEN_MAX];
#define stdin (&__iob[0])
#define stdout (&__iob[1])
#define stderr (&__iob[2])
#define _IOOMASK 0000003
#define _IOREAD 0000001
#define _IOWRITE 0000002
#define _IOAPPEND 0000004
#define _IOBF 0000070
#define _IONBF 0000010
#define _IOLBF 0000020
#define _IOFBF 0000040
#define _IOEOF 0000100
#define _IOERR 0000200
#define _IOTTY 0000400
#define _IOPIPE 0001000
#define feof(f) ((f)->flag & _IOEOF)
#define ferror(f) ((f)->flag & _IOERR)
#define fileno(f) ((f)->fd)
#define fisatty(f) ((f)->flag & _IOTTY)
#define fispipe(f) ((f)->flag & _IOPIPE)
#define fisopen(f) ((f)->flag & (_IOREAD|_IOWRITE))
#define clearerr(f) (void)((f)->flag &= (~(_IOEOF|_IOERR)))
extern int (feof)(FILE *);
extern int (ferror)(FILE *);
extern int (fileno)(FILE *);
extern int (fisatty)(FILE *);
extern int (fisopen)(FILE *);
extern void (clearerr)(FILE *);
extern void perror(const char *);
extern void __stdioinit(void); /* initialise stdin,stdout & stderr */
extern void __stdioexit(void); /* close streams & delete tmpfile() */
extern int __filbuf(FILE *); /* fill buffer */
extern int __flsbuf(int,FILE *); /* flush buffer */
extern char *__null; /* null pointer output */
extern FILE *fopen(const char *,const char *);
extern FILE *freopen(const char *,const char *,FILE *);
extern FILE *fdopen(int,const char *);
extern int fclose(FILE *);
extern int fflush(FILE *);
extern FILE *popen(const char *,const char *);
extern int pclose(FILE *);
extern int __fread(FILE *,char *,int);
extern int __fwrite(FILE *,char *,int);
extern size_t fread(void *,size_t,size_t,FILE *);
extern size_t fwrite(const void *,size_t,size_t,FILE *);
extern void setbuf(FILE *,char *);
extern int setvbuf(FILE *,char *,int,size_t);
extern int ungetc(int,FILE *);
extern int fgetpos(FILE *,fpos_t *);
extern int fsetpos(FILE *,const fpos_t *);
extern int fseek(FILE *,long,int);
extern long ftell(FILE *);
extern void rewind(FILE *);
#define getc(f) \
((--((f)->i_cnt) >= 0 ? *((f)->i_ptr)++ : __filbuf(f)))
#define getchar() getc(stdin)
extern int fgetc(FILE *);
extern int (getc)(FILE *);
extern int (getchar)(void);
extern int getw(FILE *);
#define putc(c,f) \
(((((f)->flag) & _IOLBF) && (c) == '\n') ? __flsbuf(c,f) : \
((--((f)->o_cnt) > 0 ? (*((f)->o_ptr)++ = (c)) : __flsbuf(c,f))))
#define putchar(c) putc(c,stdout)
extern int fputc(int,FILE *);
extern int (putc)(int,FILE *);
extern int (putchar)(int);
extern int putw(int,FILE *);
extern char *fgets(char *,int,FILE *);
extern char *gets(char *);
extern int fputs(const char *,FILE *);
extern int puts(const char *);
/* formatted I/O */
extern int __printf(char *,const char *,va_list);
extern int __scanf(FILE *,const char *,va_list,int *);
extern char *__pbuf; /* buffer for printf */
extern char *__sbuf; /* buffer for scanf */
extern int vsprintf(char *,const char *,va_list);
extern int vfprintf(FILE *,const char *,va_list);
extern int vprintf(const char *,va_list);
extern int sprintf(char *,const char *,...);
extern int fprintf(FILE *,const char *,...);
extern int printf(const char *,...);
extern int sscanf(const char *,const char *,...);
extern int fscanf(FILE *,const char *,...);
extern int scanf(const char *,...);
#define P_tmpdir "/tmp"
#define L_tmpnam 255
#define TMP_MAX 0x100
extern int remove(const char *);
extern int rename(const char *,const char *);
extern FILE *tmpfile(void);
extern char *tmpnam(char *);
extern char *mktemp(char *);
extern int mkstemp(char *);
extern FILE *__tmpf;
extern char __tmpn[L_tmpnam + 1];
extern unsigned int __tmpcnt;
#define __STDIOLIB__ static void __stdiolib(void) { __stdioinit(); }
#ifdef __cplusplus
}
#endif
#endif