Annotation of 43BSDReno/contrib/emacs-18.55/dist-1.3/fi/rlogin.el, revision 1.1

1.1     ! root        1: ;;
        !             2: ;; copyright (C) 1987, 1988 Franz Inc, Berkeley, Ca.
        !             3: ;;
        !             4: ;; The software, data and information contained herein are the property 
        !             5: ;; of Franz, Inc.  
        !             6: ;;
        !             7: ;; This file (or any derivation of it) may be distributed without 
        !             8: ;; further permission from Franz Inc. as long as:
        !             9: ;;
        !            10: ;;     * it is not part of a product for sale,
        !            11: ;;     * no charge is made for the distribution, other than a tape
        !            12: ;;       fee, and
        !            13: ;;     * all copyright notices and this notice are preserved.
        !            14: ;;
        !            15: ;; If you have any comments or questions on this interface, please feel
        !            16: ;; free to contact Franz Inc. at
        !            17: ;;     Franz Inc.
        !            18: ;;     Attn: Kevin Layer
        !            19: ;;     1995 University Ave
        !            20: ;;     Suite 275
        !            21: ;;     Berkeley, CA 94704
        !            22: ;;     (415) 548-3600
        !            23: ;; or
        !            24: ;;     emacs-info%[email protected]
        !            25: ;;     ucbvax!franz!emacs-info
        !            26: 
        !            27: ;; $Header: rlogin.el,v 1.11 88/11/03 17:10:29 layer Exp $
        !            28: 
        !            29: (defvar fi:rlogin-mode-map nil
        !            30:   "The rlogin major-mode keymap.")
        !            31: 
        !            32: (defvar fi:rlogin-mode-super-key-map nil
        !            33:   "Used for super-key processing in rlogin mode.")
        !            34: 
        !            35: (defvar fi:rlogin-image-name "rlogin"
        !            36:   "*Default remote-login image to invoke from (fi:rlogin).  If the value
        !            37: is a string then it names the image file or image path that
        !            38: `fi:common-lisp' invokes.  Otherwise, the value of this variable is given
        !            39: to funcall, the result of which should yield a string which is the image
        !            40: name or path.")
        !            41: 
        !            42: (defvar fi:rlogin-image-arguments nil
        !            43:   "*Default remote-login image arguments when invoked from (fi:rlogin).")
        !            44: 
        !            45: (defvar fi:rlogin-prompt-pattern
        !            46:   "^[-_.a-zA-Z0-9]*[#$%>] *"
        !            47:   "*Regexp used by Newline command in rlogin mode to match subshell prompts.
        !            48: Anything from beginning of line up to the end of what this pattern matches
        !            49: is deemed to be prompt, and is not re-executed.")
        !            50: 
        !            51: (defvar fi:rlogin-initial-input "stty -echo nl\n"
        !            52:   "*The initial input sent to the rlogin subprocess, after the first prompt
        !            53: is seen.")
        !            54: 
        !            55: (defun fi:rlogin-mode ()
        !            56:   "Major mode for interacting with an inferior rlogin."
        !            57:   (interactive)
        !            58:   (kill-all-local-variables)
        !            59:   (setq major-mode 'fi:rlogin-mode)
        !            60:   (setq mode-name "Rlogin")
        !            61: 
        !            62:   (if (null fi:rlogin-mode-super-key-map)
        !            63:       (let ((map (make-sparse-keymap)))
        !            64:        (setq map (fi::subprocess-mode-super-keys map 'rlogin))
        !            65:        (define-key map "\C-z"  'fi:rlogin-send-stop)
        !            66:        (define-key map "\C-c"  'fi:rlogin-send-interrupt)
        !            67:        (define-key map "\C-d"  'fi:rlogin-send-eof)
        !            68:        (define-key map "\C-\\" 'fi:rlogin-send-quit)
        !            69:        (setq fi:rlogin-mode-super-key-map map)))
        !            70: 
        !            71:   (if (null fi:rlogin-mode-map)
        !            72:       (setq fi:rlogin-mode-map
        !            73:        (fi::subprocess-mode-commands (make-sparse-keymap)
        !            74:                                      fi:rlogin-mode-super-key-map
        !            75:                                      'rlogin)))
        !            76:   (use-local-map fi:rlogin-mode-map)
        !            77:   (setq fi:subprocess-super-key-map fi:rlogin-mode-super-key-map)
        !            78:   (setq fi:shell-popd-regexp nil)
        !            79:   (setq fi:shell-pushd-regexp nil)
        !            80:   (setq fi:shell-cd-regexp nil)
        !            81:   (run-hooks 'fi:subprocess-mode-hook 'fi:rlogin-mode-hook))
        !            82: 
        !            83: (defun fi:rlogin (&optional buffer-number host)
        !            84:   "Start an rlogin in a buffer whose name is determined from the optional
        !            85: prefix argument BUFFER-NUMBER.  Shell buffer names start with `*HOSTNAME'
        !            86: and end with `*', with an optional `-N' in between.  If BUFFER-NUMBER is
        !            87: not given it defaults to 1.  If BUFFER-NUMBER is >= 0, then the buffer is
        !            88: named `*HOSTNAME-<BUFFER-NUMBER>*'.  If BUFFER-NUMBER is < 0, then the first
        !            89: available buffer name is chosen.
        !            90: 
        !            91: The host name is read from the minibuffer.
        !            92: 
        !            93: The image file and image arguments are taken from the variables
        !            94: `fi:rlogin-image-name' and `fi:rlogin-image-arguments'.
        !            95: 
        !            96: See fi:explicit-shell."
        !            97:   (interactive "p\nsRemote login to host: ")
        !            98:   (let ((proc
        !            99:         (fi::make-subprocess
        !           100:          buffer-number host 'fi:rlogin-mode
        !           101:          fi:rlogin-prompt-pattern
        !           102:          "env" 
        !           103:          (append (list "TERM=dumb" fi:rlogin-image-name host)
        !           104:                  fi:rlogin-image-arguments))))
        !           105:     (set-process-filter proc 'fi::rlogin-filter)
        !           106:     proc))
        !           107: 
        !           108: (defun fi:explicit-rlogin (&optional buffer-number host
        !           109:                                     image-name image-arguments)
        !           110:   "The same as fi:rlogin, except that the image and image arguments
        !           111: are read from the minibuffer."
        !           112:   (interactive
        !           113:    "p\nsRemote login to host: \nsImage name: \nxImage arguments (a list): ")
        !           114:   (let ((proc
        !           115:         (fi::make-subprocess
        !           116:          buffer-number host 'fi:rlogin-mode
        !           117:          fi:rlogin-prompt-pattern
        !           118:          "env" 
        !           119:          (append (list "TERM=dumb" image-name host) image-arguments))))
        !           120:     (set-process-filter proc 'fi::rlogin-filter)
        !           121:     proc))
        !           122: 
        !           123: (defun fi:rlogin-send-eof ()
        !           124:   "Send eof to process running through remote login subprocess buffer."
        !           125:   (interactive)
        !           126:   (send-string (get-buffer-process (current-buffer)) "\C-d"))
        !           127: 
        !           128: (defun fi:rlogin-send-interrupt ()
        !           129:   "Send interrupt to process running through remote login subprocess buffer."
        !           130:   (interactive)
        !           131:   (send-string (get-buffer-process (current-buffer)) "\C-c"))
        !           132: 
        !           133: (defun fi:rlogin-send-quit ()
        !           134:   "Send quit to process running through remote login subprocess buffer."
        !           135:   (interactive)
        !           136:   (send-string (get-buffer-process (current-buffer)) "\C-\\"))
        !           137: 
        !           138: (defun fi:rlogin-send-stop ()
        !           139:   "Send stop to process running through remote login subprocess buffer."
        !           140:   (interactive)
        !           141:   (send-string (get-buffer-process (current-buffer)) "\C-z"))
        !           142: 
        !           143: (defun fi::rlogin-filter (process output)
        !           144:   "Filter for `fi:rlogin' subprocess buffers.
        !           145: Watch for the first shell prompt from the remote login, then send the
        !           146: string bound to fi:rlogin-initial-input, and turn ourself off."
        !           147:   (let ((old-buffer (fi::subprocess-filter process output t)))
        !           148:     (if (save-excursion (beginning-of-line)
        !           149:                        (looking-at subprocess-prompt-pattern))
        !           150:        (progn
        !           151:          (set-process-filter process 'fi::subprocess-filter)
        !           152:          (fi::send-string-split process fi:rlogin-initial-input nil)))
        !           153:     (if old-buffer
        !           154:        (set-buffer old-buffer))))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.