owninteger user printed
externalintegerfunctionspec ddisconnect(string (6) user,
string (11) file,
integer fsys,destroy)
constantstring (1) snl = "
"
externalintegerfunctionspec dconnect(string (6) user,string (15) file,
integer fsys,mode,apf,
integername seg,gap)
externalstringfunctionspec derrs(integer n)
externalintegerfunctionspec dpermission(string (6) owner,user,
string (8) date,
string (11) file,
integer fsys,type,adrprm)
externalintegerfunctionspec get usnames(integername n,integer adr,
fsys)
externalroutinespec get av fsys(integername n,integerarrayname a)
systemstringfunctionspec itos(integer n)
!
recordformat contf(integer dataend,datastart,psize,filetype,
sum,datetime,sp0,sp1,mark,sp2,sp3,astk,sp4,
sp5,itwidth,ldelim,rdelim,journal,
searchdircount,arraydiag,initworksize,sp6,
itinsize,itoutsize,nobl,istk,
longinteger initparms,integer dataecho,
terminal,i23,i24,i25,i26,i27,i28,i29,i30,i31,i32,
string (31) fstartfile,bstartfile,preloadfile,
moddir,cfaults,cprompt,dprompt,s8,s9,s10,s11,s12,
s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,
s26,s27,s28,s29,s30,s31,s32,
string (31)array searchdir(1:16))
recordformat hf(integer dataend,datastart,filesize,filetype,sum,
datetime,
(integer spare1,spare2 or c { Character file }
integer format,records or c { Data file }
integer adir,count or c { Pdfile }
integer pstart,spare3 or c { Old directory file }
integer spare4,controlmode or c { Background control file }
integer lda,ofm)) { Object file }
recordformat prmsf(string (6) user,byteinteger uprm)
recordformat dpermf(integer bytesreturned,ownp,eep,spare,
record (prmsf)array prms(0:15))
!
routine output user(string (6) user)
if user printed = 0 then start
user printed = 1
printstring(user.": ")
finish
end ; ! of output user
!
!
routine do optfile(integer conad,string (6) user)
integer i
stringname s
record (contf)name h
!
h == record(conad)
for i = 1,1,h_searchdircount cycle
s == h_searchdir(i)
if s = "ERCLIB.NAGGRAPHICS_CALCDIR" then start
s = "ERCLIB.NAGGRAPHICS_BENDIR"
output user(user)
printstring(" NAG graphics done")
finish
if s = "PUBLIC.GPLOTDIR#B" then start
s = "PUBLIC.GPLOTDIR"
output user(user)
printstring(" GPLOTDIR done")
finish
if s = "PUBLIC.GINO_GINODIRB" then start
s = "PUBLIC.GINO_GINODIR"
output user(user)
printstring(" GINODIR done")
finish
repeat
end ; ! of do optfile
!
!
routine treat user(string (6) user,integer fsys)
integer flag,seg,gap,conad,i,myperm,max
record (dpermf) p
record (prmsf) pp
record (hf)name r
!
user printed = 0
!
! See if already permitted
!
flag = dpermission(user,"CUR022","","SS#OPT",fsys,4,addr(p))
if flag # 0 then start
output user(user)
printstring("DPERMISSION(1) flag =".derrs(flag).snl)
return
finish
!
max = p_bytesreturned - 16
i = sizeof(pp)
max = max//i - 1
myperm = 0
if max >= 0 then start
for i = 0,1,max cycle
if p_prms(i)_user = "CUR022" then start
myperm = p_prms(i)_uprm
exit
finish
repeat
finish
!
! Set permission if required
!
if myperm # 3 then start
flag = dpermission(user,"CUR022","","SS#OPT",fsys,2,3)
! Get write access
if flag # 0 then start
output user(user)
printstring("DPERMISSION(2) failed ".derrs(flag).snl)
return
finish
finish
!
seg = 0
gap = 0
flag = dconnect(user,"SS#OPT",fsys,3,0,seg,gap)
if flag # 0 then start
output user(user)
printstring("DCONNECT failed, flag =".derrs(flag).snl)
-> out1
finish
!
conad = seg << 18
r == record(conad)
if r_filetype = 9 then start
do optfile(conad,user)
finish
!
flag = ddisconnect(user,"SS#OPT",fsys,0)
! Ignore flag
!
out1:
!
if myperm # 0 then start
flag = dpermission(user,"CUR022","","SS#OPT",fsys,2,myperm)
if flag # 0 then start
output user(user)
printstring("DPERMISSION(3) flag =".derrs(flag).snl)
return
finish
else
flag = dpermission(user,"CUR022","","SS#OPT",fsys,3,0)
if flag # 0 then start
output user(user)
printstring("DPERMISSION(4) flag =".derrs(flag).snl)
return
finish
finish
!
if user printed # 0 then newline
end ; ! of treat user
!
!
integerfunction stoi(string (255) s)
if s = "-1" then result = -1
if length(s) = 1 then s = "0".s
if length(s) # 2 then result = -2
unless '0' <= charno(s,1) <= '9' then result = -2
unless '0' <= charno(s,2) <= '9' then result = -2
result = (charno(s,1) - '0')*10 + charno(s,2) - '0'
end ; ! of stoi
!
!
externalroutine doben(string (255) s)
string (6)array u(0:1023)
integer nu,nusers
integer j,n,fx,fsys
integerarray a(0:99)
string (63) user
!
fsys = -1
if s # "" then start
fsys = stoi(s)
unless -1 <= fsys <= 99 then -> bp
finish
if fsys<0 then get av fsys(n,a) else a(0) = fsys and n = 1
fx = 0
while fx<n cycle
fsys = a(fx)
printstring("+++ FSYS ".itos(fsys)." +++"); newline; newline
j = get usnames(nusers,addr(u(0)),fsys)
printstring("GET USNAMES flag ="); write(j,1)
printstring(" No of users ="); write(nusers,1); newlines(2)
nu = 0
while nu<nusers cycle
user<-u(nu)
if length(user) = 6 then start
treat user(user,fsys)
finish
nu = nu+1
repeat
fx = fx + 1
repeat
return
bp:
printstring("Illegal fsys specification"); newline
end ; ! of doben
endoffile