Ignore:
Timestamp:
Aug 2, 2008, 10:01:31 PM (11 years ago)
Author:
gb
Message:

Try to be more careful when parsing the -K (terminal encoding) option;
only set *TERMINAL-CHARACTER-ENCODING-NAME* of the option's value
names a known encoding. Todo: provide some way of specifying
line termination, which might matter on Windows.

Once the option's parsed, call SET-TERMINAL-ENCODING; assume that
streams have been initialized much earlier in the startup process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/l1-application.lisp

    r9903 r10275  
    150150          (#_ _exit 0))
    151151        (let* ((encoding (assoc :terminal-encoding opts)))
    152           (if encoding
    153             (setq *terminal-character-encoding-name*
    154                   (if (cdr encoding)
     152          (when (cdr encoding)
     153            (let* ((encoding-name
    155154                    (let* ((*package* (find-package "KEYWORD")))
    156                       (ignore-errors (read-from-string (cdr encoding))))))))))
     155                      (ignore-errors (read-from-string (cdr encoding))))))
     156              (when encoding-name
     157                (let* ((character-encoding (lookup-character-encoding encoding-name)))
     158                  (when character-encoding
     159                    (setq *terminal-character-encoding-name*
     160                          (character-encoding-name character-encoding))))))))))
    157161    (%usage-exit
    158162     (format nil
     
    178182    (setq *unprocessed-command-line-arguments* rest-arg)
    179183    (process-application-arguments a error-flag options args)
    180     (initialize-interactive-streams)))
     184    (let* ((encoding (lookup-character-encoding *terminal-character-encoding-name*)))
     185      (when encoding
     186         (set-terminal-encoding (character-encoding-name encoding))))))
    181187
    182188(defmethod application-version-string ((a application))
Note: See TracChangeset for help on using the changeset viewer.