45
if we are not creating, then we need to use my_access to make sure
46
the file exists since Windows doesn't handle files like "com1.sym"
45
if we are not creating, then we need to use my_access to make sure
46
the file exists since Windows doesn't handle files like "com1.sym"
50
50
make_ftype(type,flags);
51
51
fd = fopen(filename, type);
124
124
flag Flag used by open()
127
This routine attempts to find the best possible match
128
between a numeric option and a string option that could be
129
fed to fopen. There is not a 1 to 1 mapping between the two.
127
This routine attempts to find the best possible match
128
between a numeric option and a string option that could be
129
fed to fopen. There is not a 1 to 1 mapping between the two.
132
132
On Unix, O_RDONLY is usually 0
136
w == O_WRONLY|O_TRUNC|O_CREAT
137
a == O_WRONLY|O_APPEND|O_CREAT
139
w+ == O_RDWR|O_TRUNC|O_CREAT
136
w == O_WRONLY|O_TRUNC|O_CREAT
137
a == O_WRONLY|O_APPEND|O_CREAT
139
w+ == O_RDWR|O_TRUNC|O_CREAT
140
140
a+ == O_RDWR|O_APPEND|O_CREAT
143
143
static void make_ftype(register char * to, register int flag)
145
/* check some possible invalid combinations */
145
/* check some possible invalid combinations */
146
146
assert((flag & (O_TRUNC | O_APPEND)) != (O_TRUNC | O_APPEND));
147
147
assert((flag & (O_WRONLY | O_RDWR)) != (O_WRONLY | O_RDWR));
149
if ((flag & (O_RDONLY|O_WRONLY)) == O_WRONLY)
150
*to++= (flag & O_APPEND) ? 'a' : 'w';
151
else if (flag & O_RDWR)
149
if ((flag & (O_RDONLY|O_WRONLY)) == O_WRONLY)
150
*to++= (flag & O_APPEND) ? 'a' : 'w';
151
else if (flag & O_RDWR)
153
/* Add '+' after theese */
154
if (flag & (O_TRUNC | O_CREAT))
156
else if (flag & O_APPEND)
153
/* Add '+' after theese */
154
if (flag & (O_TRUNC | O_CREAT))
156
else if (flag & O_APPEND)