1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-10-18 07:24:16 +00:00

Free prefix buffer before execmod

This commit is contained in:
David Schmenk 2023-03-18 16:33:55 -07:00
parent af57dfdeeb
commit 4ca1ba9c04
2 changed files with 24 additions and 18 deletions

View File

@ -170,9 +170,11 @@ end
//
def shell#1
byte textmode[3]
byte prefix[64]
word prefix
byte err[]
word cmdptr
prefix = heapalloc(64)
//
// Copy AUTORUN commmand line
//
@ -188,18 +190,18 @@ def shell#1
break
is 'P'
if ^cmdptr and ^(cmdptr + 1) <> '/'
strcat(@prefix, cmdptr)
strcat(prefix, cmdptr)
else
strcpy(@prefix, cmdptr)
strcpy(prefix, cmdptr)
fin
setpfx(@prefix)
setpfx(prefix)
break
is '/'
repeat
prefix--
until prefix[prefix] == '/'
if prefix > 1
setpfx(@prefix)
^prefix--
until prefix->[^prefix] == '/'
if ^prefix > 1
setpfx(prefix)
fin
break
is 'S'
@ -210,6 +212,7 @@ def shell#1
volumes
break
is '+'
heaprelease(prefix)
//cmdsys:modexec(striptrail(cmdptr))
return striptrail(cmdptr)
//cmdsys:syswrite(cmdsys.refcons, @textmode, 3)
@ -226,7 +229,7 @@ def shell#1
fin
putln
fin
puts(getpfx(@prefix))
puts(getpfx(prefix))
cmdptr = gets($BA)
strcpy(cmdsys:cmdline, cmdptr)
until 0

View File

@ -245,9 +245,11 @@ end
//
def shell#1
byte textmode[3]
byte prefix[64]
word prefix
byte err[]
word cmdptr
prefix = heapalloc(64)
//
// Copy AUTORUN commmand line
//
@ -263,18 +265,18 @@ def shell#1
break
is 'P'
if ^cmdptr and ^(cmdptr + 1) <> '/'
strcat(@prefix, cmdptr)
strcat(prefix, cmdptr)
else
strcpy(@prefix, cmdptr)
strcpy(prefix, cmdptr)
fin
setpfx(@prefix)
setpfx(prefix)
break
is '/'
repeat
prefix--
until prefix[prefix] == '/'
if prefix > 1
setpfx(@prefix)
^prefix--
until prefix->[^prefix] == '/'
if ^prefix > 1
setpfx(prefix)
fin
break
is 'S'
@ -285,6 +287,7 @@ def shell#1
volumes
break
is '+'
heaprelease(prefix)
*jitcodeptr = jitcbuf
//cmdsys:modexec(striptrail(cmdptr))
return striptrail(cmdptr)
@ -302,7 +305,7 @@ def shell#1
fin
putln
fin
puts(getpfx(@prefix))
puts(getpfx(prefix))
cmdptr = gets($BA)
strcpy(cmdsys:cmdline, cmdptr)
until 0