[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/net/net-utils.el
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/net/net-utils.el |
Date: |
Wed, 16 Jan 2002 19:31:50 -0500 |
Index: emacs/lisp/net/net-utils.el
diff -c emacs/lisp/net/net-utils.el:1.12 emacs/lisp/net/net-utils.el:1.13
*** emacs/lisp/net/net-utils.el:1.12 Tue Dec 25 05:43:25 2001
--- emacs/lisp/net/net-utils.el Sun Jan 6 10:08:58 2002
***************
*** 4,11 ****
;; Author: Peter Breton <address@hidden>
;; Created: Sun Mar 16 1997
! ;; Keywords: network communications
! ;; Time-stamp: <2001-12-25 11:44:47 pavel>
;; This file is part of GNU Emacs.
--- 4,10 ----
;; Author: Peter Breton <address@hidden>
;; Created: Sun Mar 16 1997
! ;; Keywords: network comm
;; This file is part of GNU Emacs.
***************
*** 25,30 ****
--- 24,30 ----
;; Boston, MA 02111-1307, USA.
;;; Commentary:
+
;;
;; There are three main areas of functionality:
;;
***************
*** 56,70 ****
"Network utility functions."
:prefix "net-utils-"
:group 'comm
! :version "20.3"
! )
(defcustom net-utils-remove-ctl-m
(member system-type (list 'windows-nt 'msdos))
"If non-nil, remove control-Ms from output."
:group 'net-utils
! :type 'boolean
! )
(defcustom traceroute-program
(if (eq system-type 'windows-nt)
--- 56,68 ----
"Network utility functions."
:prefix "net-utils-"
:group 'comm
! :version "20.3")
(defcustom net-utils-remove-ctl-m
(member system-type (list 'windows-nt 'msdos))
"If non-nil, remove control-Ms from output."
:group 'net-utils
! :type 'boolean)
(defcustom traceroute-program
(if (eq system-type 'windows-nt)
***************
*** 72,93 ****
"traceroute")
"Program to trace network hops to a destination."
:group 'net-utils
! :type 'string
! )
(defcustom traceroute-program-options nil
"Options for the traceroute program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom ping-program "ping"
"Program to send network test packets to a host."
:group 'net-utils
! :type 'string
! )
! ;; On Linux and Irix, the system's ping program seems to send packets
;; indefinitely unless told otherwise
(defcustom ping-program-options
(and (memq system-type (list 'linux 'gnu/linux 'irix))
--- 70,88 ----
"traceroute")
"Program to trace network hops to a destination."
:group 'net-utils
! :type 'string)
(defcustom traceroute-program-options nil
"Options for the traceroute program."
:group 'net-utils
! :type '(repeat string))
(defcustom ping-program "ping"
"Program to send network test packets to a host."
:group 'net-utils
! :type 'string)
! ;; On GNU/Linux and Irix, the system's ping program seems to send packets
;; indefinitely unless told otherwise
(defcustom ping-program-options
(and (memq system-type (list 'linux 'gnu/linux 'irix))
***************
*** 95,102 ****
"Options for the ping program.
These options can be used to limit how many ICMP packets are emitted."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom ipconfig-program
(if (eq system-type 'windows-nt)
--- 90,96 ----
"Options for the ping program.
These options can be used to limit how many ICMP packets are emitted."
:group 'net-utils
! :type '(repeat string))
(defcustom ipconfig-program
(if (eq system-type 'windows-nt)
***************
*** 104,146 ****
"ifconfig")
"Program to print network configuration information."
:group 'net-utils
! :type 'string
! )
(defcustom ipconfig-program-options
! (list
! (if (eq system-type 'windows-nt)
! "/all" "-a"))
"Options for ipconfig-program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom netstat-program "netstat"
"Program to print network statistics."
:group 'net-utils
! :type 'string
! )
(defcustom netstat-program-options
(list "-a")
"Options for netstat-program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom arp-program "arp"
"Program to print IP to address translation tables."
:group 'net-utils
! :type 'string
! )
(defcustom arp-program-options
(list "-a")
"Options for arp-program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom route-program
(if (eq system-type 'windows-nt)
--- 98,134 ----
"ifconfig")
"Program to print network configuration information."
:group 'net-utils
! :type 'string)
(defcustom ipconfig-program-options
! (list
! (if (eq system-type 'windows-nt)
! "/all" "-a"))
"Options for ipconfig-program."
:group 'net-utils
! :type '(repeat string))
(defcustom netstat-program "netstat"
"Program to print network statistics."
:group 'net-utils
! :type 'string)
(defcustom netstat-program-options
(list "-a")
"Options for netstat-program."
:group 'net-utils
! :type '(repeat string))
(defcustom arp-program "arp"
"Program to print IP to address translation tables."
:group 'net-utils
! :type 'string)
(defcustom arp-program-options
(list "-a")
"Options for arp-program."
:group 'net-utils
! :type '(repeat string))
(defcustom route-program
(if (eq system-type 'windows-nt)
***************
*** 148,155 ****
"netstat")
"Program to print routing tables."
:group 'net-utils
! :type 'string
! )
(defcustom route-program-options
(if (eq system-type 'windows-nt)
--- 136,142 ----
"netstat")
"Program to print routing tables."
:group 'net-utils
! :type 'string)
(defcustom route-program-options
(if (eq system-type 'windows-nt)
***************
*** 157,176 ****
(list "-r"))
"Options for route-program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom nslookup-program "nslookup"
"Program to interactively query DNS information."
:group 'net-utils
! :type 'string
! )
(defcustom nslookup-program-options nil
"List of options to pass to the nslookup program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom nslookup-prompt-regexp "^> "
"Regexp to match the nslookup prompt.
--- 144,160 ----
(list "-r"))
"Options for route-program."
:group 'net-utils
! :type '(repeat string))
(defcustom nslookup-program "nslookup"
"Program to interactively query DNS information."
:group 'net-utils
! :type 'string)
(defcustom nslookup-program-options nil
"List of options to pass to the nslookup program."
:group 'net-utils
! :type '(repeat string))
(defcustom nslookup-prompt-regexp "^> "
"Regexp to match the nslookup prompt.
***************
*** 178,203 ****
This variable is only used if the variable
`comint-use-prompt-regexp-instead-of-fields' is non-nil."
:group 'net-utils
! :type 'regexp
! )
(defcustom dig-program "dig"
"Program to query DNS information."
:group 'net-utils
! :type 'string
! )
(defcustom ftp-program "ftp"
"Progam to run to do FTP transfers."
:group 'net-utils
! :type 'string
! )
(defcustom ftp-program-options nil
"List of options to pass to the FTP program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom ftp-prompt-regexp "^ftp>"
"Regexp which matches the FTP program's prompt.
--- 162,183 ----
This variable is only used if the variable
`comint-use-prompt-regexp-instead-of-fields' is non-nil."
:group 'net-utils
! :type 'regexp)
(defcustom dig-program "dig"
"Program to query DNS information."
:group 'net-utils
! :type 'string)
(defcustom ftp-program "ftp"
"Progam to run to do FTP transfers."
:group 'net-utils
! :type 'string)
(defcustom ftp-program-options nil
"List of options to pass to the FTP program."
:group 'net-utils
! :type '(repeat string))
(defcustom ftp-prompt-regexp "^ftp>"
"Regexp which matches the FTP program's prompt.
***************
*** 205,224 ****
This variable is only used if the variable
`comint-use-prompt-regexp-instead-of-fields' is non-nil."
:group 'net-utils
! :type 'regexp
! )
(defcustom smbclient-program "smbclient"
"Smbclient program."
:group 'net-utils
! :type 'string
! )
(defcustom smbclient-program-options nil
"List of options to pass to the smbclient program."
:group 'net-utils
! :type '(repeat string)
! )
(defcustom smbclient-prompt-regexp "^smb: \>"
"Regexp which matches the smbclient program's prompt.
--- 185,201 ----
This variable is only used if the variable
`comint-use-prompt-regexp-instead-of-fields' is non-nil."
:group 'net-utils
! :type 'regexp)
(defcustom smbclient-program "smbclient"
"Smbclient program."
:group 'net-utils
! :type 'string)
(defcustom smbclient-program-options nil
"List of options to pass to the smbclient program."
:group 'net-utils
! :type '(repeat string))
(defcustom smbclient-prompt-regexp "^smb: \>"
"Regexp which matches the smbclient program's prompt.
***************
*** 226,233 ****
This variable is only used if the variable
`comint-use-prompt-regexp-instead-of-fields' is non-nil."
:group 'net-utils
! :type 'regexp
! )
;; Internal variables
(defvar network-connection-service nil)
--- 203,209 ----
This variable is only used if the variable
`comint-use-prompt-regexp-instead-of-fields' is non-nil."
:group 'net-utils
! :type 'regexp)
;; Internal variables
(defvar network-connection-service nil)
***************
*** 239,244 ****
--- 215,223 ----
(defconst nslookup-font-lock-keywords
(progn
+ (defvar font-lock-type-face)
+ (defvar font-lock-keyword-face)
+ (defvar font-lock-variable-name-face)
(require 'font-lock)
(list
(list "^[A-Za-z0-9 _]+:" 0 font-lock-type-face)
***************
*** 257,266 ****
(mapconcat 'identity
(make-list 2 host-expression)
"\\.")
! "\\(\\." host-expression "\\)*")
! )
! 0 font-lock-variable-name-face)
! ))
"Expressions to font-lock for nslookup.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- 236,243 ----
(mapconcat 'identity
(make-list 2 host-expression)
"\\.")
! "\\(\\." host-expression "\\)*"))
! 0 font-lock-variable-name-face)))
"Expressions to font-lock for nslookup.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
***************
*** 342,349 ****
(concat "Traceroute" " " target)
(concat "** Traceroute ** " traceroute-program " ** " target)
traceroute-program
! options
! )))
;;;###autoload
(defun ping (host)
--- 319,325 ----
(concat "Traceroute" " " target)
(concat "** Traceroute ** " traceroute-program " ** " target)
traceroute-program
! options)))
;;;###autoload
(defun ping (host)
***************
*** 360,367 ****
(concat "Ping" " " host)
(concat "** Ping ** " ping-program " ** " host)
ping-program
! options
! )))
;;;###autoload
(defun ipconfig ()
--- 336,342 ----
(concat "Ping" " " host)
(concat "** Ping ** " ping-program " ** " host)
ping-program
! options)))
;;;###autoload
(defun ipconfig ()
***************
*** 371,378 ****
"Ipconfig"
(concat "** Ipconfig ** " ipconfig-program " ** ")
ipconfig-program
! ipconfig-program-options
! ))
;; This is the normal name on most Unixes.
;;;###autoload
--- 346,352 ----
"Ipconfig"
(concat "** Ipconfig ** " ipconfig-program " ** ")
ipconfig-program
! ipconfig-program-options))
;; This is the normal name on most Unixes.
;;;###autoload
***************
*** 386,393 ****
"Netstat"
(concat "** Netstat ** " netstat-program " ** ")
netstat-program
! netstat-program-options
! ))
;;;###autoload
(defun arp ()
--- 360,366 ----
"Netstat"
(concat "** Netstat ** " netstat-program " ** ")
netstat-program
! netstat-program-options))
;;;###autoload
(defun arp ()
***************
*** 397,404 ****
"Arp"
(concat "** Arp ** " arp-program " ** ")
arp-program
! arp-program-options
! ))
;;;###autoload
(defun route ()
--- 370,376 ----
"Arp"
(concat "** Arp ** " arp-program " ** ")
arp-program
! arp-program-options))
;;;###autoload
(defun route ()
***************
*** 408,415 ****
"Route"
(concat "** Route ** " route-program " ** ")
route-program
! route-program-options
! ))
;; FIXME -- Needs to be a process filter
;; (defun netstat-with-filter (filter)
--- 380,386 ----
"Route"
(concat "** Route ** " route-program " ** ")
route-program
! route-program-options))
;; FIXME -- Needs to be a process filter
;; (defun netstat-with-filter (filter)
***************
*** 418,425 ****
;; (netstat)
;; (set-buffer (get-buffer "*Netstat*"))
;; (goto-char (point-min))
! ;; (delete-matching-lines filter)
! ;; )
;;;###autoload
(defun nslookup-host (host)
--- 389,395 ----
;; (netstat)
;; (set-buffer (get-buffer "*Netstat*"))
;; (goto-char (point-min))
! ;; (delete-matching-lines filter))
;;;###autoload
(defun nslookup-host (host)
***************
*** 437,445 ****
(list "Nslookup" host nslookup-program)
" ** "))
nslookup-program
! options
! )))
!
;;;###autoload
(defun nslookup ()
--- 407,413 ----
(list "Nslookup" host nslookup-program)
" ** "))
nslookup-program
! options)))
;;;###autoload
(defun nslookup ()
***************
*** 447,454 ****
(interactive)
(require 'comint)
(comint-run nslookup-program)
! (nslookup-mode)
! )
;; Using a derived mode gives us keymaps, hooks, etc.
(define-derived-mode nslookup-mode comint-mode "Nslookup"
--- 415,421 ----
(interactive)
(require 'comint)
(comint-run nslookup-program)
! (nslookup-mode))
;; Using a derived mode gives us keymaps, hooks, etc.
(define-derived-mode nslookup-mode comint-mode "Nslookup"
***************
*** 457,464 ****
(make-local-variable 'font-lock-defaults)
'((nslookup-font-lock-keywords)))
(setq comint-prompt-regexp nslookup-prompt-regexp)
! (setq comint-input-autoexpand t)
! )
(define-key nslookup-mode-map "\t" 'comint-dynamic-complete)
--- 424,430 ----
(make-local-variable 'font-lock-defaults)
'((nslookup-font-lock-keywords)))
(setq comint-prompt-regexp nslookup-prompt-regexp)
! (setq comint-input-autoexpand t))
(define-key nslookup-mode-map "\t" 'comint-dynamic-complete)
***************
*** 479,486 ****
(list "Dig" host dig-program)
" ** "))
dig-program
! (list host)
! ))
;; This is a lot less than ange-ftp, but much simpler.
;;;###autoload
--- 445,451 ----
(list "Dig" host dig-program)
" ** "))
dig-program
! (list host)))
;; This is a lot less than ange-ftp, but much simpler.
;;;###autoload
***************
*** 513,520 ****
(unless (memq 'comint-watch-for-password-prompt
(default-value 'comint-output-filter-functions))
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt
! nil t))
! )
;; Occasionally useful
(define-key ftp-mode-map "\t" 'comint-dynamic-complete)
--- 478,484 ----
(unless (memq 'comint-watch-for-password-prompt
(default-value 'comint-output-filter-functions))
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt
! nil t)))
;; Occasionally useful
(define-key ftp-mode-map "\t" 'comint-dynamic-complete)
***************
*** 543,550 ****
(interactive
(list
(read-from-minibuffer
! "Connect to Host: " (net-utils-machine-at-point))
! ))
(let ((buf (get-buffer-create (format "*SMB Shares on %s*" host))))
(set-buffer buf)
(smbclient-mode)
--- 507,513 ----
(interactive
(list
(read-from-minibuffer
! "Connect to Host: " (net-utils-machine-at-point))))
(let ((buf (get-buffer-create (format "*SMB Shares on %s*" host))))
(set-buffer buf)
(smbclient-mode)
***************
*** 565,572 ****
(unless (memq 'comint-watch-for-password-prompt
(default-value 'comint-output-filter-functions))
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt
! nil t))
! )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--- 528,534 ----
(unless (memq 'comint-watch-for-password-prompt
(default-value 'comint-output-filter-functions))
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt
! nil t)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
***************
*** 598,605 ****
(cons 'netbios-data 139)
(cons 'irc 194)
(cons 'https 443)
! (cons 'rlogin 513)
! )
"Alist of services and associated TCP port numbers.
This list is not complete.")
--- 560,566 ----
(cons 'netbios-data 139)
(cons 'irc 194)
(cons 'https 443)
! (cons 'rlogin 513))
"Alist of services and associated TCP port numbers.
This list is not complete.")
***************
*** 607,614 ****
(defmacro run-network-program (process-name host port
&optional initial-string)
`(let ((tcp-connection)
! (buf)
! )
(setq buf (get-buffer-create (concat "*" ,process-name "*")))
(set-buffer buf)
(or
--- 568,574 ----
(defmacro run-network-program (process-name host port
&optional initial-string)
`(let ((tcp-connection)
! (buf))
(setq buf (get-buffer-create (concat "*" ,process-name "*")))
(set-buffer buf)
(or
***************
*** 617,624 ****
,process-name
buf
,host
! ,port
! ))
(error "Could not open connection to %s" ,host))
(erase-buffer)
(set-marker (process-mark tcp-connection) (point-min))
--- 577,583 ----
,process-name
buf
,host
! ,port))
(error "Could not open connection to %s" ,host))
(erase-buffer)
(set-marker (process-mark tcp-connection) (point-min))
***************
*** 676,683 ****
(defcustom whois-server-name "rs.internic.net"
"Default host name for the whois service."
:group 'net-utils
! :type 'string
! )
(defcustom whois-server-list
'(("whois.arin.net") ; Networks, ASN's, and related POC's (numbers)
--- 635,641 ----
(defcustom whois-server-name "rs.internic.net"
"Default host name for the whois service."
:group 'net-utils
! :type 'string)
(defcustom whois-server-list
'(("whois.arin.net") ; Networks, ASN's, and related POC's (numbers)
***************
*** 752,765 ****
"Whois"
host
(cdr (assoc 'whois network-connection-service-alist))
! search-string
! )))
(defcustom whois-reverse-lookup-server "whois.arin.net"
"Server which provides inverse DNS mapping."
:group 'net-utils
! :type 'string
! )
;;;###autoload
(defun whois-reverse-lookup ()
--- 710,721 ----
"Whois"
host
(cdr (assoc 'whois network-connection-service-alist))
! search-string)))
(defcustom whois-reverse-lookup-server "whois.arin.net"
"Server which provides inverse DNS mapping."
:group 'net-utils
! :type 'string)
;;;###autoload
(defun whois-reverse-lookup ()
***************
*** 774,781 ****
;; Using a derived mode gives us keymaps, hooks, etc.
(define-derived-mode
network-connection-mode comint-mode "Network-Connection"
! "Major mode for interacting with the network-connection program."
! )
(defun network-connection-mode-setup (host service)
(make-local-variable 'network-connection-host)
--- 730,736 ----
;; Using a derived mode gives us keymaps, hooks, etc.
(define-derived-mode
network-connection-mode comint-mode "Network-Connection"
! "Major mode for interacting with the network-connection program.")
(defun network-connection-mode-setup (host service)
(make-local-variable 'network-connection-host)
***************
*** 797,804 ****
network-connection-service-alist))))
(network-connection
host
! (cdr (assoc (intern service) network-connection-service-alist)))
! )
;;;###autoload
(defun network-connection (host port)
--- 752,758 ----
network-connection-service-alist))))
(network-connection
host
! (cdr (assoc (intern service) network-connection-service-alist))))
;;;###autoload
(defun network-connection (host port)
***************
*** 809,819 ****
(defun network-service-connection (host service)
"Open a network connection to SERVICE on HOST."
(require 'comint)
! (let* (
! (process-name (concat "Network Connection [" host " " service "]"))
! (portnum (string-to-number service))
! (buf (get-buffer-create (concat "*" process-name "*")))
! )
(or (zerop portnum) (setq service portnum))
(make-comint
process-name
--- 763,771 ----
(defun network-service-connection (host service)
"Open a network connection to SERVICE on HOST."
(require 'comint)
! (let* ((process-name (concat "Network Connection [" host " " service "]"))
! (portnum (string-to-number service))
! (buf (get-buffer-create (concat "*" process-name "*"))))
(or (zerop portnum) (setq service portnum))
(make-comint
process-name
***************
*** 821,828 ****
(set-buffer buf)
(network-connection-mode)
(network-connection-mode-setup host service)
! (pop-to-buffer buf)
! ))
(defun network-connection-reconnect ()
"Reconnect a network connection, preserving the old input ring."
--- 773,779 ----
(set-buffer buf)
(network-connection-mode)
(network-connection-mode-setup host service)
! (pop-to-buffer buf)))
(defun network-connection-reconnect ()
"Reconnect a network connection, preserving the old input ring."
***************
*** 830,849 ****
(let ((proc (get-buffer-process (current-buffer)))
(old-comint-input-ring comint-input-ring)
(host network-connection-host)
! (service network-connection-service)
! )
(if (not (or (not proc)
(eq (process-status proc) 'closed)))
(message "Still connected")
(goto-char (point-max))
(insert (format "Reopening connection to %s\n" host))
(network-connection host
! (if (numberp service)
! service
! (cdr (assoc service network-connection-service-alist))))
(and old-comint-input-ring
! (setq comint-input-ring old-comint-input-ring))
! )))
(provide 'net-utils)
--- 781,798 ----
(let ((proc (get-buffer-process (current-buffer)))
(old-comint-input-ring comint-input-ring)
(host network-connection-host)
! (service network-connection-service))
(if (not (or (not proc)
(eq (process-status proc) 'closed)))
(message "Still connected")
(goto-char (point-max))
(insert (format "Reopening connection to %s\n" host))
(network-connection host
! (if (numberp service)
! service
! (cdr (assoc service
network-connection-service-alist))))
(and old-comint-input-ring
! (setq comint-input-ring old-comint-input-ring)))))
(provide 'net-utils)