Index: ram/ldselbx.c
===================================================================
--- ram/ldselbx.c	(revision 6dd74a91deaf351eb39ff277233faa17ef83cab5)
+++ ram/ldselbx.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -28,33 +28,33 @@
 #include "scfns.h"
 
-extern	void	ldswin(short n);
+extern	void	ldswin(int16_t n);
 extern	void	advlcur(void);
 extern	void	bsplcur(void);
-extern	void	ttcpos(short row, short col);
-extern	short	fcindex(void);
-extern	short	storit(void);
-extern	int	showsiz(void);
-extern	short	get_asg(void);
-extern	short	get_orc(short lorh, short kind);
-extern	short	get_tun(void);
-extern	short	get_wav(void);
+extern	void	ttcpos(int16_t row, int16_t col);
+extern	int16_t	fcindex(void);
+extern	int16_t	storit(void);
+extern	int16_t	showsiz(void);
+extern	int16_t	get_asg(void);
+extern	int16_t	get_orc(int16_t lorh, int16_t kind);
+extern	int16_t	get_tun(void);
+extern	int16_t	get_wav(void);
 extern	void	nokey(void);
-extern	short	ldline(short cy);
-extern	short	lin2slt(short line);
-extern	void	dslslot(short slot, unsigned fg, short row);
-extern	void	vtdisp(unsigned *obj, unsigned fg, unsigned bg, short row, short col, char *buf);
-extern	void	ldpoint(short x, short y, short pen);
-extern	short	rd_ec(FILE *fp, char *to, long len);
+extern	int16_t	ldline(int16_t cy);
+extern	int16_t	lin2slt(int16_t line);
+extern	void	dslslot(int16_t slot, uint16_t fg, int16_t row);
+extern	void	vtdisp(uint16_t *obj, uint16_t fg, uint16_t bg, int16_t row, int16_t col, int8_t *buf);
+extern	void	ldpoint(int16_t x, int16_t y, int16_t pen);
+extern	int16_t	rd_ec(FILE *fp, int8_t *to, int32_t len);
 extern	void	fcreset(void);
