home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2001 January
/
VPR0101A.BIN
/
OLS
/
TAR32053
/
tar32053.exe
/
SRC
/
IOCTRL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1999-05-23
|
2KB
|
83 lines
/* ioctrl.h */
/* change standard output to DLL argument variable*/
#ifndef __IOCTRL_H
#define __IOCTRL_H
#ifdef DLL
#include "defconf.h"
#include <stdio.h>
#include <stdarg.h>
#include <io.h>
/* store original functions */
__inline int orig_printf(const char *format,...){
int ret;
va_list arg;
va_start(arg,format);
ret=vprintf(format,arg);
va_end(arg);
return ret;
}
__inline int orig_fprintf(FILE *fp,const char *format,...){
int ret;
va_list arg;
va_start(arg,format);
ret=vfprintf(fp,format,arg);
va_end(arg);
return ret;
}
__inline int orig_puts(const char *string){return puts(string);}
__inline int orig_fputs(const char *string,FILE *fp){return fputs(string,fp);}
__inline int orig_putchar(int c){return putchar(c);}
__inline int orig_putc(int c,FILE *fp){return putc(c,fp);}
__inline void orig_perror( const char *string ){perror(string);}
__inline size_t orig_fwrite( const void*buffer, size_t size, size_t count, FILE *stream ){return fwrite(buffer,size,count,stream);}
__inline int orig_write( int handle, const void *buffer, unsigned int count ){return write(handle,buffer,count);}
/* replace standard functions to ioctrl_ fucntsions */
#define printf ioctrl_printf
#define fprintf ioctrl_fprintf
#define puts ioctrl_puts
#define fputs ioctrl_fputs
#define perror ioctrl_perror
#define fwrite ioctrl_fwrite
#ifdef write
#undef write
#endif
#define write ioctrl_write
#ifdef putchar
#undef putchar
#endif
#ifdef putc
#undef putc
#endif
#define putchar ioctrl_putchar
#define putc ioctrl_putc
int ioctrl_printf(const char *format,...);
int ioctrl_fprintf(FILE *fp,const char *format,...);
int ioctrl_puts(const char *string);
int ioctrl_fputs(const char *string,FILE *fp);
int ioctrl_putchar(int c);
int ioctrl_putc(int c,FILE *fp);
void ioctrl_perror( const char *string );
size_t ioctrl_fwrite( const void*buffer, size_t size, size_t count, FILE *stream );
int ioctrl_write( int handle, const void *buffer, unsigned int count );
void ioctrl_output_init_test(void);
void ioctrl_output_init(char *buf,int buflen);
void ioctrl_output_end(void);
#endif DLL
#endif /* __IOCTRL_H */