home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 January / VPR0101A.BIN / OLS / TAR32053 / tar32053.exe / SRC / IOCTRL.H < prev    next >
C/C++ Source or Header  |  1999-05-23  |  2KB  |  83 lines

  1. /* ioctrl.h */
  2. /* change standard output to DLL argument variable*/
  3.  
  4. #ifndef __IOCTRL_H
  5. #define __IOCTRL_H
  6. #ifdef DLL
  7.  
  8. #include "defconf.h"
  9. #include <stdio.h>
  10. #include <stdarg.h>
  11. #include <io.h>
  12.  
  13. /* store original functions */
  14. __inline int orig_printf(const char *format,...){
  15.     int ret;
  16.     va_list arg;
  17.  
  18.     va_start(arg,format);
  19.     ret=vprintf(format,arg);
  20.     va_end(arg);
  21.     return ret;
  22. }
  23. __inline int orig_fprintf(FILE *fp,const char *format,...){
  24.     int ret;
  25.     va_list arg;
  26.  
  27.     va_start(arg,format);
  28.     ret=vfprintf(fp,format,arg);
  29.     va_end(arg);
  30.     return ret;
  31. }
  32. __inline int orig_puts(const char *string){return puts(string);}
  33. __inline int orig_fputs(const char *string,FILE *fp){return fputs(string,fp);}
  34. __inline int orig_putchar(int c){return putchar(c);}
  35. __inline int orig_putc(int c,FILE *fp){return putc(c,fp);}
  36. __inline void orig_perror( const char *string ){perror(string);}
  37. __inline size_t orig_fwrite( const void*buffer, size_t size, size_t count, FILE *stream ){return fwrite(buffer,size,count,stream);}
  38. __inline int orig_write( int handle, const void *buffer, unsigned int count ){return write(handle,buffer,count);}
  39.   
  40.  
  41.  
  42.  
  43. /* replace standard functions to ioctrl_ fucntsions */
  44. #define printf ioctrl_printf
  45. #define fprintf ioctrl_fprintf
  46. #define puts ioctrl_puts
  47. #define fputs ioctrl_fputs
  48. #define perror ioctrl_perror
  49. #define fwrite ioctrl_fwrite
  50. #ifdef write
  51. #undef write
  52. #endif
  53. #define write ioctrl_write
  54.  
  55. #ifdef putchar
  56. #undef putchar
  57. #endif
  58. #ifdef putc
  59. #undef putc
  60. #endif
  61. #define putchar ioctrl_putchar
  62. #define putc ioctrl_putc
  63.  
  64. int ioctrl_printf(const char *format,...);
  65. int ioctrl_fprintf(FILE *fp,const char *format,...);
  66. int ioctrl_puts(const char *string);
  67. int ioctrl_fputs(const char *string,FILE *fp);
  68. int ioctrl_putchar(int c);
  69. int ioctrl_putc(int c,FILE *fp);
  70. void ioctrl_perror( const char *string );
  71. size_t ioctrl_fwrite( const void*buffer, size_t size, size_t count, FILE *stream );
  72. int ioctrl_write( int handle, const void *buffer, unsigned int count );
  73.  
  74. void ioctrl_output_init_test(void);
  75. void ioctrl_output_init(char *buf,int buflen);
  76. void ioctrl_output_end(void);
  77.  
  78.  
  79. #endif DLL
  80. #endif /* __IOCTRL_H */
  81.  
  82.  
  83.