ReactOS 0.4.15-dev-7953-g1f49173
cvmod.c
Go to the documentation of this file.
1/* @(#)cvmod.c 2.9 04/08/08 Copyright 1986, 1995-2003 J. Schilling */
2/*
3 * Copyright (c) 1986, 1995-2003 J. Schilling
4 */
5/*
6 * The contents of this file are subject to the terms of the
7 * Common Development and Distribution License, Version 1.0 only
8 * (the "License"). You may not use this file except in compliance
9 * with the License.
10 *
11 * See the file CDDL.Schily.txt in this distribution for details.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file CDDL.Schily.txt from this distribution.
15 */
16
17#include "schilyio.h"
18
19#ifndef O_BINARY
20#define O_BINARY 0
21#endif
22#ifndef O_LARGEFILE
23#define O_LARGEFILE 0
24#endif
25
26EXPORT int
28 const char *mode;
29 int *omode;
30 int *flag;
31{
32 while (*mode) {
33 switch (*mode) {
34
35 case 'r': *omode |= O_RDONLY; *flag |= FI_READ; break;
36 case 'w': *omode |= O_WRONLY; *flag |= FI_WRITE; break;
37 case 'e': *omode |= O_EXCL; break;
38 case 'c': *omode |= O_CREAT; *flag |= FI_CREATE; break;
39 case 't': *omode |= O_TRUNC; *flag |= FI_TRUNC; break;
40 case 'a': *omode |= O_APPEND; *flag |= FI_APPEND; break;
41 case 'u': *flag |= FI_UNBUF; break;
42 /* dummy on UNIX */
43 case 'b': *omode |= O_BINARY; *flag |= FI_BINARY; break;
44 /*
45 * XXX do we need this ?
46 * XXX May this be a problem?
47 */
48 case 'l': *omode |= O_LARGEFILE; break;
49 default: raisecond(_badmode, 0L);
50 return (0);
51 }
52 mode++;
53 }
54 if (*flag & FI_READ && *flag & FI_WRITE) {
55 *omode &= ~(O_RDONLY|O_WRONLY);
56 *omode |= O_RDWR;
57 }
58 return (1);
59}
#define O_WRONLY
Definition: acwin.h:111
#define O_CREAT
Definition: acwin.h:110
#define O_RDONLY
Definition: acwin.h:108
#define O_TRUNC
Definition: acwin.h:112
#define O_LARGEFILE
Definition: cvmod.c:23
#define O_BINARY
Definition: cvmod.c:20
EXPORT int _cvmod(char *mode, int *omode, int *flag) const
Definition: cvmod.c:27
char _badmode[]
Definition: dat.c:18
GLenum mode
Definition: glext.h:6217
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
#define O_EXCL
Definition: fcntl.h:40
#define O_RDWR
Definition: fcntl.h:36
#define O_APPEND
Definition: fcntl.h:37
#define L(x)
Definition: ntvdm.h:50
EXPORT void raisecond(char *signame, long arg2) const
Definition: raisecond.c:100
#define FI_BINARY
Definition: schilyio.h:87
#define FI_APPEND
Definition: schilyio.h:88
#define FI_TRUNC
Definition: schilyio.h:91
#define FI_READ
Definition: schilyio.h:85
#define FI_UNBUF
Definition: schilyio.h:92
#define FI_WRITE
Definition: schilyio.h:86
#define FI_CREATE
Definition: schilyio.h:90