home *** CD-ROM | disk | FTP | other *** search
/ ftp.uni-stuttgart.de/pub/systems/acorn/ / Acorn.tar / Acorn / acornet / dev / c / debug / mnemosyn.spk / !Mnemosyne / sys / H / File < prev    next >
Text File  |  1991-04-24  |  2KB  |  53 lines

  1. #ifndef _H_FILE
  2. #include <stdio.h> /* For FILE * */
  3. #define _H_FILE 1
  4.  
  5. #define O_RAW 1
  6. #define O_BINARY 1
  7. #define O_NEW 2
  8. #define O_CREAT 4
  9. #define O_RDWR 8
  10. #define O_RDONLY 16
  11. #define O_TRUNC 32
  12. #define O_EXCL 64
  13.  
  14. /* Maybe these S_*'s should be in sys/stat.h */
  15. #define S_IRDWR 0
  16. #define S_IFCHR 1 /* For f2c */
  17.  
  18. /*
  19.  *    Warning!!! this module by GToal isn't up to the
  20.  *    standard of Paul's library -- I've just put in 
  21.  *    enough of each procedure to get the particular
  22.  *    program I've been hacking to work.
  23.  *       Notably, the fileno/casts to FILE * in file.c
  24.  *    should understand that 0 == stdin, 1 == stdout,
  25.  *    and 2 == stderr.
  26.  *       Also, there are places where we need to turn
  27.  *    an opened fd back into a filename -- this is
  28.  *    difficult, unless we remember each filename when
  29.  *    the file is open()ed or creat()ed. (And of course
  30.  *    we'd discard this info when it is close()ed)
  31.  *       Fortunately, the programs I've hacked which
  32.  *    need this feature always call one of the relevant
  33.  *    routines immediately after the open, so I've 
  34.  *    bodged it by just remembering the last filename
  35.  *    (and it's fd, to be sure we've found the right one)
  36.  *       If you extend this code, please post me back
  37.  *    your improvements.  <gtoal@ed.ac.uk>
  38.  */
  39.  
  40. extern int chmod(char *f, int mode);
  41. extern int chown(char *f, int owner, int group);
  42. extern int creat(char *f, int mode);
  43. extern int unlink(char *f);
  44. extern long lseek(int fd, long where, int whence);
  45. extern int write(int fd, char *buf, unsigned int bytes);
  46. extern int read(int fd, char *buf, int bytes);
  47. extern int open(char *fname, int mode, ...);
  48. extern int fdopen(int fd, char *mode);
  49. extern int close(int fd);
  50. extern int fileno(FILE *f);
  51.  
  52. #endif /* _H_FILE */
  53.