/* A "not so good" macro to scan tcp ports. Usage: pst " */ parse arg host low hi . if ~show("L","rxsocket.library") then if ~addLib("rxsocket.library",0,-30) then do say "can't find rxsocket.library" exit end if host=="" | host== "?" | low=="" | hi=="" then do say "Usage: pst " exit end if ~DataType(low,NUM) then do say "pst: bad number fromPort" exit end if ~DataType(hi,NUM) then do say "pst: bad number toPort" exit end if hi" exit end sin.ADDRFAMILY = "INET" do sin.ADDRPORT = low to hi sock = socket("INET","STREAM","IP") if sock<0 then do say "pst: no socket (" "" errno() || ")" exit end if connect(sock,"SIN")>=0 then if GetServByPort("SERV",sin.ADDRPORT,"tcp") then say "pst: servizio" serv.servname "(" || sin.ADDRPORT ||")" "aperto" else say "pst: porta" sin.ADDRPORT "aperta" call CloseSocket(sock) end