home *** CD-ROM | disk | FTP | other *** search
- /*
- Searches for a "suitable interface"
- wich means "up and not loopback"
- */
-
- l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
- call MacroEnv("env","stderr")
- if AddLibrary("rexxsupport.library","rxsocket.library","rxlibnet.library")~=0 then
- call err "Can't find" result,1
-
- if arg()~=0 then do
- if arg()=1 & arg(1)="?" then do
- say env.prg": searches for a suitable interface"
- end
- else call PrintFault(118)
- exit
- end
-
- res=QueryInterfaces("in")
- if res<0 then do
- say env.prg": cannot query ("errorstring()")"
- exit
- end
- if res=0 then do
- say env.prg": no suitable device found"
- exit
- end
-
- do i=0 to res-1
- if in.i.family==2 & in.i.UP==1 & in.i.LOOPBACK==0 then do
- say env.prg":" in.i.NAME
- exit
- end
- end
-
- say env.prg": no suitable device found"
-