Index: libcio/filesys.c
===================================================================
--- libcio/filesys.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ libcio/filesys.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -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
