home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff314.lha / zc / zc.lzh / include / stdio.h < prev    next >
C/C++ Source or Header  |  1989-06-15  |  3KB  |  110 lines

  1. /*
  2.  *
  3.  *    STDIO.H        Standard i/o include file
  4.  *
  5.  */
  6.  
  7. #ifndef STDIO_H
  8. #define    STDIO_H
  9.  
  10. #include <stddef.h>
  11.  
  12. /*
  13.  *    CONSTANTS:
  14.  */
  15.  
  16. #define    _NFILE        (20)        /* maximum number of open streams */
  17. #define    OPEN_MAX    _NFILE        /* ANSI equivalent (replaces _NFILE) */
  18. #define    FILENAME_MAX    (128)        /* maximum filename size */
  19. #define    BUFSIZ        (1024)        /* default buffer size */
  20. #define    EOF        (-1)        /* end-of-file indicator */
  21. #define    EOS        '\0'        /* end-of-string indicator */
  22.  
  23. #define    EXIT_FAILURE    (-1)        /* failure return value for exit() */
  24. #define    EXIT_SUCCESS    (0)        /* success return value for exit() */
  25.  
  26. #define    RAND_MAX    (0x7FFF)    /* maximum value from rand() */
  27.  
  28. #ifndef ERROR
  29. #define    ERROR        (-1)        /* general error condition */
  30. #endif
  31.  
  32. /* lseek() origins */
  33. #define    SEEK_SET    0        /* from beginning of file */
  34. #define    SEEK_CUR    1        /* from current location */
  35. #define    SEEK_END    2        /* from end of file */
  36.  
  37. /* cfg_ch() control flags */
  38. #define    _CIOB        0x01        /* use bios rather than gemdos */
  39. #define    _CIOCH        0x02        /* return only 8-bit values */
  40. #define    _CIOVT        0x04        /* process vt52 escape codes */
  41.  
  42. /* FILE structure flags */
  43. #define    _IOREAD        0x0001        /* file may be read from */
  44. #define    _IOWRT        0x0002        /* file may be written to */
  45. #define    _IOBIN        0x0004        /* file is in "binary" mode */
  46. #define    _IODEV        0x0008        /* file is a character device */
  47. #define    _IORW        0x0080        /* last i/o was 0:read/1:write */
  48. #define    _IOFBF        0x0100        /* i/o is fully buffered */
  49. #define    _IOLBF        0x0100        /* i/o is line buffered */
  50. #define    _IONBF        0x0400        /* i/o is not buffered */
  51. #define    _IOMYBUF    0x0800        /* standard buffer */
  52. #define    _IOEOF        0x1000        /* EOF has been reached */
  53. #define    _IOERR        0x4000        /* an error has occured */
  54.  
  55. typedef    struct            /* FILE structure */
  56.     {
  57.     int        _cnt;        /* # of bytes in buffer */
  58.     unsigned char    *_ptr;        /* current buffer pointer */
  59.     unsigned char    *_base;        /* base of file buffer */
  60.     unsigned int    _flag;        /* file status flags */
  61.     int        _file;        /* file handle */
  62.     int        _bsiz;        /* buffer size */
  63.     unsigned char    _ch;        /* tiny buffer, for "unbuffered" i/o */
  64.     }
  65.     FILE;
  66.  
  67. #define    L_tmpnam    128
  68. #define    TMP_MAX        1000
  69.  
  70. extern    char    *etext;
  71. extern    char    *edata;
  72. extern    char    *end;
  73.  
  74. extern    void    _exit();
  75.  
  76. extern    FILE    _iob[];
  77. extern    FILE    *fopen(), *fdopen(), *freopen(), *fopenp();
  78. extern    long    ftell(), fsize();
  79. extern    void    rewind(), setbuf(), setvbuf();
  80. extern    char    *fgets(), *gets();
  81.  
  82. /* standard streams */
  83. #define stdin    (&_iob[0])
  84. #define stdout    (&_iob[1])
  85. #define stderr    (&_iob[2])
  86.  
  87. /* stream macros */
  88. #define clearerr(fp)    ((void) ((fp)->_flag &= ~(_IOERR|_IOEOF)))
  89. #define feof(fp)    ((fp)->_flag & _IOEOF)
  90. #define ferror(fp)    ((fp)->_flag & _IOERR)
  91. #define fileno(fp)    ((fp)->_file)
  92.  
  93. /* compatibility macros */
  94. #define    sync()            /* sync() not possible, no operation */
  95.  
  96. /* aliases */
  97. #define    getc            fgetc
  98. #define    ungetc            fungetc
  99. #define    putc            fputc
  100. #define    getchar()        fgetc(stdin)
  101. #define    ungetchar(c)        fungetc((c),stdin)
  102. #define    putchar(c)        fputc((c),stdout)
  103. #define    fexists            exists
  104. #define    exists(f)        access(f,0x00)
  105. #define    unlink            remove
  106. #define    forkv(prog,args)    forkve(prog,args,NULL)
  107. #define    forkvp(prog,args)    forkvpe(prog,args,NULL)
  108.  
  109. #endif STDIO_H
  110.