create.c 501 B

12345678910111213141516171819202122232425262728
  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
  9. sys_create(filep, path, mode)
  10. File **filep;
  11. char *path;
  12. int mode;
  13. {
  14. register fd;
  15. register File *fp;
  16. if ((fp = _get_entry()) == (File *)0)
  17. return 0;
  18. if ((fd = creat(path, mode)) < 0)
  19. return 0;
  20. fp->o_fd = fd;
  21. fp->o_flags = OP_WRITE;
  22. *filep = fp;
  23. return 1;
  24. }