www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/31/18:04:50

From: Dan Nelson <dan AT dan DOT emsphone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: djgpp and joe (Joe's Own Editor)
Date: 31 May 1997 20:10:12 GMT
Organization: Executive Marketing Services, Inc.
Lines: 814
Message-ID: <5mq0j4$aa4@client2.news.psi.net>
References: <allan DOT 864982191 AT rscernix>
Reply-To: dnelson AT emsphone DOT com (Dan Nelson)
NNTP-Posting-Host: 199.67.51.101
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <allan DOT 864982191 AT rscernix>,
Allan Skillman <allan AT hpopl1 DOT cern DOT ch> wrote:
> I've recently been attempting to port some UNIX software over to
> MSDOS using the djgpp environment, which I must say is excellent. I
> do however miss my favorite UNIX editor joe. I guess I could use
> emacs, but I really do prefer joe.
>
> Has anyone managed to port this editor over to djgpp? The latest
> version does include an MSDOS port, but it would appear to be for a
> real mode compiler - the MSDOS specific code uses direct screen and
> register access.

This is the way to go; there's no reason to try to do terminal
optimization when you have direct access to the screen.

I made the necessary changes to Joe about 2 years ago, and we've been
using it at work to edit 100-meg files at times.  It autodetects the
free memory on the system, and swaps to a disk file if necessary, just
like Joe on Unix.

It's a little slow on a 386/25 (because I draw each character to the
screen one at a time, instead of batching them up), and there is no
subshell support (of course) but apart from that it works great.  It
even works with lfn's under 95.

The diffs are small enough I'll just post them here.  Compile with make
-f make.dj.

	-Dan Nelson
	dnelson AT emsphne DOT com


diff -bu --recurs --new-file joe/bw.c joe_a/bw.c
--- joe/bw.c	Fri Jan 20 08:38:24 1995
+++ joe_a/bw.c	Fri Jul  7 19:20:26 1995
@@ -176,7 +176,7 @@
 static int lgen(t,y,screen,x,w,p,scr,from,to)
 SCRN *t;
 int y;
-int *screen;	/* Screen line address */
+scrn_char *screen;	/* Screen line address */
 int w;		/* Window */
 P *p;		/* Buffer pointer */
 long scr;	/* Starting column to display */
@@ -340,7 +340,9 @@
   do
    {
    outatr(t,screen+x,x,y,' ',c1);
+#ifndef __MSDOS__
    if(ifhave) goto bye;
+#endif
    if(++x==w) goto eosl;
    }
    while(--ta);
@@ -351,7 +353,9 @@
   xlat(c,bc);
   c^=c1;
   outatr(t,screen+x,x,y,bc,c);
+#ifndef __MSDOS__
   if(ifhave) goto bye;
+#endif
   if(++x==w) goto eosl;
   }
  }
@@ -399,7 +403,7 @@
 static int lgena(t,y,screen,x,w,p,scr,from,to)
 SCRN *t;
 int y;
-int *screen;	/* Screen line address */
+scrn_char *screen;	/* Screen line address */
 int w;		/* Window */
 P *p;		/* Buffer pointer */
 long scr;	/* Starting column to display */
@@ -554,7 +558,7 @@
 
 void gennum(w,screen,t,y,comp)
 BW *w;
-int *screen;
+scrn_char *screen;
 SCRN *t;
 int *comp;
  {
@@ -566,7 +570,9 @@
  for(z=0;buf[z];++z)
   {
   outatr(t,screen+z,z,y,buf[z],0);
+#ifndef __MSDOS__
   if(ifhave) return;
+#endif
   comp[z]=buf[z];
   }
  }
