! APM FILES utility. R Thonnes et al 6/84 ! Parameters: ! Target is file name or names. Wild cards accepted in filename but not directory ! Default is all files for current directory. ! Output is output file name (default = console) ! Full specifies that size and date info should be displayed for each file ! Order may be by date or alphabetic ! Hide specifies whether "hidden" files (beginning with '.') are to be ! suppressed (default = yes) ! One line of total files and blocks in the directory is displayed when wild ! cards are used. ! If Totals is specified only this line is displayed. %begin %include "inc:util.imp" %include "inc:fs.imp" %include "inc:fsutil.imp" %externalstring(255)%fnspec FINFO(%string(255)directory,%integer number) %routinespec files(%string(255)target) ! PAM interface %constinteger dateorder=1,alphaorder=2 %string(255)target="",output="", s="" %integer full=0,hide=16_80000000 %byte order=dateorder,tots=0 defineparam("Target",target,0) defineparam("Output",output,pamnewgroup) definebooleanparams("Full",full,0) definebooleanparams("Hide",hide,0) defineenumparam("Order,Date,Alpha",order,0) define enum param("ALL,TOtals",tots,0) ;!JHB mod to display totals only. processparameters(cliparam) ! Main program openoutput(1,output) %and selectoutput(1) %unless output="" files(target) ! End of main program %string(255)%fn standardise(%string(255) s, %integer len) %integer i,case=0 %bytename k len=length(s) %if len=0 %or len>length(s) %for i = 1,1,len %cycle k == charno(s,i) %if 'A'<=k&95<='Z' %start k = k&95+case; case = 32 %finishelse case = 0 %repeat %result=s %end %routine files(%string(255)target) %string(255)directory,file,thisfile, full name %routine dofiles %recordformat f(%record(f)%name left,right,%string(13)s) %record(f)%name root, this %integer printed=0 %routine separate(%integer len) %if len<0 %start newline %unless printed=0; printed = 0 %elseif printed=6 printed = 0; newline %else spaces(13-len) %finish %end %record(f)%map add(%record(f)%name cell,tree) %result == cell %if tree==nil %if cell_s directory.(":").file file = "*" %if file="" %if wildness(file)>0 %start printline(finfo(directory,0)) %if tots = 0 %start openinput(1,directory.":directory"); selectinput(1) dofiles %finish %else full name = directory . ":" . file length(full name) = length(full name) - 1 %c %if charno(full name, length(full name)) = '?' printline(standardise(ninfo(full name),16)) %finish %end %endofprogram