home *** CD-ROM | disk | FTP | other *** search
- /* sys/open.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
-
- #include <sys/emx.h>
- #include <os2emx.h>
- #include "syscalls.h"
-
- int __open (const char *name, int flags)
- {
- ULONG rc;
- ULONG mode, attr, action, open_mode;
- HFILE handle;
-
- mode = flags & 0x77;
- attr = (flags >> 8) & 0xff;
- if (flags & 0x10000)
- open_mode = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- else
- open_mode = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
- rc = DosOpen (name, &handle, &action, 0, attr, open_mode, mode, NULL);
- if (rc != 0)
- {
- _sys_set_errno (rc);
- return (-1);
- }
- return (handle);
- }
-