 Rem File: Cmd154.bas
 Rem Sub: Sysop.Commands
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 154 -- Sysop.Commands"
    Color 7,0
    End
 Endif
 ' TempX=
 '  11 - Debug.Menu
 '  12 - Utility.Menu
 Call Sysop.Commands
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Sysop.Commands
 On Local Error Goto Error.Trap80
 Var=TempX
 Select Case Var
 Case 11
    Call Debug.Menu
 Case 12
    Call Utility.Menu
 End Select
Error.Resume80:
 Exit Sub
Error.Trap80:
 Resume Error.Resume80
End Sub

Sub Debug.Menu
 On Local Error Goto Err.Trp25
 Do While Security.Guard
    If Lost.Carrier Then
       Exit Sub
    Endif
    If Node.Abort Then
       Exit Sub
    Endif
    Graphics.Off=False
    Strng="Usage Debug menu:"
    Call IO.O
    Graphics.Off=True
    Strng="[1]Clear runs counter"
    Call IO.O
    Strng="[2]Display runs counter"
    Call IO.O
    Strng="[3]Increase runs counter"
    Call IO.O
    Graphics.Off=False
    Strng="Enter usage debug selection(1-3, Q to quit)? "
    No.Input.Out="Q"
    Call IO.I
    Select Case Ucase$(Out2)
    Case "1"
       Call Copyright(1)
       Call More.Prompt
    Case "2"
       Call Copyright(2)
       Call More.Prompt
    Case "3"
       Call Copyright(3)
       Call More.Prompt
    Case "Q"
       Exit Do
    End Select
 Loop
Err.Rsm25:
 Exit Sub
Err.Trp25:
 Resume Err.Rsm25
End Sub

Sub Copyright(Var)
 On Local Error Goto Error.Trap22
 Select Case Var
 Case 1
    Close #TempFile1
    FileName=Data.Path1+Config3(51)+Config3(15)
    Open FileName For Random Shared As #TempFile1 Len=26
    Field #TempFile1,10 As D$, 8 As T$, 8 As X$
    Get #TempFile1,2
    Lset X$=Mkd$(0)
    Put #TempFile1,2
    If Lof(TempFile1)/26<3 Then
       Lset D$="01-01-1980"
       Lset T$=Format$(Now,"hh:mm:ss")
       Lset X$=Mkd$(1#)
       Put #TempFile1,3
    Endif
    Graphics.Off=True
    Strng="Run number cleared."
    Call IO.O
 Case 2
    Close #TempFile1
    FileName=Data.Path1+Config3(51)+Config3(15)
    Open FileName For Random Shared As #TempFile1 Len=26
    Field #TempFile1,10 As D$, 8 As T$, 8 As X$
    Get #TempFile1,2
    X#=Cvd(X$)
    If Lof(TempFile1)/26<3 Then
       Lset D$="01-01-1980"
       Lset T$=Format$(Now,"hh:mm:ss")
       Lset X$=Mkd$(1#)
       Put #TempFile1,3
    Endif
    Graphics.Off=True
    Strng="Last run date: "+D$+" "+T$+"."
    Call IO.O
    Strng="Run number"+Rtrim$(Str$(X#))+"."
    Call IO.O
 Case 3
    Strng="Enter runs counter? "
    Call IO.I
    X#=Int(Val(Out2))
    If X#>=0# Then
       Close #TempFile1
       FileName=Data.Path1+Config3(51)+Config3(15)
       Open FileName For Random Shared As #TempFile1 Len=26
       Field #TempFile1,10 As D$, 8 As T$, 8 As X$
       Get #TempFile1,2
       Lset D$=DateS$
       Lset T$=Format$(Now,"hh:mm:ss")
       Lset X$=Mkd$(X#)
       Put #TempFile1,2
       If Lof(TempFile1)/26<3 Then
          Lset D$="01-01-1980"
          Lset T$=Format$(Now,"hh:mm:ss")
          Lset X$=Mkd$(1#)
          Put #TempFile1,3
       Endif
    Endif
 End Select
Error.Resume22:
 Exit Sub
Error.Trap22:
 Resume Error.Resume22
End Sub

Sub Utility.Menu
 On Local Error Goto Err.Trp26
 Do While Security.Guard
    If Lost.Carrier Then
       Exit Sub
    Endif
    If Node.Abort Then
       Exit Sub
    Endif
    Graphics.Off=False
    Strng="Utility Debug menu:"
    Call IO.O
    Graphics.Off=True
    Strng="[1]Share"
    If Share.Installed Then
       Strng=Strng+" (on)"
    Else
       Strng=Strng+" (off)"
    Endif
    Call IO.O
    Strng="[2]Fossil"
    If Fossil.Active Then
       Strng=Strng+" (on)"
    Else
       Strng=Strng+" (off)"
    Endif
    Call IO.O
    Strng="[3]Parser"
    If Config2(63) Then
       Strng=Strng+" (on)"
    Else
       Strng=Strng+" (off)"
    Endif
    Call IO.O
    If Local.Mode Then
       Strng="[4]Session-disk logging"
       If Disk.Log Then
          Strng=Strng+" (on)"
       Else
          Strng=Strng+" (off)"
       Endif
       Call IO.O
       Strng="[5]Session-printer logging"
       If Print.Log Then
          Strng=Strng+" (on)"
       Else
          Strng=Strng+" (off)"
       Endif
       Call IO.O
    Endif
    Graphics.Off=False
    If Local.Mode=False Then
       Strng="Enter utility debug selection(1-3, Q to quit)? "
    Else
       Strng="Enter utility debug selection(1-5, Q to quit)? "
    Endif
    No.Input.Out="Q"
    Call IO.I
    Var$=Nul
    Temp=Int(Val(Out2))
    If Ucase$(Out2)="Q" Then
       Exit Do
    Endif
    Select Case Temp
    Case 1
       Share.Installed=Not Share.Installed
    Case 2
       Fossil.Active=Not Fossil.Active
    Case 3
       If Config2(63) Then
          UserConfigRecord.UserConfig2=False
       Else
          UserConfigRecord.UserConfig2=True
       Endif
       Var3=MaxConfigArray1+63
       Call Write.Message.Record(MessWorkFile9,Var3)
    Case 4
       If Local.Mode Then
          Call Flag.Toggles(7)
       Endif
    Case 5
       If Local.Mode Then
          Call Flag.Toggles(8)
       Endif
    End Select
 Loop
Err.Rsm26:
 Exit Sub
Err.Trp26:
 Resume Err.Rsm26
End Sub
