Pristine Ack-5.5
[Ack-5.5.git] / modules / src / system / create.c
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: create.c,v 1.3 1994/06/24 11:24:21 ceriel Exp $ */
6
7 #include <system.h>
8
9 extern File *_get_entry();
10
11 int
12 sys_create(filep, path, mode)
13         File **filep;
14         char *path;
15         int mode;
16 {
17         register fd;
18         register File *fp;
19
20         if ((fp = _get_entry()) == (File *)0)
21                 return 0;
22         if ((fd = creat(path, mode)) < 0)
23                 return 0;
24         fp->o_fd = fd;
25         fp->o_flags = OP_WRITE;
26         *filep = fp;
27         return 1;
28 }