├── .gitignore ├── .travis.yml ├── COPYING ├── Makefile ├── README.md ├── ansi ├── ansi.rkt ├── info.rkt ├── lcd-terminal.rkt ├── main.rkt ├── private │ ├── install.rkt │ ├── tty-raw-extension.rkt │ └── tty_raw.c ├── test-ansi.rkt ├── test-modes.rkt ├── test-raw.rkt └── test-screen-size.rkt ├── doc ├── all-escapes.txt ├── ctlseqs.txt └── xterm_controls.txt ├── gpl.txt ├── info.rkt ├── lgpl.txt └── test-ansi-output.png /.gitignore: -------------------------------------------------------------------------------- 1 | compiled/ 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | # Based on: https://github.com/greghendershott/travis-racket 4 | 5 | dist: bionic 6 | 7 | env: 8 | global: 9 | # Supply a global RACKET_DIR environment variable. This is where 10 | # Racket will be installed. A good idea is to use ~/racket because 11 | # that doesn't require sudo to install and is therefore compatible 12 | # with Travis CI's newer container infrastructure. 13 | - RACKET_DIR=~/racket 14 | matrix: 15 | # Supply at least one RACKET_VERSION environment variable. This is 16 | # used by the install-racket.sh script (run at before_install, 17 | # below) to select the version of Racket to download and install. 18 | # 19 | # Supply more than one RACKET_VERSION (as in the example below) to 20 | # create a Travis-CI build matrix to test against multiple Racket 21 | # versions. 22 | - RACKET_VERSION=7.6 23 | - RACKET_VERSION=HEAD 24 | - RACKET_VERSION=HEADCS 25 | 26 | matrix: 27 | allow_failures: 28 | # - env: RACKET_VERSION=HEAD 29 | fast_finish: true 30 | 31 | before_install: 32 | - git clone https://github.com/greghendershott/travis-racket.git ~/travis-racket 33 | - cat ~/travis-racket/install-racket.sh | bash # pipe to bash not sh! 34 | - export PATH="${RACKET_DIR}/bin:${PATH}" #install-racket.sh can't set for us 35 | 36 | install: 37 | - raco pkg install -j 4 --auto --name ansi 38 | 39 | before_script: 40 | 41 | # Here supply steps such as raco make, raco test, etc. You can run 42 | # `raco pkg install --deps search-auto` to install any required 43 | # packages without it getting stuck on a confirmation prompt. 44 | script: 45 | - raco test -x -p ansi 46 | 47 | after_success: 48 | - raco setup --check-pkg-deps --pkgs ansi 49 | # These cause a problem with test-ansi.rkt 50 | # - raco pkg install --deps search-auto cover cover-coveralls 51 | # - raco cover -b -f coveralls -d $TRAVIS_BUILD_DIR/coverage . 52 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | racket-ansi: A package for ANSI and VT10x input and output. 2 | Copyright (C) 2011, 2013, 2014, 2015 Tony Garnock-Jones 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as 6 | published by the Free Software Foundation, either version 3 of the 7 | License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this program (see the files "lgpl.txt" and 16 | "gpl.txt"). If not, see . 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PACKAGENAME=ansi 2 | COLLECTS=ansi 3 | 4 | all: setup 5 | 6 | clean: 7 | find . -name compiled -type d | xargs rm -rf 8 | 9 | setup: 10 | raco setup $(COLLECTS) 11 | 12 | link: 13 | raco pkg install --link -n $(PACKAGENAME) $$(pwd) 14 | 15 | unlink: 16 | raco pkg remove $(PACKAGENAME) 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ansi 2 | 3 | ANSI and VT10x escape sequences. 4 | 5 | ## License 6 | 7 | Copyright (C) 2011, 2013, 2014, 2015 Tony Garnock-Jones 8 | 9 | This program is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as 11 | published by the Free Software Foundation, either version 3 of the 12 | License, or (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with this program (see the files "lgpl.txt" and 21 | "gpl.txt"). If not, see . 22 | -------------------------------------------------------------------------------- /ansi/ansi.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | ;; ANSI/VT10x escape sequences. 3 | ;; 4 | ;; Based initially on http://en.wikipedia.org/wiki/ANSI_escape_code, 5 | ;; but it doesn't have very many definitions; this page, however, is 6 | ;; comprehensive and excellent: 7 | ;; http://bjh21.me.uk/all-escapes/all-escapes.txt 8 | ;; 9 | ;; See also http://www.xfree86.org/current/ctlseqs.html 10 | 11 | (provide (except-out (all-defined-out) 12 | CSI 13 | ST 14 | OSC 15 | format-parameter 16 | define-variable-arity-escape-sequence 17 | define-escape-sequence)) 18 | 19 | (define CSI "\033[") 20 | (define ST "\033\\") 21 | (define OSC "\033]") 22 | 23 | (define (format-parameter v) 24 | (cond 25 | ((number? v) (number->string v)) 26 | ((string? v) v) 27 | (else (error 'format-parameter "ANSI parameters must be either strings or numbers; got ~v" v)))) 28 | 29 | (define-syntax-rule (define-escape-sequence (name arg ...) piece ...) 30 | (define (name arg ...) 31 | (let ((arg (format-parameter arg)) ...) 32 | (string-append piece ...)))) 33 | 34 | (define-syntax-rule (define-variable-arity-escape-sequence (name args) piece ...) 35 | (define (name . args) 36 | (if (null? args) 37 | (let ((args "")) 38 | (string-append piece ...)) 39 | (let ((args (string-append (format-parameter (car args)) 40 | (foldr (lambda (n acc) 41 | (string-append ";" (format-parameter n) acc)) 42 | "" 43 | (cdr args))))) 44 | (string-append piece ...))))) 45 | 46 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 47 | ;; Basic ANSI sequences 48 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 49 | 50 | (define-escape-sequence (insert-characters n) CSI n "@") 51 | 52 | (define-escape-sequence (move-cursor-up n) CSI n "A") 53 | (define-escape-sequence (move-cursor-down n) CSI n "B") 54 | (define-escape-sequence (move-cursor-right n) CSI n "C") 55 | (define-escape-sequence (move-cursor-left n) CSI n "D") 56 | 57 | (define-escape-sequence (cursor-next-line n) CSI n "E") 58 | (define-escape-sequence (cursor-previous-line n) CSI n "F") 59 | 60 | (define-escape-sequence (goto-column n) CSI n "G") 61 | (define-escape-sequence (goto row column) CSI row ";" column "H") 62 | 63 | (define-escape-sequence (cursor-forward-tabulation n) CSI n "I") 64 | 65 | (define-escape-sequence (clear-screen-from-cursor) CSI "0J") 66 | (define-escape-sequence (clear-screen-to-cursor) CSI "1J") 67 | (define-escape-sequence (clear-screen) CSI "2J") 68 | 69 | (define-escape-sequence (clear-to-eol) CSI "0K") 70 | (define-escape-sequence (clear-to-sol) CSI "1K") 71 | (define-escape-sequence (clear-line) CSI "2K") 72 | 73 | (define-escape-sequence (insert-lines n) CSI n "L") 74 | (define-escape-sequence (delete-lines n) CSI n "M") 75 | 76 | (define-escape-sequence (clear-to-end-of-field) CSI "0N") 77 | (define-escape-sequence (clear-to-start-of-field) CSI "1N") 78 | (define-escape-sequence (clear-field) CSI "2N") 79 | 80 | (define-escape-sequence (clear-to-end-of-area) CSI "0O") 81 | (define-escape-sequence (clear-to-start-of-area) CSI "1O") 82 | (define-escape-sequence (clear-area) CSI "2O") 83 | 84 | (define-escape-sequence (delete-characters n) CSI n "P") 85 | 86 | (define-escape-sequence (select-editing-extent-page) CSI "0Q") 87 | (define-escape-sequence (select-editing-extent-line) CSI "1Q") 88 | (define-escape-sequence (select-editing-extent-field) CSI "2Q") 89 | (define-escape-sequence (select-editing-extent-area) CSI "3Q") 90 | (define-escape-sequence (select-editing-extent-whole) CSI "4Q") 91 | 92 | (define-escape-sequence (active-position-report row column) CSI row ";" column "R") 93 | 94 | (define-escape-sequence (scroll-up n) CSI n "S") 95 | (define-escape-sequence (scroll-down n) CSI n "T") 96 | 97 | (define-escape-sequence (next-page n) CSI n "U") 98 | (define-escape-sequence (previous-page n) CSI n "V") 99 | 100 | (define-variable-arity-escape-sequence (cursor-tabulation-control args) CSI args "W") 101 | 102 | (define-escape-sequence (erase-characters n) CSI n "X") 103 | 104 | (define-escape-sequence (cursor-line-tabulation n) CSI n "Y") 105 | (define-escape-sequence (cursor-backward-tabulation n) CSI n "Z") 106 | 107 | (define-escape-sequence (select-implicit-movement-direction n) CSI n "^") 108 | (define-escape-sequence (character-position-absolute n) CSI n "`") 109 | 110 | (define-escape-sequence (character-position-forward n) CSI n "a") 111 | (define-escape-sequence (ansi-repeat n) CSI n "b") 112 | 113 | (define-escape-sequence (device-attributes-request n) CSI n "c") 114 | ;; See dec-device-attributes-response below. 115 | 116 | (define-escape-sequence (line-position-absolute n) CSI n "d") 117 | (define-escape-sequence (line-position-forward n) CSI n "e") 118 | (define-escape-sequence (character-and-line-position row column) CSI row ";" column "f") 119 | 120 | (define-escape-sequence (tabulation-clear-character-stop) CSI "0g") 121 | (define-escape-sequence (tabulation-clear-line-stop) CSI "1g") 122 | (define-escape-sequence (tabulation-clear-all-character-stops-on-this-line) CSI "2g") 123 | (define-escape-sequence (tabulation-clear-all-character-stops) CSI "3g") 124 | (define-escape-sequence (tabulation-clear-all-line-stops) CSI "4g") 125 | (define-escape-sequence (tabulation-clear-all-stops) CSI "5g") 126 | 127 | (define-variable-arity-escape-sequence (set-mode args) CSI args "h") 128 | 129 | (define-escape-sequence (character-position-backward n) CSI n "j") 130 | (define-escape-sequence (line-position-backward n) CSI n "k") 131 | 132 | (define-variable-arity-escape-sequence (reset-mode args) CSI args "l") 133 | 134 | (define-variable-arity-escape-sequence (select-graphic-rendition parameters) CSI parameters "m") 135 | 136 | (define-escape-sequence (device-status-report-reply-ready) CSI "0n") 137 | (define-escape-sequence (device-status-report-reply-busy-retry-later) CSI "1n") 138 | (define-escape-sequence (device-status-report-reply-busy-expect-answer-later) CSI "2n") 139 | (define-escape-sequence (device-status-report-problem-retry-later) CSI "3n") 140 | (define-escape-sequence (device-status-report-problem-expect-answer-later) CSI "4n") 141 | (define-escape-sequence (device-status-report-request) CSI "5n") 142 | (define-escape-sequence (position-report-request) CSI "6n") 143 | 144 | (define-variable-arity-escape-sequence (define-area-qualification args) CSI args "o") 145 | 146 | (define-escape-sequence (device-request-screen-size) CSI "18t") 147 | 148 | (define-escape-sequence (scroll-left n) CSI n " @") 149 | (define-escape-sequence (scroll-right n) CSI n " A") 150 | 151 | (define-escape-sequence (page-position-absolute n) CSI n " P") 152 | (define-escape-sequence (page-position-forward n) CSI n " Q") 153 | (define-escape-sequence (page-position-backward n) CSI n " R") 154 | 155 | (define-escape-sequence (select-presentation-directions orientation effect) 156 | CSI orientation ";" effect " S") 157 | 158 | (define-escape-sequence (dimension-text-area rows columns) CSI rows ";" columns " T") 159 | (define-escape-sequence (set-line-home n) CSI n " U") 160 | (define-escape-sequence (set-line-limit n) CSI n " V") 161 | 162 | (define-escape-sequence (function-key n) CSI n " W") 163 | 164 | (define-escape-sequence (tabulation-aligned-trailing-edge n) CSI n " `") 165 | (define-escape-sequence (tabulation-aligned-leading-edge n) CSI n " a") 166 | (define-escape-sequence (tabulation-aligned-centred n) CSI n " b") 167 | (define-escape-sequence (tabulation-aligned-centred-on-character n ch) CSI n ";" ch " c") 168 | (define-escape-sequence (tabulation-stop-remove n) CSI n " d") 169 | 170 | ;; n = count of 45 degree counterclockwise rotations from normal 171 | ;; direction along character path. 172 | (define-escape-sequence (select-character-orientation n) CSI n " e") 173 | 174 | (define-escape-sequence (set-page-home n) CSI n " i") 175 | (define-escape-sequence (set-page-limit n) CSI n " j") 176 | 177 | (define-escape-sequence (select-character-path-LR/TB effect) CSI "1;" effect " k") 178 | (define-escape-sequence (select-character-path-RL/BT effect) CSI "2;" effect " k") 179 | 180 | ;; SCO only? (define-escape-sequence (save-cursor-position) CSI "s") 181 | ;; SCO only? (define-escape-sequence (restore-cursor-position) CSI "u") 182 | 183 | (define-escape-sequence (hide-cursor) CSI "?25l") 184 | (define-escape-sequence (show-cursor) CSI "?25h") 185 | 186 | (define-escape-sequence (ansi-interrupt) "\033a") 187 | 188 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 189 | ;; DEC private VT100 sequences 190 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 191 | 192 | (define-escape-sequence (dec-double-width-double-height-top) "\033#3") 193 | (define-escape-sequence (dec-double-width-double-height-bottom) "\033#4") 194 | (define-escape-sequence (dec-single-width-single-height) "\033#5") 195 | (define-escape-sequence (dec-double-width-single-height) "\033#6") 196 | 197 | (define-escape-sequence (dec-save-cursor) "\0337") 198 | (define-escape-sequence (dec-restore-cursor) "\0338") 199 | 200 | (define-escape-sequence (dec-reset-margins) CSI "r") 201 | (define-escape-sequence (dec-set-margins top-row bottom-row) CSI top-row ";" bottom-row "r") 202 | 203 | ;; dec-set-left-right-margins is apparently for VT400 and printers only: 204 | (define-escape-sequence (dec-set-left-right-margins left right) CSI left ";" right "s") 205 | 206 | (define-escape-sequence (dec-soft-terminal-reset) CSI "!p") 207 | 208 | (define-variable-arity-escape-sequence (dec-device-attributes-response args) CSI "?" args "c") 209 | 210 | ;; VT400: 211 | (define-escape-sequence (dec-copy-rectangular-area top left bottom right page 212 | target-top target-left target-page) 213 | CSI top ";" left ";" bottom ";" right ";" page ";" target-top ";" target-left ";" target-page 214 | "$v") 215 | (define-escape-sequence (dec-fill-rectangular-area char-code top left bottom right page) 216 | CSI char-code ";" top ";" left ";" bottom ";" right ";" page "$x") 217 | (define-escape-sequence (dec-erase-rectangular-area top left bottom right page) 218 | CSI top ";" left ";" bottom ";" right ";" page "$z") 219 | (define-escape-sequence (dec-selective-erase-rectangular-area top left bottom right page) 220 | CSI top ";" left ";" bottom ";" right ";" page "${") 221 | 222 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 223 | ;; xterm sequences 224 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 225 | 226 | (define-escape-sequence (xterm-full-reset) "\033c") ;; DEC also? 227 | 228 | (define (xterm-set-icon-name-and-window-title text) 229 | (string-append OSC "0;" text ST)) 230 | (define (xterm-set-icon-name text) 231 | (string-append OSC "1;" text ST)) 232 | (define (xterm-set-window-title text) 233 | (string-append OSC "2;" text ST)) 234 | 235 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 236 | ;; Parameters for select-graphic-rendition 237 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 238 | 239 | (define style-normal 0) 240 | (define style-bold 1) 241 | (define style-faint 2) 242 | (define style-italic/inverse 3) 243 | (define style-underline 4) 244 | (define style-blink-slow 5) 245 | (define style-blink-fast 6) 246 | (define style-inverse 7) 247 | (define style-conceal 8) 248 | (define style-crossed-out 9) 249 | 250 | (define style-primary-font 10) 251 | (define (style-font n) 252 | (if (<= 0 n 9) 253 | (+ n 10) 254 | (error 'style-font "Font number out of range: ~a" n))) 255 | 256 | (define style-fraktur 20) 257 | (define style-no-bold/double-underline 21) 258 | (define style-normal-intensity 22) 259 | (define style-no-italic-no-fraktur 23) 260 | (define style-no-underline 24) 261 | (define style-no-blink 25) 262 | ;; 26 reserved, per wikipedia 263 | (define style-no-inverse 27) 264 | (define style-no-conceal 28) 265 | 266 | (define (style-text-color n) 267 | (if (<= 0 n 7) 268 | (+ n 30) 269 | (error 'style-text-color "Color number out of range: ~a" n))) 270 | (define style-default-text-color 39) 271 | 272 | (define (style-background-color n) 273 | (if (<= 0 n 7) 274 | (+ n 40) 275 | (error 'style-background-color "Color number out of range: ~a" n))) 276 | (define style-default-background-color 49) 277 | 278 | (define-escape-sequence (select-xterm-256-text-color n) CSI "38;5;" n "m") 279 | (define-escape-sequence (select-xterm-256-background-color n) CSI "48;5;" n "m") 280 | 281 | ;; 50 reserved, per wikipedia 282 | (define style-framed 51) 283 | (define style-encircled 52) 284 | (define style-overlined 53) 285 | (define style-no-framed-no-encircled 54) 286 | (define style-no-overlined 55) 287 | 288 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 289 | ;; Colors for certain parameters to select-graphic-rendition 290 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 291 | 292 | (define color-black 0) 293 | (define color-red 1) 294 | (define color-green 2) 295 | (define color-yellow 3) 296 | (define color-blue 4) 297 | (define color-magenta 5) 298 | (define color-cyan 6) 299 | (define color-white 7) 300 | 301 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 302 | ;; Parameters for define-area-qualification 303 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 304 | 305 | (define qualified-area-unprotected-and-unguarded 0) 306 | (define qualified-area-protected-and-guarded 1) 307 | (define qualified-area-graphic-input 2) 308 | (define qualified-area-numeric-input 3) 309 | (define qualified-area-alphabetic-input 4) 310 | (define qualified-area-right-aligned-input 5) 311 | (define qualified-area-zero-fill 6) 312 | (define qualified-area-tab-stop-field-start 7) ;; no idea what this does, sorry about the name 313 | (define qualified-area-protected-and-unguarded 8) 314 | (define qualified-area-space-fill 9) 315 | (define qualified-area-left-aligned-input 10) 316 | (define qualified-area-reversed-order 11) 317 | 318 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 319 | ;; Parameters for select-presentation-directions 320 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 321 | 322 | ;; direction-LINEORIENTATION-CHARACTERPATH-LINEPROGRESSION 323 | (define direction-horizontal-LR-TB 0) 324 | (define direction-vertical-TB-RL 1) 325 | (define direction-vertical-TB-LR 2) 326 | (define direction-horizontal-RL-TB 3) 327 | (define direction-vertical-BT-LR 4) 328 | (define direction-horizontal-RL-BT 5) 329 | (define direction-horizontal-LR-BT 6) 330 | (define direction-vertical-BT-RL 7) 331 | 332 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 333 | ;; Parameters for select-presentation-directions, 334 | ;; select-character-path-LR/TB, and select-character-path-RL/BT 335 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 336 | 337 | (define effect-undefined 0) 338 | (define effect-update-presentation-from-data 1) 339 | (define effect-update-data-from-presentation 2) 340 | 341 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 342 | ;; Modes (for set-mode and reset-mode) 343 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 344 | 345 | ;; Note that for some of the non-standard modes, the codes 346 | ;; conflict. See, for example, "?9", which controls interlace-mode for 347 | ;; DEC and X10 mouse-reporting for xterms. 348 | 349 | ;; Standard modes 350 | 351 | (define guarded-area-transfer-mode "1") 352 | (define keyboard-action-mode "2") 353 | (define control-representation-mode "3") 354 | (define insertion-replacement-mode "4") 355 | (define status-report-transfer-mode "5") 356 | (define erasure-mode "6") 357 | (define line-editing-mode "7") 358 | (define bi-directional-support-mode "8") 359 | (define device-component-select-mode "9") 360 | (define character-editing-mode "10") 361 | (define positioning-unit-mode "11") ;; deprecated 362 | (define send/receive-mode "12") 363 | (define format-effector-action-mode "13") 364 | (define format-effector-transfer-mode "14") 365 | (define multiple-area-transfer-mode "15") 366 | (define transfer-termination-mode "16") 367 | (define selected-area-transfer-mode "17") 368 | (define tabulation-stop-mode "18") 369 | (define editing-boundary-mode "19") ;; obsolete 370 | (define line-feed/new-line-mode "20") ;; obsolete 371 | (define graphic-rendition-combination-mode "21") 372 | (define zero-default-mode "22") ;; deprecated 373 | 374 | ;; dec 375 | (define ansi/vt52-mode "?2") 376 | (define column-mode "?3") 377 | (define scrolling-mode "?4") 378 | (define screen-mode "?5") 379 | (define origin-mode "?6") 380 | (define autowrap-mode "?7") 381 | (define auto-repeat-mode "?8") 382 | (define interlace-mode "?9") 383 | (define editing-mode "?10") 384 | (define line-transmit-mode "?11") 385 | (define space-compression/field-delimiter-mode "?13") 386 | (define transmit-execution-mode "?14") 387 | (define edit-key-execution-mode "?16") 388 | (define print-form-feed-mode "?18") 389 | (define printer-extent-mode "?19") 390 | (define print-density-mode "?24") 391 | (define text-cursor-enable-mode "?25") 392 | (define proportional-spacing-mode "?27") 393 | (define pitch-select-mode "?29") 394 | (define right-to-left-writing-direction-mode "?34") 395 | (define hebrew-encoding-mode "?36") 396 | (define tek-graphics-mode "?38") 397 | (define carriage-return/new-line-mode "?40") 398 | (define non-bidirectional-print-direction-mode "?41") 399 | (define nat-repl-char "?42") ;; no idea what this might mean 400 | ;; ^ Huh. Per https://vt100.net/docs/vt510-rm/DECNRCM.html, it's 401 | ;; "National Replacement Character Set Mode". 402 | (define expanded/compressed-print-mode "?43") 403 | (define print-color/black-and-white-mode "?44") 404 | (define rgb/hls-print-color-syntax-mode "?45") 405 | (define graphics-print-background-mode "?46") 406 | (define print-rotated/compressed-mode "?47") 407 | (define black/white-reversal-mode "?51") 408 | (define origin-placement-mode "?52") 409 | (define bold-page-mode "?55") 410 | (define horizontal-cursor-coupling-mode "?60") 411 | (define vertical-cursor-coupling-mode "?61") 412 | (define page-cursor-coupling-mode "?64") 413 | (define numeric-keypad-mode "?66") 414 | (define backspace/delete-mode "?67") 415 | (define typewriter-mode "?68") 416 | (define sixel-scrolling-mode "?80") 417 | 418 | ;; xterm 419 | (define x10-mouse-reporting-mode "?9") 420 | (define column-switch-enabled-mode "?40") 421 | (define more-fix-mode "?41") 422 | (define margin-bell-mode "?44") 423 | (define reverse-wraparound-mode "?45") 424 | (define logging-mode "?46") 425 | (define alternate-screen-mode "?47") 426 | (define x11-normal-mouse-tracking-mode "?1000") 427 | (define x11-hilite-mouse-tracking-mode "?1001") 428 | (define x11-button-event-mouse-tracking-mode "?1002") 429 | (define x11-any-event-mouse-tracking-mode "?1003") 430 | (define x11-focus-event-mode "?1004") ;; Send FocusIn/FocusOut events 431 | (define x11-extended-mouse-tracking-mode "?1006") ;; "SGR" mode 432 | (define alternate-screen-buffer-mode "?1047") 433 | (define save/restore-cursor-pseudomode "?1048") 434 | (define save/restore-cursor-and-alternate-screen-buffer-pseudomode "?1049") 435 | (define sun-function-key-mode "?1051") 436 | (define hp-function-key-mode "?1052") 437 | (define sun/pc-keyboard-mode "?1061") 438 | 439 | ;; rxvt (presumably supported also by (modern) xterms?) 440 | (define scroll-bar-mode "?30") 441 | (define shifted-key-functions-mode "?35") 442 | (define scroll-to-bottom-on-tty-output-mode "?1010") 443 | (define scroll-to-bottom-on-key-press-mode "?1011") 444 | (define special-modifiers-mode "?1035") 445 | 446 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 447 | ;; Derived sequences 448 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 449 | 450 | (define-escape-sequence (kill-line) 451 | (goto-column 1) 452 | (clear-to-eol)) 453 | 454 | (define-escape-sequence (clear-screen/home) 455 | (clear-screen) 456 | (goto 1 1)) 457 | -------------------------------------------------------------------------------- /ansi/info.rkt: -------------------------------------------------------------------------------- 1 | #lang setup/infotab 2 | 3 | (define name "ansi") 4 | (define blurb 5 | (list 6 | `(p "ANSI and VT10x escape sequences."))) 7 | (define homepage "https://github.com/tonyg/racket-ansi") 8 | (define primary-file "main.rkt") 9 | 10 | (define pre-install-collection "private/install.rkt") 11 | (define compile-omit-files '("private/install.rkt")) 12 | -------------------------------------------------------------------------------- /ansi/lcd-terminal.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | ;; Lowest Common Denominator terminal. 3 | 4 | (module+ event-structs 5 | (provide (struct-out key) 6 | (struct-out any-mouse-event) 7 | (struct-out mouse-focus-event) 8 | (struct-out mouse-event) 9 | (struct-out unknown-escape-sequence) 10 | (struct-out position-report) 11 | (struct-out screen-size-report))) 12 | (provide (struct-out key) 13 | (struct-out any-mouse-event) 14 | (struct-out mouse-focus-event) 15 | (struct-out mouse-event) 16 | (struct-out unknown-escape-sequence) 17 | (struct-out position-report) 18 | (struct-out screen-size-report) 19 | add-modifier 20 | lex-lcd-input 21 | lcd-terminal-utf-8? 22 | lcd-terminal-basic-x11-mouse-support?) 23 | 24 | (require racket/set) 25 | (require racket/match) 26 | (require (only-in racket/string string-split)) 27 | 28 | (define lcd-terminal-utf-8? (make-parameter #t)) 29 | (define lcd-terminal-basic-x11-mouse-support? 30 | (make-parameter 31 | (match (getenv "TERM") 32 | [(pregexp #px"^st-.*") #f] 33 | ;; ^ basic mouse events OVERLAP with control-delete in st! 34 | ;; This isn't a problem for SGR mouse event reports, though. 35 | [_ #t]))) 36 | 37 | (struct unknown-escape-sequence (string) #:prefab) 38 | (struct key (value modifiers) #:prefab) 39 | (struct position-report (row column) #:prefab) 40 | (struct screen-size-report (rows columns) #:prefab) 41 | 42 | (struct any-mouse-event () #:prefab) 43 | (struct mouse-focus-event any-mouse-event (focus-in?) #:prefab) 44 | (struct mouse-event any-mouse-event (type button row column modifiers) #:prefab) 45 | 46 | (define (simple-key value) (key value (set))) 47 | (define (S- value) (key value (set 'shift))) 48 | (define (C- value) (key value (set 'control))) 49 | (define (M- value) (key value (set 'meta))) 50 | (define (C-S- value) (key value (set 'control 'shift))) 51 | (define (C-M- value) (key value (set 'control 'meta))) 52 | 53 | (define (add-modifier modifier k) 54 | (struct-copy key k [modifiers (set-add (key-modifiers k) modifier)])) 55 | 56 | (define (decode-shifting-number v-plus-one k) 57 | (define v (- v-plus-one 1)) 58 | (let* ((k (if (zero? (bitwise-and v 1)) k (add-modifier 'shift k))) 59 | (k (if (zero? (bitwise-and v 2)) k (add-modifier 'meta k))) 60 | (k (if (zero? (bitwise-and v 4)) k (add-modifier 'control k)))) 61 | k)) 62 | 63 | (define (decode-shifting params value) 64 | (match params 65 | [(list 1 v-plus-one) (decode-shifting-number v-plus-one (simple-key value))] 66 | [_ (simple-key value)] ;; bit of a cop-out 67 | )) 68 | 69 | (define (analyze-vt-tildeish-key lexeme params ctor) 70 | (match params 71 | [(list a b) (analyze-vt-tildeish-key* lexeme ctor a b)] 72 | [(list a) (analyze-vt-tildeish-key* lexeme ctor a 1)] 73 | [_ (simple-key (unknown-escape-sequence lexeme))])) 74 | 75 | (define (analyze-vt-tildeish-key* lexeme ctor a b) 76 | (decode-shifting-number 77 | b 78 | (match a 79 | [1 (ctor 'home)] ;; linux console 80 | [2 (ctor 'insert)] 81 | [3 (ctor 'delete)] 82 | [4 (ctor 'end)] ;; linux console 83 | [5 (ctor 'page-up)] 84 | [6 (ctor 'page-down)] 85 | [7 (ctor 'home)] 86 | [8 (ctor 'end)] 87 | [11 (ctor 'f1)] [12 (ctor 'f2)] [13 (ctor 'f3)] [14 (ctor 'f4)] 88 | [15 (ctor 'f5)] [17 (ctor 'f6)] [18 (ctor 'f7)] [19 (ctor 'f8)] 89 | [20 (ctor 'f9)] [21 (ctor 'f10)] [23 (ctor 'f11)] [24 (ctor 'f12)] 90 | [25 (ctor 'f13)] [26 (ctor 'f14)] [28 (ctor 'f15)] [29 (ctor 'f16)] 91 | [31 (ctor 'f17)] [32 (ctor 'f18)] [33 (ctor 'f19)] [34 (ctor 'f20)] 92 | [_ (simple-key (unknown-escape-sequence lexeme))]))) 93 | 94 | (define (analyze-vt-bracket-key lexeme params mainchar) 95 | (match mainchar 96 | ["~" (analyze-vt-tildeish-key lexeme params simple-key)] 97 | ["$" (analyze-vt-tildeish-key lexeme params S-)] 98 | ["^" (analyze-vt-tildeish-key lexeme params C-)] 99 | ["@" (analyze-vt-tildeish-key lexeme params C-S-)] 100 | ["A" (decode-shifting params 'up)] 101 | ["B" (decode-shifting params 'down)] 102 | ["C" (decode-shifting params 'right)] 103 | ["D" (decode-shifting params 'left)] 104 | ["E" (decode-shifting params 'begin)] 105 | ["F" (decode-shifting params 'end)] 106 | ["G" (decode-shifting params 'begin)] ;; linux console (!) 107 | ["H" (decode-shifting params 'home)] 108 | ["I" (mouse-focus-event #t)] 109 | ["J" #:when (equal? params '(2)) (S- 'home)] ;; st, http://st.suckless.org/ 110 | ["J" #:when (not params) (C- 'end)] ;; st, http://st.suckless.org/ 111 | ["K" #:when (equal? params '(2)) (S- 'delete)] ;; st, http://st.suckless.org/ 112 | ["K" #:when (not params) (S- 'end)] ;; st, http://st.suckless.org/ 113 | ["L" (C- 'insert)] ;; st, http://st.suckless.org/ 114 | ["M" (C- 'delete)] ;; st, http://st.suckless.org/. Overlaps with mouse events! 115 | ["O" (mouse-focus-event #f)] 116 | ["P" #:when (not params) (simple-key 'delete)] ;; st, http://st.suckless.org/ 117 | ["P" (decode-shifting params 'f1)] 118 | ["Q" (decode-shifting params 'f2)] 119 | ["R" #:when (and (= (length params) 2) (> (car params) 1)) 120 | (apply position-report params)] 121 | ["R" (decode-shifting params 'f3)] 122 | ["S" (decode-shifting params 'f4)] 123 | ["Z" (C-S- #\I)] ;; TODO: should this instead be a 'backtab key? 124 | ["a" (S- 'up)] 125 | ["b" (S- 'down)] 126 | ["c" (S- 'right)] 127 | ["d" (S- 'left)] 128 | ["h" #:when (equal? params '(4)) (simple-key 'insert)] ;; st, http://st.suckless.org/ 129 | ["t" #:when (and (= (length params) 3) (= (car params) 8)) 130 | (apply screen-size-report (cdr params))] 131 | [_ (simple-key (unknown-escape-sequence lexeme))])) 132 | 133 | (define (analyze-vt-O-mainchar lexeme mainchar) 134 | (match mainchar 135 | ["a" (C- 'up)] 136 | ["b" (C- 'down)] 137 | ["c" (C- 'right)] 138 | ["d" (C- 'left)] 139 | 140 | ;; rxvt keypad keys. 141 | ;; Per http://www.vt100.net/docs/vt102-ug/appendixc.html, these 142 | ;; are "ANSI Alternate Keypad Mode" sequences. 143 | ["j" (simple-key #\*)] 144 | ["k" (simple-key #\+)] 145 | ["l" (simple-key #\,)] ;; my keypad doesn't have a comma 146 | ["m" (simple-key #\-)] 147 | ["n" (simple-key 'delete)] ;; #\. 148 | ["o" (simple-key #\/)] 149 | ["p" (simple-key 'insert)] ;; #\0 150 | ["q" (simple-key 'end)] ;; #\1 151 | ["r" (simple-key 'down)] ;; #\2 152 | ["s" (simple-key 'page-down)] ;; #\3 153 | ["t" (simple-key 'left)] ;; #\4 154 | ["u" (simple-key 'begin)] ;; #\5 155 | ["v" (simple-key 'right)] ;; #\6 156 | ["w" (simple-key 'home)] ;; #\7 157 | ["x" (simple-key 'up)] ;; #\8 158 | ["y" (simple-key 'page-up)] ;; #\9 159 | 160 | ["A" (simple-key 'up)] ;; kcuu1 161 | ["B" (simple-key 'down)] ;; kcud1 162 | ["C" (simple-key 'right)] ;; kcuf1 163 | ["D" (simple-key 'left)] ;; kcub1 164 | ["E" (simple-key 'begin)] ;; in screen 165 | ["F" (simple-key 'end)] ;; kend 166 | ["H" (simple-key 'home)] ;; khome 167 | ["M" (add-modifier 'control (simple-key #\M))] ;; keypad enter (rxvt) 168 | ["P" (simple-key 'f1)] 169 | ["Q" (simple-key 'f2)] 170 | ["R" (simple-key 'f3)] 171 | ["S" (simple-key 'f4)] 172 | [_ (simple-key (unknown-escape-sequence lexeme))])) 173 | 174 | (define (interpret-ascii-code b) 175 | (cond 176 | [(<= #x00 b #x1f) (C- (integer->char (+ b (char->integer #\A) -1)))] 177 | [(<= #x20 b #x7e) (simple-key (integer->char b))] 178 | [(= b #x7f) (simple-key 'backspace)])) 179 | 180 | (define (decode-mouse-event-type type) 181 | (define type-code (arithmetic-shift type -5)) 182 | (define modifier-code (bitwise-and (arithmetic-shift type -2) 7)) 183 | (define modifiers 184 | (set-union (if (zero? (bitwise-and modifier-code 1)) (set) (set 'shift)) 185 | (if (zero? (bitwise-and modifier-code 2)) (set) (set 'super)) 186 | (if (zero? (bitwise-and modifier-code 4)) (set) (set 'control)))) 187 | (define button (bitwise-and type 3)) 188 | (match type-code 189 | [1 ;; Press or release 190 | (if (= button 3) ;; basic events don't distinguish specific release buttons 191 | (values 'release-all modifiers #f) 192 | (values 'press modifiers (+ button 1)))] 193 | [2 ;; Motion 194 | (values 'motion modifiers (if (= button 3) #f (+ button 1)))] 195 | [3 ;; Scroll (really, press events for buttons 4, 5) 196 | (values 'scroll modifiers (+ button 4))] 197 | [_ 198 | (values #f modifiers (+ button 1))])) 199 | 200 | (define (decode-basic-mouse-event lexeme event-bytes) 201 | (define-values (type modifiers button) (decode-mouse-event-type (bytes-ref event-bytes 0))) 202 | (define x-raw (bytes-ref event-bytes 1)) 203 | (define y-raw (bytes-ref event-bytes 2)) 204 | ;; Very large terminals (more than 256-32=224 columns/rows) report 0 205 | ;; for a column/row position when the mouse is to the right of the 206 | ;; maximum representable position. We report #f in these cases. 207 | (define x (if (zero? x-raw) #f (- x-raw 32))) 208 | (define y (if (zero? y-raw) #f (- y-raw 32))) 209 | (if (not type) 210 | (simple-key (unknown-escape-sequence lexeme)) 211 | (mouse-event type button x y modifiers))) 212 | 213 | (define (decode-extended-mouse-event lexeme type-byte x y release? input-next) 214 | (define-values (type modifiers button) (decode-mouse-event-type (+ type-byte 32))) 215 | (cond 216 | [(not type) 217 | (simple-key (unknown-escape-sequence lexeme))] 218 | [(eq? type 'release-all) ;; This is one of the things the extended format can do better! 219 | (mouse-event 'release button x y modifiers)] 220 | [(eq? type 'press) 221 | (mouse-event (if release? 'release 'press) button x y modifiers)] 222 | [release? 223 | ;; Ignore the event -- it's likely a spurious "scroll" release event from st 224 | (input-next)] 225 | [else 226 | (mouse-event type button x y modifiers)])) 227 | 228 | (define (lex-lcd-input port 229 | #:utf-8? [utf-8? (lcd-terminal-utf-8?)] 230 | #:basic-x11-mouse-support? [basic-x11-mouse-support? 231 | (lcd-terminal-basic-x11-mouse-support?)]) 232 | (cond 233 | [(eof-object? (peek-byte port)) eof] 234 | [(regexp-try-match #px#"^\e\\[<([0-9]+);([0-9]+);([0-9]+)(m|M)" port) => 235 | (lambda (match-result) 236 | (match-define (list lexeme type row column kind) match-result) 237 | (decode-extended-mouse-event lexeme 238 | (string->number (bytes->string/utf-8 type)) 239 | (string->number (bytes->string/utf-8 row)) 240 | (string->number (bytes->string/utf-8 column)) 241 | (match kind [#"m" #t] [#"M" #f]) 242 | (lambda () 243 | (lex-lcd-input port 244 | #:utf-8? utf-8? 245 | #:basic-x11-mouse-support? 246 | basic-x11-mouse-support?))))] 247 | [(and basic-x11-mouse-support? 248 | (regexp-try-match #px#"^\e\\[M(...)" port)) => 249 | (lambda (match-result) 250 | (match-define (list lexeme mouse-event-bytes) match-result) 251 | (decode-basic-mouse-event lexeme mouse-event-bytes))] 252 | [(or (regexp-try-match #px"^\e\\[([0-9]+(;[0-9]+)*)?(.)" port) 253 | (regexp-try-match #px#"^\x9b([0-9]+(;[0-9]+)*)?(.)" port)) => 254 | (lambda (match-result) 255 | (match-define (list lexeme parambytes _ mainbytes) match-result) 256 | (define params 257 | (and parambytes 258 | (map string->number (string-split (bytes->string/utf-8 parambytes) ";")))) 259 | (analyze-vt-bracket-key lexeme params (bytes->string/utf-8 mainbytes)))] 260 | [(regexp-try-match #px"^\eO([0-9])(.)" port) => 261 | ;; screen generates shifting escapes for the keypad like this 262 | (lambda (match-result) 263 | (match-define (list lexeme v-plus-one-bytes mainbytes) match-result) 264 | (decode-shifting-number 265 | (string->number (bytes->string/utf-8 v-plus-one-bytes)) 266 | (analyze-vt-O-mainchar lexeme (bytes->string/utf-8 mainbytes))))] 267 | [(regexp-try-match #px"^\eO(.)" port) => 268 | (lambda (match-result) 269 | (match-define (list lexeme mainbytes) match-result) 270 | (analyze-vt-O-mainchar lexeme (bytes->string/utf-8 mainbytes)))] 271 | ;; Characters between #\u80 and #\uff are ambiguous because in 272 | ;; some terminals, the high bit is set to indicate meta, and in 273 | ;; others, they are plain UTF-8 characters. We let the user 274 | ;; distinguish via the #:utf-8? keyword argument. 275 | [(not utf-8?) 276 | (define b (read-byte port)) 277 | (if (< b 128) 278 | (interpret-ascii-code b) 279 | (add-modifier 'meta (interpret-ascii-code (- b 128))))] 280 | [else 281 | (define b (char->integer (read-char port))) 282 | (if (< b 128) 283 | (interpret-ascii-code b) 284 | (simple-key (integer->char b)))])) 285 | -------------------------------------------------------------------------------- /ansi/main.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require "ansi.rkt" 4 | "lcd-terminal.rkt" 5 | "private/tty-raw-extension.rkt") 6 | 7 | (provide (all-from-out "ansi.rkt") 8 | (all-from-out "lcd-terminal.rkt") 9 | (all-from-out "private/tty-raw-extension.rkt")) 10 | -------------------------------------------------------------------------------- /ansi/private/install.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require dynext/file 4 | dynext/link 5 | racket/file) 6 | 7 | (provide pre-installer) 8 | 9 | ;; Used by "../info.rkt" (so this-collection-path is ".."). 10 | 11 | ;; Heavily based on Sam Tobin-Hochstadt's bcrypt/private/install.rkt 12 | ;; https://github.com/samth/bcrypt.rkt 13 | 14 | (define (pre-installer collections-top-path this-collection-path) 15 | (define ansi/private/ 16 | (build-path this-collection-path "private")) 17 | (parameterize ([current-directory ansi/private/] 18 | [current-use-mzdyn #f]) 19 | (define tty_raw.c 20 | (build-path ansi/private/ "tty_raw.c")) 21 | (define libtty_raw.so 22 | (build-path ansi/private/ 23 | "compiled" 24 | "native" 25 | (system-library-subpath #f) 26 | (append-extension-suffix "libtty_raw"))) 27 | (when (file-exists? libtty_raw.so) 28 | (delete-file libtty_raw.so)) 29 | (make-parent-directory* libtty_raw.so) 30 | (link-extension #f ;; not quiet 31 | (list tty_raw.c) 32 | libtty_raw.so))) 33 | -------------------------------------------------------------------------------- /ansi/private/tty-raw-extension.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require ffi/unsafe 4 | ffi/unsafe/global 5 | ffi/unsafe/define) 6 | 7 | (provide (protect-out tty-raw! 8 | tty-restore!)) 9 | 10 | (define (local-lib-dirs) 11 | ;; FIXME: There's probably a better way to do this with 12 | ;; define-runtime-path and cross-system-library-subpath, 13 | ;; but this is what the bcrypt package is doing. 14 | (list (build-path (collection-path "ansi") 15 | "private" 16 | "compiled" 17 | "native" 18 | (system-library-subpath #f)))) 19 | 20 | (define libtty_raw 21 | (ffi-lib "libtty_raw" #:get-lib-dirs local-lib-dirs)) 22 | 23 | (define-ffi-definer define-tty libtty_raw 24 | #:default-make-fail make-not-available) 25 | 26 | (define-tty tty-raw! 27 | (_fun #:in-original-place? #t 28 | -> _stdbool) 29 | #:c-id tty_raw) 30 | 31 | (define-tty tty-restore! 32 | (_fun #:in-original-place? #t 33 | -> _stdbool) 34 | #:c-id tty_restore) 35 | 36 | (unless (register-process-global #"ansi-private-tty-raw-has-set-restore-at-exit" #"") 37 | (define-tty tty_set_restore_at_exit 38 | (_fun -> _void)) 39 | (tty_set_restore_at_exit)) 40 | -------------------------------------------------------------------------------- /ansi/private/tty_raw.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define STDIN_FD 0 9 | 10 | static bool is_raw = false; 11 | static struct termios saved; 12 | 13 | bool tty_raw(void) { 14 | /* Based on the settings given in: 15 | * https://web.archive.org/web/20180516224400/http://www.minek.com:80/files/unix_examples/raw.html */ 16 | struct termios t; 17 | 18 | if (is_raw) return true; 19 | 20 | if (tcgetattr(STDIN_FD, &saved) < 0) return false; 21 | t = saved; 22 | 23 | t.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); 24 | t.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); 25 | t.c_cflag &= ~(CSIZE | PARENB); 26 | t.c_cflag |= CS8; 27 | t.c_oflag &= ~(OPOST); 28 | t.c_cc[VMIN] = 1; 29 | t.c_cc[VTIME] = 0; 30 | 31 | if (tcsetattr(STDIN_FD, TCSAFLUSH, &t) < 0) return false; 32 | 33 | is_raw = true; 34 | return true; 35 | } 36 | 37 | bool tty_restore(void) { 38 | if (!is_raw) return true; 39 | 40 | if (tcsetattr(STDIN_FD, TCSAFLUSH, &saved) < 0) return false; 41 | 42 | is_raw = false; 43 | return true; 44 | } 45 | 46 | void tty_set_restore_at_exit(void) { 47 | atexit((void (*)(void)) tty_restore); 48 | } 49 | -------------------------------------------------------------------------------- /ansi/test-ansi.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require "ansi.rkt") 4 | 5 | (for-each display (list (dec-soft-terminal-reset) 6 | 7 | (select-graphic-rendition style-bold 8 | (style-text-color color-yellow) 9 | (style-background-color color-blue)) 10 | (clear-screen/home) 11 | (dec-double-width-single-height) 12 | "Hello world!" 13 | (move-cursor-left 6) 14 | (insert-characters 5) 15 | "ANSI" 16 | "\n" 17 | (dec-double-width-double-height-top) 18 | "Bigger yet\n" 19 | (dec-double-width-double-height-bottom) 20 | "Bigger yet\n" 21 | (dec-single-width-single-height) 22 | "Normal\n" 23 | (move-cursor-up 3) 24 | (select-graphic-rendition style-normal-intensity) 25 | (select-graphic-rendition (style-text-color color-white) 26 | (style-background-color color-red)) 27 | (insert-lines 3) 28 | "Test\n" 29 | (select-graphic-rendition (style-text-color color-white) 30 | (style-background-color color-green)) 31 | (delete-lines 2) 32 | (move-cursor-up 1) 33 | (goto-column 2) 34 | (delete-characters 1) 35 | (select-graphic-rendition) 36 | 37 | (goto 19 1))) 38 | 39 | -------------------------------------------------------------------------------- /ansi/test-modes.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require "ansi.rkt") 4 | 5 | (define (display* . vs) 6 | (for-each display vs) 7 | (flush-output)) 8 | 9 | (display* (dec-soft-terminal-reset) 10 | (select-graphic-rendition style-bold 11 | (style-text-color color-yellow) 12 | (style-background-color color-blue)) 13 | (clear-screen/home)) 14 | 15 | (display* (reset-mode send/receive-mode)) 16 | 17 | (display (read-char)) 18 | (display (read-char)) 19 | (display (read-char)) 20 | 21 | (display* (dec-soft-terminal-reset)) 22 | -------------------------------------------------------------------------------- /ansi/test-raw.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require "main.rkt") 4 | 5 | (require racket/set) 6 | (require racket/match) 7 | 8 | (define (main) 9 | (tty-raw!) 10 | 11 | (define utf-8? 12 | (match (current-command-line-arguments) 13 | [(or '#() '#("--utf-8")) #t] 14 | ['#("--no-utf-8") #f] 15 | [_ (error 'main "Usage: test-raw [ --utf-8 / --no-utf-8 ]")])) 16 | 17 | (plumber-add-flush! (current-plumber) 18 | (lambda (handle) 19 | (for-each display 20 | (list 21 | (reset-mode x11-extended-mouse-tracking-mode) 22 | (reset-mode x11-any-event-mouse-tracking-mode) 23 | (reset-mode x11-focus-event-mode) 24 | )))) 25 | 26 | (for-each display (list 27 | (set-mode x11-focus-event-mode) 28 | (set-mode x11-any-event-mouse-tracking-mode) 29 | (set-mode x11-extended-mouse-tracking-mode) 30 | )) 31 | 32 | (display "Type keys. Press control-D to exit.\r\n") 33 | (let loop () 34 | (flush-output) 35 | (match (lex-lcd-input (current-input-port) #:utf-8? utf-8?) 36 | [(? eof-object?) (void)] 37 | [(== (key #\D (set 'control))) (void)] 38 | [key 39 | (printf "Key: ~v\r\n" key) 40 | (loop)]))) 41 | 42 | (main) 43 | -------------------------------------------------------------------------------- /ansi/test-screen-size.rkt: -------------------------------------------------------------------------------- 1 | #lang racket/base 2 | 3 | (require "main.rkt") 4 | 5 | (define (display* . things) 6 | (for-each display things) 7 | (flush-output)) 8 | 9 | (define (main) 10 | (tty-raw!) 11 | 12 | (display* (dec-soft-terminal-reset) 13 | (device-request-screen-size)) 14 | 15 | (define report (lex-lcd-input (current-input-port))) 16 | (printf "The reported screen size is ~a columns and ~a rows.\r\n" 17 | (screen-size-report-columns report) 18 | (screen-size-report-rows report)) 19 | (printf "The raw report value itself is ~v.\r\n" report) 20 | 21 | (display* (dec-soft-terminal-reset))) 22 | 23 | (module+ main 24 | (main)) 25 | -------------------------------------------------------------------------------- /doc/xterm_controls.txt: -------------------------------------------------------------------------------- 1 | Controlling "xterm" emulations 2 | 3 | (and similar software under X: decterm, hpterm, dtterm, etc.) 4 | 5 | The "xterm" application, which runs in the graphical X Windows 6 | environment and emulates a character-cell terminal. 7 | 8 | *---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---* 9 | 10 | Date: 12 Sep 1989 17:44:43 GMT 11 | Organization: GE Corporate Research & Development, Schenectady, NY 12 | To: xpert@expo.lcs.mit.edu 13 | From: crdgw1!montnaro@uunet.uu.net (Skip Montanaro) 14 | Subject: XTerm Escape Sequences (X11 Version) 15 | 16 | I rummaged around through the xterm code and came up with the following 17 | stuff. No guarantees. I'm headed out of town for a couple days and thought 18 | it better to get it out than let it get stale. Comments, bugs, and other 19 | notes are welcome. Somebody else can convert it to troff. I prefer LaTeX. 20 | :-) I will try and get to the Tek mode stuff when I return, although I doubt 21 | it's changed much from X10 XTerm. 22 | 23 | I gleaned the basic stuff out of the charproc.c code, by hacking VTparse() 24 | so it spit out leaves of the parse tree. I was mildly surprised to see 25 | things like "ESC # BEL" turn up. 26 | 27 | For most folks, the most interesting stuff will probably be "ESC ] Ps ND 28 | string NP" down near the bottom. That's what you use to change the icon and 29 | window labels, and the log file name. Most other things appear the same as 30 | the X10 documentation, although a few DEC-ish mode parameters (42, 43, 48, & 31 | 49) seem to have disappeared. 32 | 33 | ------------------------------------------------------------------------------ 34 | BEL Bell (Ctrl-G) 35 | BS Backspace (Ctrl-H) 36 | HT Horizontal Tab (Ctrl-I) 37 | NL Line Feed or New Line (Ctrl-J) 38 | VT Vertical Tab (Ctrl-K) 39 | NP Form Feed or New Page (Ctrl-L) 40 | CR Carriage Return (Ctrl-M) 41 | SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set 42 | SI Shift In (Ctrl-O) -> Switch to Standard Character Set 43 | ESC BEL (Same as non-escaped BEL) 44 | ESC BS (Same as non-escaped BS) 45 | ESC HT (Same as non-escaped HT) 46 | ESC NL (Same as non-escaped NL) 47 | ESC VT (Same as non-escaped VT) 48 | ESC NP (Same as non-escaped NP) 49 | ESC CR (Same as non-escaped CR) 50 | ESC SO (Same as non-escaped SO) 51 | ESC SI (Same as non-escaped SI) 52 | ESC # BEL (Same as non-escaped BEL) 53 | ESC # BS (Same as non-escaped BS) 54 | ESC # HT (Same as non-escaped HT) 55 | ESC # NL (Same as non-escaped NL) 56 | ESC # VT (Same as non-escaped VT) 57 | ESC # NP (Same as non-escaped NP) 58 | ESC # CR (Same as non-escaped CR) 59 | ESC # SO (Same as non-escaped SO) 60 | ESC # SI (Same as non-escaped SI) 61 | ESC # 8 DEC Screen Alignment Test (DECALN) 62 | ESC ( BEL (Same as non-escaped BEL) 63 | ESC ( BS (Same as non-escaped BS) 64 | ESC ( HT (Same as non-escaped HT) 65 | ESC ( NL (Same as non-escaped NL) 66 | ESC ( VT (Same as non-escaped VT) 67 | ESC ( NP (Same as non-escaped NP) 68 | ESC ( CR (Same as non-escaped CR) 69 | ESC ( SO (Same as non-escaped SO) 70 | ESC ( SI (Same as non-escaped SI) 71 | ESC ( C Select G0 Character Set (SCS) 72 | C = 0 -> Special Character and Line Drawing Set 73 | C = 1 -> Alternate Character ROM Standard Set 74 | C = 2 -> Alternate Character ROM Special Set 75 | C = A -> United Kingdom (UK) 76 | C = B -> United States (USASCII) 77 | ESC ) C Select G1 Character Set (SCS) 78 | C takes same values as above 79 | ESC * C Select G2 Character Set (SCS) 80 | C takes same values as above 81 | ESC + C Select G3 Character Set (SCS) 82 | C takes same values as above 83 | ESC 7 Save Cursor (DECSC) 84 | ESC 8 Restore Cursor (DECRC) 85 | ESC = Application Keypad (DECPAM) 86 | ESC > Normal Keypad (DECNM) 87 | ESC D Index (IND) 88 | ESC E Next Line (NEL) 89 | ESC H Tab Set (HTS) 90 | ESC M Reverse Index (RI) 91 | ESC N Single Shift Select of G2 Character Set (SS2) 92 | ESC O Single Shift Select of G3 Character Set (SS3) 93 | ESC [ BEL (Same as non-escaped BEL) 94 | ESC [ BS (Same as non-escaped BS) 95 | ESC [ HT (Same as non-escaped HT) 96 | ESC [ NL (Same as non-escaped NL) 97 | ESC [ VT (Same as non-escaped VT) 98 | ESC [ NP (Same as non-escaped NP) 99 | ESC [ CR (Same as non-escaped CR) 100 | ESC [ SO (Same as non-escaped SO) 101 | ESC [ SI (Same as non-escaped SI) 102 | ESC [ ? BEL (Same as non-escaped BEL) 103 | ESC [ ? BS (Same as non-escaped BS) 104 | ESC [ ? HT (Same as non-escaped HT) 105 | ESC [ ? NL (Same as non-escaped NL) 106 | ESC [ ? VT (Same as non-escaped VT) 107 | ESC [ ? NP (Same as non-escaped NP) 108 | ESC [ ? CR (Same as non-escaped CR) 109 | ESC [ ? SO (Same as non-escaped SO) 110 | ESC [ ? SI (Same as non-escaped SI) 111 | ESC [ ? Ps h DEC Private Mode Set (DECSET) 112 | Ps = 1 -> Application Cursor Keys (DECCKM) 113 | Ps = 2 -> Set VT52 Mode 114 | Ps = 3 -> 132 Column Mode (DECCOLM) 115 | Ps = 4 -> Smooth (Slow) Scroll (DECSCLM) 116 | Ps = 5 -> Reverse Video (DECSCNM) 117 | Ps = 6 -> Origin Mode (DECOM) 118 | Ps = 7 -> Wraparound Mode (DECAWM) 119 | Ps = 8 -> Auto-Repeat Keys (DECARM) 120 | Ps = 9 -> Send MIT Mouse Row & Column on Button 121 | Press 122 | Ps = 38 -> Enter Tektronix Mode (DECTEK) 123 | Ps = 40 -> Allow 80 <-> 132 Mode 124 | Ps = 41 -> curses(5) fix 125 | Ps = 44 -> Turn on Margin Bell 126 | Ps = 45 -> Reverse-wraparound Mode 127 | Ps = 46 -> Start Logging 128 | Ps = 47 -> Use Alternate Screen Buffer 129 | Ps = 1000 -> xtem bogus sequence (???) 130 | Ps = 1001 -> xtem sequence w/hilite tracking (???) 131 | ESC [ ? Ps l DEC Private Mode Reset (DECRST) 132 | Ps = 1 -> Normal Cursor Keys (DECCKM) 133 | Ps = 3 -> 80 Column Mode (DECCOLM) 134 | Ps = 4 -> Jump (Fast) Scroll (DECSCLM) 135 | Ps = 5 -> Normal Video (DECSCNM) 136 | Ps = 6 -> Normal Cursor Mode (DECOM) 137 | Ps = 7 -> No Wraparound Mode (DECAWM) 138 | Ps = 8 -> No Auto-Repeat Keys (DECARM) 139 | Ps = 9 -> Don't Send MIT Mouse Row & Column on 140 | Button Press 141 | Ps = 40 -> Don't Allow 80 <-> 132 Mode 142 | Ps = 41 -> No curses(5) fix 143 | Ps = 44 -> Turn Off Margin Bell 144 | Ps = 45 -> No Reverse-wraparound Mode 145 | Ps = 46 -> Stop Logging 146 | Ps = 47 -> Use Normal Screen Buffer 147 | Ps = 1000 -> xtem bogus sequence (???) 148 | Ps = 1001 -> xtem sequence w/hilite tracking (???) 149 | ESC [ ? Ps r Restore DEC Private Mode 150 | Ps = 1 -> Normal/Application Cursor Keys (DECCKM) 151 | Ps = 3 -> 80/132 Column Mode (DECCOLM) 152 | Ps = 4 -> Jump (Fast)/Smooth (Slow) Scroll (DECSCLM) 153 | Ps = 5 -> Normal/Reverse Video (DECSCNM) 154 | Ps = 6 -> Normal/Origin Cursor Mode (DECOM) 155 | Ps = 7 -> No Wraparound/Wraparound Mode (DECAWM) 156 | Ps = 8 -> Auto-repeat/No Auto-repeat Keys (DECARM) 157 | Ps = 9 -> Don't Send/Send MIT Mouse Row & Column on 158 | Button Press 159 | Ps = 40 -> Disallow/Allow 80 <-> 132 Mode 160 | Ps = 41 -> Off/On curses(5) fix 161 | Ps = 44 -> Turn Off/On Margin Bell 162 | Ps = 45 -> No Reverse-wraparound/Reverse-wraparound 163 | Mode 164 | Ps = 46 -> Stop/Start Logging 165 | Ps = 47 -> Use Normal/Alternate Screen Buffer 166 | Ps = 1000 -> mouse bogus sequence (???) 167 | Ps = 1001 -> mouse bogus sequence (???) 168 | ESC [ ? Ps s Save DEC Private Mode 169 | Same P's as Restore DEC Private Mode 170 | ESC [ Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH) 171 | ESC [ Ps A Cursor Up Ps Times (default = 1) (CUU) 172 | ESC [ Ps B Cursor Down Ps Times (default = 1) (CUD) 173 | ESC [ Ps C Cursor Forward Ps Times (default = 1) (CUF) 174 | ESC [ Ps D Cursor Backward Ps Times (default = 1) (CUB) 175 | ESC [ Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP) 176 | ESC [ Ps J Erase in Display 177 | Ps = 0 -> Clear Below (default) 178 | Ps = 1 -> Clear Above 179 | Ps = 2 -> Clear All 180 | ESC [ Ps K Erase in Line 181 | Ps = 0 -> Clear to Right (default) 182 | Ps = 1 -> Clear to Left 183 | Ps = 2 -> Clear All 184 | ESC [ Ps L Insert Ps lines (default = 1) (IL) 185 | ESC [ Ps M Delete Ps lines (default = 1) (DL) 186 | ESC [ Ps P Delete Ps Characters (default = 1) (DCH) 187 | ESC [ T Track Mouse (???) 188 | ESC [ Ps c Device Attributes (DA1) 189 | ESC [ Ps ; Ps f Cursor Position [row;column] (default = [1,1]) (HVP) 190 | ESC [ Ps g Tab Clear 191 | Ps = 0 -> Clear Current Column (default) 192 | Ps = 3 -> Clear All 193 | ESC [ Ps h Mode Set (SET) 194 | Ps = 4 -> Insert Mode (IRM) 195 | Ps = 20 -> Automatic Linefeed (LNM) 196 | ESC [ Ps l Mode Reset (RST) 197 | Ps = 4 -> Insert Mode (IRM) 198 | Ps = 20 -> Automatic Linefeed (LNM) 199 | ESC [ Pm m Character Attributes (SGR) 200 | Ps = 0 -> Normal (default) 201 | Ps = 1 -> Blink (appears as Bold) 202 | Ps = 4 -> Underscore 203 | Ps = 5 -> Bold 204 | Ps = 7 -> Inverse 205 | ESC [ Ps n Device Status Report (DSR) 206 | Ps = 5 -> Status Report ESC [ 0 n -> OK 207 | Ps = 6 -> Report Cursor Position (CPR) [row;column] 208 | as ESC [ r ; c R 209 | ESC [ Ps ; Ps r Set Scrolling Region [top;bottom] (default = full size 210 | of window) (DECSTBM) 211 | ESC [ Ps x Request Terminal Parameters (DECREQTPARM) 212 | ESC ] Ps ND string NP OSC Mode 213 | ND can be any non-digit Character (it's discarded) 214 | NP can be any non-printing Character (it's discarded) 215 | string can be any ASCII printable string 216 | (max 511 characters) 217 | Ps = 0 -> use string as a new icon name and title 218 | Ps = 1 -> use string is a new icon name only 219 | Ps = 2 -> use string is a new title only 220 | Ps = 46 -> use string as a new log file name 221 | 222 | ESC c Full Reset 223 | ESC n Switch to Alternate Character Set LS2 224 | ESC o Switch to Alternate Character Set LS3 225 | ESC | Switch to Alternate Graphics(?) Set LS3R 226 | ESC } Switch to Alternate Graphics(?) Set LS2R 227 | ESC ~ Switch to Alternate Graphics(?) Set LS1R 228 | -- 229 | Skip Montanaro (montanaro@crdgw1.ge.com) 230 | 231 | *---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---* 232 | 233 | Newsgroups: comp.terminals 234 | Path: cs.utk.edu!emory!swrinde!zaphod.mps.ohio-state.edu!howland.reston.ans.net 235 | !spool.mu.edu!hri.com!noc.near.net!news.bbn.com!bbn.com!pdsmith 236 | Message-ID: 237 | References: <1993Jan28.010333.2187@spang.Camosun.BC.CA> 238 | Date: 29 Jan 1993 16:28:49 GMT 239 | From: pdsmith@bbn.com (Peter D. Smith) 240 | Subject: Re: Can you identify this escape sequence? 241 | Summary: DECELR and DECSLE 242 | 243 | In article <1993Jan28.010333.2187@spang.Camosun.BC.CA>, 244 | morley@suncad.camosun.bc.ca (Mark Morley) writes: 245 | > 246 | > The escape sequence is [1;1'z 247 | > or [1;1'{ 248 | 249 | Sure -- looking it up in my Escape sequence reverse index, I find 250 | 251 | ...z is DECELR: Enable locator report. It's only used by DECTERM; 252 | see the Decterm programming release notes (EK-DTERM-RN-001) 253 | page 3-1. The first one means 'enable' and the second 254 | one means 'report in pixels'. 255 | 256 | The 'locator' is the mouse. 257 | 258 | ...{ is DECSLE: Select type of locator events, same book, page 3-5. 259 | It's not clear why there are two parameters; this 260 | sequence doesn't attach any positional significance 261 | on parameters (eg, a one means the same thing no matter 262 | where it is). One means "Report button down". 263 | 264 | 265 | Peter D. Smith 266 | 267 | *---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---* 268 | 269 | Newsgroups: comp.os.vms 270 | Path: cs.utk.edu!emory!wupost!uunet!pipex!sunic!ugle.unit.no!alf.uib.no 271 | !dsfys1.fi.uib.no!iversen 272 | From: iversen@dsfys1.fi.uib.no (Per Steinar Iversen) 273 | Subject: RE: ]VMS;2\ sequence in Device Control Reset Modules 274 | Message-ID: <1993Mar4.071327.17421@alf.uib.no> 275 | Sender: iversen@vsfys1.fi.uib.no (Per Steinar Iversen) 276 | Organization: Department of Physics, University of Bergen, Norway 277 | References: <9303031720.AA28424@uu3.psi.com> 278 | Date: Thu, 4 Mar 1993 07:13:27 GMT 279 | 280 | In article <9303031720.AA28424@uu3.psi.com>, 281 | Jerry Leichter writes: 282 | > 283 | >OSC sequences have been used by the UIS terminal emulators to provide a means 284 | >for a program to control things like window sizes and positions through the 285 | >data stream; the DECWindows terminal emulator inherited them. A few OSC 286 | >sequences have been used in the standard print symbiont as well. I KNOW I 287 | >found the documentation for them once, but a search through the VMS docs just 288 | >now revealed nothing. I do recall that the OSC sequences didn't do much that 289 | >was very interesting. If anyone can find where this stuff is described, I'd 290 | >be interested. 291 | 292 | The UIS OSC sequences are documented in the VWS User's Guide, "Additional 293 | Features of the VT220 Terminal Emulator". I have found the related "Control 294 | Sequence Introducer Strings" useful to set terminal window sizes, if one logs 295 | in on a remote node through DECnet or TELNET, then a terminal resize with 296 | SET TERM does not propagate back to my DECwindows window. By having a command 297 | file on the remote node one can fix this: 298 | 299 | $! BIG.COM 300 | $ set term/page=60/width=132 301 | $ write sys$output "[?3h[60t>" 302 | 303 | (Subsitute real s with an editor.) 304 | 305 | It would be nice though if DEC would document DECterm better... 306 | 307 | +-----------------------------------------------------------------------------+ 308 | ! Per Steinar Iversen ! Internet: iversen@vsfys1.fi.uib.no ! 309 | ! Fysisk Institutt ! BITnet: iversen@cernvm.bitnet ! 310 | ! Universitetet i Bergen ! HEPnet: VSFYS::IVERSEN (VSFYS=21.341=21845) ! 311 | ! Allegaten 55 ! Phone: +47 5212770 ! 312 | ! N-5007 Bergen ! Fax: +47 5318334 ! 313 | ! NORWAY ! ! 314 | +-----------------------------------------------------------------------------+ 315 | 316 | 317 | *---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---* 318 | 319 | From the HP-UX FAQ: 320 | 321 | Subject: 6.3 How do I get a scroll bar on hpterms? 322 | 323 | Set the following resources: 324 | 325 | HPterm*scrollBar: TRUE 326 | HPterm*saveLines: 1024 327 | 328 | or some other other arbitrarily large number. To do this interactively, use 329 | "hpterm -sb -sl 1024". You can also set these in an app-default file 330 | (/usr/lib/X11/app-defaults/HPterm). You can also set saveLines to something 331 | like "4s", which indicates four screens. 332 | 333 | If you want the VUE panel terminal icon produce hpterm's that have 334 | scroll bars, and also have their login shell run at the startup of 335 | the terminal. To do this you have to modify the default action of the 336 | VUE panel. The easiest way to do this on a system-wide basis is 337 | to edit the "/usr/vue/types/xclients.vf" file. Change the line that says 338 | "hpterm" to "hpterm -ls -sb -sl 400": 339 | 340 | /usr/vue/types/xclients.vf 341 | 342 | ACTION Hpterm 343 | TYPE COMMAND 344 | WINDOW-TYPE NO-STDIO 345 | EXEC-STRING hpterm -ls -sb -sl 400 346 | DESCRIPTION The Hpterm action starts an hpterm terminal 347 | emulator. 348 | END 349 | 350 | (Thanks to Greg Cagle and 351 | John Kemp ) 352 | 353 | 354 | ......... ......... ......... ......... ......... ......... ......... ....... 355 | 356 | The HP-UX Frequently Asked Questions compilation, which includes several 357 | other 'hpterm' items, can be read in its entirety from this URL: 358 | 359 | http://www.cis.ohio-state.edu/hypertext/faq/usenet/hp/top.html 360 | 361 | *---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---*---* 362 | 363 | 364 | ////////////////////////////////////////////////////////////////////////////// 365 | 366 | From charlesp@darwin.sfbr.org Sat Feb 20 23:32:53 1999 367 | Date: Fri, 19 Feb 1999 00:30:05 GMT 368 | From: charlesp@darwin.sfbr.org 369 | Subject: Re: Emacs in a dtterm under 2.6 CDE 370 | 371 | In article <7a1f2i$j3c$2@callisto.clark.net>, 372 | "T.E.Dickey" wrote: 373 | > charlesp@darwin.sfbr.org wrote: 374 | > > Recently I was forced to switch from Openwindows to CDE under Solaris 2.6 375 | > > which features dtterm terminal windows. 376 | > 377 | > > I like to run emacs inside my terminal windows (I can C-Z to flop back from 378 | > > "real" shell to emacs without reaching for a mouse). But this CDE dtterm 379 | > > appears to be broken. It works for a while, but certain cursor motions 380 | > > (particularly going backward from the bottom of a window) screw up the 381 | > > display so I end up typing C-l all the time. When the display is hosed, 382 | > > one symptom is that the reverse video lines near the bottom and in the 383 | > > middle (if you have multiple windows) go away and are replaced by some of 384 | > > the text you are editing. 385 | > 386 | > simple fix: remove the scrolling capabilities from the dtterm description 387 | > hard fix: get the vendor to correct the bug. 388 | > 389 | 390 | I've tried both disabling the scroll bar and both positions of the "jump 391 | scroll" option. I also tried "kshMode." Nothing solved the problem. 392 | 393 | dtterm is BROKEN. 394 | 395 | Besides, I like scrolling. I'm now using cmdtools (which I didn't even know 396 | were available under CDE, but they are, at least in 2.6) and they work 397 | perfectly. The version of xterm in 2.6 also works fine, but I haven't 398 | figured out how to get xterms to work so that when I exit out of emacs (or 399 | vi). I see the previous terminal history, not just the editing session 400 | paritally scrolled off screen. It is very useful to see the previous terminal 401 | history. (dtterm doesn't do this the way I want either). cmdtool does 402 | everything the way I want by default. 403 | 404 | 405 | ter fix (imho): 406 | > The XFree86 3.3.3 xterm supports ANSI color and VT220 emulation 407 | > There's an faq at 408 | > [STALE URL] 409 | > http://www.clark.net/pub/dickey/xterm/xterm.faq.html 410 | > ftp://ftp.clark.net/pub/dickey/xterm 411 | 412 | [URL functional in 2009] 413 | http://invisible-island.net/xterm/xterm.faq.html 414 | 415 | > -- 416 | > Thomas E. Dickey 417 | > dickey@clark.net 418 | > http://www.clark.net/pub/dickey 419 | > 420 | 421 | ////////////////////////////////////////////////////////////////////////////// 422 | 423 | Newsgroups: comp.terminals 424 | Date: 19 Feb 1999 17:11:38 GMT 425 | From: T.E.Dickey 426 | Subject: Re: Emacs in a dtterm under 2.6 CDE 427 | 428 | charlesp@darwin.sfbr.org wrote: 429 | ... 430 | >> simple fix: remove the scrolling capabilities from the dtterm description 431 | >> hard fix: get the vendor to correct the bug. 432 | 433 | > I've tried both disabling the scroll bar and both positions of the "jump 434 | > scroll" option. I also tried "kshMode." Nothing solved the problem. 435 | 436 | the scrollbar has nothing to do with it. run 437 | infocmp dtterm >foo 438 | and remove the 'csr', 'ind', 'ri' strings. recompile with tic. 439 | 440 | > dtterm is BROKEN. 441 | 442 | that appears correct. 443 | 444 | > Besides, I like scrolling. I'm now using cmdtools (which I didn't even know 445 | > were available under CDE, but they are, at least in 2.6) and they work 446 | > perfectly. The version of xterm in 2.6 also works fine, but I haven't 447 | > figured out how to get xterms to work so that when I exit out of emacs (or 448 | > vi) I see the previous terminal history, not just the editing session 449 | > paritally scrolled off screen. It is very useful to see the previous terminal 450 | > history. (dtterm doesn't do this the way I want either). cmdtool does 451 | 452 | dtterm doesn't do it at all. you are describing the alternate screen feature 453 | of xterm (half of the users dislike it, half like it). still - in my faq. 454 | 455 | -- 456 | Thomas E. Dickey 457 | dickey@clark.net 458 | 459 | 460 | ////////////////////////////////////////////////////////////////////////////// 461 | 462 | Newsgroups: comp.terminals,comp.unix.aix,comp.windows.x 463 | Message-ID: <6pouaa$20p$1@usenet50.supernews.com> 464 | Date: Thu, 30 Jul 1998 00:51:05 -0400 465 | From: "M. Kovarski" 466 | Subject: CATIA on X-Terminal 467 | 468 | 469 | Anyone here using CATIA on an X-Terminal? If so, which on. We tried the IBM 470 | Network Station 1000 and it does not seem to work. The colors are funny. I 471 | think it is because the Netstation has only 256 colors!?!? 472 | 473 | The server which runs the CATIA is an F50 with an GXT800P running in OpenGL 474 | mode. I have not tried Pex/Phigs yet. CATIA uses 16 Million colors as far as 475 | I can tell. 476 | 477 | Any other 24-Bit color X-Terminals out there by other companies? Any 478 | recommendations or warnings? 479 | 480 | CATIA is a strange app since it uses some weird colormap scheme. I get 481 | exactly the same problem when running CATIA on Hummingbird, WRQs and others. 482 | The colors are weird. Hummingbird came to the conclusion that catia uses 4 483 | or so colormaps and the PC can handle on 2. Anyone any ideas? 484 | 485 | Thanks and best regards, 486 | Mark K. 487 | markk@openetix.com 488 | 489 | 490 | ////////////////////////////////////////////////////////////////////////////// 491 | 492 | Newsgroups: comp.terminals,comp.unix.aix,comp.windows.x 493 | Message-ID: <35C13398.67AB81A6@ma.ultranet.com> 494 | References: <6pouaa$20p$1@usenet50.supernews.com> 495 | <35C13462.E55D6291@ma.ultranet.com> 496 | Date: Thu, 30 Jul 1998 23:01:44 -0400 497 | From: Chuck Kuhlman 498 | Subject: Re: CATIA on X-Terminal 499 | 500 | 501 | inadviseable 502 | 503 | you'll get ...poor performance and network saturation. If you can 504 | even get it to work at all. 505 | 506 | Best to stay with the explicit hardware configs set up for you at the 507 | Dassault/IBM CASIL web site and NOT cheap out on sub-standard kludges. 508 | 509 | CATIA belongs to Dassault Aerospace (France) who have a very close 510 | relationship with IBM to run CATIA on RS/6000 and OS/390. 511 | 512 | 513 | 514 | 515 | ////////////////////////////////////////////////////////////////////////////// 516 | 517 | Newsgroups: comp.unix.solaris 518 | References: <374149b0.9183139@news.esat.net> 519 | <1riu9q7byu.fsf@haey.ifi.uio.no> 520 | <7hu486$j6i$1@ash.prod.itd.earthlink.net> <1rn1z15fxn.fsf@haey.ifi.uio.no> 521 | <7i5bsg$ulv$1@nnrp1.deja.com> 522 | Message-ID: <3Ky13.621$Rl3.23904@ord-read.news.verio.net> 523 | Date: Sat, 22 May 1999 13:58:23 GMT 524 | NNTP-Posting-Host: 168.143.0.8 525 | From: "T.E.Dickey" 526 | Subject: Re: Colour Xterm? 527 | 528 | olefevre@my-dejanews.com wrote: 529 | > Kjetil Torgrim Homme wrote: 530 | 531 | > Also, xterm compiled in a snap on this Solaris 2.5.1 system and all 532 | > tests in xterm-103/vttests seem to work. However, I'm not getting any 533 | > color with, e.g., man. I set XTerm*customization in ~/.Xdefaults to 534 | 535 | 'man' doesn't do color in any version I've seen. You can setup XFree86 536 | xterm to apply specified colors to bold and underlined text. 537 | 538 | > -color and my XUSERetc starts with the path to XTerm-color file yet 539 | > truss tells me it is not read (Xterm is, though). Why? Anyway, even 540 | 541 | If you have 542 | 543 | *customization: color 544 | 545 | in your .Xdefaults, it should read the XTerm-color file _if_ app-defaults 546 | aren't overridden by xrdb or some environment variable such as XENVIRONMENT 547 | or XAPPLRESDIR. 548 | 549 | > instructions in my XTerm seem ignored because, e.g., I can change the 550 | > cursor color in .Xdefaults but not in XTerm. But then even setting 551 | > XTerm*VT100*colorMode to on in .Xdefaults does not get me color. 552 | 553 | > At this point I'm giving up. Can someone tell me what is wrong and how 554 | > to get color at last? 555 | 556 | > Thanks a lot, 557 | 558 | > -- O.L. 559 | 560 | -- 561 | Thomas E. Dickey 562 | dickey@clark.net 563 | http://invisible-island.net/ 564 | 565 | ////////////////////////////////////////////////////////////////////////////// 566 | 567 | Newsgroups: comp.terminals,comp.os.linux.admin 568 | Path: !cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com 569 | !cyclone.swbell.net!newsfeed.berkeley.edu!newsfeed.nyu.edu 570 | !wesley.videotron.net!wagner.videotron.net.POSTED!ocurtin 571 | NNTP-Posting-Host: 24.200.125.165 572 | Organization: The Minetown Digger 573 | Reply-To: ocurtin@NOSPAM.usa.net 574 | Message-ID: 575 | Date: Fri, 3 Mar 2000 15:08:59 -0500 576 | From: ocurtin@usa.net (Curly++) 577 | Subject: Escape sequences for xterm? 578 | 579 | I think what I need is a listing of xterm escape codes. All the 580 | listings I've found are horribly out of date. 581 | 582 | I've done a few extensive web crawls but haven't been able to 583 | find anything up-to-date except the source code... yeah, I know, 584 | but it's self-documenting! 585 | 586 | 587 | Maybe I'm going about this all wrong, so let me tell you what I'm 588 | doing, you can tell me if I'm stupidly ignoring an obvious and 589 | simple solution. 590 | 591 | I'm fiddling with the source for xterm. I need to monitor the 592 | user's interaction with some applications so as to divert some 593 | of the inputs to another app. Legacy stuff, this is a kludge 594 | to bridge the old and the new until the old can be fully phased 595 | out. I'm writing scripts with `expect` to wait for the user 596 | to fill in a form, then take an image of the screen and pass it 597 | to another app. I can't capture the data coming back, the 598 | screen is updated in tiny bits sort-of like what curses does. 599 | 600 | I've added an escape sequence to xterm so the expect script can 601 | be triggered by the few predictable strings and use `send_user` 602 | to trigger a screen dump to an external file. I'd like to use a 603 | "correct" sequence and submit this as a patch to the xterm 604 | maintainer. This seems to me a general solution to a set of 605 | problems that turn up occassionaly. 606 | 607 | 608 | -- 609 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 610 | Surface Liaison, Minetown Digger Send no SPAM. 611 | http://pages.infinit.net/curlypp/ 612 | 613 | ////////////////////////////////////////////////////////////////////////////// 614 | 615 | Newsgroups: comp.terminals,comp.os.linux.admin 616 | Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany) 617 | Message-ID: 618 | References: 619 | Date: 3 Mar 2000 22:51:21 +0100 620 | From: m.ramsch@computer.org (Martin Ramsch) 621 | Subject: Re: Escape sequences for xterm? 622 | 623 | On Fri, 3 Mar 2000 15:08:59 -0500, 624 | Oisin "Curly++" Curtin wrote: 625 | > I think what I need is a listing of xterm escape codes. All the 626 | > listings I've found are horribly out of date. 627 | 628 | Did you also have a look at the file "ctlseqs.ms" which is part of 629 | every xterm packages? 630 | 631 | To convert this file into other formats use for example 632 | groff -ms -t -Tps ctlseqs.ms >ctlseqs.ps for Postscript output 633 | groff -ms -t -Tlj4 ctlseqs.ms >ctlseqs.lj4 for LaserJet 4 print file 634 | groff -ms -t -Tdvi ctlseqs.ms >ctlseqs.dvi for TeX dvi output 635 | groff -ms -t -Tlatin1 ctlseqs.ms >ctlseqs.txt for text output 636 | 637 | Regards, 638 | Martin 639 | -- 640 | Martin Ramsch 641 | PGP KeyID=0xE8EF4F75 FiPr=5244 5EF3 B0B1 3826 E4EC 8058 7B31 3AD7 642 | 643 | ////////////////////////////////////////////////////////////////////////////// 644 | 645 | Newsgroups: comp.terminals,comp.os.linux.admin 646 | References: 647 | 648 | Organization: Clark Internet Services, Inc., Ellicott City, MD USA 649 | User-Agent: tin/1.5.2-20000119 ("Sumerland") (UNIX) (SunOS/5.6 (sun4u)) 650 | Message-ID: 651 | Date: Sat, 04 Mar 2000 11:37:52 GMT 652 | From: "T.E.Dickey" 653 | Subject: Re: Escape sequences for xterm? 654 | 655 | Martin Ramsch wrote: 656 | > On Fri, 3 Mar 2000 15:08:59 -0500, 657 | > Oisin "Curly++" Curtin wrote: 658 | >> I think what I need is a listing of xterm escape codes. All the 659 | >> listings I've found are horribly out of date. 660 | 661 | > Did you also have a look at the file "ctlseqs.ms" which is part of 662 | > every xterm packages? 663 | 664 | 665 | Technically, ctlseqs.ms was moved to the doc directory tree some time 666 | ago - depending on how you get xterm, you may not see it - I bundle it 667 | in my xterm tarballs for convenience. 668 | 669 | 670 | The XFree86 xterm supports ANSI color and VT220 emulation 671 | 672 | There's an faq at 673 | [STALE URL] 674 | http://www.clark.net/pub/dickey/xterm/xterm.faq.html 675 | ftp://ftp.clark.net/pub/dickey/xterm 676 | 677 | [2009 URL] 678 | http://invisible-island.net/xterm/xterm.faq.html 679 | 680 | (altavista usually shows my webpage - though I don't search for that ;-) 681 | 682 | 683 | [Altavista was popular before Google saturated the search function.] 684 | 685 | 686 | -- 687 | Thomas E. Dickey 688 | dickey@clark.net 689 | http://www.clark.net/pub/dickey 690 | 691 | ////////////////////////////////////////////////////////////////////////////// 692 | 693 | Newsgroups: comp.terminals,comp.os.linux.admin 694 | References: 695 | Message-ID: 696 | Date: Sat, 04 Mar 2000 14:39:17 GMT 697 | NNTP-Posting-Date: Sat, 04 Mar 2000 14:39:17 GMT 698 | From: "T.E.Dickey" 699 | Subject: Re: Escape sequences for xterm? 700 | 701 | Curly++ wrote: 702 | > 703 | > I've added an escape sequence to xterm so the expect script can 704 | > be triggered by the few predictable strings and use `send_user` 705 | > to trigger a screen dump to an external file. I'd like to use a 706 | > "correct" sequence and submit this as a patch to the xterm 707 | > maintainer. This seems to me a general solution to a set of 708 | > problems that turn up occassionaly. 709 | 710 | While it's useful, this is generally frowned upon as a security problem. 711 | I don't think it'll get much general acceptance. 712 | 713 | -- 714 | Thomas E. Dickey 715 | dickey@clark.net 716 | http://www.clark.net/pub/dickey 717 | 718 | ////////////////////////////////////////////////////////////////////////////// 719 | 720 | Newsgroups: comp.terminals,comp.os.linux.admin 721 | References: 722 | 723 | NNTP-Posting-Host: modem-88-4-60-62.vip.uk.com 724 | Message-ID: <38C15701.7CF1A007@tinyworld.co.uk> 725 | Date: Sat, 04 Mar 2000 18:33:37 +0000 726 | From: Paul Williams 727 | Subject: Re: Escape sequences for xterm? 728 | 729 | "T.E.Dickey" wrote: 730 | > 731 | > Curly++ wrote: 732 | > 733 | > > I've added an escape sequence to xterm so the expect script can 734 | > > be triggered by the few predictable strings and use `send_user` 735 | > > to trigger a screen dump to an external file. I'd like to use a 736 | > > "correct" sequence and submit this as a patch to the xterm 737 | > > maintainer. This seems to me a general solution to a set of 738 | > > problems that turn up occassionaly. 739 | > 740 | > While it's useful, this is generally frowned upon as a security problem. 741 | > I don't think it'll get much general acceptance. 742 | 743 | 744 | It is possible for a host computer to grab the contents of the screen 745 | of a Digital VT420. Howeve, xterm doesn't emulate a VT420 (yet?) 746 | 747 | ////////////////////////////////////////////////////////////////////////////// 748 | 749 | Newsgroups: comp.terminals,comp.os.linux.admin 750 | References: 751 | 752 | Organization: The Minetown Digger 753 | Message-ID: 754 | Date: Sun, 5 Mar 2000 15:32:03 -0500 755 | From: ocurtin@NOSPAM.usa.net (Curly++) 756 | Subject: Re: Escape sequences for xterm? 757 | 758 | On 3 Mar 2000 22:51:21 +0100, Martin Ramsch wrote: 759 | > 760 | > On Fri, 3 Mar 2000 15:08:59 -0500, 761 | > Oisin "Curly++" Curtin wrote: 762 | > > I think what I need is a listing of xterm escape codes. All the 763 | > > listings I've found are horribly out of date. 764 | > 765 | > Did you also have a look at the file "ctlseqs.ms" which is part of 766 | 767 | > groff -ms -t -Tlatin1 ctlseqs.ms >ctlseqs.txt for text output 768 | 769 | 770 | Ah! Thanks, Martin. That's the answer all right! 771 | 772 | I'm not a gruff person, er, I mean I'm not a groff person so the 773 | .ms didn't mean anthing to me. I'll suggest that your answer be 774 | added to the FAQ for all us ignoramuses. :-) 775 | 776 | 777 | -- 778 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 779 | Surface Liaison, Minetown Digger Send no SPAM. 780 | http://pages.infinit.net/curlypp/ 781 | 782 | ////////////////////////////////////////////////////////////////////////////// 783 | 784 | Newsgroups: comp.terminals,comp.os.linux.admin 785 | From: ocurtin@NOSPAM.usa.net (Curly++) 786 | Subject: Re: Escape sequences for xterm? 787 | References: 788 | 789 | 790 | Organization: The Minetown Digger 791 | Message-ID: 792 | Date: Sun, 5 Mar 2000 15:39:42 -0500 793 | 794 | 795 | On Sat, 04 Mar 2000 11:37:52 GMT, T.E.Dickey wrote: 796 | > Martin Ramsch wrote: 797 | > > On Fri, 3 Mar 2000 15:08:59 -0500, 798 | > > Oisin "Curly++" Curtin wrote: 799 | > >> I think what I need is a listing of xterm escape codes. All the 800 | > >> listings I've found are horribly out of date. 801 | > 802 | > > Did you also have a look at the file "ctlseqs.ms" which is part of 803 | > > every xterm packages? 804 | > 805 | > Technically, ctlseqs.ms was moved to the doc directory tree some time 806 | > ago - depending on how you get xterm, you may not see it - I bundle it 807 | 808 | I must have an old copy then. 809 | 810 | AFAIK, I did check the lastest FAQ at clark. Can MR's reply be 811 | added so "us unwashed masses" can cut'n'paste the right command 812 | to see it? TIA, either way. 813 | 814 | 815 | -- 816 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 817 | Surface Liaison, Minetown Digger Send no SPAM. 818 | http://pages.infinit.net/curlypp/ 819 | 820 | 821 | 822 | Newsgroups: comp.terminals,comp.os.linux.admin 823 | References: 824 | 825 | Organization: The Minetown Digger 826 | NNTP-Posting-Host: 24.200.125.165 827 | Message-ID: 828 | Date: Sun, 5 Mar 2000 16:15:02 -0500 829 | From: ocurtin@usa.net (Curly++) 830 | Subject: Re: Escape sequences for xterm? 831 | 832 | On Sat, 04 Mar 2000 14:39:17 GMT, T.E.Dickey wrote: 833 | > Curly++ wrote: 834 | > 835 | > > I've added an escape sequence to xterm so the expect script can 836 | > > be triggered by the few predictable strings and use `send_user` 837 | > > to trigger a screen dump to an external file. I'd like to use a 838 | > > "correct" sequence and submit this as a patch to the xterm 839 | > > maintainer. This seems to me a general solution to a set of 840 | > > problems that turn up occassionaly. 841 | > 842 | > While it's useful, this is generally frowned upon as a security problem. 843 | > I don't think it'll get much general acceptance. 844 | 845 | DISCLAIMER: I'm not a security expert and I don't play one on TV. 846 | 847 | You're referring to the log problem? I haven't read all about 848 | it, but I gather it's not logging per se, but the fact that the 849 | destination file is uncontrolled that causes a problem. 850 | 851 | I plan to make screen-scraping secure by allowing the user only 852 | limited control of the destination filename and ignoring the 853 | request if the file already exists. That means the screen-scrape 854 | will never, for example, add a line to ~/.profile. This forces 855 | the external script to delete files, but then the script needs 856 | much less logic to read the image that way. 857 | 858 | I'm not sure, but I think the solution to the logging problem is 859 | similar: restrict the name and location of the file to something 860 | less than anywhere/anything and use more elaborate fstat code in 861 | place of the access tests. Maybe even put a magic cookie at the 862 | top of new logs and never append to an existing log if it doesn't 863 | have a cookie on top. A cookie is a lot of extra code though, I 864 | wouldn't do it unless the real security experts say it's needed. 865 | 866 | BTW, I have to add this... 867 | My partner is not used to seeing me grinning from ear to ear and 868 | muttering under my breath "Wow! That's neat!" and similar things. 869 | This code is an absolute _pleasure_ to work with. 870 | 871 | 872 | -- 873 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 874 | Surface Liaison, Minetown Digger Send no SPAM. 875 | http://pages.infinit.net/curlypp/ 876 | 877 | ////////////////////////////////////////////////////////////////////////////// 878 | 879 | Newsgroups: comp.terminals,comp.os.linux.admin 880 | References: 881 | 882 | <38C15701.7CF1A007@tinyworld.co.uk> 883 | Organization: The Minetown Digger 884 | Reply-To: ocurtin@NOSPAM.usa.net 885 | User-Agent: slrn/0.9.5.4 (UNIX) 886 | Lines: 15 887 | Date: Sun, 5 Mar 2000 16:32:52 -0500 888 | From: ocurtin@NOSPAM.usa.net (Curly++) 889 | Subject: Re: Escape sequences for xterm? 890 | 891 | On 04 Mar 2000, Paul Williams wrote: 892 | 893 | > It is possible for a host computer to grab the contents of the screen 894 | > of a Digital VT420. Howeve, xterm doesn't emulate a VT420 (yet?) 895 | 896 | But doesn't that go back to the remote application? I think 897 | `expect` could divert the output, but having dealt with timing 898 | issues before, I feel more comfortable if the data *cannot* 899 | go out the wrong way no matter how hard it tries. 900 | 901 | 902 | -- 903 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 904 | Surface Liaison, Minetown Digger Send no SPAM. 905 | http://pages.infinit.net/curlypp/ 906 | 907 | ////////////////////////////////////////////////////////////////////////////// 908 | 909 | Newsgroups: comp.terminals,comp.os.linux.admin 910 | References: 911 | 912 | 913 | 914 | Organization: Clark Internet Services, Inc., Ellicott City, MD USA 915 | Message-ID: 916 | Date: Sun, 05 Mar 2000 23:55:17 GMT 917 | From: "T.E.Dickey" 918 | Subject: Re: Escape sequences for xterm? 919 | 920 | Curly++ wrote: 921 | >> Technically, ctlseqs.ms was moved to the doc directory tree some time 922 | >> ago - depending on how you get xterm, you may not see it - I bundle it 923 | 924 | > I must have an old copy then. 925 | 926 | > AFAIK, I did check the lastest FAQ at clark. Can MR's reply be 927 | > added so "us unwashed masses" can cut'n'paste the right command 928 | > to see it? TIA, either way. 929 | 930 | maybe (I've been more busy fixing bugs in various programs recently than 931 | updating webpages). 932 | 933 | -- 934 | Thomas E. Dickey 935 | dickey@clark.net 936 | 937 | ////////////////////////////////////////////////////////////////////////////// 938 | 939 | Newsgroups: comp.terminals,comp.os.linux.admin 940 | References: 941 | 942 | 943 | Organization: The Minetown Digger 944 | Message-ID: 945 | Date: Mon, 6 Mar 2000 12:37:00 -0500 946 | From: ocurtin@usa.net (Curly++) 947 | Subject: Re: Escape sequences for xterm? 948 | 949 | In comp.terminals, Curly++ proclaimed: 950 | 951 | > DISCLAIMER: I'm not a security expert and I don't play one on TV. 952 | 953 | Geez, I'll never get that TV job. 954 | 955 | I went back to look at Morten Welinder and Branden Robinson's 956 | postings to bugtraq. Ya now, I don't even have to think to see 957 | how *machines* could get confused splitting the data stream 958 | between the local screen-image and the remote host. But Morten 959 | Welinder clearly is describing the same kind of timing issue, 960 | except the failure is in human ethical subroutines. I didn't see 961 | it until I'd read it three times. Such is the life of an 962 | optimist. 963 | 964 | I'm off to carefully read (at least three times!) the proposed 965 | logging patch. 966 | 967 | 968 | -- 969 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 970 | Surface Liaison, Minetown Digger Send no SPAM. 971 | http://pages.infinit.net/curlypp/ 972 | 973 | ////////////////////////////////////////////////////////////////////////////// 974 | 975 | Newsgroups: comp.terminals,comp.os.linux.admin 976 | Organization: Columbia University 977 | Message-ID: <8a1bfi$sn5$1@newsmaster.cc.columbia.edu> 978 | References: 979 | 980 | 981 | Date: 6 Mar 2000 22:29:06 GMT 982 | From: Jeffrey Altman 983 | Subject: Re: Escape sequences for xterm? 984 | 985 | In article , 986 | Curly++ wrote: 987 | : In comp.terminals, Curly++ proclaimed: 988 | : 989 | : > DISCLAIMER: I'm not a security expert and I don't play one on TV. 990 | : 991 | : Geez, I'll never get that TV job. 992 | : 993 | : I went back to look at Morten Welinder and Branden Robinson's 994 | : postings to bugtraq. Ya now, I don't even have to think to see 995 | : how *machines* could get confused splitting the data stream 996 | : between the local screen-image and the remote host. But Morten 997 | : Welinder clearly is describing the same kind of timing issue, 998 | : except the failure is in human ethical subroutines. I didn't see 999 | : it until I'd read it three times. Such is the life of an 1000 | : optimist. 1001 | : 1002 | : I'm off to carefully read (at least three times!) the proposed 1003 | : logging patch. 1004 | 1005 | 1006 | There is no safe way for a host to specify a file name that should 1007 | be used for logging, or printing, or any other kind of output. If 1008 | host automated logging is the be provided it MUST be: 1009 | 1010 | . authorized by the client 1011 | 1012 | . to a file specified by the client 1013 | 1014 | This should not be done via a standard control sequence. If it is 1015 | going to be done it should be performed via a private sequence (preferably 1016 | not a '?' sequence) or via an APC. 1017 | 1018 | Jeffrey Altman * Sr.Software Designer * Kermit-95 for Win32 and OS/2 1019 | The Kermit Project * Columbia University 1020 | 612 West 115th St #716 * New York, NY * 10025 1021 | http://www.kermit-project.org/k95.html * kermit-support@kermit-project.org 1022 | 1023 | ////////////////////////////////////////////////////////////////////////////// 1024 | 1025 | From: ocurtin@NOSPAM.usa.net (Curly++) 1026 | Newsgroups: comp.terminals,comp.os.linux.admin 1027 | Subject: Re: Escape sequences for xterm? 1028 | References: 1029 | 1030 | 1031 | <8a1bfi$sn5$1@newsmaster.cc.columbia.edu> 1032 | Organization: The Minetown Digger 1033 | Date: Mon, 6 Mar 2000 22:10:52 -0500 1034 | 1035 | 1036 | In comp.os.linux.admin, Jeffrey Altman proclaimed: 1037 | > In article , 1038 | > Curly++ wrote: 1039 | > : In comp.terminals, Curly++ proclaimed: 1040 | > : 1041 | > : > DISCLAIMER: I'm not a security expert and I don't play one on TV. 1042 | > : 1043 | > : Geez, I'll never get that TV job. 1044 | > : 1045 | > : I went back to look at Morten Welinder and Branden Robinson's 1046 | > : postings to bugtraq. Ya now, I don't even have to think to see 1047 | > : how *machines* could get confused splitting the data stream 1048 | > : between the local screen-image and the remote host. But Morten 1049 | > : Welinder clearly is describing the same kind of timing issue, 1050 | > : except the failure is in human ethical subroutines. I didn't see 1051 | > : it until I'd read it three times. Such is the life of an 1052 | > : optimist. 1053 | > : 1054 | > : I'm off to carefully read (at least three times!) the proposed 1055 | > : logging patch. 1056 | > 1057 | > There is no safe way for a host to specify a file name that should 1058 | > be used for logging, or printing, or any other kind of output. If 1059 | 1060 | 1061 | It's a connundrum, all right. I started this thinking it would be a 1062 | breeze. Making the part I needed was simple and straightforward. 1063 | Fitting it into the configurator was a bit more work. But making it 1064 | secure enough to distribute... this is tough! 1065 | 1066 | > host automated logging is the be provided it MUST be: 1067 | > 1068 | > . authorized by the client 1069 | 1070 | Yes. Authorization may be implicit, just as you "authorize" someone 1071 | to modify your log files by connectiong to your anonymous FTP server, 1072 | so too you might provide a very limited authorization to write to a 1073 | file within a carefully proscribed namespace. 1074 | 1075 | > . to a file specified by the client 1076 | 1077 | I've only really considered *nix for building a name. But I 1078 | suspect this can be easily addapted to other OSs. 1079 | 1080 | I had hoped I could use the code that opens the log in the patch 1081 | posted to bugtraq, but the method seems broken to me. Also, I 1082 | can't see how it deals with the symlink problem, but I haven't 1083 | had time to play with it yet. It is broken in terms of the 1084 | forced naming. First, it allows the file to be anywhere because 1085 | it opens it in the current directory. I think it should be 1086 | restricted to a selection between the user's home directory and 1087 | the system-wide tmp directory. Second, using the time to create 1088 | a "unique" name is just wrong. A user starting two sessions from 1089 | the same shell script will have a problem, but can deal with it 1090 | by adding "sleep" to slow down that expensive, fast computer. 1091 | However, if it's two different users clicking at the same time, 1092 | the user cannot predict or prevent the collision. It would have 1093 | been less work and more reliable to use UID and PID instead of 1094 | time. Still not perfect, but at least the user can clean out old 1095 | files to prevent collisions. 1096 | 1097 | I'm planning to put two restrictions. First, a screen dump must 1098 | go to a new file. This is harsh, but I think I need it to deal 1099 | with the symlink race problem. Second, the pathname of the file 1100 | is severely restricted. As long as the script/host has just a 1101 | little control, it can do nice things for the user. It doesn't 1102 | need full control of the pathname. 1103 | 1104 | The pathname will be [dir]/screen[.UID.PID].txt where [dir] is 1105 | required and must be either "/tmp" or "/home/me". Home would be 1106 | determined from /etc/passwd, not from $HOME. I'd like to make 1107 | ".UID.PID" replaceable within a narrow range. With these 1108 | restrictions, an external script which started the xterm (see 1109 | /bin/expect) can have just enough control to detect some trigger 1110 | and grab a screen image. A script should not be forced to do 1111 | extra work between keystrokes to clear the file if a name change 1112 | will be sufficient. 1113 | 1114 | Requiring that a new file be created for each screen dump partly 1115 | protects existing files from modification, but doesn't fully deal 1116 | with the symlink race condition. I expect that can be solved 1117 | using the low-level I/O library, (i.e. open instead of fopen) but 1118 | I haven't set up the experiment yet. 1119 | 1120 | 1121 | Now, I *don't* think like a cracker, so if I've missed anything, 1122 | please point it out to me! 1123 | 1124 | 1125 | > This should not be done via a standard control sequence. If it is 1126 | > going to be done it should be performed via a private sequence (preferably 1127 | > not a '?' sequence) or via an APC. 1128 | 1129 | Hmm. I was thinking... 1130 | 1131 | OSC Ps ; P1 ; P2 ; Pt ST 1132 | where Ps is the unique value to select this service, 1133 | p1 is 0 for "use home", 1 for "use /tmp" 1134 | p2 is 0 for mode 0666, 1 for mode 0600 1135 | Pt is: empty to use UID.PID 1136 | " " (blank) to eliminate UID.PID 1137 | or 1-8 digits, letters and period. 1138 | 1139 | A malicious host or a broken program could fill a partition with 1140 | files named screen.1.txt, screen.2.txt and so on. But I think 1141 | that's all it can do. Is filling the disk a serious enough 1142 | threat to limit the Pt to one character? That wouldn't be harsh, 1143 | but I think it's unnecessary. 1144 | 1145 | Why is this a bad idea? 1146 | 1147 | 1148 | -- 1149 | Oisin "Curly++" Curtin ocurtin@SPAM.usa.net 1150 | Surface Liaison, Minetown Digger Send no SPAM. 1151 | http://pages.infinit.net/curlypp/ 1152 | 1153 | ////////////////////////////////////////////////////////////////////////////// 1154 | 1155 | Newsgroups: comp.terminals,comp.os.linux.admin 1156 | References: 1157 | 1158 | 1159 | <8a1bfi$sn5$1@newsmaster.cc.columbia.edu> 1160 | Organization: Clark Internet Services, Inc., Ellicott City, MD USA 1161 | User-Agent: tin/1.5.2-20000119 ("Sumerland") (UNIX) (SunOS/5.6 (sun4u)) 1162 | Lines: 15 1163 | Message-ID: 1164 | Date: Tue, 07 Mar 2000 20:34:01 GMT 1165 | From: "T.E.Dickey" 1166 | Subject: Re: Escape sequences for xterm? 1167 | 1168 | Curly++ wrote: 1169 | 1170 | > I had hoped I could use the code that opens the log in the patch 1171 | > posted to bugtraq, but the method seems broken to me. Also, I 1172 | 1173 | briefly, the point of the patch is to ensure that the effective user owns 1174 | the file - and no one else. if the file is in a directory that prevents 1175 | non-owners from deleting the file, then that covers most of the remaining 1176 | issues. (I added a bit to that though - it's in the most recent patch 1177 | I made for xterm). 1178 | 1179 | -- 1180 | Thomas E. Dickey 1181 | dickey@clark.net 1182 | 1183 | ////////////////////////////////////////////////////////////////////////////// 1184 | 1185 | Newsgroups: comp.terminals,comp.os.linux.admin 1186 | Organization: It's in one of the piles 1187 | Message-ID: <38C4C0D0.D5AD4FF@rdel.co.uk> 1188 | References: 1189 | 1190 | 1191 | <8a1bfi$sn5$1@newsmaster.cc.columbia.edu> 1192 | Date: Tue, 07 Mar 2000 08:41:52 +0000 1193 | From: Paul Williams 1194 | Subject: Re: Escape sequences for xterm? 1195 | 1196 | Curly++ wrote: 1197 | > 1198 | > In comp.os.linux.admin, Jeffrey Altman proclaimed: 1199 | > > 1200 | > > This should not be done via a standard control sequence. If it is 1201 | > > going to be done it should be performed via a private sequence 1202 | > > (preferably not a '?' sequence) or via an APC. 1203 | > 1204 | > Hmm. I was thinking... 1205 | > 1206 | > OSC Ps ; P1 ; P2 ; Pt ST 1207 | > where Ps is the unique value to select this service, 1208 | > p1 is 0 for "use home", 1 for "use /tmp" 1209 | > p2 is 0 for mode 0666, 1 for mode 0600 1210 | > Pt is: empty to use UID.PID 1211 | > " " (blank) to eliminate UID.PID 1212 | > or 1-8 digits, letters and period. 1213 | 1214 | It's a shame that the writers of xterm didn't structure the code space 1215 | for OSC in the same way that DEC did with DCS, ie. use the same 1216 | 1217 | Param ;...; Param Intermediate Final 1218 | 1219 | structure as for CSI, with extra, textual parameters appearing after 1220 | Final and before ST. It would've made the parser a lot simpler, because 1221 | you'd know unambiguously where the text starts, even with a variable 1222 | number of parameters. At the moment, it seems that the existing codes 1223 | are of the form 1224 | 1225 | OSC Ps ; Pt ST 1226 | 1227 | which is OK until you add more Ps (or Pn) parameters before Pt. Then you 1228 | have to start doing something special in the parser based on the value 1229 | of the first Ps. 1230 | 1231 | (Of course, this decision is historical -- no reflection on the current 1232 | maintainers. Never let history get in the way of a good whinge, I say!) 1233 | 1234 | ////////////////////////////////////////////////////////////////////////////// 1235 | 1236 | Newsgroups: comp.terminals,comp.os.linux.admin 1237 | Organization: Columbia University 1238 | Lines: 41 1239 | Message-ID: <8a33dh$bko$1@newsmaster.cc.columbia.edu> 1240 | References: 1241 | <8a1bfi$sn5$1@newsmaster.cc.columbia.edu> 1242 | <38C4C0D0.D5AD4FF@rdel.co.uk> 1243 | Date: 7 Mar 2000 14:23:45 GMT 1244 | From: jaltman@watsun.cc.columbia.edu (Jeffrey Altman) 1245 | Subject: Re: Escape sequences for xterm? 1246 | 1247 | In article <38C4C0D0.D5AD4FF@rdel.co.uk>, 1248 | Paul Williams wrote: 1249 | : > OSC Ps ; P1 ; P2 ; Pt ST 1250 | : > where Ps is the unique value to select this service, 1251 | : > p1 is 0 for "use home", 1 for "use /tmp" 1252 | : > p2 is 0 for mode 0666, 1 for mode 0600 1253 | : > Pt is: empty to use UID.PID 1254 | : > " " (blank) to eliminate UID.PID 1255 | : > or 1-8 digits, letters and period. 1256 | : 1257 | : It's a shame that the writers of xterm didn't structure the code space 1258 | : for OSC in the same way that DEC did with DCS, ie. use the same 1259 | : 1260 | : Param ;...; Param Intermediate Final 1261 | : 1262 | : structure as for CSI, with extra, textual parameters appearing after 1263 | : Final and before ST. It would've made the parser a lot simpler, because 1264 | : you'd know unambiguously where the text starts, even with a variable 1265 | : number of parameters. At the moment, it seems that the existing codes 1266 | : are of the form 1267 | : 1268 | : OSC Ps ; Pt ST 1269 | : 1270 | : which is OK until you add more Ps (or Pn) parameters before Pt. Then you 1271 | : have to start doing something special in the parser based on the value 1272 | : of the first Ps. 1273 | 1274 | The whole purpose of the control sequences OSC, APC, DCS, PM, PU1, PU2 1275 | are so that something special will be done with the contents. If you 1276 | can represent the command using X3.64 notation then you should not be 1277 | using an OSC but should instead be using a private CSI sequence. 1278 | 1279 | Just to set the record straight, the OSC sequences for Set Window Title 1280 | and Set Icon Name were developed by DEC for the DECterm and were later 1281 | supported on windowing versions of the VT terminals. 1282 | 1283 | 1284 | Jeffrey Altman * Sr.Software Designer * Kermit-95 for Win32 and OS/2 1285 | The Kermit Project * Columbia University 1286 | 612 West 115th St #716 * New York, NY * 10025 1287 | http://www.kermit-project.org/k95.html * kermit-support@kermit-project.org 1288 | 1289 | ////////////////////////////////////////////////////////////////////////////// 1290 | 1291 | Newsgroups: comp.terminals,comp.os.linux.admin 1292 | Organization: It's in one of the piles 1293 | Lines: 57 1294 | Message-ID: <38C51FE0.11DD3325@rdel.co.uk> 1295 | References: 1296 | <8a1bfi$sn5$1@newsmaster.cc.columbia.edu> 1297 | <38C4C0D0.D5AD4FF@rdel.co.uk> <8a33dh$bko$1@newsmaster.cc.columbia.edu> 1298 | Date: Tue, 07 Mar 2000 15:27:28 +0000 1299 | From: Paul Williams 1300 | Subject: Re: Escape sequences for xterm? 1301 | 1302 | Jeffrey Altman wrote: 1303 | > 1304 | > In article <38C4C0D0.D5AD4FF@rdel.co.uk>, 1305 | > Paul Williams wrote: 1306 | > : > OSC Ps ; P1 ; P2 ; Pt ST 1307 | > : > where Ps is the unique value to select this service, 1308 | > : > p1 is 0 for "use home", 1 for "use /tmp" 1309 | > : > p2 is 0 for mode 0666, 1 for mode 0600 1310 | > : > Pt is: empty to use UID.PID 1311 | > : > " " (blank) to eliminate UID.PID 1312 | > : > or 1-8 digits, letters and period. 1313 | > : 1314 | > : It's a shame that the writers of xterm didn't structure the code space 1315 | > : for OSC in the same way that DEC did with DCS, ie. use the same 1316 | > : 1317 | > : Param ;...; Param Intermediate Final 1318 | > : 1319 | > : structure as for CSI, with extra, textual parameters appearing after 1320 | > : Final and before ST. It would've made the parser a lot simpler, because 1321 | > : you'd know unambiguously where the text starts, even with a variable 1322 | > : number of parameters. At the moment, it seems that the existing codes 1323 | > : are of the form 1324 | > : 1325 | > : OSC Ps ; Pt ST 1326 | > : 1327 | > : which is OK until you add more Ps (or Pn) parameters before Pt. Then you 1328 | > : have to start doing something special in the parser based on the value 1329 | > : of the first Ps. 1330 | > 1331 | > The whole purpose of the control sequences OSC, APC, DCS, PM, PU1, PU2 1332 | > are so that something special will be done with the contents. If you 1333 | > can represent the command using X3.64 notation then you should not be 1334 | > using an OSC but should instead be using a private CSI sequence. 1335 | 1336 | 1337 | You can't represent a command containing a sixel string or filename as a 1338 | CSI sequence, so yes, you must use one of the extension mechanisms you 1339 | listed above. However, that doesn't stop you structuring these in the 1340 | same way as CSI _up to a point_. It makes sense to use as much of the 1341 | existing parser for your new sequences, and then just differ at the 1342 | point where you need parameters that don't fit the CSI structure. Take a 1343 | look at all the DCS sequences defined by DEC, and you'll see that that's 1344 | exactly what they did. 1345 | 1346 | > Just to set the record straight, the OSC sequences for Set Window Title 1347 | > and Set Icon Name were developed by DEC for the DECterm and were later 1348 | > supported on windowing versions of the VT terminals. 1349 | 1350 | Then I'd say that DEC only ever intended their OSCs to have one 1351 | selective parameter. Any more than that, and your sequence starts 1352 | getting ambiguous, because ';' doesn't have any standard meaning in OSC. 1353 | 1354 | Hmm...are you saying that DEC defined the sequence "OSC Ps ; title BEL"? 1355 | Because that's the only version of Set Window Title and Set Icon Name 1356 | that xterm used to accept. Or was that miscopied across from the DECterm 1357 | implementation? 1358 | 1359 | Which "windowing versions of VT terminals" supported these sequences? 1360 | 1361 | ////////////////////////////////////////////////////////////////////////////// 1362 | 1363 | Newsgroups: comp.terminals,comp.os.linux.admin 1364 | Message-ID: <8a39tn$et8$1@pegasus.csx.cam.ac.uk> 1365 | References: <38C4C0D0.D5AD4FF@rdel.co.uk> 1366 | <8a33dh$bko$1@newsmaster.cc.columbia.edu> <38C51FE0.11DD3325@rdel.co.uk> 1367 | NNTP-Posting-Host: ursa.cus.cam.ac.uk 1368 | Organization: University of Cambridge, England 1369 | Date: 7 Mar 2000 16:14:47 GMT 1370 | From: bjh21@cus.cam.ac.uk (Ben Harris) 1371 | Subject: Re: Escape sequences for xterm? 1372 | 1373 | In article <38C51FE0.11DD3325@rdel.co.uk>, 1374 | Paul Williams wrote: 1375 | >Hmm...are you saying that DEC defined the sequence "OSC Ps ; title BEL"? 1376 | >Because that's the only version of Set Window Title and Set Icon Name 1377 | >that xterm used to accept. Or was that miscopied across from the DECterm 1378 | >implementation? 1379 | 1380 | My rather vague understanding, from reading the PuTTY sources (PuTTY 1381 | supports both DECterm and xterm title sequences) is that DECterm uses 1382 | "OSC Ps L title ST" or somesuch. 1383 | 1384 | -- 1385 | Ben Harris 1386 | Unix Support, University of Cambridge Computing Service. 1387 | If I wanted to speak for the University, I'd be in ucam.comp-serv.announce. 1388 | 1389 | ////////////////////////////////////////////////////////////////////////////// 1390 | 1391 | Newsgroups: comp.terminals,comp.os.linux.admin 1392 | Message-ID: <8a3am2$hs5$1@newsmaster.cc.columbia.edu> 1393 | References: <38C4C0D0.D5AD4FF@rdel.co.uk> 1394 | <8a33dh$bko$1@newsmaster.cc.columbia.edu> <38C51FE0.11DD3325@rdel.co.uk> 1395 | Date: 7 Mar 2000 16:27:46 GMT 1396 | Organization: Columbia University 1397 | From: jaltman@watsun.cc.columbia.edu (Jeffrey Altman) 1398 | Subject: Re: Escape sequences for xterm? 1399 | 1400 | In article <38C51FE0.11DD3325@rdel.co.uk>, 1401 | Paul Williams wrote: 1402 | : 1403 | : You can't represent a command containing a sixel string or filename as a 1404 | : CSI sequence, so yes, you must use one of the extension mechanisms you 1405 | : listed above. However, that doesn't stop you structuring these in the 1406 | : same way as CSI _up to a point_. It makes sense to use as much of the 1407 | : existing parser for your new sequences, and then just differ at the 1408 | : point where you need parameters that don't fit the CSI structure. Take a 1409 | : look at all the DCS sequences defined by DEC, and you'll see that that's 1410 | : exactly what they did. 1411 | 1412 | And when you can do that you use a DCS instead of an OSC or APC. 1413 | DEC was very consistent about this. All DCS sequences follow X3.64 and 1414 | the others do not. 1415 | 1416 | : > Just to set the record straight, the OSC sequences for Set Window Title 1417 | : > and Set Icon Name were developed by DEC for the DECterm and were later 1418 | : > supported on windowing versions of the VT terminals. 1419 | : 1420 | : Then I'd say that DEC only ever intended their OSCs to have one 1421 | : selective parameter. Any more than that, and your sequence starts 1422 | : getting ambiguous, because ';' doesn't have any standard meaning in OSC. 1423 | : 1424 | : Hmm...are you saying that DEC defined the sequence "OSC Ps ; title BEL"? 1425 | : Because that's the only version of Set Window Title and Set Icon Name 1426 | : that xterm used to accept. Or was that miscopied across from the DECterm 1427 | : implementation? 1428 | 1429 | DEC defined it. 1430 | 1431 | DECSWT (Set Window Title) 1432 | DECSIN (Set Icon Name) 1433 | 1434 | : Which "windowing versions of VT terminals" supported these sequences? 1435 | 1436 | VT5xx has it. And I think the VT420 had it but I don't have a manual to 1437 | check against at the moment. 1438 | 1439 | 1440 | 1441 | 1442 | Jeffrey Altman * Sr.Software Designer * Kermit-95 for Win32 and OS/2 1443 | The Kermit Project * Columbia University 1444 | 612 West 115th St #716 * New York, NY * 10025 1445 | http://www.kermit-project.org/k95.html * kermit-support@kermit-project.org 1446 | 1447 | ////////////////////////////////////////////////////////////////////////////// 1448 | 1449 | Newsgroups: comp.terminals,comp.os.linux.admin 1450 | Organization: It's in one of the piles 1451 | Lines: 20 1452 | Message-ID: <38C52F31.57255BB4@rdel.co.uk> 1453 | References: <38C4C0D0.D5AD4FF@rdel.co.uk> 1454 | <8a33dh$bko$1@newsmaster.cc.columbia.edu> <38C51FE0.11DD3325@rdel.co.uk> 1455 | <8a3am2$hs5$1@newsmaster.cc.columbia.edu> 1456 | Date: Tue, 07 Mar 2000 16:32:49 +0000 1457 | From: Paul Williams 1458 | Subject: Re: Escape sequences for xterm? 1459 | 1460 | Jeffrey Altman wrote: 1461 | > 1462 | > In article <38C51FE0.11DD3325@rdel.co.uk>, 1463 | > Paul Williams wrote: 1464 | > : 1465 | > : You can't represent a command containing a sixel string or filename as a 1466 | > : CSI sequence, so yes, you must use one of the extension mechanisms you 1467 | > : listed above. However, that doesn't stop you structuring these in the 1468 | > : same way as CSI _up to a point_. It makes sense to use as much of the 1469 | > : existing parser for your new sequences, and then just differ at the 1470 | > : point where you need parameters that don't fit the CSI structure. Take a 1471 | > : look at all the DCS sequences defined by DEC, and you'll see that that's 1472 | > : exactly what they did. 1473 | > 1474 | > And when you can do that you use a DCS instead of an OSC or APC. 1475 | > DEC was very consistent about this. All DCS sequences follow X3.64 and 1476 | > the others do not. 1477 | 1478 | But this was _only_ a DEC decision. IIRC, DCS is not defined by X3.64 to 1479 | have any more structure than OSC or APC. 1480 | 1481 | ////////////////////////////////////////////////////////////////////////////// 1482 | 1483 | Newsgroups: comp.terminals,comp.os.linux.admin 1484 | From: "T.E.Dickey" 1485 | Subject: Re: Escape sequences for xterm? 1486 | References: <38C4C0D0.D5AD4FF@rdel.co.uk> 1487 | <8a33dh$bko$1@newsmaster.cc.columbia.edu> <38C51FE0.11DD3325@rdel.co.uk> 1488 | <8a39tn$et8$1@pegasus.csx.cam.ac.uk> 1489 | Message-ID: <4Rdx4.1096$G15.28286@iad-read.news.verio.net> 1490 | Date: Tue, 07 Mar 2000 20:42:40 GMT 1491 | 1492 | Ben Harris wrote: 1493 | > In article <38C51FE0.11DD3325@rdel.co.uk>, 1494 | > Paul Williams wrote: 1495 | >>Hmm...are you saying that DEC defined the sequence "OSC Ps ; title BEL"? 1496 | >>Because that's the only version of Set Window Title and Set Icon Name 1497 | >>that xterm used to accept. Or was that miscopied across from the DECterm 1498 | >>implementation? 1499 | 1500 | > My rather vague understanding, from reading the PuTTY sources (PuTTY 1501 | > supports both DECterm and xterm title sequences) is that DECterm uses 1502 | > "OSC Ps L title ST" or somesuch. 1503 | 1504 | 1505 | yes (OSC is supposed to end with ST, DECterm does the Right Thing). 1506 | I had the impression that Sun's use of this sort of escape sequence 1507 | preceded DEC's - but since both were implemented ~12 years ago, I'm 1508 | not sure (I was using Apollo's at the time, and didn't much like X or 1509 | xterm ;-). 1510 | 1511 | -- XFree86 xterm recognizes both... 1512 | 1513 | -- 1514 | Thomas E. Dickey 1515 | dickey(at)clark.net 1516 | http://www.clark.net/pub/dickey 1517 | 1518 | ////////////////////////////////////////////////////////////////////////////// 1519 | 1520 | 1521 | Newsgroups: comp.unix.solaris,comp.terminals,comp.windows.x.apps, 1522 | comp.unix.questions 1523 | References: <3B4225C4.FB86F2EC@to.gd-es.com> <3b425acd@news.uni-ulm.de> 1524 | <20010704190000_rshu@stratagy.com> 1525 | User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (SunOS/5.8 (sun4u)) 1526 | Organization: united xpiloteers 1527 | Message-ID: <3b437542@news.uni-ulm.de> 1528 | Supersedes: <3b437389@news.uni-ulm.de> 1529 | Date: 4 Jul 2001 21:57:54 +0200 1530 | From: Sven Mascheck 1531 | Subject: Re: resetting xterm under Solaris 8 1532 | 1533 | [sorry, supersede: named original group, 2 typos] 1534 | 1535 | In comp.unix.solaris, Richard S. Shuford wrote: 1536 | > 1537 | > Allen M. Cohen wrote: 1538 | 1539 | >> Sometimes an xterm session gets stuck in either reverse video state 1540 | >> and/or underline state. 1541 | 1542 | > However, I think Allen is *not* reporting a line-drawing character problem. 1543 | 1544 | Yup, thanks for pointing out, i confused underline with linedrawing! 1545 | 1546 | My reference [1]tried to cover this and all related stuff (xterm reset, 1547 | using an alias to reset a VT like terminal, reason for linedrawing problems, 1548 | as text really becomes unreadable, then) in detail with explanations. 1549 | 1550 | 1551 | > I devised a C-shell hack that sends some appropriate control sequences to 1552 | > an DEC-VT100/VT220-compatible terminal or emulator that should bring it to 1553 | > a known good state. A uuencoded self-explanatory file "cls.uue" appears 1554 | > below. 1555 | 1556 | Nice idea to use uuencoding to transfer the control sequences via Usenet. 1557 | 1558 | An alternative i had found in an old Usenet posting ('95) is something 1559 | like the follwing (here bourne shell): 1560 | 1561 | alias vtn='echo "X[mX(BX)0OX[?5lX7X[rX8" | tr "XO" "\033\017"' 1562 | 1563 | This is even editable on the run when experimenting. 1564 | 1565 | 1566 | BTW, about your control sequences: In XFree86/X11 xterm with 1567 | TERM=xterm-xfree86/vt100, the last few characters are "left over" 1568 | ("8J i"). Perhaps as there is a "nobreakspace" contained. 1569 | 1570 | When skipping this last control sequence for now, your version would read 1571 | 1572 | alias vtn='echo "X[4iX[?4iX[?38lX\X(BX)0OX[?5lX[0mX[rX[HX[JY[4iX[?4iX[?38lX\X(BX)0OX[?5lX[0mX[rX[H" | tr "XOY" "\033\017\203"' 1573 | 1574 | (line broken at end) 1575 | 1576 | 1577 | [I am not sure about the FUP2, comp.terminals?] 1578 | Sven 1579 | -- 1580 | [1] , tuned for critics 1581 | 1582 | 2003 updated URL: 1583 | 1584 | http://www.in-ulm.de/~mascheck/various/alternate_charset/ 1585 | 1586 | 1587 | ////////////////////////////////////////////////////////////////////////////// 1588 | 1589 | Newsgroups: comp.unix.solaris,comp.terminals,comp.windows.x.apps, 1590 | comp.unix.questions 1591 | Message-ID: <20010705163030_rshu@stratagy.com> 1592 | References: <3B4225C4.FB86F2EC@to.gd-es.com> <3b425acd@news.uni-ulm.de> 1593 | 1594 | <20010704190000_rshu@stratagy.com> 1595 | <3b437542@news.uni-ulm.de> 1596 | Organization: Stratagy Users Group 1597 | Expires: Wed, 15 Aug 2001 23:59:59 GMT 1598 | Date: Thu, 5 Jul 2001 16:30:30 GMT 1599 | From: "Richard S. Shuford" 1600 | Subject: Re: resetting xterm under Solaris 8 1601 | 1602 | Sven Mascheck wrote: 1603 | > 1604 | > BTW, about your control sequences: In XFree86/X11 xterm with 1605 | > TERM=xterm-xfree86/vt100, the last few characters are "left over" 1606 | > ("8J i"). Perhaps as there is a "nobreakspace" contained. 1607 | 1608 | 1609 | This is puzzling. The sequence "8J i" does not appear in my file. 1610 | 1611 | Here again is the uuencoded form: 1612 | 1613 | ----------------------------------------------------------- 1614 | begin 444 .cls 1615 | J&ULT:1M;/S1I&UL_,SAL&UP;*$(;*3 /&UL_-6P;6S!M&UMR&UM(&UM* 1616 | 1617 | end 1618 | ----------------------------------------------------------- 1619 | 1620 | When decoded and after the unprintables are rendered into printable 1621 | tokens, it looks like this: 1622 | 1623 | ^[[4i^[[?4i^[[?38l^[\^[(B^[)0^O^[[?5l^[[0m^[[r^[[H^[[J 1624 | 1625 | There is nothing in there that should be interpreted as a "nobreakspace", 1626 | if the ANSI X3.64 parsing rules are being properly followed. 1627 | Is it possible that your "uudecode" program is decoding improperly? 1628 | 1629 | The XFree86/X11 distribution contains the "xterm" variant maintained 1630 | by Thomas Dickey, and I certainly have tested my little hack with an 1631 | earlier version of that package. 1632 | 1633 | I note that several people have contributed suggestions on how to 1634 | reset xterm visual attributes using the "tput" command to extract 1635 | codes from the "terminfo" database. This is arguably the "proper" 1636 | way to do the job, but my cat-the-file hack does work even if the 1637 | terminal type is set wrong, and it also resets some obscure modes 1638 | of DEC-style terminals that may not be represented by codes in the 1639 | terminfo database. (There are yet some people in the world who are 1640 | using real VT420 character-cell terminals to connect to Solaris!) 1641 | 1642 | Other video-terminal information is archived at 1643 | 1644 | http://www.cs.utk.edu/~shuford/terminal_index.html (contains file you are now viewing) 1645 | 1646 | ...Richard S. Shuford 1647 | 1648 | ////////////////////////////////////////////////////////////////////////////// 1649 | 1650 | In most Solaris releases, the following trivial shell script is equivalent. 1651 | 1652 | #!/bin/sh 1653 | printf \ 1654 | "\033[4i\033[?4i\033[?38l\033\\033(B\033)0\017\033[?5l\033[0m\033[r\033[H\033[J" 1655 | 1656 | ////////////////////////////////////////////////////////////////////////////// 1657 | 1658 | Newsgroups: comp.unix.solaris 1659 | Organization: http://groups.google.com/ 1660 | Message-ID: <860c5108.0107021102.531938f1@posting.google.com> 1661 | References: <4f8fe677.0106282305.58233eb5@posting.google.com> 1662 | <9hllcp$sdh$1@news.okay.net> 1663 | NNTP-Posting-Date: 2 Jul 2001 19:02:57 GMT 1664 | Date: 2 Jul 2001 12:02:56 -0700 1665 | From: cvernon(at)enron.com (Clayton Vernon) 1666 | Subject: Re: xterm session crashes very often 1667 | 1668 | "Thomas Dehn" wrote in message news:<9hllcp$sdh$1@news.okay.net>... 1669 | > "Radhakrishnan" wrote: 1670 | > > We are using Hummingbird Excedd 1671 | > > as Xserver on NT4.0 to connect to 1672 | > > boxes across WAN. Very often, the Xserver crashes. Have anyone faced 1673 | > > this kind of problem? 1674 | > 1675 | > Use the current version of eXceed on the PC side. 1676 | > Make sure that fonts you are using are available 1677 | > to your Xserver. 1678 | > 1679 | > 1680 | > 1681 | > Thomas 1682 | 1683 | i use the hell out of exceed and i've never seen it "crash" per se. 1684 | 1685 | what i have seen are certain java applications map to the pc display 1686 | in a way appearing to "crash" the task bar (they co-opt the entire 1687 | display). and, i have seen in these java apps that they have 1688 | difficulty permitting keystrokes in the java-based x-window- on one of 1689 | my apps i run the java app 'nohup' in the background and completely 1690 | kill off the invoking cmdtool/xterm. but, if you kill off the java app 1691 | windows returns as normal. 1692 | 1693 | 1694 | ////////////////////////////////////////////////////////////////////////////// 1695 | 1696 | Newsgroups: comp.unix.admin,comp.unix.cde,comp.unix.solaris 1697 | Path: !uunet!dca.uu.net!newsfeed.fast.net!howland.erols.net 1698 | !news.maxwell.syr.edu!news.alt.net!usenet 1699 | Organization: NYPD: We don't need no stinkin' license plates! 1700 | Message-ID: <9i7aje$lgd$5@pita.alt.net> 1701 | References: 1702 | <9i43cl$ac6$1@news1.Radix.Net> 1703 | Fromage: cypher-@-punk.net goes to /dev/null 1704 | Date: 7 Jul 2001 15:41:34 GMT 1705 | From: cypher-@-punk.net 1706 | Subject: Re: Escape sequence for "clear" command 1707 | 1708 | In comp.unix.solaris Thomas Dickey wrote: 1709 | # In comp.unix.admin guess wrote: 1710 | # > Hello, 1711 | # 1712 | # > I'm using Solaris 8 (SPARC platform). Just started to use dtterm on 1713 | # > CDE(prevously was openwin). When I issue the "clear" command in front 1714 | # > of the Sun monitor (not using telnet), I want it to clear the 1715 | # > screen (cursor at the upper left hand corner, no problem with this). 1716 | # > 1717 | # > However I don't want it to clear the previous screen buffer, meaning 1718 | # > that I'm still able to scroll back to look at previous screen's data. 1719 | # > For those of u who have experience in openwin should know what I want 1720 | # > coz the "clear" command behaved this way under openwin. But it doesn't 1721 | # > work this way anymore under CDE (dtterm), it clears the previous screen 1722 | # > buffer as well. I can't scroll back to view the previous screen. 1723 | # 1724 | # I'd try the ANSI sequences for home, clear to end of display: 1725 | # 1726 | # \E[H\E[0J 1727 | # 1728 | # The XFree86 xterm supports ANSI color and VT220 emulation 1729 | # There's an faq at 1730 | # 1731 | # http://dickey.his.com/xterm/xterm.faq.html 1732 | # ftp://dickey.his.com/xterm 1733 | 1734 | And, not that anyone has asked... 1735 | 1736 | If you want an xterm to repaint the screen after using 'vi', 1737 | add these to /usr/share/lib/terminfo/x/xterm: 1738 | 1739 | tail -1 /usr/share/lib/terminfo/x/xterm.src 1740 | rmcup=\E[2J\E[?47l\E8, smcup=\E7\E[?47h, 1741 | 1742 | Use 'infocmp' to get source from the compiled 'xterm' entry, 1743 | use 'tic' to compile it again. 1744 | 1745 | ////////////////////////////////////////////////////////////////////////////// 1746 | 1747 | Date: 15 Jul 2001 11:18:48 +0200 1748 | Organization: united xpiloteers 1749 | Newsgroups: comp.unix.solaris 1750 | Message-ID: <3b515ff8@news.uni-ulm.de> 1751 | References: 1752 | <3B4F2D40.203CBDFA@kodak.com> 1753 | From: Sven Mascheck 1754 | Subject: Re: console login terminal color 1755 | 1756 | Mathew Kirsch wrote: 1757 | > Harry Putnam wrote: 1758 | 1759 | >> If I choose terminal login from the selector thing. I get a white 1760 | >> terminal with black foreground. 1761 | 1762 | > [...] Besides, a graphical console should be used for a GUI. 1763 | 1764 | $ xterm -xrm 'XTerm*font: gallant' \ 1765 | -xrm 'XTerm*background: white' \ 1766 | -xrm 'XTerm*foreground: black' \ 1767 | -xrm 'XTerm*cursorColor: black' \ 1768 | -xrm 'XTerm*scrollBar: False' \ 1769 | -xrm 'XTerm.VT100.geometry: 80x34+80+100' \ 1770 | -name long_live_the_console 1771 | 1772 | SvenCNR 1773 | 1774 | .............................................................................. 1775 | 1776 | 2003 update: 1777 | 1778 | Subsequently, Sven found that the font alias "gallant" works only 1779 | on SunOS 5.5 (Solaris 2.5). Instead, the font name "Gallant19" is 1780 | the right choice for the later releases. (And in fact it's 1781 | "-sun-gallant-demi-r-normal--19-190-72-72-m-120-iso8859-1"). 1782 | 1783 | ////////////////////////////////////////////////////////////////////////////// 1784 | 1785 | Newsgroups: comp.terminals 1786 | References: 1787 | Message-ID: <10vn3cvh4mio89b@corp.supernews.com> 1788 | Date: Sat, 29 Jan 2005 13:20:31 -0000 1789 | From: Thomas Dickey 1790 | Subject: Re: Hot-key to minimize Putty 1791 | 1792 | Barry wrote: 1793 | > 1794 | > Any tips for minimizing the current Putty window? 1795 | 1796 | It might respond to the window-modification escape sequences that xterm 1797 | implements. These are demonstrated by vttest... 1798 | 1799 | http://invisible-island.net/vttest/ 1800 | 1801 | under menu 11. 1802 | 1803 | (A quick read of the source code doesn't tell me yes/no to this question; 1804 | it does honor the title change). 1805 | 1806 | -- 1807 | Thomas E. Dickey 1808 | http://invisible-island.net/ 1809 | ftp://invisible-island.net/ 1810 | 1811 | ////////////////////////////////////////////////////////////////////////////// 1812 | 1813 | Newsgroups: comp.terminals 1814 | References: <20070507215136.GG3593@interface.famille.thibault.fr> 1815 | Message-ID: <1340luvjj2uf49d@corp.supernews.com> 1816 | Date: Tue, 08 May 2007 10:58:39 -0000 1817 | From: Thomas Dickey 1818 | Subject: Re: Getting the cursor coordinates? 1819 | 1820 | Samuel Thibault wrote: 1821 | > 1822 | > Hi, 1823 | > 1824 | > How standard is the CSI 6 n combination for getting the cursor position? 1825 | > Can we reasonnably expect usual virtual terminals (unix virtual 1826 | > consoles, xterms, ...) to always have it? 1827 | 1828 | 1829 | It doesn't work with Sun's console emulator. Can't test at the moment, 1830 | but since I don't see the data for *BSD consoles, the same limitation 1831 | may apply there as well. 1832 | 1833 | -- 1834 | Thomas E. Dickey 1835 | http://invisible-island.net/ 1836 | ftp://invisible-island.net/ 1837 | 1838 | 1839 | ////////////////////////////////////////////////////////////////////////////// 1840 | 1841 | -------------------------------------------------------------------------------- /gpl.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /info.rkt: -------------------------------------------------------------------------------- 1 | #lang setup/infotab 2 | (define pkg-name 'ansi) 3 | (define collection 'multi) 4 | (define deps 5 | '("base" 6 | "dynext-lib")) 7 | (define build-deps 8 | '()) 9 | -------------------------------------------------------------------------------- /lgpl.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /test-ansi-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonyg/racket-ansi/c14081de59bc7273f1f9088a51d6d9c202b2b9d0/test-ansi-output.png --------------------------------------------------------------------------------