1 /* @(#)fileopen.c 1.12 10/08/21 Copyright 1986, 1995-2010 J. Schilling */ 2 /* 3 * Copyright (c) 1986, 1995-2010 J. Schilling 4 */ 5 /* 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * See the file CDDL.Schily.txt in this distribution for details. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file CDDL.Schily.txt from this distribution. 15 */ 16 17 #include "schilyio.h" 18 19 EXPORT FILE * 20 fileopen(name, mode) 21 const char *name; 22 const char *mode; 23 { 24 int ret; 25 int omode = 0; 26 int flag = 0; 27 28 if (!_cvmod(mode, &omode, &flag)) 29 return ((FILE *)NULL); 30 31 if ((ret = _openfd(name, omode)) < 0) 32 return ((FILE *)NULL); 33 34 return (_fcons((FILE *)0, ret, flag | FI_CLOSE)); 35 } 36