1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-16 16:31:02 +00:00

Add catalog command to SPRED

This commit is contained in:
David Schmenk 2024-11-11 15:30:10 -08:00
parent 71011e644f
commit 7675708a27
2 changed files with 60 additions and 0 deletions

Binary file not shown.

View File

@ -3,6 +3,7 @@ include "inc/args.plh"
include "inc/grlib.plh"
include "inc/dcgrlib.plh"
include "inc/dcgrutils.plh"
include "inc/fileio.plh"
sysflags restxt1|restxt2|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages
@ -141,6 +142,58 @@ def strnum(strptr)
return num
end
def prfiles(optpath)
byte path[64]
byte refnum
byte firstblk
byte entrylen, entriesblk
byte i, type, len
word databuff, entry
if ^optpath
strcpy(@path, optpath)
else
fileio:getpfx(@path)
puts(@path)
putln
fin
databuff = heapalloc(512)
refnum = fileio:open(@path)
if perr
return perr
fin
firstblk = 1
while fileio:read(refnum, databuff, 512) == 512
entry = databuff + 4
if firstblk
entrylen = databuff->$23
entriesblk = databuff->$24
entry = entry + entrylen
fin
for i = firstblk to entriesblk
type = ^entry
if type <> 0
len = type & $0F
^entry = len
puts(entry)
if type & $F0 == $D0 // Is it a directory?
putc('/')
len++
fin
for len = 20 - len downto 1
putc(' ')
next
fin
entry = entry + entrylen
next
firstblk = 0
loop
fileio:close(refnum)
heaprelease(databuff)
putln
return 0
end
def getCmd#1
var cmdstr, xorg, yorg, width, height, sprptr, sprspan, grspr
byte frame, i
@ -216,6 +269,13 @@ def getCmd#1
fin
modified = writeFile
break
is 'C'
repeat // Skip to pathname
^cmdstr--
memcpy(cmdstr + 1, cmdstr + 2, ^cmdstr)
until ^cmdstr == 0 or ^(cmdstr + 1) <> ' '
prfiles(cmdstr)
break
is 'Q'
if modified
puts("Lose changes (Y/N)?")