 Rem File: Cmd180.bas
 Rem Sub: !Abort
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 180 -- !Abort"
    Color 7,0
    End
 Endif
 Call Abort
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Abort
 On Local Error Goto Error.Trap180
 Do While Lost.Carrier=False
    Graphics.Off=False
    Strng="Abort node menu:"
    Call IO.O
    Graphics.Off=True
    Strng="(A)bort all nodes to DOS"
    Call IO.O
    Strng="(S)hut down and recycle all nodes"
    Call IO.O
    Strng="(C)ancel abort"
    Call IO.O
    Strng="(H)elp on abort"
    Call IO.O
    Graphics.Off=False
    Strng="Enter selection(A/S/C/H)?"
    No.Input.Out="C"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "A"
       VarQ1=1
       Exit Do
    Case "S"
       VarQ1=2
       Exit Do
    Case "C"
       Exit Sub
    Case "H"
       Call Out.File(Data.Path2+"ABORT1.DOC","")
    End Select
 Loop
 Select Case VarQ1
 Case 1
    Strng="Abort all nodes to DOS(y/n)? "
    No.Input.Out="N"
    Call IO.I
    If Yes Then
       Call Shutdown.Message(1)
       For Temp=1 To MaxNodes
          Call Read.Message.Record(MessWorkFile1,Temp+1)
          MessWorkRecord1.ActiveNode=False
          Call Write.Message.Record(MessWorkFile1,Temp+1)
       Next
       Call Send.Mess(12,SFalse,SFalse,"Abort")
       Strng="Abort this node to DOS(y/n)?"
       Call IO.I
       If Yes Then
          Call Hang.Up(11)
       Endif
    Endif
 Case 2
    Strng="Shutdown and recycle all nodes(y/n)?"
    No.Input.Out="N"
    Call IO.I
    If Yes Then
       Call Shutdown.Message(2)
       Call Send.Mess(32,SFalse,SFalse,"Shutdown")
       Strng="Shutdown and recycle this node(y/n)?"
       Call IO.I
       If Yes Then
          Call Hang.Up(4)
       Endif
    Endif
 End Select
Error.Resume180:
 Exit Sub
Error.Trap180:
 Resume Error.Resume180
End Sub

Sub Shutdown.Message(Var)
 On Local Error Goto Err.Trap31
 No.Input.Out="N"
 Strng="Send shutdown message(y/n)? "
 Call IO.I
 If No Then
    Exit Sub
 Endif
 Strng="Enter shutdown message(80 char.):"
 Call IO.O
 Strng="?"
 Line.Length=80
 Call IO.I
 Var1$=Out2
 Strng="Sending message.."
 Call IO.O
 Call Send.Mess(5,SFalse,SFalse,Var1$)
 Strng="Enter seconds to wait(1-360)/<enter>=none? "
 Call IO.I
 VarX=Int(Val(Out2))
 If VarX>=1 And VarX<=360 Then
    Strng="Waiting"+Str$(VarX)+" seconds. Enter Control-K to break.."
    Call IO.O
    Carriage.Return=True
    Graphics.Off=True
    Strng="..0   "
    Call IO.O
    VarY=False
    Do While Security.Guard
       Allow.Break=True
       Call Pause.Second
       If Break Then
          For VarZ=1 To 4
             Call Back.Space
          Next
          Allow.Break=False
          Break=False
          Carriage.Return=True
          Graphics.Off=True
          Strng="break"
          Call IO.O
          Exit Do
       Endif
       If Lost.Carrier Then
          Exit Do
       Endif
       For VarZ=1 To 4
          Call Back.Space
       Next
       VarY=VarY+1
       VarZ$=Mid$(Str$(VarY),2)
       VarZ$=VarZ$+Space$(4-Len(VarZ$))
       Strng=VarZ$
       Carriage.Return=True
       Graphics.Off=True
       Call IO.O
       If VarY>=VarX Then
          Exit Do
       Endif
    Loop
    Allow.Break=False
    Break=False
    Carriage.Return=False
    Call IO.O
 Endif
 If Var=1 Then
    Strng="Abort message sent."
 Else
    Strng="Shutdown message sent."
 Endif
 Call IO.O
Err.Resume31:
 Exit Sub
Err.Trap31:
 Resume Err.Resume31
End Sub
