; *************************************
;
; Acos GBBS Editor Version 1.1
; Main Utility Segment
; (c) April 1988
; Northwest Computer Services
;
; *************************************
;
; Written by
; W. P. Martens
; 28 April 1988
;
; *************************************
;
; Nortwest Computer Services
; Address Removed
;
; *************************************

 on nocar goto dropped

 public main.acos

 qu=0

acos.editor
 open #1,"h:segs.data"
 input #1,ll
 close
 print \\"There currently are "ll" segments in this section."\

main.acos
 print \"Acos.Editor (?=menu) >";
 input i$
 if i$="?" goto menu.acos
 if i$="E" goto edit.seg
 if i$="D" goto delete.acos
 if i$="L" goto list.seg
 if I$="Q" goto link.main
 if i$="R" goto execute.seg
 if i$="H" goto help.file
 if (i$="*") and (info(5)) goto link.sysop
 print \"Illegal Command"
 goto main.acos

menu.acos
 f$="acos.edit.menu"
 gosub show.file
 goto main.acos

help.file
 setint(1)
 copy "h:editor.help"
 setint("")
 goto main.acos

link.sysop
 Print\\"Entering System Operator Utility"
 link "h:edit.sys"

list.seg
 print \"Enter file number to list"
 input">";i$
 if i$="" goto main.acos
 if i$="?" kq=1:goto show.list
 kl=val(i$)
 if klll goto file.none
 f$="h:seg."+i$+".s"
 gosub show.file
 goto main.acos

file.none
 print \"That segment does not exist
 goto list.seg

delete.acos
 print\"Enter file number to delete"
 input">";i$
 if i$="" goto main.acos
 kl=val(i$)
 if klll goto del.none
 open #1,"h:segs.list"
 position#1,16,kl
 input #1,fu$,sy,sw
 close
 if (swun) and (not info(5)) goto del.belong
 f$="h:seg."+i$+".s"
 f9$="h:seg."+i$+".g"
 kill f9$
 kill f$
 if ll=kl goto del.done
 open #1,"h:segs.list"
 for x=kl to ll-1
 position #1,16,x+1
 input #1,fu$,sy,sw
 position #1,16,x
 print #1,fu$,sy,sw
 next
 close
 ll=ll-1
 open #1,"h:segs.data"
 print#1,ll
 close

del.belong
 print \"That segment was not written by you"
 print "thus, you are not allowed to delete it."
 goto main.acos

del.done
 print \"Deleted!!"
 goto main.acos

del.none
 print \"That file does not exist."
 goto delete.acos

execute.seg
 print \\"Execute A Segment…"
 print \"Enter number to execute"
 input ">";i$
 if i$="" goto main.acos
 if i$="?" kq=4: goto show.list
 kl=val(i$)
 if kl ll then goto ex.none
 open #1,"h:segs.list"
 position #1,16,kl
 input #1,k9$,k8,k7
 close
 if k8=0 goto ex.verify
 f$="h:seg."+i$+".s"
 link f$
 return

ex.verify
 print \’
 That program has not been verified by the System operator yet.  Try again later or choose another selection’
 goto execute.seg

ex.none
 print \"That segement does not exist"
 goto execute.seg

log.out
 print \\"breech of security"
 print"Goodbye…"
 goto dropped

link.main
 link"a:main.seg","fromsys"

edit.seg
 print\"Editor Command ->";
 input i$
 if i$="?" goto ed.menu
 if i$="A" goto add.file
 if i$="E" goto edit.file
 if i$="L" kq=2:goto show.list
 if i$="Q" goto main.acos

ed.menu
 setint(1)
 copy "h:edit.menu.1"
 setint("")
 goto edit.seg

add.file
 print \"Add a Segment…"
 edit(0)
 gosub editor
 if not edit(2) goto edit.seg

add.name
 print \"Name of Acos Segment"
 input ">";i$
 if i$="" goto add.none
 nq$=i$:ll=ll+1:f$="h:seg."+STR$(LL)+".s"
 kill f$:create f$:open #1,f$
 copy #8,#1:close
 print\\"File Saved!"
 create "h:segs.list"
 open #1,"h:segs.list"
 position #1,16,ll
 print #1,nq$,qu,un
 close
 open #1,"h:segs.data"
 print #1,ll
 close
 goto edit.seg

add.none
 print\"Do you really want to abort? (Y/N)"
 input ">";i$
 if i$="" print \"enter Yes or No":goto add.none
 if left$(i$,1)="Y" goto main.acos
 goto add.name

edit.file
 print \"File number to edit"
 input">";i$
 if i$="" goto edit.seg
 if i$="?" kq=3:goto show.list
 kl=val(i$)
 if kl>ll or kl ";sg$;"        ";
 if sq=1 print "Yes"
 if sq=0 print "No"
 next
 close
 setint("")

show.ret
 if kq=1 goto list.seg
 if kq=2 goto edit.seg
 if kq=3 goto edit.file
 if kq=4 goto execute.seg

show.list2
 print\\"There are currently no existing segments"
 goto show.ret

editor
 print \"Acos Segment Editor   "edit(3)"Cols., 4k max."
 print ".s to save, .h to get help, .a to abort"
 print "======================================="
 edit(1)
 return

dropped
 link"a:main.seg","term1″

show.file
 print \"Acos Editor V.1.0 Source File Lister"
 print "<Ctrl><S> to pause, <Space>" to stop
 print "===================================="\
 setint(1)
 copy f$
 setint("")
 return
