1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
* Internal libjar routines.
12
/*-----------------------------------------------------------------------
13
* JAR_FOPEN_to_PR_Open
14
* Translate JAR_FOPEN arguments to PR_Open arguments
17
JAR_FOPEN_to_PR_Open(const char* name, const char *mode)
20
PRIntn prflags=0, prmode=0;
22
/* Get read/write flags */
23
if (strchr(mode, 'r') && !strchr(mode, '+')) {
25
} else if( (strchr(mode, 'w') || strchr(mode, 'a')) &&
32
/* Create a new file? */
33
if (strchr(mode, 'w') || strchr(mode, 'a')) {
34
prflags |= PR_CREATE_FILE;
38
if (strchr(mode, 'a')) {
43
if (strchr(mode, 'w')) {
44
prflags |= PR_TRUNCATE;
47
/* We can't do umask because it isn't XP. Choose some default
48
mode for created files */
51
return PR_Open(name, prflags, prmode);