aboutsummaryrefslogtreecommitdiff
path: root/unix/boot/bootlib/osopen.c
blob: 42b3cdeb4d8d349cf20ee9d2cf6337dbf6896182 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
 */

#include <fcntl.h>
#include "bootlib.h"

extern 	int  os_createfile (char *fname, int mode, int type);


/* OS_OPEN -- Open or create a host system file for reading or writing (text
 * and binary disk files only).
 */
int
os_open (
  char	*vfn,			/* file to be opened		*/
  int	mode,			/* access mode 0=R, 1=W, 2=RW	*/
  int	type 			/* file type			*/
)
{
	extern	char *vfn2osfn();

	if (mode == 0) {
	    osfiletype = BINARY_FILE;
	    return (open (vfn2osfn (vfn, 0), 0));
	} else if (mode == 1) {
	    return (os_createfile (vfn, mode, type));
	} else
	    return (-1);
}