Changeset 33086 in project


Ignore:
Timestamp:
01/14/16 16:02:34 (4 years ago)
Author:
Alex Shinn
Message:

stty should ignore non-terminal inputs.
Fixes ticket #1254.

Location:
release/4/stty
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/stty/tags/0.2.6/stty.scm

    r31133 r33086  
    11;;;; stty.scm -- stty-like interface to termios
    22;;
    3 ;; Copyright (c) 2007-2009 Alex Shinn.  All rights reserved.
     3;; Copyright (c) 2007-2016 Alex Shinn.  All rights reserved.
    44;; BSD-style license: http://synthcode.com/license.txt
    55
     
    371371(define (stty . args)
    372372
    373   (let* ((port (if (and (pair? args) (port? (car args)))
    374                    (car args)
    375                    (current-input-port)))
    376          (attr (get-terminal-attributes port))
    377          (iflag (term-attrs-iflag attr))
    378          (oflag (term-attrs-oflag attr))
    379          (cflag (term-attrs-cflag attr))
    380          (lflag (term-attrs-lflag attr)))
     373  (and-let* ((port (if (and (pair? args) (port? (car args)))
     374                       (car args)
     375                       (current-input-port)))
     376             (attr (get-terminal-attributes port))
     377             (iflag (term-attrs-iflag attr))
     378             (oflag (term-attrs-oflag attr))
     379             (cflag (term-attrs-cflag attr))
     380             (lflag (term-attrs-lflag attr)))
    381381
    382382    ;; parse change requests
     
    439439  (let* ((port (current-input-port))
    440440         (orig-attrs (get-terminal-attributes port)))
    441     (dynamic-wind
    442         (lambda ()
    443           (stty setting))
    444         thunk
    445         (lambda ()
    446           (set-terminal-attributes! port TCSANOW orig-attrs)
    447           (free-term-attrs orig-attrs)))))
     441    (if orig-attrs
     442        (dynamic-wind
     443          (lambda ()
     444            (stty setting))
     445          thunk
     446          (lambda ()
     447            (set-terminal-attributes! port TCSANOW orig-attrs)
     448            (free-term-attrs orig-attrs)))
     449        (thunk))))
    448450
    449451)
  • release/4/stty/tags/0.2.6/stty.setup

    r31133 r33086  
    55(install-extension 'stty
    66  '("stty.so" "stty.import.so")
    7   '((version "0.2.5")))
     7  '((version "0.2.6")))
  • release/4/stty/trunk/stty.scm

    r31133 r33086  
    11;;;; stty.scm -- stty-like interface to termios
    22;;
    3 ;; Copyright (c) 2007-2009 Alex Shinn.  All rights reserved.
     3;; Copyright (c) 2007-2016 Alex Shinn.  All rights reserved.
    44;; BSD-style license: http://synthcode.com/license.txt
    55
     
    371371(define (stty . args)
    372372
    373   (let* ((port (if (and (pair? args) (port? (car args)))
    374                    (car args)
    375                    (current-input-port)))
    376          (attr (get-terminal-attributes port))
    377          (iflag (term-attrs-iflag attr))
    378          (oflag (term-attrs-oflag attr))
    379          (cflag (term-attrs-cflag attr))
    380          (lflag (term-attrs-lflag attr)))
     373  (and-let* ((port (if (and (pair? args) (port? (car args)))
     374                       (car args)
     375                       (current-input-port)))
     376             (attr (get-terminal-attributes port))
     377             (iflag (term-attrs-iflag attr))
     378             (oflag (term-attrs-oflag attr))
     379             (cflag (term-attrs-cflag attr))
     380             (lflag (term-attrs-lflag attr)))
    381381
    382382    ;; parse change requests
     
    439439  (let* ((port (current-input-port))
    440440         (orig-attrs (get-terminal-attributes port)))
    441     (dynamic-wind
    442         (lambda ()
    443           (stty setting))
    444         thunk
    445         (lambda ()
    446           (set-terminal-attributes! port TCSANOW orig-attrs)
    447           (free-term-attrs orig-attrs)))))
     441    (if orig-attrs
     442        (dynamic-wind
     443          (lambda ()
     444            (stty setting))
     445          thunk
     446          (lambda ()
     447            (set-terminal-attributes! port TCSANOW orig-attrs)
     448            (free-term-attrs orig-attrs)))
     449        (thunk))))
    448450
    449451)
  • release/4/stty/trunk/stty.setup

    r31133 r33086  
    55(install-extension 'stty
    66  '("stty.so" "stty.import.so")
    7   '((version "0.2.5")))
     7  '((version "0.2.6")))
Note: See TracChangeset for help on using the changeset viewer.