@@ -574,7 +580,7 @@
 void bwgen(w,linums)
 BW *w;
 {
-int *screen;
+scrn_char *screen;
 P *p=0;
 P *q=pdup(w->cursor);
 int bot=w->h+w->y;
diff -bu --recurs --new-file joe/conf.c joe_a/conf.c
--- joe/conf.c	Fri Jan 13 17:10:32 1995
+++ joe_a/conf.c	Sat May 31 13:28:08 1997
@@ -121,6 +121,8 @@
  fprintf(f,"\n");
 
  /* Check if we have utime.h */
+
+#ifdef __MSDOS__
  if(g=fopen("/usr/include/utime.h","r"))
   {
   fprintf(f,"/* Uncomment if we have utime.h */\n");
@@ -141,6 +143,11 @@
   fprintf(f,"/* #define UTIME 1 */\n");
   fprintf(f,"/* #define SYSUTIME 1 */\n");
   }
+#else
+  fprintf(f,"/* Uncomment if we have utime.h */\n");
+  fprintf(f,"#define UTIME 1\n");
+  fprintf(f,"/* #define SYSUTIME 1 */\n");
+#endif
 
  fprintf(f,"\n");
 
@@ -175,7 +182,7 @@
  fprintf(f,"/* #define AUTOINC 1 */\n");
  fprintf(f,"/* #define ALIGNED 1 */\n");
 
-#ifdef __MSDOS__
+#if defined (__MSDOS__) && !defined(__DJGPP__)
  if(sizeof(void *)==4)
   {
   fprintf(f,"#define physical(a) (((unsigned long)(a)&0xFFFF)+(((unsigned long)(a)&0xFFFF0000)>>12))\n");
@@ -196,7 +203,7 @@
  fprintf(f,"#define physical(a) ((unsigned long)(a))\n");
  fprintf(f,"#define normalize(a) (a)\n");
  fprintf(f,"#define SEGSIZ 4096\n");
- fprintf(f,"#define PGSIZE 4096\n");
+ fprintf(f,"#define PGSIZE %d\n",getpagesize());
  fprintf(f,"#define LPGSIZE 12\n");
  fprintf(f,"#define ILIMIT (PGSIZE*1024)\n");
  fprintf(f,"#define HTSIZE 2048\n");
@@ -205,7 +212,7 @@
 
  fprintf(f,"char *getenv();\n");
  if(sizeof(long)==8) fprintf(f,"int time();\n");
- else fprintf(f,"long time();\n");
+ else fprintf(f,"unsigned long time();\n");
  fprintf(f,"void *malloc();\n");
  fprintf(f,"void free();\n");
  fprintf(f,"void *calloc();\n");
diff -bu --recurs --new-file joe/main.c joe_a/main.c
--- joe/main.c	Sun Jan 22 00:21:08 1995
+++ joe_a/main.c	Sat May 31 13:15:34 1997
@@ -38,8 +38,8 @@
            exask, skiptop, noxon, lines, staen, columns, Baud, dopadding,
            marking, beep;
 
-extern int idleout;	/* Clear to use /dev/tty for screen */
-extern char *joeterm;
+int idleout;	/* Clear to use /dev/tty for screen */
+char *joeterm;
 int help=0;		/* Set to have help on when starting */
 int nonotice=0;		/* Set to prevent copyright notice */
 int orphan=0;
@@ -169,10 +169,29 @@
  int backopt;
  int c;
 
+#ifdef __DJGPP__
+ unsigned long memmax;
+#endif
+
  mainenv=envv;
 
 #ifdef __MSDOS__
+
+#ifdef __DJGPP__
+ if (_go32_dpmi_remaining_physical_memory()>0)
+ { memmax=(_go32_dpmi_remaining_physical_memory()/100)*95;
+   if (memmax<64000) memmax=_go32_dpmi_remaining_physical_memory();
+ } else
+ { memmax=_go32_dpmi_remaining_virtual_memory()/100*95;
+ }
+ vlimit(memmax);
+ fprintf (stderr,"Editor memory is %luK.\n",memmax/1024);
+ 
+#endif /* __DJGPP__ */
+
+
  _fmode=O_BINARY;
+
  zcpy(stdbuf,argv[0]);
  joesep(stdbuf);
  run=namprt(stdbuf);
@@ -183,9 +202,10 @@
    run=vstrunc(run,c);
    break;
    }
+
 #else
  run=namprt(argv[0]);
-#endif 
+#endif /* __MSDOS__ */
 
  if(s=getenv("LINES")) sscanf(s,"%d",&lines);
  if(s=getenv("COLUMNS")) sscanf(s,"%d",&columns);
@@ -372,3 +392,4 @@
  if(exmsg) fprintf(stderr,"\n%s\n",exmsg);
  return 0;
  }
