Index: libcio/filesys.c
===================================================================
--- libcio/filesys.c	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/filesys.c	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -783,10 +783,10 @@
    =============================================================================
 	_inifcb(fcp, name, ext, mode) -- initialize FCB pointed to by 'fcp'
-	for file named 'name'.'ext' in mode 'mode'.
+	for file named 'name'.'ext'.
 	Returns SUCCESS (0) if ok, FAILURE (-1) if not.
    =============================================================================
 */
 
-int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, uint16_t mode)
+int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, uint16_t flags)
 {
 	int16_t	fl;
@@ -800,5 +800,5 @@
 	/* check for valid flags */
 
-	if (mode & ~(O_WRONLY|O_RDWR|O_NDELAY|O_APPEND|O_CREAT|O_TRUNC|O_EXCL|O_RAW))
+	if (flags & ~(O_WRONLY|O_RDWR|O_NDELAY|O_APPEND|O_CREAT|O_TRUNC|O_EXCL|O_RAW))
 		return(FAILURE);
 
@@ -871,29 +871,29 @@
 	/* set the flags in the FCB and exit */
 
-	if (mode & O_RDONLY)
+	if (flags & O_RDONLY)
 		fcp->modefl |= FC_RD;
 
-	if (mode & O_WRONLY)
+	if (flags & O_WRONLY)
 		fcp->modefl |= FC_WR;
 
-	if (mode & O_RDWR)
+	if (flags & O_RDWR)
 		fcp->modefl |= FC_RW;
 
-	if (mode & O_NDELAY)
+	if (flags & O_NDELAY)
 		fcp->modefl |= FC_NB;
 
-	if (mode & O_APPEND)
+	if (flags & O_APPEND)
 		fcp->modefl |= FC_AP;
 
-	if (mode & O_CREAT)
+	if (flags & O_CREAT)
 		fcp->modefl |= FC_CR;
 
-	if (mode & O_TRUNC)
+	if (flags & O_TRUNC)
 		fcp->modefl |= FC_TR;
 
-	if (mode & O_EXCL)
+	if (flags & O_EXCL)
 		fcp->modefl |= FC_EX;
 
-	if (mode & O_RAW)
+	if (flags & O_RAW)
 		fcp->modefl |= FC_BF;
 
Index: libcio/fopen.c
===================================================================
--- libcio/fopen.c	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/fopen.c	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -8,5 +8,5 @@
 #include "ram.h"
 
-FILE *_opener(int8_t *name, int8_t *mode, uint16_t rawflg)
+FILE *_opener(int8_t *name, int8_t *mode, uint16_t raw)
 {
 	register FILE *fp;
@@ -26,10 +26,10 @@
 
 	case 'r':	/* read mode */
-		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY) | rawflg)) EQ -1)
+		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_RDONLY) | raw)) EQ -1)
 			return(NULL);
 		break;
 
 	case 'w':	/* write mode */
-		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|O_TRUNC|rawflg)) EQ -1)
+		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|O_TRUNC|raw)) EQ -1)
 			return(NULL);
 
@@ -37,5 +37,5 @@
 	
 	case 'a':	/* append mode */
-		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|rawflg)) EQ -1)
+		if ((fp->_unit = open(name, (plusopt ? O_RDWR : O_WRONLY)|O_CREAT|raw)) EQ -1)
 			return(NULL);
 
Index: libcio/fopen.x
===================================================================
--- libcio/fopen.x	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/fopen.x	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -16,5 +16,5 @@
 */
 
-extern	FILE		*_opener(int8_t *name, int8_t *mode, uint16_t aflag);
+extern	FILE		*_opener(int8_t *name, int8_t *mode, uint16_t raw);
 extern	FILE		*fopen(int8_t *name, int8_t *mode);
 extern	FILE		*fopena(int8_t *name, int8_t *mode);
Index: libcio/fsinit.c
===================================================================
--- libcio/fsinit.c	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/fsinit.c	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -69,8 +69,8 @@
 */
 
