From c288505517aa0e3d5eae81a185ad8e56bc71dde1 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Wed, 15 Sep 2021 14:26:33 +0200 Subject: [PATCH] Work around a bug with negative literals in the C compiler. If an octal literal has the sign bit set, the resulting code will try to use MOVNI to write the value to the destination. --- src/cprog/ipak.c | 5 +++-- src/cprog/shell.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cprog/ipak.c b/src/cprog/ipak.c index 293c6489..39674994 100644 --- a/src/cprog/ipak.c +++ b/src/cprog/ipak.c @@ -16,6 +16,7 @@ static int encrypt; static int verbose; static int user; static int loser; +static int dsk_device DSK; /********************************************************************** @@ -36,7 +37,7 @@ main (argc, argv) char *argv[]; user = rsuset (UXUNAME); loser = rsuset (UOPTION) & 10000000000; fparse (argv[0], &pakfil); - pakfil.dev = DSK; + pakfil.dev = dsk_device; if (pakfil.fn2 == 0) pakfil.fn2 = csto6 ("-IPAK-"); if (argc < 2) s = "l"; else s = argv[1]; @@ -396,7 +397,7 @@ updatfile (dp, in, out, delflg) desc *dp; int xopen (fp, mode) filespec *fp; int mode; - {if (fp->dev == 0) fp->dev = DSK; + {if (fp->dev == 0) fp->dev = dsk_device; if (fp->dir == 0) fp->dir = rsname(); return (open (fp, mode)); } diff --git a/src/cprog/shell.c b/src/cprog/shell.c index 9f4eb6eb..6216df8a 100644 --- a/src/cprog/shell.c +++ b/src/cprog/shell.c @@ -86,6 +86,8 @@ int argc; /* # of arguments to built-in commands */ char *argv[max_args]; /* parsed args to built-in commands */ tag restart; /* restart loc for ^G interrupt */ +static int ts_file _TS_; +static int dsk_device _DSK_; static int default_device _DSK_; struct _command { @@ -310,7 +312,7 @@ more: while (incnt>0) filespec fs; char buf[100]; uname = rsuset (UXUNAME); - fs.dev = _DSK_; + fs.dev = dsk_device; fs.dir = csto6 ("(INIT)"); fs.fn1 = uname; fs.fn2 = csto6 ("SHELL_"); @@ -857,7 +859,7 @@ int _login () else {int ch; filespec ff; - ff.dev = _DSK_; + ff.dev = dsk_device; ff.dir = oldname; ff.fn1 = _FILE_; ff.fn2 = _PDIRP_; @@ -1356,7 +1358,7 @@ int findprog (fp) if (fp->fn1 == _GREATER_ || fp->fn1 == _LESS_) return (-1000); fp->fn2 = fp->fn1; - fp->fn1 = _TS_; + fp->fn1 = ts_file; if (!fp->dev) fp->dev = default_device; if (fp->dir) return (tryprog (fp)); @@ -1379,7 +1381,7 @@ int tryprog (fp) {int oldn2, fd; - fp->fn1 = _TS_; + fp->fn1 = ts_file; if ((fd = open (fp, BII)) >= 0) return (j_cload (fd, fp->fn2)); fp->fn1 = _ZZ_; @@ -1387,7 +1389,7 @@ int tryprog (fp) fp->fn2 = rj6 (fp->fn2); if ((fd = open (fp, BII)) >= 0) return (j_cload (fd, oldn2)); - fp->fn1 = _TS_; + fp->fn1 = ts_file; fp->fn2 = oldn2; return (-1000); } @@ -1574,7 +1576,7 @@ doinit () filespec fs; char buf[100]; uname = rsuset (UXUNAME); - fs.dev = _DSK_; + fs.dev = dsk_device; fs.dir = csto6 ("(INIT)"); fs.fn1 = uname; fs.fn2 = csto6 ("_SHELL");