home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1999 February / MACPOWER-1999-02.ISO.7z / MACPOWER-1999-02.ISO / 9902⁄AMUG / UTILITY / mac06-0.95.sit / mac06-0.95 / usr / include / stdio.h < prev    next >
Text File  |  1998-11-04  |  3KB  |  106 lines

  1. /* mac06ゥ1997,98 by HNS/DSITRI hns@computer.org
  2. ** stdio.h
  3. **
  4. ** 02.01.1998    HNS        rename(), remove(), gets() corrected
  5. */
  6.  
  7. #pragma once
  8.  
  9. #include "stdarg.h"
  10. #include "limits.h"
  11. #include "size_t.h"
  12.  
  13. #define BUFSIZ            (1024)
  14. #define EOF             (-1)
  15. #define FILENAME_MAX    (256)
  16. #define FOPEN_MAX        (OPEN_MAX)
  17. #ifndef NULL
  18. #define NULL             (0)
  19. #endif
  20. #ifndef SEEK_SET
  21. #define SEEK_CUR        (1)
  22. #define SEEK_END        (2)
  23. #define SEEK_SET        (0)
  24. #endif
  25. #define TMP_MAX            26
  26. #define L_tmpnam        32
  27.  
  28. typedef unsigned long fpos_t;
  29.  
  30. typedef struct
  31.     {
  32.     int fd;
  33.     unsigned char *bfr;    /* base address */
  34.     unsigned char *ptr;    /* read/write pointer */
  35.     unsigned char *fill;    /* fill for read */
  36.     unsigned char *end;    /* max size for write */
  37. #define _IORD            0x01
  38. #define _IOWR            0x02
  39. #define _IOEOF            0x04
  40. #define _IOERR            0x08
  41. #define _IOFBF            0x10
  42. #define _IOLBF            0x20
  43. #define _IONBF            0x40
  44. #define _IOTTY            0x80
  45.     int flags;
  46.     int pid;                /* for popen */
  47.     } FILE;
  48.     
  49. extern FILE *stdin;
  50. extern FILE *stdout;
  51. extern FILE *stderr;
  52.  
  53. #define clearerr(fp) ((fp)->flags&=~_IOERR)
  54. int fclose(FILE *fp);
  55. #define feof(fp) ((fp)->flags&_IOEOF)
  56. #define ferror(fp) ((fp)->flags&_IOERR)
  57. int _fflush(FILE *fp, int c);
  58. #define fflush(fp) _fflush((fp), 0)
  59. int fgetc(FILE *f);
  60. #define fgetpos(f, pos) ((*(pos)=ftell(f)) != -1l)
  61. char *fgets(char *s, int n, FILE *fp);
  62. #define fopen(N, M) (freopen((N), (M), NULL))
  63. int fprintf(FILE *f, char *format, ...);
  64. int fputc(int c, FILE *f);
  65. #define fputs(s, fp) (fwrite((s), 1, strlen(s), (fp)))
  66. size_t fread(void *buf, size_t size, size_t nitems, FILE *fp);
  67. FILE *freopen(char *name, char *mode, FILE *fp);
  68. int fscanf(FILE *f, char *format, ...);
  69. int fseek(FILE *fp, long off, int w);
  70. #define fsetpos(f, pos) fseek((f), *(pos), SEEK_SET)
  71. long int ftell(FILE *fp);
  72. size_t fwrite(void *buf, size_t size, size_t nitems, FILE *fp);
  73. int _ffill(FILE *);
  74. #define getc(fp) ((fp)->ptr < (fp)->fill?*(fp)->ptr++:_ffill(fp))
  75. #define getchar() getc(stdin)
  76. char *gets(char *s);
  77. void perror(char const *s);
  78. int pclose(FILE *f);
  79. FILE *popen(const char *cmd, const char *mod);
  80. int printf(char *format, ...);
  81. #define putc(C, fp) (*(fp)->ptr++=(C), (((fp)->ptr >= (fp)->end) || (((fp)->flags&_IOTTY) != 0 && (C) == '¥n'))?_fflush(fp, (C)):(C))
  82. #define putchar(C) (putc(C, stdout))
  83. #define puts(s) (fputs((s), stdout), putchar('¥n'))
  84. int remove(char *name);
  85. int rename(char *from, char *to);
  86. #define rewind(fp) (fseek((fp), 0l, SEEK_SET))
  87. int scanf(char *format, ...);
  88. #define setbuf(fp, buf) setvbuf((fp), (buf), _IOFBF, BUFSIZE)
  89. #define setvbuf(fp, buf, mode, size) /* ignore */
  90. int sprintf(char *buf, char *format, ...);
  91. int sscanf(char *buf, char *format, ...);
  92. FILE *tmpfile(void);
  93. char *tmpnam(char *s);
  94. #define ungetc(c, fp) if((fp)->ptr == (fp)->bfr) *(fp)->ptr=(c), (fp)->fill=(fp)->bfr+1; else *--(fp)->ptr=(c)
  95. int vprintf(char *format, va_list arg);
  96. int vfprintf(FILE *f, char *format, va_list arg);
  97. int vsprintf(char *buf, char *format, va_list arg);
  98.  
  99. #define fileno(fp) ((fp)->fd)
  100. #define fdopen(FD, M) (fdreopen((FD), (M), NULL))
  101.  
  102. #ifndef _POSIX_SOURCE
  103. FILE *fdreopen(int fd, const char *mode, FILE *fp);
  104. #endif
  105.  
  106. /* EOF */