summaryrefslogtreecommitdiffstats
path: root/contrib/opie/libopie/open.c
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-03-21 22:50:02 +0000
committermarkm <markm@FreeBSD.org>2002-03-21 22:50:02 +0000
commitda481742fe10db46be0a0f92255f012bcfa3a0a9 (patch)
tree5c9f598749274986230a9eaa1de3c9dd00eb09b3 /contrib/opie/libopie/open.c
parent3b73ce2319e249cf2795cf4b0d0c624134f01e77 (diff)
parent4cdfa7814cda254acabe1040a2b2d0c4f5bc4295 (diff)
downloadFreeBSD-src-da481742fe10db46be0a0f92255f012bcfa3a0a9.zip
FreeBSD-src-da481742fe10db46be0a0f92255f012bcfa3a0a9.tar.gz
This commit was generated by cvs2svn to compensate for changes in r92906,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/opie/libopie/open.c')
-rw-r--r--contrib/opie/libopie/open.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/contrib/opie/libopie/open.c b/contrib/opie/libopie/open.c
index dac03a8..c0c76c2 100644
--- a/contrib/opie/libopie/open.c
+++ b/contrib/opie/libopie/open.c
@@ -1,13 +1,15 @@
/* open.c: The __opieopen() library function.
%%% copyright-cmetz-96
-This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
-The Inner Net License Version 2 applies to this software.
+This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
+The Inner Net License Version 3 applies to this software.
You should have received a copy of the license with this software. If
you didn't get a copy, you may request one from <license@inner.net>.
History:
+ Modified by cmetz for OPIE 2.4. More portable way to get the mode
+ string for fopen.
Created by cmetz for OPIE 2.3.
*/
#include "opie_cfg.h"
@@ -51,9 +53,23 @@ FILE *__opieopen FUNCTION((file, rw, mode), char *file AND int rw AND int mode)
return NULL;
{
- char *fmodes[] = { "r", "r+", "a" };
-
- if (!(f = fopen(file, fmodes[rw])))
+ char *fmode;
+
+ switch(rw) {
+ case 0:
+ fmode = "r";
+ break;
+ case 1:
+ fmode = "r+";
+ break;
+ case 2:
+ fmode = "a";
+ break;
+ default:
+ return NULL;
+ };
+
+ if (!(f = fopen(file, fmode)))
return NULL;
}
OpenPOWER on IntegriCloud