+
diff -bu --recurs --new-file joe/make.dj joe_a/make.dj
--- joe/make.dj	Wed Dec 31 19:00:00 1969
+++ joe_a/make.dj	Mon Feb 12 19:31:04 1996
@@ -0,0 +1,130 @@
+# Makefile for Joe's Own Editor
+
+###############
+# Configuration
+###############
+
+# Set where you want joe to go, where you
+# want joe's initialization file (joerc)
+# to go and where you want the man page
+# to go:
+
+WHEREJOE = /usr/local/bin
+WHERERC = /usr/local/lib
+WHEREMAN = /usr/man/man1
+
+# If you want to use TERMINFO, you have to set
+# the following variable to 1.  Also you have to
+# include some additional libraries- see below.
+
+TERMINFO = 0
+
+# You may also have to add some additional
+# defines to get the include files to work
+# right on some systems.
+#
+# for some HPUX systems, you need to add:  -D_HPUX_SOURCE
+
+# C compiler options: make's built-in rules use this variable
+
+CFLAGS = -O2 -m486
+
+# C compiler to use: make's built-in rules use this variable
+
+CC = gcc
+
+# You may have to include some extra libraries
+# for some systems
+#
+# for Xenix, add (in this order!!): -ldir -lx
+#
+# For some systems you might have to add: -lbsd
+# to get access to the timer system calls.
+#
+# If you wish to use terminfo, you have to
+# add '-ltinfo', '-lcurses' or '-ltermlib',
+# depending on the system.
+
+EXTRALIBS =
+
+# Object files
+
+OBJS = b.o blocks.o bw.o cmd.o hash.o help.o kbd.o macro.o main.o menu.o \
+ path.o poshist.o pw.o queue.o qw.o random.o rc.o regex.o msscrn.o tab.o \
+ mstty.o tw.o ublock.o uedit.o uerror.o ufile.o uformat.o uisrch.o \
+ umath.o undo.o usearch.o ushell.o utag.o va.o vfile.o vs.o w.o zstr.o
+
+# That's it!
+
+# How to make joe from object files.  Object files are made from source
+# files using make's built-in rules.
+
+joe: $(OBJS)
+#	rm -f jmacs jstar rjoe jpico
+	$(CC) $(CFLAGS) -s -o joe $(OBJS) $(EXTRALIBS)
+#	strip joe
+#	coff2exe joe
+#	ln joe jmacs
+#	ln joe jstar
+#	ln joe rjoe
+#	ln joe jpico
+
+# All object files depend on config.h
+
+$(OBJS): config.h
+
+# How to make config.h
+
+config.h: conf.c
+	$(CC) conf.c -o conf
+	conf $(WHERERC) $(TERMINFO)
+
+# How to make termidx
+
+termidx: termidx.o
+	$(CC) $(CFLAGS) -o termidx termidx.o
+
+# Install proceedure
+
+install: joe termidx
+	strip joe
+	strip termidx
+	if [ ! -d $(WHEREJOE) ]; then mkdir $(WHEREJOE); chmod a+rx $(WHEREJOE); fi
+	rm -f $(WHEREJOE)/joe $(WHEREJOE)/jmacs $(WHEREJOE)/jstar $(WHEREJOE)/jpico $(WHEREJOE)/rjoe $(WHEREJOE)/termidx
+	mv joe $(WHEREJOE)
+	ln $(WHEREJOE)/joe $(WHEREJOE)/jmacs
+	ln $(WHEREJOE)/joe $(WHEREJOE)/jstar
+	ln $(WHEREJOE)/joe $(WHEREJOE)/rjoe
+	ln $(WHEREJOE)/joe $(WHEREJOE)/jpico
+	mv termidx $(WHEREJOE)
+	if [ ! -d $(WHERERC) ]; then mkdir $(WHERERC); chmod a+rx $(WHERERC); fi
+	rm -f $(WHERERC)/joerc $(WHERERC)/jmacsrc $(WHERERC)/jstarrc $(WHERERC)/jpicorc $(WHERERC)/rjoerc $(WHEREMAN)/joe.1
+	cp joerc $(WHERERC)
+	cp jmacsrc $(WHERERC)
+	cp jstarrc $(WHERERC)
+	cp rjoerc $(WHERERC)
+	cp jpicorc $(WHERERC)
+	cp joe.1 $(WHEREMAN)
+	chmod a+x $(WHEREJOE)/joe
+	chmod a+x $(WHEREJOE)/jmacs
+	chmod a+x $(WHEREJOE)/jstar
+	chmod a+x $(WHEREJOE)/rjoe
+	chmod a+x $(WHEREJOE)/jpico
+	chmod a+r $(WHERERC)/joerc
+	chmod a+r $(WHERERC)/jmacsrc
+	chmod a+r $(WHERERC)/jstarrc
+	chmod a+r $(WHERERC)/rjoerc
+	chmod a+r $(WHERERC)/jpicorc
+	chmod a+r $(WHEREMAN)/joe.1
+	chmod a+x $(WHEREJOE)/termidx
+	rm -f $(WHERERC)/termcap
+	cp termcap $(WHERERC)/termcap
+	chmod a+r $(WHERERC)/termcap
+	rm -f $(WHERERC)/terminfo
+	cp terminfo $(WHERERC)/terminfo
+	chmod a+r $(WHERERC)/terminfo
+
+# Cleanup proceedure
+
+clean:
+	del *.o conf.exe config.h
diff -bu --recurs --new-file joe/make.dos joe_a/make.dos
--- joe/make.dos	Sat Jan  7 15:17:06 1995
+++ joe_a/make.dos	Fri Jul  7 19:15:40 1995
@@ -57,9 +57,9 @@
 	copy joe.exe jpico.exe
 	copy joe.exe rjoe.exe
 
