1: copen (filename, type)
2: char *filename;
3: int type;
4: {
5: int fn;
6: switch (type)
7: {
8: case 'r': type = 0;
9: case 0: fn = open(filename,0);
10: break;
11: case 'a': type = 2;
12: case 2: if ((fn=open(filename,1))>=0)
13: break; /* courtesy of sny */
14: /* append defaults to write if file missing */
15: case 'w': type = 1;
16: case 1: fn = creat(filename,0666);
17: break;
18: default: IEH3err("copen: bad file %s",filename);
19: }
20: if (fn >= 0)
21: IEH3mbuf(fn,type);
22: return(fn);
23: }
Defined functions
copen
defined in line
1; used 4 times