Advertisement
shiftdot515

invader

Jul 25th, 2019
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 17.79 KB | None | 0 0
  1. #!/sbin/mksh
  2. #Question
  3. #Who is this for?
  4. #### XTERM related ########
  5. icontitile(){  echo -e "\e]1;$*\a\c" ; }   # change icon name
  6. windowtitle(){ echo -e "\e]2;$*\a\c" ; }   # change window title
  7.  
  8. xproperty(){   echo -e "\e]3;$*\a\c" ; } # set X prop=value #prop to delete
  9. xcolor(){      echo -e "\e]4;$1;$2\a\c" ; }  
  10. xxcolor(){     echo -e "\e]5;$1;$2\a\c" ; }
  11.  
  12.  
  13. G0(){ echo -e "\017\c" ; }  # SI CTRL-O switch to standard character set
  14. G1(){ echo -e "\016\c" ; }  # SO CTRL-N switch to alternate character set
  15. G2SS(){ echo -e "\eN\c" ; } # SS2 Single Shift Select of G2 character set
  16. G3SS(){ echo -e "\eO\c" ; } # SS3 Single Shift Select of G3 character set
  17. CHARSET(){
  18. case "${1:-default}${2}" in
  19. default) echo -e '\e%@\c' ;; # Select default character set  ISO 8859-1
  20. utf8)    echo -e '\e%G\c' ;; # Select UTF-8 character set (ISO 2022)
  21. G0|G0ascii)  echo -e '\e(B\c' ;; # USASCII
  22. G0line)      echo -e '\e(0\c' ;; # DEC Special Character and Line Drawing Set
  23. G0soft)      echo -e '\e( @\c' ;; # use soft set
  24. G0?)         echo -e "\e(${2}\c"  ;; # Designate G0 Character Set
  25. G1|G1ascii)  echo -e '\e)B\c' ;; # USASCII
  26. G1line)      echo -e '\e)0\c' ;; # line drawing
  27. G1soft)      echo -e '\e) @\c' ;; # use soft set
  28. G1?)         echo -e "\e)${2}\c"  ;; # Designate G1 Character Set
  29. G2|G2ascii)  echo -e '\e\*B\c' ;;
  30. G2line)      echo -e '\e*0\c' ;;
  31. G2soft)      echo -e '\e* @\c' ;; # use soft set
  32. G2?)         echo -e "\e*${2}\c"  ;; # Designate G2 Character Set
  33. G3|G3ascii)  echo -e '\e+B\c' ;;
  34. G3line)      echo -e '\e+0\c' ;;
  35. G3soft)      echo -e '\e+ @\c' ;; # use soft set
  36. G3?)         echo -e "\e\+${2}\c"  ;; # Designate G3 Character Set
  37. vt100)       echo -e '\e[?2h\c' ;; # set USASCII for G0-G3 and vt100 mode ???
  38. esac
  39. }
  40. #echo 531
  41. CR(){ echo -e "\015\c" ; }   # carriage return
  42. LF(){ echo -e "\012\c" ; }   # line need or new line
  43. TABSET(){
  44. #TABSET col 10 20 30 ...
  45. #TABSET clear_all
  46. #TABSET cleartab 20 25 30 ...
  47. case "${1}" in
  48.   col)
  49.       shift
  50.       for COL in $@
  51.       do
  52.         CURSOR column $COL
  53.         echo -e '\eH\c' # Horizontal Tab Set ## HTS
  54.       done;;
  55.   clear_all)
  56.      echo -e '\e[3g\c' ;;  # TBC clear all tabs (works)
  57.   clear_tab)
  58.       shift
  59.       for COL in $@
  60.       do
  61.         CURSOR column $COL
  62.         echo -e '\e[0g\c'  # TBC clear tab at current column
  63.       done ;;
  64.   *)      echo -e '\eH\c' ;; # Horizontal Tab Set ## HTS
  65. esac
  66. }
  67. SS2(){ echo -e '\eN\c' ; }   # Single Shift for one G2 character
  68. SS3(){ echo -e '\eO\c' ; }   # Single Shift for one G3 character
  69. DOUBLEHEIGHTLINETOP(){ echo -e "\e#3\c" ; }  #DECDHL  top half
  70. DOUBLEHEIGHTLINEBOT(){ echo -e "\e#4\c" ; }  #DECDHL  bottom half
  71. PRINTDOUBLEHEIGHT(){
  72. echo -n "$1"
  73. echo -e "\e#3"
  74. echo -n "${2:-$1}"   # bottom, default 2same, but allow experimentation
  75. echo -e "\e#4"
  76. SINGLEWIDTHLINE; # cleanup
  77. }
  78. SINGLEWIDTHLINE(){ echo -en "\e#5" ; }      #DECSWL
  79. DOUBLEWIDTHLINE(){ echo -en "\e#6" ; }      #DECDWL
  80. SCREENTEST(){      echo -en "\e#8" ; }  #DECALN screen alignmnet test
  81. NORMAL(){ echo -e '\e[0m\c' ; }   # character attributes
  82. BOLD(){ echo -e '\e[1m\c' ; }  
  83. UNDERLINE(){ echo -e '\e[4m\c' ; }
  84. BLINK(){ echo -e '\e[5m\c' ; }
  85. INVERSE(){ echo -e '\e[7m\c' ; }
  86. INVISIBLE(){ echo -e '\e[8m\c' ; }
  87. UNDERLINENOT(){ echo -e '\e[24m\c' ; }
  88. BLINKNOT(){ echo -e '\e[25m\c' ; }
  89. INVERSENOT(){ echo -e '\e[27m\c' ; }
  90. INVISIBLENOT(){ echo -e '\e[28m\c' ; }
  91. BLACK(){   echo -e '\e[30m\c' ; }
  92. RED(){     echo -e '\e[31m\c' ; }
  93. GREEN(){   echo -e '\e[32m\c' ; }
  94. YELLOW(){  echo -e '\e[33m\c' ; }
  95. BLUE(){    echo -e '\e[34m\c' ; }
  96. MAGENTA(){ echo -e '\e[35m\c' ; }
  97. CYAN(){    echo -e '\e[36m\c' ; }
  98. WHITE(){   echo -e '\e[37m\c' ; }
  99. COLORFG(){   echo -e "\e[38;5;${1:-0}m\c" ; } # 88/256 color support
  100. COLORBG(){   echo -e "\e[48;5;${1:-0}m\c" ; } # 88/256 color support
  101. ORIGINAL(){ echo -e '\e[39m\c' ; }
  102. BGBLACK(){  echo -e '\e[40m\c' ; }
  103. BGRED(){    echo -e '\e[41m\c' ; }
  104. BGGREEN(){  echo -e '\e[42m\c' ; }
  105. BGYELLOW(){ echo -e '\e[43m\c' ; }
  106. BGBLUE(){   echo -e '\e[44m\c' ; }
  107. BGMAGENTA(){ echo -e '\e[45m\c' ; }
  108. BGCYAN(){   echo -e '\e[46m\c' ; }
  109. BGWHITE(){  echo -e '\e[47m\c' ; }
  110. BGORIGINAL(){ echo -e '\e[49m\c' ; }
  111. HIBLACK(){   echo -e '\e[90m\c' ; }
  112. HIRED(){     echo -e '\e[91m\c' ; }
  113. HIGREEN(){   echo -e '\e[92m\c' ; }
  114. HIYELLOW(){  echo -e '\e[93m\c' ; }
  115. HIBLUE(){    echo -e '\e[94m\c' ; }
  116. HIMAGENTA(){ echo -e '\e[95m\c' ; }
  117. HICYAN(){    echo -e '\e[96m\c' ; }
  118. HIWHITE(){   echo -e '\e[97m\c' ; }
  119. BGHIBLACK(){  echo -e '\e[100m\c' ; }
  120. BGHIRED(){    echo -e '\e[101m\c' ; }
  121. BGHIGREEN(){  echo -e '\e[102m\c' ; }
  122. BGHIYELLOW(){ echo -e '\e[103m\c' ; }
  123. BGHIBLUE(){   echo -e '\e[104m\c' ; }
  124. BGHIMAGENTA(){ echo -e '\e[105m\c' ; }
  125. BGHICYAN(){   echo -e '\e[106m\c' ; }
  126. BGHIWHITE(){  echo -e '\e[107m\c' ; }
  127.  
  128. REVVID(){ echo -e '\e[?5h\c' ; } # reverse video (set private mode)
  129. NORMVID(){ echo -e '\e[?5l\c' ; }  # normal video (reset private mode)
  130. ALTSCREEN(){ echo -e '\e[?47h\c' ; }    # alternate screen buffer
  131. NORMSCREEN(){ echo -e '\e[?47l\c' ; } # use normal screen buffer
  132. ALTSCREENSC(){ echo -e '\e[?1049h\c' ; } # save cursor+alternate screen buffer
  133.  
  134. KEYPADAPP(){       echo -e '\e=\c' ; }    #Are these usable?
  135. KEYPADNORMAL(){    echo -e '\e>\c' ; }    #don't seem so # maybe I needed strict-vt set
  136.  
  137. SCREENMEMLOCK(){   echo -e '\el\c' ; } #characters above cursor are locked in
  138. SCREENMEMUNLOCK(){ echo -e '\em\c' ; } ##in place, clear screen undoes also.
  139. FULLRESET(){ echo -e '\ec\c' ; }
  140. SOFTRESET(){ echo -e '\e[!p\c' ; }
  141. REFRESH(){ echo -e '\e[7t\c' ; }     # refresh xterm window
  142. MOVEWINDOW(){ echo -e "\e[3;${1:-0};${2:-0}t\c" ; } #move window to x,y pixels
  143. RESIZEWINDOW(){ echo -e "\e[4;${1:-620};${2:-900}t\c" ; } #resize height,width
  144. RESIZETERM(){ echo -e "\e[8;${2:-0};${1:-0}t\c" ; } #resize characters x,y
  145.  
  146. RESTOREWINDOW(){ echo -e "\e[9;0t\c" ; }  
  147. MAXWINDOW(){     echo -e "\e[9;1t\c" ; }
  148. FULLSCREEN(){ echo -e "\e[10;1t\c" ; }
  149. UNDOFULLSCREEN(){ echo -e "\e[10;0t\c" ; }
  150. #MAXWINDOW(){ MOVEWINDOW; RESIZE ; } #what was I thinkinghere?onDARWINthisis an x11util
  151.  
  152.  
  153. INSERTCHAR(){ echo -e "\e[${1}@\c" ; } # ICH insert Blank characters
  154. INSERTLINE(){ echo -e "\e[${1}L\c" ; } # insert $1 lines #IL
  155. DELETELINE(){ echo -e "\e[${1}M\c" ; } # delete $1 lines #DL
  156. DELETECHAR(){ echo -e "\e[${1}P\c" ; } # delete $1 characters #DCH
  157. SCROLLUP(){   echo -e "\e[${1}S\c" ; } # scroll up $1 lines   #SU
  158. SCROLLDOWN(){ echo -e "\e[${1}T\c" ; } # scroll down $2 lines #SD ?useless?
  159. REPEAT(){ echo -e "\e[${1}b\c" ; } #REP repeat graphicchar ?useless?
  160. SCROLLZONE(){ echo -e "\e[${1};${2}r\c" ; } #DECSTBM  set scrolling region
  161. LEDSET(){   # load LEDS #DECLL
  162. case "${1:-clear}$2" in
  163. clear|default)         echo -e '\e[0q\c' ;;   # clear all
  164. numlock|num)           echo -e '\e[1q\c' ;;   # light Num Lock
  165. capslock|caps)          echo -e '\e[2q\c' ;;
  166. scrolllock|scroll)     echo -e '\e[3q\c' ;;
  167. num*off)           echo -e '\e[21q\c' ;;   # extinguish Num Lock
  168. caps*off)          echo -e '\e[22q\c' ;;
  169. scr*off)           echo -e '\e[23q\c' ;;
  170. esac
  171. }
  172. #echo 663
  173. MODE(){
  174. for M in $@
  175. do
  176. case "${M}" in
  177. insert)  echo -en '\e[4h'  ;;  # insert mode  #IRM
  178. replace) echo -en '\e[4l'  ;;  # replace mode #IRM
  179. noecho)  echo -en '\e[12h' ;;  # no echo      #SRM
  180. echo)    echo -en '\e[12l' ;;  # local cho    #SRM
  181. cr)      echo -en '\e[20l' ;;  # cr only      #LNM
  182. crlf)    echo -en '\e[20h' ;;  # send crlf    #LNM
  183. 132)     echo -en '\e[?3h' ;;  # 132 column mode #DECCOLM
  184. 80)      echo -en '\e[?3l' ;;  # 80  column mode #DECCOLM
  185. allow)   echo -en '\e[?40h' ;; # allow 80/132 switch
  186. allowoff)   echo -en '\e[?40l' ;; # don't allow 80/132 switch
  187. jump|fast)   echo -en '\e[?4l' ;; # Jump/fast  scroll mode #DECSCLM
  188. smooth|slow) echo -en '\e[?4h' ;; # smooth/slow scroll mode #DECSCLM
  189. origin)      echo -en '\e[?6h' ;; #DECOM lines are rel scroll zone
  190. originoff)   echo -en '\e[?6l' ;; #DECOM back to normal
  191. wrap)      echo -en '\e[?7h' ;; #DECAWM
  192. wrapoff)   echo -en '\e[?7l' ;; #DECAWM
  193. repeat)      echo -en '\e[?8h' ;; #DECARM auto repeat 0.5 seconds
  194. repeatoff)   echo -en '\e[?8l' ;; #DECARM
  195. esac
  196. done
  197. }
  198. CURSOR(){
  199. case "$1" in
  200. save)     echo -e '\e7\c'     ;; # save cursor   # DECSC
  201. restore)  echo -e '\e8\c'     ;; # restore cursor# DECRC
  202. show)     echo -e '\e[25?h\c' ;; # show cursor # DECTCEM
  203. hide)     echo -e '\e[25?l\c' ;; # hide cursor # DECTCEM
  204. report)                       #### Report Cursor Position CPR
  205.        INVISIBLE;echo -e '\e[6n\c'; read -rn 16 -t 1.5;INVISIBLENOT  
  206.        CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  207.        if [[ "${REPLY:1:1}" != "[" || 'R' != "${REPLY: -1:1}" ]] then
  208.            xterm_info[6]=CURROW
  209.            xterm_info[7]=CURCOL
  210.        else
  211.            REPLY="${REPLY#*\[}"
  212.            REPLY="${REPLY%R}"
  213.            xterm_info[6]="${REPLY%;*}"
  214.            xterm_info[7]="${REPLY#*;}"
  215.       fi ;;
  216. style)  case "${2:-blink}${3:-block}" in       # set cursor style DECSCUSR
  217.         blinkblock)      echo -en '\e[1 q' ;;  # blinking block
  218.         steadyblock)     echo -en '\e[2 q' ;;  # steady block
  219.         blinkunderline)  echo -en '\e[3 q' ;;  # blinking underline
  220.         steadyunderline) echo -en '\e[4 q' ;;  # steady underline
  221.         *)               echo -en '\e[0 q' ;;
  222.         esac ;;
  223. up)       echo -en "\e[${2}A" ;; # CUU cursor up   #$2 times
  224. down)     echo -en "\e[${2}B" ;; # CUD cursor down   #$2="" ==null==default==1
  225. forward)  echo -en "\e[${2}C" ;; # CUF cursor forward  
  226. backward) echo -en "\e[${2}D" ;; # CUB cursor backward  
  227. nextline) echo -en "\e[${2}E" ;; # CNL cursor next line ?
  228. prevline) echo -en "\e[${2}F" ;; # CPL cursor preceding line ?
  229. column)   echo -en "\e[${2}G" ;; # CHA move cursor to absolute column position
  230. backtab)  echo -en "\e[${2}Z" ;;  #CBT Backward to tabstop
  231. nexttab)  echo -en "\e[${2}I" ;;  #CHT Forward $2 tab stops
  232. ind)   echo -e '\eD\c' ;;   # Index
  233. rnd)   echo -e '\eM\c' ;;   # Reverse Index
  234. nel)  echo  -e '\eE\c' ;;   # Next Line
  235. altcol)  echo -en "\e[${2}\0140"  ;; # Char position absolute HPA ???
  236. altline) echo -en "\e[${2}d"      ;; # Line Position Absolute VPA ???
  237. altpos)  echo -en "\e[${2};${3}f" ;; # Horizontal&Vertical Position HVP ???
  238. help)    echo "#CURSOR rise then run" ;;
  239. *)       echo -en "\e[${1};${2}H" ;; # CUP cursor position # default 1,1
  240. esac
  241. }
  242. #echo 731
  243. SELECTCAN(){  echo -e "\e[1\042q" ; }     #DECSCA set char. protect attribute
  244. SELECTCANNOT(){  echo -e "\e[0\042q" ; }  #DECSED DECSEL can erase
  245. ERASE(){
  246. #echo "${1:-line}_${2}"
  247. case "${1:-line}_${2}"  in
  248.     line_right)  echo -e '\e[0K\c' ;; # EL erase in line # right
  249.     line_left)   echo -e '\e[1K\c' ;; # EL erase in line # left
  250.     line_)       echo -e '\e[2K\c' ;; # EL erase in line # all
  251.     display_below)    echo -e '\e[0J\c' ;; # ED Erase in Display # below
  252.     display_above)    echo -e '\e[1J\c' ;; # ED Erase in Display # above
  253.     display_|screen_) echo -e '\e[2J\c' ;; # ED Erase in Display # all
  254.     display_saved)    echo -e '\e[3J\c' ;; # erase saved lines useless??
  255.     selective_below)    echo -e '\e[?0J\c' ;; # selective erase display
  256.     selective_above)    echo -e '\e[?1J\c' ;; # DECSED
  257.     selective_screen)   echo -e '\e[?2J\c' ;; # seems useless
  258.     selective_lineleft)  echo -e '\e[?0K\c' ;; # selective erase line
  259.     selective_lineright) echo -e '\e[?1K\c' ;; # DECSEL
  260.     selective_lineall)   echo -e '\e[?2K\c' ;; # seems useless
  261.     selective_rect) #DECSERA ERASE
  262.         shift 2  
  263.         echo -e "\e[${1};${2};${3};${4}\${\c" ;; # top left bottom right
  264.     rect_*)   # useless in terminal.app
  265.         shift  #   # DECERA Erase Rectangular Area
  266.         echo -e "\e[${1};${2};${3};${4}\$z\c" ;; # top left bottom right
  267.     char_*)
  268.         echo -e "\e[${2}X\c" ;;    # erase $2 characters backward ECH ?useless?
  269.  
  270.     screen_)  #add another way to clear screen, maybe w/o home?
  271.         CURSOR save;
  272.         echo -e "\e[H\e[J\c" # H or J etc by themselves doesn't do it.
  273.         CURSOR retore;
  274.         ;;
  275.     esac
  276. }
  277. #echo 767
  278.  
  279. Paint(){  # what I always wanted from ERASE
  280. # paint a rectangle on the screen , taking the current postion
  281. # as one corner.  then dx dy optionalcolor optionalcharacter flags
  282. # procedure will determine length, and height, and whether...
  283. # And, how to interpret dx dy, to create an appropriate corner.
  284. XTERMINFO clear #insert self gratifying remark here.
  285. # now get cursor position
  286. local integer cornerx
  287. local integer cornery
  288. CURSOR report
  289. cornerx=${xterm_info[6]}
  290. cornery=${xterm_info[7]}
  291. #now, paint this square right now with an X
  292. # since it will be needed to painted, regardlessly
  293. #PaintASqaure
  294. CURSOR save
  295. echo -e "A\c" #pedantically, we do CURSOR backward # but we don't need to
  296. CURSOR restore
  297. # now see if that works.
  298. # ok.  opposing corner , then paint that
  299. local integer ox
  300. local integer oy
  301. # we should see if it works. but 1st presume it works
  302. let ox=cornerx+$1
  303. let oy=cornery+$2
  304. CURSOR $ox $oy
  305. echo -e "B\c"
  306. CURSOR backward
  307. # fixme: use the shorter corner
  308. # finish me! dan
  309. }
  310.  
  311. wow(){  # and now fg !
  312. for X in ../* ;
  313. do
  314.   print ''
  315.   DOUBLEWIDTHLINE
  316. done
  317. }
  318.    
  319. ICONIFIED(){ # true  if iconified  
  320. INVISIBLE;echo -e '\e[11t\c'; read -rn 4 -t 1.5;INVISIBLENOT
  321. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  322. #echo "${REPLY:2:1}"
  323. #echo "${#REPLY}"
  324. (( "${REPLY:2:1}" == "2" ))
  325. }
  326. OSXTERMINAL(){ # true  if running inside Terminal.app
  327. INVISIBLE;echo -e '\e[7n\c'; read -rn 20 -t 1.5;INVISIBLENOT
  328. if [[ "" == "$REPLY" ]] then
  329.    (( 1 == 0 ))
  330. fi
  331. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  332. [[ "$REPLY" == "Mac OS X Terminal" ]]
  333. }
  334.  
  335. typeset -ai xterm_info  # an array of integers
  336. XTERMINFO()
  337. {
  338.  case "${1}" in
  339.  clear|init)
  340.      xterm_info[0]=XPOS
  341.      xterm_info[1]=YPOS
  342.      xterm_info[2]=XSIZE
  343.      xterm_info[3]=YSIZE
  344.      xterm_info[4]=TERMID
  345.      xterm_info[5]=DEVATTR
  346.      xterm_info[6]=CURROW
  347.      xterm_info[7]=CURCOL
  348.      xterm_info[8]=ROWS
  349.      xterm_info[9]=COLS
  350.  ;;
  351.  dump|print)
  352.      print "XPOS    ${xterm_info[0]}"
  353.      print "YPOS    ${xterm_info[1]}"
  354.      print "XSIZE   ${xterm_info[2]}"
  355.      print "YSIZE   ${xterm_info[3]}"
  356.      print "TERMID  ${xterm_info[4]}"
  357.      print "DEVATTR ${xterm_info[5]}"
  358.      print "CURROW  ${xterm_info[6]}"
  359.      print "CURCOL  ${xterm_info[7]}"
  360.      print "ROWS    ${xterm_info[8]}"
  361.      print "COLS    ${xterm_info[9]}"
  362.  ;;
  363.  [xX])      print ${xterm_info[0]} ;;
  364.  [yY])      print ${xterm_info[1]} ;;
  365.  [xX]size)  print ${xterm_info[2]} ;;
  366.  [yY]size)  print ${xterm_info[3]} ;;
  367.  *)         print ${xterm_info[@]} ;;
  368.  esac
  369. }
  370. WINDOWPOS(){ # get xterm window position ( in pixels )
  371. INVISIBLE;echo -e '\e[13t\c'; read -rn 16 -t 1.5;INVISIBLENOT
  372. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  373. #echo "${#REPLY}"
  374. #echo "${REPLY:1:3}" |vis
  375. #[[ "${REPLY:1:3}" == "[3;" && 't' == "${REPLY: -1:1}" ]] && echo fine
  376. if [[ "${REPLY:1:3}" != "[3;" || 't' != "${REPLY: -1:1}" ]]
  377. then
  378.    echo -e "\nnot fine"
  379.    return    # return false produced error when X="$(WINDOWPOS)"
  380. fi  
  381. #echo "${REPLY:4:(( ${#REPLY} - 5 ))}"  
  382. REPLY="${REPLY:4:(( ${#REPLY} - 5 ))}" # after this REPLY is 81;48 etc
  383. xterm_info[0]="${REPLY%;*}"            
  384. xterm_info[1]="${REPLY#*;}"      
  385. }
  386. WINDOWSIZE(){ # get xterm window size (in pixels)
  387. INVISIBLE;echo -e '\e[14t\c'; read -rn 16 -t 1.5;INVISIBLENOT
  388. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  389. if [[ "${REPLY:1:3}" != "[4;" || 't' != "${REPLY: -1:1}" ]]
  390. then
  391.    return  
  392. fi  
  393. REPLY="${REPLY:4:(( ${#REPLY} - 5 ))}"
  394. xterm_info[2]="${REPLY%;*}"            
  395. xterm_info[3]="${REPLY#*;}"      
  396. }
  397. TERMSIZE(){ # get xterm size of text area window size (in characters)
  398. INVISIBLE;echo -e '\e[18t\c'; read -rn 16 -t 1.5;INVISIBLENOT
  399. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  400. if [[ "${REPLY:1:3}" != "[8;" || 't' != "${REPLY: -1:1}" ]]
  401. then
  402.    return  
  403. fi  
  404. REPLY="${REPLY:4:(( ${#REPLY} - 5 ))}"
  405. xterm_info[8]="${REPLY%;*}"            
  406. xterm_info[9]="${REPLY#*;}"      
  407. }
  408. XTERMINALID(){
  409. INVISIBLE;echo -e '\eZ\c'; read -rn 16 -t 1.5;INVISIBLENOT
  410. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  411. if [[ "${REPLY:3:4}" == "1;2c" ]] then
  412.     xterm_info[4]=1     # string for terminal.app at least
  413. else
  414.     xterm_info[4]=TERMID
  415. fi
  416. }
  417. DECDEVATTR(){
  418. INVISIBLE;echo -e '\e[0c\c'; read -rn 16 -t 1.5;INVISIBLENOT
  419. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  420. #SEND DEVICE Attributes (PRIMARY DA) ... depends on decTerminalID resource
  421. REPLY="${REPLY#*\[}"
  422. if [ "${REPLY}" == "" ] ; then
  423.     xterm_info[5]=DEVATTR
  424. elif [ "${REPLY}"     == "?1;2c" ] ; then
  425.     xterm_info[5]=1          # VT100 with ADVANCED Video Option
  426. elif [ "${REPLY}"     == "?1;0c" ] ; then
  427.     xterm_info[5]=2          # VT101 with NO Options
  428. elif [ "${REPLY}"     == "?6c" ] ; then
  429.     xterm_info[5]=3          # VT102
  430. elif [ "${REPLY:0:4}" == "?60;" ] ; then
  431.     xterm_info[5]=4       # VT220
  432.     REPLY="{$REPLY:4}"    # remaining parameters in REPLY
  433. else
  434.     xterm_info[5]=DEVATTR
  435. fi
  436. }
  437.  
  438. ENQUIRE(){
  439. INVISIBLE;echo -e '\05'; read -rn 16 -t 1.5;INVISIBLENOT
  440. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  441. #REPLY is now answerbackString..if there is one.
  442. }
  443. DECREQTERM(){  # request terminal parameters #DECREQTPARM
  444. INVISIBLE;echo -en '\e[1x'; read -rn 30 -t 0.8 ;INVISIBLENOT
  445. CURSOR backward "${#REPLY}";CURSOR backward;  # cleanup
  446. if [[ "$REPLY" == "" ]] then
  447.   return
  448. elif [[ "${REPLY:1:3}" != "[3;" || 't' != "${REPLY: -1:1}x" ]] then
  449.     REPLY="${REPLY%x}"
  450.     REPLY="${REPLY#*3;}" #REPLY is now paramaters
  451.     echo "$REPLY" |vis
  452. fi
  453. }
  454. #Answer
  455. #SomeoneTheyNeverPaidWell
  456. #Changethat
  457. #Answer
  458. #my401k
  459. #my401k: no tax dependent so guess we dont need to do this lol
  460.  
  461.  
  462.  
  463.  
  464. SCREENTEST;sleep 1.2; ERASE screen
  465. (( rows = $(stty -a|sed -n '1{s/^.* baud; //;s/ rows.*columns;$//;p;}') / 2 ))
  466. sleep 2.5
  467. #MEH
  468. PRINTDOUBLEHEIGHT 'xxxxtTh/exxxxxxxxxx' '#MUTETTHHePRESIDENT'
  469. CURSOR down
  470. PRINTDOUBLEHEIGHT 'x' '#'
  471. print Alien
  472. CURSOR down
  473. PRINTDOUBLEHEIGHT 'x' 'M'
  474. CURSOR down
  475. PRINTDOUBLEHEIGHT 'x' 'U'
  476. print prize
  477. CURSOR down
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement