;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                       ;
; Emulex Performance Series Terminal/Print Server.      ;
;                                                       ;
; This macro was created by the makemenu utility.       ;
;                                                       ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Macro Name: cmenu.m

;Note that the following 3 lines are commented out
;authip       all port all
;authpriv     all
;authdev      all

descript     "This Menu Created by Utility MAKEMENU"

beginmac

            ;If debugging a macro use the cacheoff directive
            ;to disable caching of the macro. After the macro
            ;is fully debugged comment out ';' the cacheoff
            ;directive to enable caching of the macro.

;cacheoff   ;comment out ';' to enable caching of this macro

            ;If debug is to be enabled, issue server command
            ;SET PORT MACRO DEBUG port# SHOWREQ ENABLE to enable
            ;debug port and remove ';' on next line

;debugon    ;comment out ';' to disable debug mode

loop
   currc  1 1
   clr
   currc  6 9
   echo "%B%HtC O N N E C T   M E N U"
   currc  7 9
   echo "%HbC O N N E C T   M E N U%N"
;
;Paint the Menu
;
   currc  9 21
   echo "  1  king"
   currc  10 21
   echo "  2  queen"
   currc  11 21
   echo "  3  bishop"
   currc  9 48
   echo "  4  knight"
   currc  10 48
   echo "  5  castle"
   currc  11 48
   echo "  6  exit"
;
;Get Menu Selection
;
   align             ;force start of loop to new record
   loop
      currc 13 21
      curon
      f1 = 0         ;reset error flag
      echo "  Enter Selection: "
      clrends
      read           ;wait for input
      atoi b1 kb     ;convert ascii input to decimal
;
;Check for valid input
;
      if (b1 < 1)
         f1 = 1      ;set error
      elif ( b1 > 6)
         f1 = 1      ;set error
      endif
      if (f1 == 1)
         curoff
         currc 15 16
         echo "%HtTry Again"
         currc 16 16
         echo "%HbTry Again"
         sleep 10    ;allow user time to read message
         continue    ;back to loop
      endif
      break
   endloop
;
;Identify selection and process it
;
   currc 17 1
   if (b1 == 1)
      connect lat king
   elif (b1 == 2)
      connect lat queen
   elif (b1 == 3)
      connect tcp bishop
   elif (b1 == 4)
      connect tcp knight
   elif (b1 == 5)
      connect lat castle
   elif (b1 == 6)
      if (captive == 1)
         logout
      else
         exit
      endif
   endif
   sleep 10    ;allow user time to read message in case of
   continue    ;connect failure
endloop
endmac
