diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /unix/boot/bootlib/oscrfile.c | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/boot/bootlib/oscrfile.c')
-rw-r--r-- | unix/boot/bootlib/oscrfile.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/unix/boot/bootlib/oscrfile.c b/unix/boot/bootlib/oscrfile.c new file mode 100644 index 00000000..28eec304 --- /dev/null +++ b/unix/boot/bootlib/oscrfile.c @@ -0,0 +1,36 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#include <fcntl.h> +#include "bootlib.h" + + +/* OS_CREATEFILE -- Open a new file for writing. Create the file with the + * given mode bits. + */ +int +os_createfile ( + char *fname, + int mode, + int type +) +{ + static XINT xmode = NEW_FILE; + PKCHAR *osfn = (PKCHAR *) vfn2osfn (fname, 1); + XINT chan; + extern int ZOPNTX(); + + + if (bdebug) + fprintf (stderr, "create %s file `%s' -> `%s'\n", + type == TEXT_FILE ? "text" : "binary", fname, (char *)osfn); + osfiletype = type; + + if (type == BINARY_FILE) + return (creat ((char *)osfn, mode)); + else { + ZOPNTX (osfn, &xmode, &chan); + txop = text; + return (chan == XERR ? ERR : chan); + } +} |