Index: libcio/atoi.c
===================================================================
--- libcio/atoi.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/atoi.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,8 +9,8 @@
 #include "ctype.h"
 
-int atoi(char *cp)
+int16_t atoi(int8_t *cp)
 {
-	register unsigned i;
-	register short sign;
+	register uint16_t i;
+	register int16_t sign;
 
 	sign = 0;
Index: libcio/atol.c
===================================================================
--- libcio/atol.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/atol.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,8 +9,8 @@
 #include "ctype.h"
 
-long atol(char *cp)
+int32_t atol(int8_t *cp)
 {
-	register long n;
-	register short sign;
+	register int32_t n;
+	register int16_t sign;
 
 	sign = 0;
Index: libcio/blkrd.c
===================================================================
--- libcio/blkrd.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/blkrd.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -40,9 +40,9 @@
 #endif
 
-extern	int	_nsic(struct fcb *fcp, struct bpb *bpp, char *fp);
+extern	int16_t	_nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp);
 
-extern	long	_berrno;		/* last file system bios error number */
+extern	int32_t	_berrno;		/* last file system bios error number */
 
-extern	unsigned	_thefat[];		/* current file allocation table */
+extern	uint16_t	_thefat[];		/* current file allocation table */
 
 extern	struct	bpb	*_thebpb;	/* current bios parameter block */
@@ -52,10 +52,10 @@
 /* WARNING:  this ONLY works for 512 byte sectors, 9 sectors per track */
 
-extern	short	_b_tbuf[9][256];	/* the track buffer */
+extern	int16_t	_b_tbuf[9][256];	/* the track buffer */
 
-extern	short	_b_trak;		/* current track */
-extern	short	_b_side;		/* current side */
-extern	short	_b_sect;		/* current sector */
-extern	short	_b_tsec;		/* current base sector of current track */
+extern	int16_t	_b_trak;		/* current track */
+extern	int16_t	_b_side;		/* current side */
+extern	int16_t	_b_sect;		/* current sector */
+extern	int16_t	_b_tsec;		/* current base sector of current track */
 
 #endif
@@ -73,8 +73,8 @@
 */
 
-long _secrd(char *buf, short rec)
+int32_t _secrd(int8_t *buf, int16_t rec)
 {
-	register short	track, side, sector;
-	long brc;
+	register int16_t	track, side, sector;
+	int32_t brc;
 
 	if (_thebpb->dspt NE 9)			/* make sure we can do this */
@@ -118,5 +118,5 @@
 	}
 
-	memcpy(buf, (char *)_b_tbuf[sector], 512);
+	memcpy(buf, (int8_t *)_b_tbuf[sector], 512);
 	return(0L);
 }
@@ -135,8 +135,8 @@
 */
 
