.KEY FLUSH/S,KILL/S
.BRA {
.KET }

; $VER: stopnet 1.9 (10.11.97) use with startnet 1.9 by jpvw@xs4all.nl

FailAt 21

;--- kill servers and AmiPOP
Break >NIL: `Status COM=aws:aws` C ; Send Break to aws
Break >NIL: `Status COM=inetd` C ; Send Break to inetd
Break >NIL: `Status COM=AmiPOP` C ; Send Break to AmiPOP

; hangup
ifconfig ppp0 down
offline ppp0

; Kill TCP/IP stack or delete routes only
If {KILL}
  rx "address AMITCP; KILL" ; Send "KILL" to AmiTCP
  Assign >NIL: TCP: DISMOUNT
  If {FLUSH}
    Wait 2 secs
    If `rx "Say Show(ports, AMITCP)"` EQ 0
      Avail >NIL: FLUSH
    EndIf
  EndIf
Else
  If "$ppp0IPLocal" NOT EQ "*$ppp0IPLocal"
    route >NIL: delete $ppp0IPLocal localhost
    route >NIL: delete default $ppp0IPRemote
  EndIf
  ifconfig lo0 down
  If {FLUSH}
    Echo "FLUSH only when KILLed"
  EndIf
EndIf

; cleanup
UnsetEnv ppp0IPLocal
UnsetEnv ppp0IPRemote
UnsetEnv HOSTNAME

Lab Exit
FailAt 10

