system.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* RCS: $Id$ */
  6. #ifndef __SYSTEM_INCLUDED__
  7. #define __SYSTEM_INCLUDED__
  8. #include <ansi.h>
  9. #include <stdio.h>
  10. #include <sys/types.h>
  11. #include <sys/stat.h>
  12. #include <fcntl.h>
  13. #include <unistd.h>
  14. #include <missing_proto.h>
  15. struct _sys_fildes {
  16. int o_fd; /* UNIX filedescriptor */
  17. int o_flags; /* flags for open; 0 if not used */
  18. };
  19. typedef struct _sys_fildes File;
  20. extern File _sys_ftab[];
  21. /* flags for sys_open() */
  22. #define OP_READ 01
  23. #define OP_WRITE 02
  24. #define OP_APPEND 04
  25. /* flags for sys_access() */
  26. #define AC_EXIST 00
  27. #define AC_READ 04
  28. #define AC_WRITE 02
  29. #define AC_EXEC 01
  30. /* flags for sys_stop() */
  31. #define S_END 0
  32. #define S_EXIT 1
  33. #define S_ABORT 2
  34. _PROTOTYPE(int sys_open, (char *, int, File **));
  35. _PROTOTYPE(void sys_close, (File *));
  36. _PROTOTYPE(int sys_read, (File *, char *, int, int *));
  37. _PROTOTYPE(int sys_write, (File *, char *, int));
  38. _PROTOTYPE(int sys_seek, (File *, long, int, long *));
  39. _PROTOTYPE(int sys_reset, (File *));
  40. _PROTOTYPE(int sys_access, (char *, int));
  41. _PROTOTYPE(int sys_remove, (char *));
  42. _PROTOTYPE(int sys_rename, (char *, char *));
  43. _PROTOTYPE(long sys_filesize, (char *));
  44. _PROTOTYPE(int sys_chmode, (char *, int));
  45. #if 0
  46. _PROTOTYPE(int sys_lock, (char *));
  47. _PROTOTYPE(int sys_unlock, (char *));
  48. #endif
  49. _PROTOTYPE(char *sys_break, (int));
  50. _PROTOTYPE(void sys_stop, (int));
  51. _PROTOTYPE(long sys_time, (void));
  52. _PROTOTYPE(long sys_modtime, (char *));
  53. /* standard file decsriptors */
  54. #define STDIN &_sys_ftab[0]
  55. #define STDOUT &_sys_ftab[1]
  56. #define STDERR &_sys_ftab[2]
  57. /* maximum number of open files */
  58. #define SYS_NOPEN 20
  59. /* return value for sys_break */
  60. #define ILL_BREAK ((char *)0)
  61. #endif /* __SYSTEM_INCLUDED__ */