-int blkrd(struct fcb *fcp, char *buf, int ns)
+int16_t blkrd(struct fcb *fcp, int8_t *buf, int16_t ns)
 {
-	register long	brc;		/* bios return code */
-	register int	rb;		/* _nsic return code */
+	register int32_t	brc;		/* bios return code */
+	register int16_t	rb;		/* _nsic return code */
 
 	if (ns < 0)		/* can't read a negative number of sectors */
@@ -152,5 +152,5 @@
 
 #if	TBUFFER
-		if (brc = _secrd(buf, (short)fcp->curdsn)) {
+		if (brc = _secrd(buf, (int16_t)fcp->curdsn)) {
 #else
 		if (brc = BIOS(B_RDWR, 0, buf, 1, (short)fcp->curdsn, 0)) {
Index: libcio/blkwr.c
===================================================================
--- libcio/blkwr.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/blkwr.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -24,15 +24,15 @@
 #include "fspars.h"
 
-extern	int	_nsic(struct fcb *fcp, struct bpb *bpp, char *fp);
-extern	int	_alcnew(struct fcb *fcp);
-extern	int	_newcls(void);
-
-extern	long	_berrno;		/* last file system bios error number */
+extern	int16_t	_nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp);
+extern	int16_t	_alcnew(struct fcb *fcp);
+extern	int16_t	_newcls(void);
+
+extern	int32_t	_berrno;		/* last file system bios error number */
 
 extern	struct	bpb	*_thebpb;	/* current bios parameter block */
 
-extern	unsigned	_thefat[];		/* current file allocation table */
-
-extern	int	_fatmod;		/* FAT modified flag */
+extern	uint16_t	_thefat[];		/* current file allocation table */
+
+extern	int16_t	_fatmod;		/* FAT modified flag */
 
 #if DEBUGIT
@@ -44,10 +44,10 @@
 /* WARNING:  this ONLY works for 512 byte sectors, 9 sectors per track */
 
-extern	short	_b_tbuf[9][256];	/* the track buffer */
-
-extern	short	_b_trak;		/* current track */
-extern	short	_b_side;		/* current side */
-extern	short	_b_sect;		/* current sector */
-extern	short	_b_tsec;		/* base sector for current track */
+extern	int16_t	_b_tbuf[9][256];	/* the track buffer */
+
+extern	int16_t	_b_trak;		/* current track */
+extern	int16_t	_b_side;		/* current side */
+extern	int16_t	_b_sect;		/* current sector */
+extern	int16_t	_b_tsec;		/* base sector for current track */
 
 #endif
@@ -65,7 +65,7 @@
 */
 
-long _secwr(char *buf, short rec)
+int32_t _secwr(int8_t *buf, int16_t rec)
 {
-	register short	track, side, sector;
+	register int16_t	track, side, sector;
 
 	if (_thebpb->dspt NE 9)			/* make sure we can do this */
@@ -101,5 +101,5 @@
 		return(0L);
 
-	memcpy((char *)_b_tbuf[sector], buf, 512);	/* update the buffer */
+	memcpy((int8_t *)_b_tbuf[sector], buf, 512);	/* update the buffer */
 
 #if	DEBUGIT
@@ -124,8 +124,8 @@
 */
 
-int blkwr(struct fcb *fcp, char *buf, int ns)
+int16_t blkwr(struct fcb *fcp, int8_t *buf, int16_t ns)
 {
-	long	rc;
-	short	clustr;
+	int32_t	rc;
+	int16_t	clustr;
 
 	while (ns > 0) {		/* write a sector at a time */
@@ -141,5 +141,5 @@
 #endif
 
-				if (rc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+				if (rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
 
 #if	DEBUGIT
@@ -154,5 +154,5 @@
 
 #if	TBUFFER
-				_secwr(buf, (short)fcp->curdsn);
+				_secwr(buf, (int16_t)fcp->curdsn);
 #endif
 
@@ -193,5 +193,5 @@
 #endif
 
-				if (rc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+				if (rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
 
 #if	DEBUGIT
@@ -206,5 +206,5 @@
 
 #if	TBUFFER
-				_secwr(buf, (short)fcp->curdsn);
+				_secwr(buf, (int16_t)fcp->curdsn);
 #endif
 
@@ -246,5 +246,5 @@
 #endif
 
-			if (rc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+			if (rc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
 
 #if	DEBUGIT
@@ -259,5 +259,5 @@
 
 #if	TBUFFER
-			_secwr(buf, (short)fcp->curdsn);
+			_secwr(buf, (int16_t)fcp->curdsn);
 #endif
 
Index: libcio/close.c
===================================================================
--- libcio/close.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/close.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -12,12 +12,12 @@
 #include "stddefs.h"
 
-extern	int	_badfd(void);
-extern	int	ClsFile(struct fcb *fcp);
+extern	int16_t	_badfd(void);
+extern	int16_t	ClsFile(struct fcb *fcp);
 extern	void	_clsvol(void);
 
-extern	int	_fatmod, _dirmod;
+extern	int16_t	_fatmod, _dirmod;
 extern	struct	bpb	*_thebpb;
 extern	struct	dirent	_thedir[];
-extern	unsigned	_thefat[];
+extern	uint16_t	_thefat[];
 
 /* 
@@ -72,8 +72,8 @@
 */
 
-int close(int fd)
+int16_t close(int16_t fd)
 {
 	register struct channel *chp;
-	register int rc;
+	register int16_t rc;
 
 	if ((fd < 0) OR (fd > MAXCHAN)) {
@@ -112,7 +112,7 @@
 */
 
-int _filecl(struct fcb *fp)
+int16_t _filecl(struct fcb *fp)
 {
-	register int rc;
+	register int16_t rc;
 
 	rc = ClsFile(fp);		/* close the FCB */
@@ -129,5 +129,5 @@
 void _fd_cls(void)
 {
-	register int fd;
+	register int16_t fd;
 
 	for (fd = 0; fd < MAXCHAN; ++fd)
Index: libcio/clusmap.c
===================================================================
--- libcio/clusmap.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/clusmap.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -12,19 +12,19 @@
 #include "stddefs.h"
 
-extern	short	micons(short wi);
-extern	unsigned	_gtcl12(char *fat, unsigned cl);
-extern	long	miconl(long wi);
+extern	int16_t	micons(int16_t wi);
+extern	uint16_t	_gtcl12(int8_t *fat, uint16_t cl);
+extern	int32_t	miconl(int32_t wi);
 
 extern	struct	bpb	*_thebpb;
-extern	unsigned	_thefat[];
-
-extern	int	_filecl(struct fcb *fp);
-extern	int	_noper(void);
-
-/* 
-
-*/
-
-static char	*mfname[] = {	/* FCB flag names */
+extern	uint16_t	_thefat[];
+
+extern	int16_t	_filecl(struct fcb *fp);
+extern	int16_t	_noper(void);
+
+/* 
+
+*/
+
+static int8_t	*mfname[] = {	/* FCB flag names */
 
 	"?D0",	/* D0  - 0001 */
@@ -53,5 +53,5 @@
 */
 
-static	char	*dfname[] = {
+static	int8_t	*dfname[] = {
 
 	"RDONLY",	/* D0 - 01 */
@@ -65,5 +65,5 @@
 };
 
-static	char	*ffname[] = {
+static	int8_t	*ffname[] = {
 
 	"BUSY  ",	/* D0 - 01 */
@@ -81,7 +81,7 @@
 */
 
-static int waitcr(void)
-{
-	char	c;
+static int16_t waitcr(void)
+{
+	int8_t	c;
 
 	BIOS(B_PUTC, CON_DEV, '\007');
@@ -106,8 +106,8 @@
 */
 
-int ClusMap(struct fcb *fcp)
-{
-	int	clus, nc;
-	long	alsize, bused, bunused;
+int16_t ClusMap(struct fcb *fcp)
+{
+	int16_t	clus, nc;
+	int32_t	alsize, bused, bunused;
 
 	if (!(fcp->modefl & FC_OPN)) {
@@ -175,6 +175,6 @@
 struct fcb *FCBmode(struct fcb *fcp)
 {
-	register unsigned short mf;
-	register short i;
+	register uint16_t mf;
+	register int16_t i;
 
 	printf("  flags:  ");
@@ -254,7 +254,7 @@
 */
 
-void MapFAT(char *fat, short ncl, short stops)
-{
-	register int i;
+void MapFAT(int8_t *fat, int16_t ncl, int16_t stops)
+{
+	register int16_t i;
 
 	printf("\nCluster dump of FAT at 0x%08.8lx  (%d entries):\n",
@@ -290,6 +290,6 @@
 FILE *FILEfl(FILE *fp)
 {
-	register unsigned short mf;
-	register short i;
+	register uint16_t mf;
+	register int16_t i;
 
 	printf("  _flags:  ");
@@ -320,6 +320,6 @@
 void FILEpr(FILE *fp)
 {
-	int	(*arg)(), ft;
-	char	*ds, *fsn, *fse;
+	int16_t	(*arg)(), ft;
+	int8_t	*ds, *fsn, *fse;
 	struct	fcb	*fcp;
 
@@ -379,5 +379,5 @@
 */
 
-struct fcb *fd2fcb(short fd)
+struct fcb *fd2fcb(int16_t fd)
 {
 	if ((fd < 0) OR (fd > MAXCHAN))
Index: libcio/conin.c
===================================================================
--- libcio/conin.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/conin.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -14,15 +14,15 @@
 #include "stddefs.h"
 
-extern	void	*memcpy(void *vp1, void *vp2, int n);
-extern	int	readbuf(int dev, char *buf);
-extern	void	writeln(int unit, char *buf);
+extern	void	*memcpy(void *vp1, void *vp2, int16_t n);
+extern	int16_t	readbuf(int16_t dev, int8_t *buf);
+extern	void	writeln(int16_t unit, int8_t *buf);
 
-char _ConBuf[258];	/* console input buffer */
-int _CBused;
+int8_t _ConBuf[258];	/* console input buffer */
+int16_t _CBused;
 
-int _conin(char *buff, int len)
+int16_t _conin(int8_t *buff, int16_t len)
 {
-	int 	nbp;
-	register int l;
+	int16_t 	nbp;
+	register int16_t l;
 
 	if (_ConBuf[1] EQ 0) {
Index: libcio/conwr.c
===================================================================
--- libcio/conwr.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/conwr.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -19,7 +19,7 @@
    ============================================================================
 */
-int _conwr(int kind, char *buff, int len)
+int16_t _conwr(int16_t kind, int8_t *buff, int16_t len)
 {
-	register int count;
+	register int16_t count;
 
 	for (count = 0; count < len; ++count)
Index: libcio/dirfns.c
===================================================================
--- libcio/dirfns.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/dirfns.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,7 +9,7 @@
 #include "biosdefs.h"
 
-extern	long	sprintf(char *str, char *fmt, ...);
+extern	int32_t	sprintf(int8_t *str, int8_t *fmt, ...);
 
-static char atrcons[] = "ADVSHR";
+static int8_t atrcons[] = "ADVSHR";
 
 /*
@@ -19,7 +19,7 @@
 */
 
-char *atrstr(short atr, char s[])
+int8_t *atrstr(int16_t atr, int8_t s[])
 {
-	register short	i, j;
+	register int16_t	i, j;
 
 	i = 0x20;
@@ -42,5 +42,5 @@
  */
 
-static char *mnames[] = {
+static int8_t *mnames[] = {
 
 	"???",
@@ -65,5 +65,5 @@
 */
 
-char *mname(short n)
+int8_t *mname(int16_t n)
 {
 	return((n < 1 || n > 12) ? mnames[0] : mnames[n]);
@@ -81,7 +81,7 @@
 */
 
-char *dtunpk(short din, short tin, short fmt, char *s)
+int8_t *dtunpk(int16_t din, int16_t tin, int16_t fmt, int8_t *s)
 {
-	register short	ftm, fdt;
+	register int16_t	ftm, fdt;
 
 	ftm = ((tin << 8) & 0xFF00) | ((tin >> 8) & 0x00FF);
Index: libcio/fgets.c
===================================================================
--- libcio/fgets.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fgets.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,7 +11,7 @@
 #define	EATCHAR	'\n'	/* character to be "eaten" on input */
 
-int agetc(FILE *ptr)
+int16_t agetc(FILE *ptr)
 {
-	register int c;
+	register int16_t c;
 
 top:
@@ -33,8 +33,8 @@
 }
 
-char *gets(char *line)
+int8_t *gets(int8_t *line)
 {
-	register char *cp;
-	register int i;
+	register int8_t *cp;
+	register int16_t i;
 
 	cp = line;
@@ -51,8 +51,8 @@
 }
 
-char *fgets(char *s, int n, FILE *fp)
+int8_t *fgets(int8_t *s, int16_t n, FILE *fp)
 {
-	register int c;
-	register char *cp;
+	register int16_t c;
+	register int8_t *cp;
 
 	cp = s;
Index: libcio/filesys.c
===================================================================
--- libcio/filesys.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/filesys.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -29,9 +29,9 @@
 #define	DE_NULL		((struct dirent *)0L)
 
-extern	short	micons(short wi);
-extern	long	miconl(long wi);
-extern	void	_ptcl12(unsigned *fat, unsigned cl, unsigned val);
-extern	char	*FilName(char *s, char *p);
-extern	char	*FilExt(char *s, char *p);
+extern	int16_t	micons(int16_t wi);
+extern	int32_t	miconl(int32_t wi);
+extern	void	_ptcl12(uint16_t *fat, uint16_t cl, uint16_t val);
+extern	int8_t	*FilName(int8_t *s, int8_t *p);
+extern	int8_t	*FilExt(int8_t *s, int8_t *p);
 
 #if DEBUGIT
@@ -44,13 +44,13 @@
 struct	dirent	*_dptr;			/* internal directory pointer */
 
-unsigned _thefat[MAXFAT * WDPSEC];	/* file allocation table */
-
-int	_fatin;				/* FAT has been read */
-int	_dirin;				/* directory has been read */
-int	_bpbin;				/* BPB has been read */
-int	_fatmod;			/* FAT modified flag */
-int	_dirmod;			/* directory modified flag */
-
-long	_berrno;			/* BIOS error number */
+uint16_t _thefat[MAXFAT * WDPSEC];	/* file allocation table */
+
+int16_t	_fatin;				/* FAT has been read */
+int16_t	_dirin;				/* directory has been read */
+int16_t	_bpbin;				/* BPB has been read */
+int16_t	_fatmod;			/* FAT modified flag */
+int16_t	_dirmod;			/* directory modified flag */
+
+int32_t	_berrno;			/* BIOS error number */
 
 /* 
@@ -66,5 +66,5 @@
 */
 
-unsigned _cl2lsn(struct bpb *bpp, unsigned clnum)
+uint16_t _cl2lsn(struct bpb *bpp, uint16_t clnum)
 {
 	return(bpp->datrec + (bpp->clsiz * (clnum - 2)) );
@@ -78,16 +78,16 @@
 */
 
-unsigned _gtcl12(char *fat, unsigned cl)
-{
-	register unsigned cla, clt;
+uint16_t _gtcl12(int8_t *fat, uint16_t cl)
+{
+	register uint16_t cla, clt;
 
 	cla = cl + (cl >> 1);
-	clt = ((unsigned)0xFF00 & (fat[cla+1] << 8))
-		| ((unsigned)0x00FF & fat[cla]);
+	clt = ((uint16_t)0xFF00 & (fat[cla+1] << 8))
+		| ((uint16_t)0x00FF & fat[cla]);
 
 	if (cl & 1)
 		clt >>= 4;
 
-	clt &= (unsigned)0x0FFF;
+	clt &= (uint16_t)0x0FFF;
 	return(clt);
 }
@@ -104,10 +104,10 @@
 */
 
-unsigned _getfat(unsigned *bufad, unsigned nfat, struct bpb *bpp)
-{
-	unsigned fatsec;
+uint16_t _getfat(uint16_t *bufad, uint16_t nfat, struct bpb *bpp)
+{
+	uint16_t fatsec;
 
 	fatsec = nfat ? bpp->fatrec : (bpp->fatrec - bpp->fsiz);
-	return(BIOS(B_RDWR, 0, (char *)bufad, bpp->fsiz, fatsec, 0));
+	return(BIOS(B_RDWR, 0, (int8_t *)bufad, bpp->fsiz, fatsec, 0));
 }
 
@@ -123,5 +123,5 @@
 */
 
-int _rdfat(unsigned *bufad, struct bpb *bpp)
+int16_t _rdfat(uint16_t *bufad, struct bpb *bpp)
 {
 	if (_getfat(bufad, bpp, 0)) {
@@ -143,7 +143,7 @@
 */
 
-int _rdroot(unsigned *buf, struct bpb *bpp)
-{
-	return(BIOS(B_RDWR, 0, (char *)buf, bpp->rdlen,
+int16_t _rdroot(uint16_t *buf, struct bpb *bpp)
+{
+	return(BIOS(B_RDWR, 0, (int8_t *)buf, bpp->rdlen,
 		(bpp->fatrec + bpp->fsiz), 0));
 }
@@ -162,7 +162,7 @@
 */
 
-int _nsic(struct fcb *fcp, struct bpb *bpp, char *fp)
-{
-	register unsigned tfe;
+int16_t _nsic(struct fcb *fcp, struct bpb *bpp, int8_t *fp)
+{
+	register uint16_t tfe;
 
 	/* check the FCB flags */
@@ -261,5 +261,5 @@
 struct dirent *_dsrch(struct dirent *de)
 {
-	unsigned i, dl;
+	uint16_t i, dl;
 	register struct dirent *dp;
 
@@ -298,5 +298,5 @@
 struct dirent *_dsnew(void)
 {
-	unsigned i, dl;
+	uint16_t i, dl;
 	register struct dirent *dp;
 
@@ -332,5 +332,5 @@
 */
 
-void _deadio(struct fcb *fcp, int err)
+void _deadio(struct fcb *fcp, int16_t err)
 {
 	fcp->clsec = 0;
@@ -355,8 +355,8 @@
 */
 
-int _seek(struct fcb *fcp)
-{
-	register unsigned acls, rcls, nc;
-	unsigned sic, spc;
+int16_t _seek(struct fcb *fcp)
+{
+	register uint16_t acls, rcls, nc;
+	uint16_t sic, spc;
 
 	if (!(fcp->modefl & FC_OPN)) {		/* file must be open */
@@ -461,7 +461,7 @@
 */
 
-int _ftrnc(struct dirent *dp)
-{
-	register unsigned acls, ncls;
+int16_t _ftrnc(struct dirent *dp)
+{
+	register uint16_t acls, ncls;
 
 #if	DEBUGIT
@@ -525,7 +525,7 @@
 */
 
-int _newcls(void)
-{
-	register int tc, i;
+int16_t _newcls(void)
+{
+	register int16_t tc, i;
 
 	tc = _thebpb->numcl;
@@ -548,7 +548,7 @@
 */
 
-int _alcnew(struct fcb *fcp)
-{
-	register int ac, nc, pc;
+int16_t _alcnew(struct fcb *fcp)
+{
+	register int16_t ac, nc, pc;
 
 #if	DEBUGIT
@@ -639,5 +639,5 @@
 */
 
-int _fmake(struct fcb *fcp)
+int16_t _fmake(struct fcb *fcp)
 {
 	register struct dirent *dp;
@@ -664,7 +664,7 @@
 */
 
-int _opnvol(void)
-{
-	register long drc;
+int16_t _opnvol(void)
+{
+	register int32_t drc;
 
 	/* check for media change if we already have a BPB */
@@ -750,7 +750,7 @@
 */
 
-int _opfcb(struct fcb *fcp)
-{
-	int	rc;
+int16_t _opfcb(struct fcb *fcp)
+{
+	int16_t	rc;
 
 	/* check for an already open FCB */
@@ -892,13 +892,13 @@
 */
 
-int _inifcb(struct fcb *fcp, char *name, char *ext, int mode)
-{
-	int	fl;
-	register int	i;
-	register char *s1, *s2, c;
+int16_t _inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, int16_t mode)
+{
+	int16_t	fl;
+	register int16_t	i;
+	register int8_t *s1, *s2, c;
 
 	/* clear the FCB */
 
-	memset((char *)fcp, 0, sizeof (struct fcb));
+	memset((int8_t *)fcp, 0, sizeof (struct fcb));
 
 	/* check for valid flags */
@@ -1024,5 +1024,5 @@
 */
 
-int ClsFile(struct fcb *fcp)
+int16_t ClsFile(struct fcb *fcp)
 {
 	register struct dirent *dp;
@@ -1136,7 +1136,7 @@
 */
 
-short fcbinit(char *name, struct fcb *fcp)
-{
-	char	tmpname[9], tmpext[4];
+int16_t fcbinit(int8_t *name, struct fcb *fcp)
+{
+	int8_t	tmpname[9], tmpext[4];
 
 	return(_inifcb(fcp, FilName(name, tmpname), FilExt(name, tmpext), 0));
@@ -1153,5 +1153,5 @@
 */
 
-int DelFile(struct fcb *fcp)
+int16_t DelFile(struct fcb *fcp)
 {
 #if	DEBUGIT
Index: libcio/filname.c
===================================================================
--- libcio/filname.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/filname.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -20,8 +20,8 @@
 */
 
-char *FilName(char *s, char *p)
+int8_t *FilName(int8_t *s, int8_t *p)
 {
-	register char	*tp;
-	register int i;
+	register int8_t	*tp;
+	register int16_t i;
 
 	tp = p;
@@ -59,8 +59,8 @@
 */
 
-char *FilExt(char *s, char *p)
+int8_t *FilExt(int8_t *s, int8_t *p)
 {
-	register char c, *tp;
-	register int i;
+	register int8_t c, *tp;
+	register int16_t i;
 
 	tp = p;
Index: libcio/flread.c
===================================================================
--- libcio/flread.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/flread.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -19,17 +19,17 @@
 */
 
-int flread(char *buff, long len, FILE *fp)
+int16_t flread(int8_t *buff, int32_t len, FILE *fp)
 {
-	register int	ilen;
+	register int16_t	ilen;
 
 	while (len > 0L) {
 
-		if (len GE (long)CHUNK) {
+		if (len GE (int32_t)CHUNK) {
 
 			if (1 NE fread(buff, CHUNK, 1, fp))
 				return(EOF);
 
-			buff += (long)CHUNK;
-			len -= (long)CHUNK;
+			buff += (int32_t)CHUNK;
+			len -= (int32_t)CHUNK;
 
 		} else {
Index: libcio/fopen.c
===================================================================
--- libcio/fopen.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fopen.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,10 +11,10 @@
 #include "stddefs.h"
 
-extern	long	lseek(int fd, long pos, int how);
+extern	int32_t	lseek(int16_t fd, int32_t pos, int16_t how);
 
-FILE *_opener(char *name, char *mode, int aflag)
+FILE *_opener(int8_t *name, int8_t *mode, int16_t aflag)
 {
 	register FILE *fp;
-	register int plusopt;
+	register int16_t plusopt;
 
 	fp = Cbuffs;
@@ -70,15 +70,15 @@
 */
 
-FILE *fopen(char *name, char *mode)
+FILE *fopen(int8_t *name, int8_t *mode)
 {
 	return(_opener(name, mode, 0));
 }
 
-FILE *fopena(char *name, char *mode)
+FILE *fopena(int8_t *name, int8_t *mode)
 {
 	return(_opener(name, mode, 0));
 }
 
-FILE *fopenb(char *name, char *mode)
+FILE *fopenb(int8_t *name, int8_t *mode)
 {
 	return(_opener(name, mode, O_RAW));
Index: libcio/fprintf.c
===================================================================
--- libcio/fprintf.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fprintf.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -12,12 +12,12 @@
 static FILE *Stream;
 
-extern	long	dofmt_(int (*putsub)(), char *format, va_list args);
-extern	int	aputc(int c, FILE *ptr);
+extern	int32_t	dofmt_(int16_t (*putsub)(), int8_t *format, va_list args);
+extern	int16_t	aputc(int16_t c, FILE *ptr);
 
-	static int fpsub(int c);
+	static int16_t fpsub(int16_t c);
 
-int fprintf(FILE *stream, char *fmt, ...)
+int16_t fprintf(FILE *stream, int8_t *fmt, ...)
 {
-	register int count;
+	register int16_t count;
 	va_list aptr;
 
@@ -29,5 +29,5 @@
 }
 
-static int fpsub(int c)
+static int16_t fpsub(int16_t c)
 {
 	return(aputc(c, Stream));
Index: libcio/fputs.c
===================================================================
--- libcio/fputs.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fputs.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,5 +9,5 @@
 #include "stddefs.h"
 
-int puts(char *str)
+int16_t puts(int8_t *str)
 {
 	while (*str)
@@ -18,5 +18,5 @@
 }
 
-int aputc(int c, FILE *ptr)
+int16_t aputc(int16_t c, FILE *ptr)
 {
 	c &= 127;
@@ -29,5 +29,5 @@
 }
 
-int fputs(char *s, FILE *fp)
+int16_t fputs(int8_t *s, FILE *fp)
 {
 	while ( *s )
Index: libcio/fread.c
===================================================================
--- libcio/fread.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fread.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -16,8 +16,8 @@
 */
 
-int fread(char *buffer, unsigned size, int number, FILE *stream)
+int16_t fread(int8_t *buffer, uint16_t size, int16_t number, FILE *stream)
 {
-	int total;
-	register int c,i;
+	int16_t total;
+	register int16_t c,i;
 
 	for (total = 0; total < number; ++total) {
Index: libcio/fscanf.c
===================================================================
--- libcio/fscanf.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fscanf.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,8 +9,8 @@
 #include "stddefs.h"
 
-static int scnlast;
+static int16_t scnlast;
 static FILE *scnfp;
 
-static int gchar(int what)
+static int16_t gchar(int16_t what)
 {
 	if (what EQ 0) {
@@ -26,5 +26,5 @@
 }
 
-int scanf(char *fmt, int *args)
+int16_t scanf(int8_t *fmt, int16_t *args)
 {
 	scnfp = stdin;
@@ -33,5 +33,5 @@
 }
 
-int fscanf(FILE *fp, char *fmt, int *args)
+int16_t fscanf(FILE *fp, int8_t *fmt, int16_t *args)
 {
 	scnfp = fp;
Index: libcio/fseek.c
===================================================================
--- libcio/fseek.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fseek.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,5 +11,5 @@
 #include "stddefs.h"
 
-extern	long	lseek(int fd, long pos, int how);
+extern	int32_t	lseek(int16_t fd, int32_t pos, int16_t how);
 
 /*
@@ -19,8 +19,8 @@
 */
 
-int fseek(FILE *fp, long pos, int mode)
+int16_t fseek(FILE *fp, int32_t pos, int16_t mode)
 {
-	register int i, lr;
-	long curpos;
+	register int16_t i, lr;
+	int32_t curpos;
 
 	if (fp->_flags & _DIRTY) {
@@ -32,5 +32,5 @@
 
 		if (mode EQ 1 AND fp->_bp)
-			pos -= (long)fp->_bend - (long)fp->_bp;
+			pos -= (int32_t)fp->_bend - (int32_t)fp->_bp;
 	}
 
Index: libcio/fsinit.c
===================================================================
--- libcio/fsinit.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fsinit.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -14,14 +14,14 @@
 #include "stddefs.h"
 
-extern	int	_bpbin, _dirin, _fatin, _dirmod, _fatmod;
+extern	int16_t	_bpbin, _dirin, _fatin, _dirmod, _fatmod;
 
-int	_badfd(void);
-int	_noper(void);
+int16_t	_badfd(void);
+int16_t	_noper(void);
 
-char	*Stdbufs;			/* buffer chain pointer */
+int8_t	*Stdbufs;			/* buffer chain pointer */
 
-char	Wrkbuf[BPSEC];			/* sector work buffer */
+int8_t	Wrkbuf[BPSEC];			/* sector work buffer */
 
-long	Stdbuf[MAXDFILE][BUFSIZL];	/* standard buffers */
+int32_t	Stdbuf[MAXDFILE][BUFSIZL];	/* standard buffers */
 
 FILE Cbuffs[NSTREAMS];			/* stream file control table */
@@ -35,10 +35,10 @@
 /* WARNING:  this ONLY works for 512 byte sectors, 9 sectors per track */
 
-short	_b_tbuf[9][256];	/* the track buffer */
+int16_t	_b_tbuf[9][256];	/* the track buffer */
 
-short	_b_trak;		/* current track */
-short	_b_side;		/* current side */
-short	_b_sect;		/* current sector */
-short	_b_tsec;		/* current base sector of current track */
+int16_t	_b_trak;		/* current track */
+int16_t	_b_side;		/* current side */
+int16_t	_b_sect;		/* current sector */
+int16_t	_b_tsec;		/* current base sector of current track */
 
 #endif
@@ -54,5 +54,5 @@
 */
 
-int _badfd(void)
+int16_t _badfd(void)
 {
 	errno = EBADF;		/* set bad fd code */
@@ -66,5 +66,5 @@
 */
 
-int _noper(void)
+int16_t _noper(void)
 {
 	return(SUCCESS);	/* return with a non-error indication */
@@ -81,5 +81,5 @@
 */
 
-void InitCH(struct channel *cp, char rdi, char wri, char ioi, char ski, int (*cfp)(), io_arg charg)
+void InitCH(struct channel *cp, int8_t rdi, int8_t wri, int8_t ioi, int8_t ski, int16_t (*cfp)(), io_arg charg)
 {
 	cp->c_read  = rdi;
@@ -97,9 +97,9 @@
 */
 
-void Init_CB(FILE *fp, char unit, char flags, long *bufad, int bufsize)
+void Init_CB(FILE *fp, int8_t unit, int8_t flags, int32_t *bufad, int16_t bufsize)
 {
-	fp->_bp     = (char *)0L;
-	fp->_bend   = (char *)0L;
-	fp->_buff   = (char *)bufad;
+	fp->_bp     = (int8_t *)0L;
+	fp->_bend   = (int8_t *)0L;
+	fp->_buff   = (int8_t *)bufad;
 	fp->_flags  = flags;
 	fp->_unit   = unit;
@@ -120,20 +120,20 @@
 void InitFS(void)
 {
-	register int i;
+	register int16_t i;
 
 	memset(_fcbtab, 0, sizeof _fcbtab);		/* clear fcb table */
 	memsetw(Stdbuf, 0, sizeof Stdbuf / 2);		/* clear buffers */
 
-	Init_CB(stdin,  _BUSY, 0, (char *)0L, BUFSIZ);	/* stdin */
-	Init_CB(stdout, _BUSY, 1, (char *)0L, 1);	/* stdout */ 
-	Init_CB(stderr, _BUSY, 2, (char *)0L, 1);	/* stderr */
+	Init_CB(stdin,  _BUSY, 0, (int8_t *)0L, BUFSIZ);	/* stdin */
+	Init_CB(stdout, _BUSY, 1, (int8_t *)0L, 1);	/* stdout */ 
+	Init_CB(stderr, _BUSY, 2, (int8_t *)0L, 1);	/* stderr */
 
 	for (i = 3; i < NSTREAMS; i++)
-		Init_CB(&Cbuffs[i], 0, 0, (char *)0L, 0);
+		Init_CB(&Cbuffs[i], 0, 0, (int8_t *)0L, 0);
 
 	Stdbuf[0][0] = 0L;		/* initialize the buffer list */
 
 	for (i = 1; i < MAXDFILE; i++)
-		Stdbuf[i][0] = (long)Stdbuf[i-1];
+		Stdbuf[i][0] = (int32_t)Stdbuf[i-1];
 
 	Stdbufs = Stdbuf[MAXDFILE-1];
Index: libcio/fsize.c
===================================================================
--- libcio/fsize.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fsize.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,9 +11,9 @@
 #include "stddefs.h"
 
-extern	unsigned	_gtcl12(char *fat, unsigned cl);
-extern	int	_opnvol(void);
-extern	int	_filecl(struct fcb *fp);
+extern	uint16_t	_gtcl12(int8_t *fat, uint16_t cl);
+extern	int16_t	_opnvol(void);
+extern	int16_t	_filecl(struct fcb *fp);
 
-extern	unsigned _thefat[];
+extern	uint16_t _thefat[];
 
 extern	struct	bpb	*_thebpb;
@@ -27,5 +27,5 @@
 */
 
-long fsize(FILE *fp, short how)
+int32_t fsize(FILE *fp, int16_t how)
 {
 	register struct channel *chp;
@@ -70,7 +70,7 @@
 */
 
-short dspace(short which)
+int16_t dspace(int16_t which)
 {
-	register short maxcl, clcount, nc;
+	register int16_t maxcl, clcount, nc;
 
 	if (_opnvol())
Index: libcio/fstubs.c
===================================================================
--- libcio/fstubs.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fstubs.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -40,5 +40,5 @@
 */
 
-int readbuf(int dev, char *buf)
+int16_t readbuf(int16_t dev, int8_t *buf)
 {
 	xtrap15();
Index: libcio/ftell.c
===================================================================
--- libcio/ftell.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/ftell.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -17,5 +17,5 @@
 #endif
 
-extern	int	_filecl(struct fcb *fp);
+extern	int16_t	_filecl(struct fcb *fp);
 
 /*
@@ -25,9 +25,9 @@
 */
 
-long ftell(FILE *fp)
+int32_t ftell(FILE *fp)
 {
 	register struct fcb *fcp;
 	register struct channel *chp;
-	register long dpos, pos, diff;
+	register int32_t dpos, pos, diff;
 
 	if (fp EQ (FILE *)0L) {		/* see if we point at a FILE */
@@ -69,7 +69,7 @@
 
 	if (fp->_flags & _DIRTY)	/* adjust for the buffering */
-		pos = dpos + (diff = ((long)fp->_bp - (long)fp->_buff));
+		pos = dpos + (diff = ((int32_t)fp->_bp - (int32_t)fp->_buff));
 	else if (fp->_bp)
-		pos = dpos - (diff = ((long)fp->_bend - (long)fp->_bp));
+		pos = dpos - (diff = ((int32_t)fp->_bend - (int32_t)fp->_bp));
 	else
 		pos = dpos;
Index: libcio/fwrite.c
===================================================================
--- libcio/fwrite.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/fwrite.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -20,7 +20,7 @@
 */
 
-int fwrite(char *buffer, int size, int number, FILE *stream)
+int16_t fwrite(int8_t *buffer, int16_t size, int16_t number, FILE *stream)
 {
-	register int i, j;
+	register int16_t i, j;
 
 	if (size < 0)		/* check size for validity */
Index: libcio/getbuff.c
===================================================================
--- libcio/getbuff.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/getbuff.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,5 +11,5 @@
 void getbuff(FILE *ptr)
 {
-	char *buffer;
+	int8_t *buffer;
 
 	if (ptr->_buflen EQ 1) {	/* see if we want the small buffer */
@@ -21,6 +21,6 @@
 	if (Stdbufs) {		/* see if we have any standard buffers left */
 
-		buffer = (char *)Stdbufs;
-		Stdbufs = *(long **)Stdbufs;
+		buffer = (int8_t *)Stdbufs;
+		Stdbufs = *(int32_t **)Stdbufs;
 
 	} else {		/* ... if not, use the small one */
Index: libcio/getc.c
===================================================================
--- libcio/getc.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/getc.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,7 +9,7 @@
 #include "stddefs.h"
 
-int getc(FILE *ptr)
+int16_t getc(FILE *ptr)
 {
-	register int len;
+	register int16_t len;
 
 	if (ptr->_bp >= ptr->_bend) {		/* see if the buffer is empty */
Index: libcio/getl.c
===================================================================
--- libcio/getl.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/getl.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -8,5 +8,5 @@
 #include "stdio.h"
 
-extern	int	getc(FILE *ptr);
+extern	int16_t	getc(FILE *ptr);
 
 /*
@@ -19,8 +19,8 @@
 */
 
-long getl(FILE *stream)
+int32_t getl(FILE *stream)
 {
-	long temp;
-	register char *t;
+	int32_t temp;
+	register int8_t *t;
 
 	t = &temp;
Index: libcio/getw.c
===================================================================
--- libcio/getw.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/getw.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -8,5 +8,5 @@
 #include "stdio.h"
 
-extern	int	getc(FILE *ptr);
+extern	int16_t	getc(FILE *ptr);
 
 /*
@@ -19,8 +19,8 @@
 */
 
-int getw(FILE *stream)
+int16_t getw(FILE *stream)
 {
-	int temp;
-	register char *t;
+	int16_t temp;
+	register int8_t *t;
 
 	t = &temp;
Index: libcio/lseek.c
===================================================================
--- libcio/lseek.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/lseek.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -13,5 +13,5 @@
 #include "stddefs.h"
 
-extern	int	_seek(struct fcb *fcp);
+extern	int16_t	_seek(struct fcb *fcp);
 
 #if	DEBUGIT
@@ -19,5 +19,5 @@
 #endif
 
-long lseek(int fd, long pos, int how)
+int32_t lseek(int16_t fd, int32_t pos, int16_t how)
 {
 	register struct fcb *fp;
@@ -96,5 +96,5 @@
 	}
 
-	fp->offset = pos & ((long)BPSEC - 1);	/* calculate sector offset */
+	fp->offset = pos & ((int32_t)BPSEC - 1);	/* calculate sector offset */
 	fp->curlsn = pos >> FILESHFT;		/* calculate logical sector */
 
Index: libcio/open.c
===================================================================
--- libcio/open.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/open.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -12,14 +12,14 @@
 #include "stddefs.h"
 
-extern	int	_badfd(void);
-extern	int	_noper(void);
-extern	int	_inifcb(struct fcb *fcp, char *name, char *ext, int mode);
-extern	int	_opfcb(struct fcb *fcp);
-
-extern	char	*FilName(char *s, char *p);
-extern	char	*FilExt(char *s, char *p);
-
-int	_fileop(char *name, int flag, int mode, struct channel *chp, struct devtabl *dp);
-int	_filecl(struct fcb *fp);
+extern	int16_t	_badfd(void);
+extern	int16_t	_noper(void);
+extern	int16_t	_inifcb(struct fcb *fcp, int8_t *name, int8_t *ext, int16_t mode);
+extern	int16_t	_opfcb(struct fcb *fcp);
+
+extern	int8_t	*FilName(int8_t *s, int8_t *p);
+extern	int8_t	*FilExt(int8_t *s, int8_t *p);
+
+int16_t	_fileop(int8_t *name, int16_t flag, int16_t mode, struct channel *chp, struct devtabl *dp);
+int16_t	_filecl(struct fcb *fp);
 
 static struct device condev  = { 2, 2, 1, 0, _noper  };
@@ -55,10 +55,10 @@
 */
 
-int open(char *name, int flag, int mode)
+int16_t open(int8_t *name, int16_t flag, int16_t mode)
 {
 	register struct devtabl	*dp;
 	register struct channel	*chp;
 	register struct device	*dev;
-	int	fd, mdmask;
+	int16_t	fd, mdmask;
 
 	/* search for a free channel */
@@ -131,5 +131,5 @@
 */
 
-int opena(char *name, int flag, int mode)
+int16_t opena(int8_t *name, int16_t flag, int16_t mode)
 {
 	return(open(name, flag, mode));
@@ -145,5 +145,5 @@
 */
 
-int openb(char *name, int flag, int mode)
+int16_t openb(int8_t *name, int16_t flag, int16_t mode)
 {
 	return(open(name, flag|O_RAW, mode));
@@ -164,5 +164,5 @@
 */
 
-int creat(char *name, int mode)
+int16_t creat(int8_t *name, int16_t mode)
 {
 	return(open(name, O_WRONLY|O_TRUNC|O_CREAT, mode));
@@ -183,5 +183,5 @@
 */
 
-int creata(char *name, int mode)
+int16_t creata(int8_t *name, int16_t mode)
 {
 	return(open(name, O_WRONLY|O_TRUNC|O_CREAT, mode));
@@ -198,5 +198,5 @@
 */
 
-int creatb(char *name, int mode)
+int16_t creatb(int8_t *name, int16_t mode)
 {
 	return(open(name, O_WRONLY|O_TRUNC|O_CREAT|O_RAW, mode));
@@ -215,8 +215,8 @@
 */
 
-int _fileop(char *name, int flag, int mode, struct channel *chp, struct devtabl *dp)
+int16_t _fileop(int8_t *name, int16_t flag, int16_t mode, struct channel *chp, struct devtabl *dp)
 {
 	register struct fcb *fp;
-	char	tmpname[9], tmpext[4];
+	int8_t	tmpname[9], tmpext[4];
 
 	/* search for an available fcb entry */
Index: libcio/posit.c
===================================================================
--- libcio/posit.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/posit.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,5 +11,5 @@
 #include "stddefs.h"
 
-extern	int	_seek(struct fcb *fcp);
+extern	int16_t	_seek(struct fcb *fcp);
 
 /*
@@ -19,5 +19,5 @@
 */
 
-int posit(int fd, unsigned pos)
+int16_t posit(int16_t fd, uint16_t pos)
 {
 	register struct fcb *fp;
Index: libcio/putc.c
===================================================================
--- libcio/putc.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/putc.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,15 +9,15 @@
 #include "stddefs.h"
 
-extern	int	write(int fd, char *buff, unsigned len);
+extern	int16_t	write(int16_t fd, int8_t *buff, uint16_t len);
 extern	void	getbuff(FILE *ptr);
-extern	int	close(int fd);
+extern	int16_t	close(int16_t fd);
 
-extern int (*_clsall)();
+extern int16_t (*_clsall)();
 
-static int (*cls_rtn)();
+static int16_t (*cls_rtn)();
 
-int	_ClFlag;
+int16_t	_ClFlag;
 
-int	fclose(FILE *ptr);
+int16_t	fclose(FILE *ptr);
 
 /*
@@ -47,7 +47,7 @@
 */
 
-int flush_(FILE *ptr, int data)
+int16_t flush_(FILE *ptr, int16_t data)
 {
-	register int size;
+	register int16_t size;
 
 	if (_ClFlag EQ 0) {
@@ -60,5 +60,5 @@
 	if (ptr->_flags & _DIRTY) {	/* something in the buffer ? */
 
-		size = (int)((long)ptr->_bp - (long)ptr->_buff);
+		size = (int16_t)((int32_t)ptr->_bp - (int32_t)ptr->_buff);
 
 		if (write(ptr->_unit, ptr->_buff, size) EQ -1) {
@@ -105,5 +105,5 @@
 */
 
-int fflush(FILE *ptr)
+int16_t fflush(FILE *ptr)
 {
 	return(flush_(ptr, -1));
@@ -116,7 +116,7 @@
 */
 
-int fclose(FILE *ptr)
+int16_t fclose(FILE *ptr)
 {
-	int err;
+	int16_t err;
 
 	err = 0;
@@ -131,6 +131,6 @@
 		if (ptr->_flags & _ALLBUF) {	/* deallocate standard buffer */
 
-			*(long **)ptr->_buff = Stdbufs;
-			Stdbufs = (long *)ptr->_buff;
+			*(int32_t **)ptr->_buff = Stdbufs;
+			Stdbufs = (int32_t *)ptr->_buff;
 		}
 	}
@@ -150,5 +150,5 @@
 */
 
-int putc(int c, FILE *ptr)
+int16_t putc(int16_t c, FILE *ptr)
 {
 	if (ptr->_bp GE ptr->_bend)
@@ -164,5 +164,5 @@
 */
 
-int puterr(int c)
+int16_t puterr(int16_t c)
 {
 	return(putc(c, stderr));
Index: libcio/putl.c
===================================================================
--- libcio/putl.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/putl.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,5 +11,5 @@
 #include "stddefs.h"
 
-void putl(long w, FILE *stream)
+void putl(int32_t w, FILE *stream)
 {
 	if (putc(((w >> 24) & 0xFF), stream) < 0 ) 
Index: libcio/putw.c
===================================================================
--- libcio/putw.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/putw.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -11,5 +11,5 @@
 #include "stddefs.h"
 
-void putw(unsigned w, FILE *stream)
+void putw(uint16_t w, FILE *stream)
 {
 	if (putc(((w >> 8) & 0xFF), stream) < 0 ) 
Index: libcio/read.c
===================================================================
--- libcio/read.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/read.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -46,13 +46,13 @@
 #endif
 
-extern	int	_badfd(void);
-extern	int	_conin(char *buff, int len);
-extern	int	_seek(struct fcb *fcp);
+extern	int16_t	_badfd(void);
+extern	int16_t	_conin(int8_t *buff, int16_t len);
+extern	int16_t	_seek(struct fcb *fcp);
 
-extern	void	*memcpy(void *vp1, void *vp2, int n);
+extern	void	*memcpy(void *vp1, void *vp2, int16_t n);
 
-int	_filerd(struct fcb *fp, char *buffer, unsigned len);
+int16_t	_filerd(struct fcb *fp, int8_t *buffer, uint16_t len);
 
-static int (*t_read[])() = {
+static int16_t (*t_read[])() = {
 
 	_badfd,		/* 0 - invalid type */
@@ -72,5 +72,5 @@
 */
 
-int read(int fd, char *buff, unsigned len)
+int16_t read(int16_t fd, int8_t *buff, uint16_t len)
 {
 	register struct channel *chp;
@@ -97,5 +97,5 @@
 */
 
-int _getsec(struct fcb *fp, char *buf, unsigned len)
+int16_t _getsec(struct fcb *fp, int8_t *buf, uint16_t len)
 {
 	if ((errno = ReadRN(fp, Wrkbuf)) NE 0)	/* get current sector */
@@ -126,9 +126,9 @@
 */
 
-int _filerd(struct fcb *fp, char *buffer, unsigned len)
+int16_t _filerd(struct fcb *fp, int8_t *buffer, uint16_t len)
 {
-	register unsigned l;
-	register unsigned j, k;
-	register long curpos, newpos;
+	register uint16_t l;
+	register uint16_t j, k;
+	register int32_t curpos, newpos;
 
 	l = 0;
Index: libcio/readrn.c
===================================================================
--- libcio/readrn.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/readrn.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -27,9 +27,9 @@
 
 #if	TBUFFER
-extern	long	_secrd(char *buf, short rec);
+extern	int32_t	_secrd(int8_t *buf, int16_t rec);
 #endif
 
-extern	long	_berrno;
-extern	int	_seek(struct fcb *fcp);
+extern	int32_t	_berrno;
+extern	int16_t	_seek(struct fcb *fcp);
 
 /* 
@@ -44,8 +44,8 @@
 */
 
-int ReadRN(struct fcb *fcp, char *buf)
+int16_t ReadRN(struct fcb *fcp, int8_t *buf)
 {
-	int	sv;		/* seek return code */
-	long	brc;		/* bios return code */
+	int16_t	sv;		/* seek return code */
+	int32_t	brc;		/* bios return code */
 
 	if (sv = _seek(fcp))		/* try to find the sector we want */
@@ -68,5 +68,5 @@
 
 #if	TBUFFER
-	if (brc = _secrd(buf, (short)fcp->curdsn)) {
+	if (brc = _secrd(buf, (int16_t)fcp->curdsn)) {
 #else
 	if (brc = BIOS(B_RDWR, 0, buf, 1, (short)fcp->curdsn, 0)) {
Index: libcio/rename.c
===================================================================
--- libcio/rename.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/rename.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -6,7 +6,7 @@
 */
 
-int rename(char *old, char *new)
+int16_t rename(int8_t *old, int8_t *new)
 {
-	char buff[60];
+	int8_t buff[60];
 
 	return(-1);		/* return an error for now */
Index: libcio/scan.c
===================================================================
--- libcio/scan.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/scan.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -10,22 +10,22 @@
 #include "ctype.h"
 
-static int maxwide;
-static int (*gsub)();
-
-extern char *index(char *str, char c);
-
-static char *scnstr;
-static char quit;
-
-/* 
-
-*/
-
-static long getnum(char *list, char *values, int base)
-{
-	register long val;
-	register char *cp;
-	int c;
-	int sign;
+static int16_t maxwide;
+static int16_t (*gsub)();
+
+extern int8_t *index(int8_t *str, int8_t c);
+
+static int8_t *scnstr;
+static int8_t quit;
+
+/* 
+
+*/
+
+static int32_t getnum(int8_t *list, int8_t *values, int16_t base)
+{
+	register int32_t val;
+	register int8_t *cp;
+	int16_t c;
+	int16_t sign;
 
 	if (maxwide LE 0)
@@ -53,5 +53,5 @@
 
 		val *= base;
-		val += values[(long)cp - (long)list];
+		val += values[(int32_t)cp - (int32_t)list];
 	}
 
@@ -66,5 +66,5 @@
 */
 
-static int skipblk(void)
+static int16_t skipblk(void)
 {
 	while (isspace((*gsub)(0)))
@@ -77,5 +77,5 @@
 }
 
-static int sgetc(int what)
+static int16_t sgetc(int16_t what)
 {
 	if (what EQ 0) {
@@ -99,5 +99,5 @@
 */
 
-int scanfmt(int (*getsub)(), char *fmt, int **args)
+int16_t scanfmt(int16_t (*getsub)(), int8_t *fmt, int16_t **args)
 {
 
@@ -106,12 +106,12 @@
 #endif
 
-	long lv;
-	int c, count, dontdo, lflag, base;
-	char *cp;
-	char tlist[130];
-
-	static char list[] = "ABCDEFabcdef9876543210";
-
-	static char vals[] = {
+	int32_t lv;
+	int16_t c, count, dontdo, lflag, base;
+	int8_t *cp;
+	int8_t tlist[130];
+
+	static int8_t list[] = "ABCDEFabcdef9876543210";
+
+	static int8_t vals[] = {
 
 		10,11,12,13,14,15,10,11,12,13,14,15,9,8,7,6,5,4,3,2,1,0
@@ -198,5 +198,5 @@
 
 					if (lflag)
-						*(long *)(*args++) = lv;
+						*(int32_t *)(*args++) = lv;
 					else
 						**args++ = lv;
@@ -298,5 +298,5 @@
 				if (!dontdo) {
 
-					*(char *)(*args++) = c;
+					*(int8_t *)(*args++) = c;
 					++count;
 				}
@@ -379,5 +379,5 @@
 */
 
-int sscanf(char *string, char *fmt, int *args)
+int16_t sscanf(int8_t *string, int8_t *fmt, int16_t *args)
 {
 	scnstr = string;
Index: libcio/setbuf.c
===================================================================
--- libcio/setbuf.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/setbuf.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -8,5 +8,5 @@
 #include "stdio.h"
 
-void setbuf(FILE *stream, char *buffer)
+void setbuf(FILE *stream, int8_t *buffer)
 {
 	if (stream->_buff)
Index: libcio/ungetc.c
===================================================================
--- libcio/ungetc.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/ungetc.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -9,5 +9,5 @@
 #include "stddefs.h"
 
-int ungetc(int c, FILE *ptr)
+int16_t ungetc(int16_t c, FILE *ptr)
 {
 	if ((c EQ EOF) OR (ptr->_bp LE ptr->_buff))
Index: libcio/unlink.c
===================================================================
--- libcio/unlink.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/unlink.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -17,5 +17,5 @@
 #endif
 
-extern	int	DelFile(struct fcb *fcp);
+extern	int16_t	DelFile(struct fcb *fcp);
 
 /*
@@ -25,5 +25,5 @@
 */
 
-int unlink(char *name)
+int16_t unlink(int8_t *name)
 {
 	struct fcb delfcb;
Index: libcio/write.c
===================================================================
--- libcio/write.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/write.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -13,22 +13,22 @@
 #include "stddefs.h"
 
-int	_filewr(struct fcb *fp, char *buffer, unsigned len);
-
-extern	int	_badfd(void);
-extern	int	_conwr(int kind, char *buff, int len);
-extern	int	blkwr(struct fcb *fcp, char *buf, int ns);
-extern	int	ReadRN(struct fcb *fcp, char *buf);
-extern	int	WriteRN(struct fcb *fcp, char *buf);
-extern	int	_newcls(void);
-extern	short	micons(short wi);
-extern	void	_ptcl12(unsigned *fat, unsigned cl, unsigned val);
-
-extern	long	miconl(long wi);
-
-extern	void	*memset(void *vp, char c, int n);
-
-extern	int	_fatmod;
-
-extern	unsigned	_thefat[];
+int16_t	_filewr(struct fcb *fp, int8_t *buffer, uint16_t len);
+
+extern	int16_t	_badfd(void);
+extern	int16_t	_conwr(int16_t kind, int8_t *buff, int16_t len);
+extern	int16_t	blkwr(struct fcb *fcp, int8_t *buf, int16_t ns);
+extern	int16_t	ReadRN(struct fcb *fcp, int8_t *buf);
+extern	int16_t	WriteRN(struct fcb *fcp, int8_t *buf);
+extern	int16_t	_newcls(void);
+extern	int16_t	micons(int16_t wi);
+extern	void	_ptcl12(uint16_t *fat, uint16_t cl, uint16_t val);
+
+extern	int32_t	miconl(int32_t wi);
+
+extern	void	*memset(void *vp, int8_t c, int16_t n);
+
+extern	int16_t	_fatmod;
+
+extern	uint16_t	_thefat[];
 
 extern	struct	bpb	*_thebpb;
@@ -38,5 +38,5 @@
 #endif
 
-static	int	(*wr_tab[])() = {	/* write routine dispatch table */
+static	int16_t	(*wr_tab[])() = {	/* write routine dispatch table */
 
 	_badfd,		/* 0 - invalid entry */
@@ -55,5 +55,5 @@
 */
 
-int _putsec(struct fcb *fp, char *buf, unsigned len)
+int16_t _putsec(struct fcb *fp, int8_t *buf, uint16_t len)
 {
 #if DEBUGIT
@@ -126,9 +126,9 @@
 */
 
-int _filewr(struct fcb *fp, char *buffer, unsigned len)
+int16_t _filewr(struct fcb *fp, int8_t *buffer, uint16_t len)
 {
-	register unsigned j, k, l;
-	int clustr;
-	register long curpos;
+	register uint16_t j, k, l;
+	int16_t clustr;
+	register int32_t curpos;
 
 	curpos = fp->offset + (fp->curlsn << FILESHFT);	/* get position */
@@ -245,5 +245,5 @@
 */
 
-int write(int fd, char *buff, unsigned len)
+int16_t write(int16_t fd, int8_t *buff, uint16_t len)
 {
 	register struct channel *chp;
Index: libcio/writern.c
===================================================================
--- libcio/writern.c	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ libcio/writern.c	(revision 7848656beb2903f579b69a9e8ae840577e026a94)
@@ -22,6 +22,6 @@
 #include "fspars.h"
 
-extern	long	_berrno;
-extern	int	_seek(struct fcb *fcp);
+extern	int32_t	_berrno;
+extern	int16_t	_seek(struct fcb *fcp);
 
 #if DEBUGIT
@@ -30,5 +30,5 @@
 
 #if	TBUFFER
-extern	long	_secwr(char *buf, short rec);
+extern	int32_t	_secwr(int8_t *buf, int16_t rec);
 #endif
 
@@ -44,8 +44,8 @@
 */
 
-int WriteRN(struct fcb *fcp, char *buf)
+int16_t WriteRN(struct fcb *fcp, int8_t *buf)
 {
-	int	sv;		/* seek return code */
-	long	brc;		/* bios return code */
+	int16_t	sv;		/* seek return code */
+	int32_t	brc;		/* bios return code */
 
 	if (sv = _seek(fcp)) {		/* try to find the sector we want */
@@ -86,5 +86,5 @@
 	/* write the sector */
 
-	if (brc = BIOS(B_RDWR, 1, buf, 1, (short)fcp->curdsn, 0)) {
+	if (brc = BIOS(B_RDWR, 1, buf, 1, (int16_t)fcp->curdsn, 0)) {
 
 #if DEBUGIT
@@ -99,5 +99,5 @@
 
 #if	TBUFFER
-	_secwr(buf, (short)fcp->curdsn);
+	_secwr(buf, (int16_t)fcp->curdsn);
 #endif
 