-extern	short	ftkind(short ns);
-extern	void	ldwmsg(char *line1, char *line2, char *line3, unsigned fgcolor, unsigned bgcolor);
-extern	void	ldbusy(char *msg);
-extern	short	ckstor(void);
-extern	short	get_pat(void);
-extern	short	get_scr(void);
-
-extern	unsigned	exp_c(unsigned c);
-
-extern	char	*slotnam(unsigned slot, unsigned kind);
+extern	int16_t	ftkind(int16_t ns);
+extern	void	ldwmsg(int8_t *line1, int8_t *line2, int8_t *line3, uint16_t fgcolor, uint16_t bgcolor);
+extern	void	ldbusy(int8_t *msg);
+extern	int16_t	ckstor(void);
+extern	int16_t	get_pat(void);
+extern	int16_t	get_scr(void);
+
+extern	uint16_t	exp_c(uint16_t c);
+
+extern	int8_t	*slotnam(uint16_t slot, uint16_t kind);
 
 /* 
@@ -66,53 +66,53 @@
 #endif
 
-extern	void	(*point)(short x, short y, short pen);
-
-extern	short	asmode;
-extern	short	catin;
-extern	short	cxrate;
-extern	short	cxval;
-extern	short	cyrate;
-extern	short	cyval;
-extern	int	errno;
-extern	short	gomode;
-extern	short	hitcx;
-extern	short	hitcy;
-extern	short	ismode;
-extern	short	lasgsw;
-extern	short	ldelsw;
-extern	short	lderrsw;
-extern	short	ldkind;
-extern	short	ldrow;
-extern	short	ldslot;
-extern	short	lksel;
-extern	short	lmwtype;
-extern	short	lorchl;
-extern	short	lorchsw;
-extern	short	lorclsw;
-extern	short	ldpass;
-extern	short	lpatsw;
-extern	short	lrasw;
-extern	short	lscrsw;
-extern	short	lselsw;
-extern	short	lseqsw;
-extern	short	lstrsw;
-extern	short	ltagged;
-extern	short	ltunsw;
-extern	short	lwavsw;
-extern	short	ndisp;
-extern	short	oldpk;
-extern	short	oldsl;
-extern	short	pkctrl;
-extern	short	sliders;
-extern	short	stcrow;
-extern	short	stccol;
-extern	short	tagslot;
-
-extern	unsigned	*librob;
-
-extern	short	ldmap[];
-extern	short	scsizes[][2];
-
-extern	short	ldbox[][8];
+extern	void	(*point)(int16_t x, int16_t y, int16_t pen);
+
+extern	int16_t	asmode;
+extern	int16_t	catin;
+extern	int16_t	cxrate;
+extern	int16_t	cxval;
+extern	int16_t	cyrate;
+extern	int16_t	cyval;
+extern	int16_t	errno;
+extern	int16_t	gomode;
+extern	int16_t	hitcx;
+extern	int16_t	hitcy;
+extern	int16_t	ismode;
+extern	int16_t	lasgsw;
+extern	int16_t	ldelsw;
+extern	int16_t	lderrsw;
+extern	int16_t	ldkind;
+extern	int16_t	ldrow;
+extern	int16_t	ldslot;
+extern	int16_t	lksel;
+extern	int16_t	lmwtype;
+extern	int16_t	lorchl;
+extern	int16_t	lorchsw;
+extern	int16_t	lorclsw;
+extern	int16_t	ldpass;
+extern	int16_t	lpatsw;
+extern	int16_t	lrasw;
+extern	int16_t	lscrsw;
+extern	int16_t	lselsw;
+extern	int16_t	lseqsw;
+extern	int16_t	lstrsw;
+extern	int16_t	ltagged;
+extern	int16_t	ltunsw;
+extern	int16_t	lwavsw;
+extern	int16_t	ndisp;
+extern	int16_t	oldpk;
+extern	int16_t	oldsl;
+extern	int16_t	pkctrl;
+extern	int16_t	sliders;
+extern	int16_t	stcrow;
+extern	int16_t	stccol;
+extern	int16_t	tagslot;
+
+extern	uint16_t	*librob;
+
+extern	int16_t	ldmap[];
+extern	int16_t	scsizes[][2];
+
+extern	int16_t	ldbox[][8];
 
 extern	struct	scndx	sindex[];
@@ -125,21 +125,21 @@
 extern	LPF	t_libr[];
 
-extern	char	bfs[];
-extern	char	ldfile[];
-extern	char	ldcmnt[];
-
-extern	char	loadedf[][8];
-extern	char	loadedc[][37];
+extern	int8_t	bfs[];
+extern	int8_t	ldfile[];
+extern	int8_t	ldcmnt[];
+
+extern	int8_t	loadedf[][8];
+extern	int8_t	loadedc[][37];
 
 /* forward references */
 
