5 * Revision 1.4 1997/09/02 14:26:53 mclareni
8 * Revision 1.3 1997/02/04 17:35:18 mclareni
9 * Merge Winnt and 97a versions
11 * Revision 1.2 1997/01/15 16:25:45 cernlib
12 * fix from F.Hemmer to return rfio return code
14 * Revision 1.1.1.1.2.1 1997/01/21 11:30:17 mclareni
15 * All mods for Winnt 96a on winnt branch
17 * Revision 1.1.1.1 1996/02/15 17:49:39 mclareni
21 #include "kerngen/pilot.h"
22 #include "kerngen/fortranc.h"
24 #if defined(CERNLIB_QMOS9)
25 #include "os9gs/ciopei.c"
28 CERN PROGLIB# Z311 CIOPEI .VERSION KERNFOR 4.39 940228
30 CALL CIOPEN (LUNDES, MODE, TEXT, ISTAT)
32 *LUNDES file descriptor
33 MODE string selecting IO mode
34 = 'r ', 'w ', 'a ', 'r+ ', ...
36 *ISTAT status, =zero if success
38 #include "kerngen/cf_open.h"
44 #include "kerngen/cf_xaft.h"
45 #include "kerngen/fortchar.h"
47 #if defined(CERNLIB_QX_SC)
48 void type_of_call ciopei_(lundes,mode,ftext,stat,lgtx)
50 #if defined(CERNLIB_QXNO_SC)
51 void type_of_call ciopei(lundes,mode,ftext,stat,lgtx)
53 #if defined(CERNLIB_QXCAPT)
54 # ifdef CERNLIB_MSSTDCALL
55 void type_of_call CIOPEI(lundes,mode,ftext,lftext,stat,lgtx)
58 void type_of_call CIOPEI(lundes,mode,ftext,stat,lgtx)
61 #if defined(CERNLIB_QMCRY)
64 #if !defined(CERNLIB_QMCRY)
67 int *lundes, *stat, *lgtx;
70 char *pttext, *fchtak();
94 else if (mode[0] == 1)
96 flags = O_WRONLY | O_CREAT | O_TRUNC;
98 flags = O_RDWR | O_CREAT | O_TRUNC;}
100 else if (mode[0] == 2)
102 flags = O_WRONLY | O_CREAT | O_APPEND;
104 flags = O_RDWR | O_CREAT | O_APPEND;}
108 pttext = fchtak(ftext,*lgtx);
109 if (pttext == 0) return;
111 if (perm == 0) perm = 0644;
113 #if defined(CERNLIB_QMDOS) || defined(CERNLIB_WINNT)
114 fildes = open (pttext, flags | O_BINARY, perm);
116 fildes = open (pttext, flags, perm);
118 if (fildes < 0) goto errm;
123 #if defined(CERNLIB_PROJSHIFT)
124 errm: *stat = (serrno ? serrno : (rfio_errno ? rfio_errno : errno));
128 /* perror (" error in CIOPEN"); */
133 /*> END <----------------------------------------------------------*/