]> code.delx.au - gnu-emacs/blobdiff - lisp/net/net-utils.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / net / net-utils.el
index 16f6164c9871fbbb106f08dc62161545ede8f178..910dd322b6f89a9ad6afaccdfebe03de7231b157 100644 (file)
@@ -46,8 +46,6 @@
 
 
 ;;; Code:
-(eval-when-compile
-  (require 'comint))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Customization Variables
@@ -111,6 +109,18 @@ These options can be used to limit how many ICMP packets are emitted."
   :group 'net-utils
   :type  '(repeat string))
 
+(defcustom iwconfig-program "iwconfig"
+  "Program to print wireless network configuration information."
+  :group 'net-utils
+  :type 'string
+  :version "23.1")
+
+(defcustom iwconfig-program-options nil
+ "Options for `iwconfig-program'."
+ :group 'net-utils
+ :type '(repeat string)
+ :version "23.1")
+
 (define-obsolete-variable-alias 'ipconfig-program-options
   'ifconfig-program-options "22.2")
 
@@ -230,30 +240,25 @@ This variable is only used if the variable
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (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)
-     (list "\\<\\(SOA\\|NS\\|MX\\|A\\|CNAME\\)\\>"
-          1 font-lock-keyword-face)
-     ;; Dotted quads
-     (list
-      (mapconcat 'identity
-                (make-list 4 "[0-9]+")
-                "\\.")
-      0 font-lock-variable-name-face)
-     ;; Host names
-     (list
-      (let ((host-expression "[-A-Za-z0-9]+"))
-       (concat
-        (mapconcat 'identity
-                   (make-list 2 host-expression)
-                   "\\.")
-        "\\(\\." host-expression "\\)*"))
-      0 font-lock-variable-name-face)))
+  (list
+   (list "^[A-Za-z0-9 _]+:" 0 'font-lock-type-face)
+   (list "\\<\\(SOA\\|NS\\|MX\\|A\\|CNAME\\)\\>"
+         1 'font-lock-keyword-face)
+   ;; Dotted quads
+   (list
+    (mapconcat 'identity
+               (make-list 4 "[0-9]+")
+               "\\.")
+    0 'font-lock-variable-name-face)
+   ;; Host names
+   (list
+    (let ((host-expression "[-A-Za-z0-9]+"))
+      (concat
+       (mapconcat 'identity
+                  (make-list 2 host-expression)
+                  "\\.")
+       "\\(\\." host-expression "\\)*"))
+    0 'font-lock-variable-name-face))
   "Expressions to font-lock for nslookup.")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -309,7 +314,7 @@ This variable is only used if the variable
 
 (defmacro net-utils-run-program (name header program &rest args)
   "Run a network information program."
-  ` (let ((buf (get-buffer-create (concat "*" ,name "*"))))
+  ` (let ((buf (get-buffer-create (concat "*" ,name "*")))) 
       (set-buffer buf)
       (erase-buffer)
       (insert ,header "\n")
@@ -368,6 +373,16 @@ If your system's ping continues until interrupted, you can try setting
 ;;;###autoload
 (defalias 'ipconfig 'ifconfig)
 
+;;;###autoload
+(defun iwconfig ()
+  "Run iwconfig program."
+  (interactive)
+  (net-utils-run-program
+   "Iwconfig"
+   (concat "** Iwconfig ** " iwconfig-program " ** ")
+   iwconfig-program
+   iwconfig-program-options))
+
 ;;;###autoload
 (defun netstat ()
   "Run netstat program."
@@ -429,10 +444,14 @@ If your system's ping continues until interrupted, you can try setting
 (defun nslookup ()
   "Run nslookup program."
   (interactive)
-  (require 'comint)
   (comint-run nslookup-program)
   (nslookup-mode))
 
+(defvar comint-prompt-regexp)
+(defvar comint-input-autoexpand)
+
+(autoload 'comint-mode "comint" nil t)
+
 ;; Using a derived mode gives us keymaps, hooks, etc.
 (define-derived-mode nslookup-mode comint-mode "Nslookup"
   "Major mode for interacting with the nslookup program."
@@ -462,17 +481,15 @@ If your system's ping continues until interrupted, you can try setting
      dns-lookup-program
      options)))
 
+(autoload 'ffap-string-at-point "ffap")
+
 ;;;###autoload
 (defun run-dig (host)
   "Run dig program."
   (interactive
    (list
-    (progn
-      (require 'ffap)
-      (read-from-minibuffer
-       "Lookup host: "
-       (with-no-warnings
-        (or (ffap-string-at-point 'machine) ""))))))
+    (read-from-minibuffer "Lookup host: "
+                          (or (ffap-string-at-point 'machine) ""))))
   (net-utils-run-program
    "Dig"
    (concat "** "
@@ -482,6 +499,8 @@ If your system's ping continues until interrupted, you can try setting
    dig-program
    (list host)))
 
+(autoload 'comint-exec "comint")
+
 ;; This is a lot less than ange-ftp, but much simpler.
 ;;;###autoload
 (defun ftp (host)
@@ -490,7 +509,6 @@ If your system's ping continues until interrupted, you can try setting
    (list
     (read-from-minibuffer
      "Ftp to Host: " (net-utils-machine-at-point))))
-  (require 'comint)
   (let ((buf (get-buffer-create (concat "*ftp [" host "]*"))))
     (set-buffer buf)
     (ftp-mode)
@@ -525,7 +543,6 @@ If your system's ping continues until interrupted, you can try setting
     (read-from-minibuffer
      "Connect to Host: " (net-utils-machine-at-point))
     (read-from-minibuffer "SMB Service: ")))
-  (require 'comint)
   (let* ((name (format "smbclient [%s\\%s]" host service))
         (buf (get-buffer-create (concat "*" name "*")))
         (service-name (concat "\\\\" host "\\" service)))
@@ -802,7 +819,6 @@ from SEARCH-STRING.  With argument, prompt for whois server."
 
 (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 "*"))))
@@ -815,6 +831,8 @@ from SEARCH-STRING.  With argument, prompt for whois server."
     (network-connection-mode-setup host service)
     (pop-to-buffer buf)))
 
+(defvar comint-input-ring)
+
 (defun network-connection-reconnect  ()
   "Reconnect a network connection, preserving the old input ring."
   (interactive)