|
Here's a hacky command file to find terminals that you can use to
dial out on. It checks the protection of the terminal to make sure
you have access to them.
$ @findterm
matt
$ say = "write sys$output"
$ devmm = "_TX,_TT"
$ devices = 0
$ !
$ next_devmm: if devmm .eqs. "" then goto end
$ dd = f$extract(0,f$locate(",",devmm),devmm)
$ devmm = f$extract(f$locate(",",devmm)+1,f$length(devmm),devmm)
$ c = "A" ! start off fresh
$ !
$ next_cont: label = "next_devmm"
$ c[0,8] = f$cvui(0,8,c) + 1
$ u = 0
$ !
$ loop: terminal = dd + c + f$string(u) + ":"
$ if .not. f$getdvi(terminal,"exists") then goto 'label'
$ if .not. f$getdvi(terminal,"tt_modem") then goto next_unit
$ if .not. f$getdvi(terminal,"avl") then goto next_unit
$ !
$ vprot = f$getdvi(terminal,"vprot")
$ prot = f$extract(f$locate("WORLD=",vprot)+6,4,vprot) - "L" - "P"
$ if "''prot'" .eqs. "" then goto next_unit
$ !
$ string = " (unallocated)"
$ if f$getdvi(terminal,"refcnt") .gt. 0 then -
$ string = " (allocated to PID "+-
f$getdvi(terminal,"pid")+-
")"
$ say "Found: "+terminal+string
$ devices = devices + 1
$ !
$ next_unit: label = "next_cont"
$ u = u + 1
$ goto loop
$ !
$ !
$ end: if devices .eq. 0 then goto none
$ say f$fao("Total: !UL terminal!%S found.",devices)
$ exit
$ !
$ none: say "No terminals where found."
$ exit
|