-# $(OBJS): config.h
+$(OBJS): config.h
 
-config.h:
+config.h: conf.c
         bcc -ml conf.c
         del conf.obj
         conf $(WHERERC) $(IDLEOUT)
diff -bu --recurs --new-file joe/menu.c joe_a/menu.c
--- joe/menu.c	Thu Oct  6 05:20:34 1994
+++ joe_a/menu.c	Wed May  3 16:49:46 1995
@@ -36,7 +36,7 @@
  {
  int col;
  int x;
- int *s=m->t->t->scrn+m->x+m->y*m->t->t->co;
+ scrn_char *s=m->t->t->scrn+m->x+m->y*m->t->t->co;
  col=0;
  for(x=0;x!=m->perline && m->list[x+m->top];++x)
   {
diff -bu --recurs --new-file joe/msscrn.c joe_a/msscrn.c
--- joe/msscrn.c	Thu Oct  6 06:10:46 1994
+++ joe_a/msscrn.c	Sat May 31 13:15:24 1997
@@ -104,9 +104,30 @@
 int eraeol(t,x,y)
 SCRN *t;
  {
- while(x<t->co) t->scrn[y*t->co+x++]=0x0720;
+ while(x<t->co) 
+ 	outatr(0,t->scrn+y*t->co+x++,0,0,' ',0);
  }
 
+#if defined(__DJGPP__)
+
+SCRN *nopen()
+ {
+ SCRN *t=(SCRN *)malloc(sizeof(SCRN));
+ short *screen;
+ ttopen();
+ t->scrn=(void *)0xB8000;
+ t->co=ScreenCols();
+ t->li=ScreenRows();
+ if(!t->li) t->li=25;
+ t->scroll=0;
+ t->insdel=0;
+ t->updtab=0; t->sary=0; t->compose=0;
+ nresize(t,t->co,t->li);
+ return t;
+ }
+
+#else
+
 SCRN *nopen()
  {
  SCRN *t=(SCRN *)malloc(sizeof(SCRN));
@@ -127,6 +148,8 @@
  return t;
  }
 
+#endif
+
 void nresize(t,w,h)
 SCRN *t;
  {
@@ -186,17 +209,18 @@
 void nscrldn(t,top,bot,amnt)
 SCRN *t;
  {
- nredraw(t);
+ msetI(t->updtab+skiptop,-1,t->li-skiptop);
  }
 
 void nscrlup(t,top,bot,amnt)
 SCRN *t;
  {
- nredraw(t);
+ msetI(t->updtab+skiptop,-1,t->li-skiptop);
  }
 
 void nredraw(t)
 SCRN *t;
  {
+ clrscr();
  msetI(t->updtab+skiptop,-1,t->li-skiptop);
  }
diff -bu --recurs --new-file joe/mstty.c joe_a/mstty.c
--- joe/mstty.c	Thu Oct  6 05:20:34 1994
+++ joe_a/mstty.c	Sat May 31 13:15:28 1997
@@ -5,6 +5,12 @@
 #include <bios.h>
 #include "tty.h"
 
+#ifdef __DJGPP__
+#include <go32.h>
+#include <sys/farptr.h>
+#include <signal.h>
+#endif
+
 int obufp;
 int obufsiz;
 char *obuf;
@@ -17,22 +23,52 @@
 int noxon;
 int Baud;
 
+#ifdef __DJGPP__
+	#define screenw(off,ch)  _farpokew(_go32_info_block.selector_for_linear_memory,0xb8000+(off),(ch))
+#else
+	#ifdef __MSDOS__
+		#define screenw(off,ch) (((unsigned short far *)MK_FP(0xB800,0))[off] = (ch))
+	#else
+		#define screenw(off,ch)
+	#endif
+#endif
+
 int jread(fd,buf,siz)
 char *buf;
  {
- return read(fd,buf,siz);
- }
+ int i;
+ screenw(158,'R'|0x0F00);
+ i=read(fd,buf,siz);
+ screenw(158,' '|0x0F00);
+ return i;
+}
 
 int jwrite(fd,buf,siz)
 char *buf;
  {
- return write(fd,buf,siz);
+ int i;
+ screenw(158,'W'|0x0F00);
+ i=write(fd,buf,siz);
+ screenw(158,' '|0x0F00);
+ return i;
+ }
+
+int fork(void) {}
+int pipe(int * a) {}
+int wait(int * a) {}
+int kill(int a,int b) {}
+
+#if defined (__DJGPP__)
+
+ int setbreak(stat)
+  {
+  int prv;
+  prv=getcbrk();
+  setcbrk(stat);
+  return prv;
  }
 
-int fork() {}
-int pipe() {}
-int wait() {}
-int kill() {}
+#else
 
 int setbreak(stat)
  {
@@ -46,10 +82,13 @@
  return prv;
  }
 
+#endif
+
 int breakflg;
 
 void ttopen()
  {
+ sigjoe();
  obuf=malloc(4096);
  obufsiz=4096;
  obufp=0;
@@ -64,6 +103,7 @@
 void ttclose()
  {
  ttflsh();
+ signrm();
  setbreak(breakflg);
  }
 
@@ -72,8 +112,8 @@
  ttflsh();
  }
 
-int prefix=0;
-int prefixc;
+static int prefix=0;
+static int prefixc;
 
 int ttgetc()
  {
@@ -96,7 +136,7 @@
 
 ttflsh()
  {
- if(obufp) _write(fileno(stdout),obuf,obufp);
+ if(obufp) write(fileno(stdout),obuf,obufp);
  obufp=0;
  }
 
@@ -117,9 +157,33 @@
 
 void ttgtsz(x,y) int *x, *y; { *x=0; *y=0; }
 
-void sigjoe() {}
+/* Signal state flag.  1 for joe, 0 for normal */
+
+static int ttysig=0;
+
+/* Set signals for JOE */
 
-void signrm() {}
+void sigjoe()
+ {
+ if(ttysig) return;
+ ttysig=1;
+ signal(SIGHUP,ttsig);
+ signal(SIGTERM,ttsig);
+ signal(SIGINT,SIG_IGN);
+ signal(SIGPIPE,SIG_IGN);
+ }
+
+/* Restore signals for exiting */
+
+void signrm()
+ {
+ if(!ttysig) return;
+ ttysig=0;
+ signal(SIGHUP,SIG_DFL);
+ signal(SIGTERM,SIG_DFL);
+ signal(SIGINT,SIG_DFL);
+ signal(SIGPIPE,SIG_DFL);
+ }
 
 char *getcwd();
 char *pwd()
diff -bu --recurs --new-file joe/path.c joe_a/path.c
--- joe/path.c	Thu Oct  6 11:47:36 1994
+++ joe_a/path.c	Sat May 31 13:15:30 1997
@@ -102,7 +102,7 @@
  {
  int x;
  for(x=0;path[x];++x)
-#ifdef __MSDOS__
+#if defined( __MSDOS__) && !defined(__DJGPP__)
   if(path[x]=='/') path[x]='\\';
 #else
   if(path[x]=='\\') path[x]='/';
@@ -227,7 +227,7 @@
  int fd;
  if(!where) where=getenv("TEMP");
 #ifdef __MSDOS__
- if(!where) where="";
+ if(!where) where=".";
 #else
  if(!where) where="/tmp";
 #endif
@@ -357,6 +357,19 @@
   }
  return lst;
  }
+
+#ifdef __DJGPP__
+
+int _chdrive(int drive)
+{
+	setdisk(drive-1);
+	if (getdisk() != drive-1)
+		return -1;
+	else
+		return 0;
+}
+
+#endif
 
 int chpwd(path)
 char *path;
diff -bu --recurs --new-file joe/queue.c joe_a/queue.c
--- joe/queue.c	Thu Oct  6 05:20:34 1994
+++ joe_a/queue.c	Wed Sep 13 13:37:16 1995
@@ -34,8 +34,11 @@
  {
  if(qempty(STDITEM,link,freelist))
   {
-  STDITEM *i=(STDITEM *)malloc(itemsize*16);
-  STDITEM *z=(STDITEM *)((char *)i+itemsize*16);
+  STDITEM *i, *z;
+  
+  i=(STDITEM *)malloc(itemsize*16);
+
+  z=(STDITEM *)((char *)i+itemsize*16);
   while(i!=z)
    {
    enquef(STDITEM,link,freelist,i);
diff -bu --recurs --new-file joe/scrn.h joe_a/scrn.h
--- joe/scrn.h	Thu Oct  6 06:09:04 1994
+++ joe_a/scrn.h	Sat May 31 13:14:56 1997
@@ -37,11 +37,13 @@
 
 #ifdef __MSDOS__
 
+typedef short scrn_char;
+
 struct scrn
  {
  int li;
  int co;
- short *scrn;
+ scrn_char *scrn;
  int scroll;
  int insdel;
  int *updtab;
@@ -50,6 +52,9 @@
  };
 
 #else
+
+typedef int scrn_char;
+
 struct scrn
  {
  CAP *cap;		/* Termcap/Terminfo data */
@@ -140,7 +145,7 @@
  int insdel;			/* Set to use insert/delete within line */
 
  /* Current state of terminal */
- int *scrn;			/* Current contents of screen */
+ scrn_char *scrn;			/* Current contents of screen */
  int x,y;			/* Current cursor position (-1 for unknown) */
  int top,bot;			/* Current scrolling region */
  int attrib;			/* Current character attributes */
@@ -213,16 +218,21 @@
 #ifdef __MSDOS__
 
 #define INVERSE 1
-#define UNDERLINE 2
-#define BOLD 4
+#define UNDERLINE 4
+#define BOLD 2
 #define BLINK 8
 #define DIM 16
 extern unsigned atab[];
 
-#define outatr(t,scrn,x,y,c,a) \
-  ( \
-    (t), (x), (y), *(scrn)=((unsigned)(c)|atab[a]) \
-  )
+#if defined(__DJGPP__)
+ 
+#include <go32.h>
+#include <sys/farptr.h>
+ 
+#define outatr(t,scrn,x,y,c,a) ((t), (x), (y), _farpokew(_go32_info_block.selector_for_linear_memory,(long)(scrn),((unsigned)(c)|atab[(a)])))
+#else
+#define outatr(t,scrn,x,y,c,a) ((t), (x), (y), *(scrn)=((unsigned)(c)|atab[a]))
+#endif
 
 #else
 
diff -bu --recurs --new-file joe/tab.c joe_a/tab.c
--- joe/tab.c	Thu Oct  6 05:20:34 1994
+++ joe_a/tab.c	Sat Jul  8 19:26:30 1995
@@ -295,6 +295,7 @@
  p=pdup(bw->cursor); pbol(p);
  q=pdup(bw->cursor); peol(q);
  tmp=brvs(p,(int)(q->byte-p->byte));
+ joesep(tmp);
  cline=parsens(tmp,&a,&b);
  vsrm(tmp);
  prm(p); prm(q);
diff -bu --recurs --new-file joe/tty.h joe_a/tty.h
--- joe/tty.h	Thu Oct  6 05:20:34 1994
+++ joe_a/tty.h	Sat May 31 13:14:48 1997
@@ -159,7 +159,13 @@
 extern int leave;
 
 #ifdef __MSDOS__
+ 
+#if defined (__DJGPP__)
+#define ifhave kbhit()
+#else
 #define ifhave bioskey(1)
+#endif
+
 #else
 #define ifhave have
 #endif
diff -bu --recurs --new-file joe/vfile.c joe_a/vfile.c
--- joe/vfile.c	Thu Oct  6 05:20:34 1994
+++ joe_a/vfile.c	Fri Jul  7 19:38:48 1995
@@ -286,11 +286,18 @@
 if(vfile->vpage1) vunlock(vfile->vpage1);
 if(vfile->name)
  {
- if(vfile->flags) unlink(vfile->name);
- else vflshf(vfile);
+ if(vfile->flags)
+  {
+  if(vfile->fd) close(vfile->fd);
+  unlink(vfile->name);
+  }
+ else 
+  {
+  vflshf(vfile);
+  if(vfile->fd) close(vfile->fd);
+  }
  vsrm(vfile->name);
  }
-if(vfile->fd) close(vfile->fd);
 free(deque(VFILE,link,vfile));
 for(x=0;x!=HTSIZE;x++)
  for(pp=(VPAGE *)(htab+x), vp=pp->next;vp;)
@@ -302,6 +309,10 @@
    vp=pp->next;
    }
   else pp=vp, vp=vp->next;
+}
+
+void vlimit(unsigned long amount)
+{	maxvalloc=amount-(amount%PGSIZE);
 }
 
 #ifdef junk
diff -bu --recurs --new-file joe/vfile.h joe_a/vfile.h
--- joe/vfile.h	Thu Oct  6 05:20:34 1994
+++ joe_a/vfile.h	Wed May  3 15:28:44 1995
@@ -213,6 +213,8 @@
  * Returns file address of beginning of allocated space
  */
 
+#define valloc Valloc
+
 long valloc();
 
 #ifdef junk
diff -bu --recurs --new-file joe/w.c joe_a/w.c
--- joe/w.c	Thu Oct  6 05:20:34 1994
+++ joe_a/w.c	Wed May  3 16:50:30 1995
@@ -687,7 +687,7 @@
 SCRN *t;
 char *s;
  {
- int *scrn=t->scrn+y*t->co+x;
+ scrn_char *scrn=t->scrn+y*t->co+x;
  int atr=0;
  int col=0;
  int c;
@@ -743,7 +743,7 @@
 SCRN *t;
 char *s;
  {
- int *scrn=t->scrn+y*t->co+x;
+ scrn_char *scrn=t->scrn+y*t->co+x;
  int col;
  int c;
  int a;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019