1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-03-11 09:42:04 +00:00

Add blocks total, used, and free to CAT

This commit is contained in:
David Schmenk
2026-02-19 16:00:00 -08:00
parent 8e20f4b5b9
commit 898df9b7be
3 changed files with 33 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -10,7 +10,7 @@ predef catalog(pathstr)#0
var arg, recurse, exit
char[64] path, wildname
res[t_fileinfo] fileinfo
res[t_fileentry] fileentry
word[2] blockcnt, usedcnt, freecnt
//
// Copy string with upper case conversion
//
@@ -116,6 +116,16 @@ def catalog(pathstr)#0
heaprelease(entrylist)
fin
end
def trimpath(fullpathstr)#0
byte i
for i = 2 to ^fullpathstr
if fullpathstr->[i] == '/'
^fullpathstr = i
return
fin
next
end
//
// Install error exit
//
@@ -149,6 +159,28 @@ if not except(exit)
//
if fileio:getfileinfo(@path, @fileinfo) == FILE_ERR_OK
catalog(@path)
//
// Print block total, used. free
//
if path[1] <> '/' // Ensure full path with volume name
fileio:getpfx(@path)
fin
trimpath(@path)
fileio:getfileinfo(@path, @fileinfo)
blockcnt[0] = fileinfo:aux_type
blockcnt[1] = 0
puts("Blocks: Total=")
puti32(@blockcnt)
usedcnt[0] = fileinfo:blocks_used
usedcnt[1] = 0
puts(" Used=")
puti32(@usedcnt)
load32(@blockcnt)
sub32(@usedcnt)
store32(@freecnt)
puts(" Free=")
puti32(@freecnt)
putln
else
puts("Unable to open: "); puts(@path); putln
fin