-short	bx_null(void);
-short	ldfnbox(short n);
-
-/* 
-
-*/
-
-short	ft2lt[] = {	/* file type to load type map */
+int16_t	bx_null(void);
+int16_t	ldfnbox(int16_t n);
+
+/* 
+
+*/
+
+int16_t	ft2lt[] = {	/* file type to load type map */
 
 	LT_ASG,
@@ -181,8 +181,8 @@
 */
 
-void skperr(short sn)
-{
-	char	scid[32];
-	char	erms[64];
+void skperr(int16_t sn)
+{
+	int8_t	scid[32];
+	int8_t	erms[64];
 
 	clrlsel();
@@ -205,9 +205,9 @@
 */
 
-short skp_ec(FILE *fp, long len)
-{
-	register long count;
-	register int c;
-	char errbuf[64];
+int16_t skp_ec(FILE *fp, int32_t len)
+{
+	register int32_t count;
+	register int16_t c;
+	int8_t errbuf[64];
 
 	for (count = 0; count < len; count++) {
@@ -220,5 +220,5 @@
 
 			ldermsg("Unexpected EOF",
-				errbuf, (char *)NULL, LD_EMCF, LD_EMCB);
+				errbuf, (int8_t *)NULL, LD_EMCF, LD_EMCB);
 
 #if	DEBUGIT
@@ -246,13 +246,13 @@
 */
 
-short scskip(FILE *fp, short ns)
-{
-	register short ehdr, go;
-	char etype;
-	char erms[64];
+int16_t scskip(FILE *fp, int16_t ns)
+{
+	register int16_t ehdr, go;
+	int8_t etype;
+	int8_t erms[64];
 
 	go = TRUE;
 
-	if (skp_ec(fp, (long)(N_SECTS * 12))) { 	/* skip section times */
+	if (skp_ec(fp, (int32_t)(N_SECTS * 12))) { 	/* skip section times */
 
 		skperr(ns);
@@ -276,5 +276,5 @@
 	}
 
-	if (skp_ec(fp, (long)(scsizes[etype][1] - 1))) {	/* skip data */
+	if (skp_ec(fp, (int32_t)(scsizes[etype][1] - 1))) {	/* skip data */
 
 		skperr(ns);
@@ -295,5 +295,5 @@
 		/* skip the event's data */
 
-		if (skp_ec(fp, (long)(scsizes[etype][1] - 1))) {
+		if (skp_ec(fp, (int32_t)(scsizes[etype][1] - 1))) {
 
 			skperr(ns);
@@ -319,7 +319,7 @@
 */
 
-void ldermsg(char *p1, char *p2, char *p3, unsigned p4, unsigned p5)
-{
-	char msgbuf[64];
+void ldermsg(int8_t *p1, int8_t *p2, int8_t *p3, uint16_t p4, uint16_t p5)
+{
+	int8_t msgbuf[64];
 
 	if (NOT lderrsw) {			/* put up new messages only */
@@ -406,7 +406,7 @@
 */
 
-void savefc(short kind)
-{
-	short fi;
+void savefc(int16_t kind)
+{
+	int16_t fi;
 
 	fi = ft2lt[kind - 1];
@@ -429,7 +429,7 @@
 */
 
-short lcancel(short lct)
-{
-	short rc;
+int16_t lcancel(int16_t lct)
+{
+	int16_t rc;
 
 	rc = FALSE;
@@ -467,8 +467,8 @@
 */
 
-void dpy_scr(unsigned color, short ns)
-{
-	char buf[40];
-	long scl;
+void dpy_scr(uint16_t color, int16_t ns)
+{
+	int8_t buf[40];
+	int32_t scl;
 
 	if (ndisp NE 0)
@@ -505,6 +505,6 @@
 void lst_scr(void)
 {
-	register short i;
-	unsigned cx;
+	register int16_t i;
+	uint16_t cx;
 
 	if (ndisp NE 0)
@@ -547,12 +547,12 @@
 */
 
-short ndx_scr(short slot)
+int16_t ndx_scr(int16_t slot)
 {
 	register FILE *fp;
-	register short i;
-	register long rlen;
-	long rdlen;
-	char msgbuf1[64];
-	char msgbuf2[64];
+	register int16_t i;
+	register int32_t rlen;
+	int32_t rdlen;
+	int8_t msgbuf1[64];
+	int8_t msgbuf2[64];
 
 	ldpass = 0;
@@ -585,5 +585,5 @@
 
 		ldermsg("Seek failure",
-			(char *)NULL, msgbuf2,
+			(int8_t *)NULL, msgbuf2,
 			LD_EMCF, LD_EMCB);
 
@@ -740,5 +740,5 @@
 */
 
-short getit(void)
+int16_t getit(void)
 {
 	ldkind = ftkind(ldslot);
@@ -747,5 +747,5 @@
 
 		ldermsg("Unknown file type",
-			(char *)NULL, (char *)NULL,
+			(int8_t *)NULL, (int8_t *)NULL,
 			LD_EMCF, LD_EMCB);
 
@@ -814,5 +814,5 @@
 
 		ldermsg("ldkind bad",
-			(char *)NULL, (char *)NULL,
+			(int8_t *)NULL, (int8_t *)NULL,
 			LD_EMCF, LD_EMCB);
 
@@ -852,7 +852,7 @@
 */
 
-short ldfnbox(short n)
-{
-	register short col, i, slot, sn;
+int16_t ldfnbox(int16_t n)
+{
+	register int16_t col, i, slot, sn;
 
 	col = hitcx >> 3;