-int16_t _nopo(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp)
+int16_t _nopo(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp)
 {
 	(void)name;
-	(void)flag;
+	(void)flags;
 	(void)chp;
 	(void)dp;
Index: libcio/fsinit.x
===================================================================
--- libcio/fsinit.x	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/fsinit.x	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -46,3 +46,3 @@
 extern	int16_t		_badfio(io_arg arg, void *buff, int16_t len);
 extern	int16_t		_nopc(io_arg arg);
-extern	int16_t		_nopo(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp);
+extern	int16_t		_nopo(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp);
Index: libcio/open.c
===================================================================
--- libcio/open.c	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/open.c	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -34,5 +34,5 @@
 */
 
-int16_t open(int8_t *name, uint16_t flag)
+int16_t open(int8_t *name, uint16_t flags)
 {
 	register struct devtabl	*dp;
@@ -58,5 +58,5 @@
 
 	dev = dp->d_dev;
-	mdmask = (flag & 3) + 1;
+	mdmask = (flags & 3) + 1;
 
 	if (mdmask & 1) {	/* see if device is readable */
@@ -85,5 +85,5 @@
 	chp->c_close = _nopc;
 
-	if ((*dev->d_open)(name, flag, chp, dp) < 0) {	/* open */
+	if ((*dev->d_open)(name, flags, chp, dp) < 0) {	/* open */
 
 		chp->c_close = _badfc;	/* couldn't open for some reason */
@@ -96,35 +96,35 @@
 /*
    =============================================================================
-	opena(name, flag, mode) -- Opens ASCII file 'name' with flags 'flag'
-	and access mode 'mode'.  Newline translation will be done.
-	Returns a file descriptor (small positive integer) if successful, or
-	FAILURE (-1) if an error occurred.
-   =============================================================================
-*/
-
-int16_t opena(int8_t *name, uint16_t flag)
-{
-	return(open(name, flag));
-}
-
-/*
-   =============================================================================
-	openb(name, flag, mode) -- Opens binary file 'name' with flags 'flag'
-	and access mode 'mode'.  No newline translation is done.
-	Returns a file descriptor (small positive integer) if successful, or
-	FAILURE (-1) if an error occurred.
-   =============================================================================
-*/
-
-int16_t openb(int8_t *name, uint16_t flag)
-{
-	return(open(name, flag|O_RAW));
-}
-
-/*
-   =============================================================================
-	creat(name, mode) -- Creates file 'name' with access mode 'mode'.
+	opena(name, flag, mode) -- Opens ASCII file 'name' with flags 'flags'
+	Newline translation will be done.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int16_t opena(int8_t *name, uint16_t flags)
+{
+	return(open(name, flags));
+}
+
+/*
+   =============================================================================
+	openb(name, flag, mode) -- Opens binary file 'name' with flags 'flags'.
+	No newline translation is done.
+	Returns a file descriptor (small positive integer) if successful, or
+	FAILURE (-1) if an error occurred.
+   =============================================================================
+*/
+
+int16_t openb(int8_t *name, uint16_t flags)
+{
+	return(open(name, flags|O_RAW));
+}
+
+/*
+   =============================================================================
+	creat(name, mode) -- Creates file 'name'.
 	The created file is initially open for writing only.  The file
-	will be ASCII unless mode contains O_RAW.
+	will be ASCII.
 	Returns a file descriptor (small positive integer) if successful, or
 	FAILURE (-1) if an error occurred.
@@ -139,5 +139,5 @@
 /*
    =============================================================================
-	creata(name, mode) -- Creates ASCII file 'name' with access mode 'mode'.
+	creata(name, mode) -- Creates ASCII file 'name'.
 	The created file is initially open for writing only.
 	Files created with creata() do newline translations.
@@ -154,5 +154,5 @@
 /*
    =============================================================================
-	creatb(name, mode) -- create binary file 'name' with access mode 'mode'.
+	creatb(name, mode) -- create binary file 'name'.
 	The created file is initially open for writing only.
 	Files created with creatb don't do newline translations.
@@ -175,5 +175,5 @@
 */
 
-int16_t _fileop(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp)
+int16_t _fileop(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp)
 {
 	register struct fcb *fp;
@@ -195,5 +195,5 @@
 	/* setup the initial fcb */
 
-	if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flag)) {
+	if (_inifcb(fp, FilName(name, tmpname), FilExt(name, tmpext), flags)) {
 
 		errno = EINVAL;		/* bad file name or flags */
Index: libcio/open.x
===================================================================
--- libcio/open.x	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/open.x	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -16,9 +16,9 @@
 */
 
-extern	int16_t		_fileop(int8_t *name, uint16_t flag, struct channel *chp, struct devtabl *dp);
+extern	int16_t		_fileop(int8_t *name, uint16_t flags, struct channel *chp, struct devtabl *dp);
 extern	int16_t		creat(int8_t *name);
 extern	int16_t		creata(int8_t *name);
 extern	int16_t		creatb(int8_t *name);
-extern	int16_t		open(int8_t *name, uint16_t flag);
-extern	int16_t		opena(int8_t *name, uint16_t flag);
-extern	int16_t		openb(int8_t *name, uint16_t flag);
+extern	int16_t		open(int8_t *name, uint16_t flags);
+extern	int16_t		opena(int8_t *name, uint16_t flags);
+extern	int16_t		openb(int8_t *name, uint16_t flags);
Index: libcio/putl.c
===================================================================
--- libcio/putl.c	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/putl.c	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -21,5 +21,5 @@
 		return;
 
-	putc((w & 0xFF), stream);
+	putc((int16_t)(w & 0xFF), stream);
 }
 
Index: libcio/putw.c
===================================================================
--- libcio/putw.c	(revision 0c06bc5032efc771f3c0aa1d4e5f9ae2e103656d)
+++ libcio/putw.c	(revision 1c4f9beda6fc6257caf0dfd7cd6d13775ba0b7de)
@@ -12,8 +12,8 @@
 void putw(int32_t w, FILE *stream)
 {
-	if (putc(((w >> 8) & 0xFF), stream) < 0 ) 
+	if (putc((int16_t)((w >> 8) & 0xFF), stream) < 0 )
 		return;
 
-	putc((w & 0xFF), stream);
+	putc((int16_t)(w & 0xFF), stream);
 }
 
