With this change the v7 Bourne shell now runs, even on 32K userspace boxes.
Later she added quite a few things (see
http://heirloom.cvs.sourceforge.net/heirloom/heirloom-sh/) however most of
those are memory expensive.
Probably we should add the use of '#' as a comment character as this is
nowdays considered normal.
Of the other features - an external test suits our memory size better,
while the later builtins aren't that useful and again have size issues. Only
unset cannot be external and might be useful.
Of the late features it might be nice to get 8bit clean
-
#define busy(x) (Rcheat((x)->word)&BUSY)
POS brkincr = BRKINCR;
-BLKPTR blokp; /*current search pointer */
-BLKPTR bloktop = BLK(end); /*top of arena (last blok) */
-
+BLKPTR blokp; /* current search pointer */
+BLKPTR bloktop; /* top of arena (last blok) */
+static void *end; /* end of memory */
+void blokinit(void)
+{
+ end = sbrk(0); /* Find where space starts */
+ bloktop = BLK(end);
+}
ADDRESS alloc(POS nbytes)
{
extern const char notfound[];
extern const char badfile[];
-extern address end[];
-
#include "ctype.h"
/* args.c */
extern void clearup(void);
extern DOLPTR useargs(void);
/* blok.c */
+void blokinit(void);
ADDRESS alloc(POS nbytes);
extern void addblok(POS reqd);
extern void sh_free(void *ap);
BOOL reserv;
int wdnum;
BOOL trapnote;
-address end[1]; /* FIXME */
int serial;
BLKPTR stakbsy;
STKPTR stakbas;
register int rflag = ttyflg;
/* initialise storage allocation */
+ blokinit();
+
stdsigs();
setbrk(BRKINCR);