create.c 479 B

123456789101112131415161718192021222324
  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. /* $Id$ */
  6. #include "system.h"
  7. extern File *_get_entry();
  8. int sys_create(File **filep, char *path, int mode)
  9. {
  10. register fd;
  11. register File *fp;
  12. if ((fp = _get_entry()) == (File *)0)
  13. return 0;
  14. if ((fd = creat(path, mode)) < 0)
  15. return 0;
  16. fp->o_fd = fd;
  17. fp->o_flags = OP_WRITE;
  18. *filep = fp;
  19. return 1;
  20. }