89 lines
2.4 KiB
Plaintext
89 lines
2.4 KiB
Plaintext
###sysinclude standard.uh
|
|
###sysinclude args.uh
|
|
###sysinclude io.uh
|
|
###sysinclude str.uh
|
|
|
|
###define COLORS
|
|
// delete the COLORS directive above if you do not want colored output!
|
|
#g argc 3 < { "." }{ 2 argv } sto mypath
|
|
@mypath 'd inv istrue { ."The given directory doesn't exist! Exited.\n" end }
|
|
@mypath getdir { ."Cannot load the dir! Aborted.\n" end } sto mydir
|
|
'- 90 *... sto vonal
|
|
'. 60 *... sto points
|
|
|
|
@mydir ~d {
|
|
."Directories:\n"
|
|
@mydir ~d {{ #s
|
|
@mydir 'd {{}} octalrights dup print inv mem SPACE
|
|
@mydir 'd {{}} getfilename dup 67 mc print SPACE drop
|
|
@mydir 'd {{}} groupname ': !+
|
|
@mydir 'd {{}} ownername dup sto temp + dup 10 mc print inv mem @temp inv mem
|
|
@mydir 'd {{}} mtime dup print inv mem
|
|
NL }}
|
|
@points sprintnl
|
|
@mydir ~d { ."Total: " @mydir ~d #g print ." subdirectories.\n" }
|
|
@vonal sprintnl
|
|
}
|
|
|
|
@mydir ~r {
|
|
."Regular files:\n"
|
|
@mydir ~r {{ #s
|
|
@mydir 'r {{}} octalrights dup print inv mem SPACE
|
|
@mydir 'r {{}} getfilesize sbr §ifcolored
|
|
@mydir 'r {{}} executable { ." >" }{ ." " } SPACE
|
|
@mydir 'r {{}} getfilename dup 67 mc print SPACE drop
|
|
@mydir 'r {{}} groupname ': !+
|
|
@mydir 'r {{}} ownername dup sto temp + dup 10 mc print inv mem @temp inv mem
|
|
@mydir 'r {{}} mtime dup print inv mem
|
|
NL }}
|
|
@points sprintnl
|
|
@mydir ~r { ."Total: " @mydir ~r #g print ." regular files. "
|
|
."TotalSize = " @mydir 'r totalsize sbr §ifcolored NL
|
|
}
|
|
@vonal sprintnl
|
|
}
|
|
@mydir ~L {
|
|
."Symlinks:\n"
|
|
@mydir ~L {{ #s
|
|
@mydir 'L {{}} octalrights dup print inv mem SPACE
|
|
@mydir 'L {{}} executable { .">" }{ SPACE } SPACE
|
|
@mydir 'L {{}} getfilename dup 67 mc print SPACE drop
|
|
@mydir 'L {{}} broken { ."--->" }{ ."===>" } SPACE
|
|
@mydir 'L {{}} destination dup 30 mc print drop
|
|
NL }}
|
|
@points sprintnl
|
|
@mydir ~L { ."Total: " @mydir ~L #g print ." symlinks.\n"
|
|
}
|
|
}
|
|
@vonal sprintnl
|
|
."Size, alltogether = " @mydir alltotal sbr §ifcolored NL
|
|
@vonal sprintnl
|
|
|
|
|
|
@mydir inv mem
|
|
|
|
."free spaces: /* Total size of the filesystem is : " @mypath filesystemsize dup sto filsize sbr §ifcolored ." */\n"
|
|
." for non-privilegized use: " @mypath freenonpriv dup sbr §ifcolored
|
|
#g 100 * @filsize / ." ( " print ."% ) " NL
|
|
." All available free space: " @mypath totalfree dup sbr §ifcolored
|
|
#g 100 * @filsize / ." ( " print ."% ) " NL
|
|
@vonal inv mem
|
|
end
|
|
|
|
ifcolored:
|
|
###ifdef COLORS
|
|
coloredsize
|
|
###endif
|
|
###ifndef COLORS
|
|
#g !(#s) 21 >|
|
|
###endif
|
|
dup sprint inv mem
|
|
rts
|
|
|
|
{ „filsize” }
|
|
{ „mydir” }
|
|
{ „mypath” }
|
|
{ „temp” }
|
|
{ „vonal” }
|
|
{ „points” }
|