annotate lisp/net/net-utils.el @ 106139:92448fe233b3

(calc-embedded-mode-vars): Rename `calc-complement-signed-mode' to `calc-twos-complement-mode'.
author Jay Belanger <jay.p.belanger@gmail.com>
date Fri, 20 Nov 2009 00:56:59 +0000
parents f8ba8d6fd250
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36225
diff changeset
1 ;;; net-utils.el --- network functions
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
104770
603c369f665b (nslookup): Use make-comint rather than comint-run.
Glenn Morris <rgm@gnu.org>
parents: 104206
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
603c369f665b (nslookup): Use make-comint rather than comint-run.
Glenn Morris <rgm@gnu.org>
parents: 104206
diff changeset
4 ;; 2007, 2008, 2009 Free Software Foundation, Inc.
36225
2a73e688d635 Update copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents: 32197
diff changeset
5
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Author: Peter Breton <pbreton@cs.umb.edu>
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; Created: Sun Mar 16 1997
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
8 ;; Keywords: network comm
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94025
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94025
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94025
diff changeset
15 ;; (at your option) any later version.
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94025
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
26
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 ;; There are three main areas of functionality:
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
29 ;;
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 ;; * Wrap common network utility programs (ping, traceroute, netstat,
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 ;; nslookup, arp, route). Note that these wrappers are of the diagnostic
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 ;; functions of these programs only.
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
33 ;;
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 ;; * Implement some very basic protocols in Emacs Lisp (finger and whois)
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
35 ;;
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 ;; * Support connections to HOST/PORT, generally for debugging and the like.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 ;; In other words, for doing much the same thing as "telnet HOST PORT", and
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 ;; then typing commands.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 ;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 ;; PATHS
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 ;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 ;; On some systems, some of these programs are not in normal user path,
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
43 ;; but rather in /sbin, /usr/sbin, and so on.
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 ;;; Code:
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 ;; Customization Variables
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (defgroup net-utils nil
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 "Network utility functions."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 :prefix "net-utils-"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 :group 'comm
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
56 :version "20.3")
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
58 (defcustom net-utils-remove-ctl-m
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (member system-type (list 'windows-nt 'msdos))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 "If non-nil, remove control-Ms from output."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
62 :type 'boolean)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
64 (defcustom traceroute-program
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
65 (if (eq system-type 'windows-nt)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 "tracert"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 "traceroute")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 "Program to trace network hops to a destination."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
70 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (defcustom traceroute-program-options nil
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 "Options for the traceroute program."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
75 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (defcustom ping-program "ping"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 "Program to send network test packets to a host."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
80 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
82 ;; On GNU/Linux and Irix, the system's ping program seems to send packets
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 ;; indefinitely unless told otherwise
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
84 (defcustom ping-program-options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (and (memq system-type (list 'linux 'gnu/linux 'irix))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (list "-c" "4"))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 "Options for the ping program.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 These options can be used to limit how many ICMP packets are emitted."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
90 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91
94025
a8f8b0947a08 Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
92 (define-obsolete-variable-alias 'ipconfig-program 'ifconfig-program "22.2")
a8f8b0947a08 Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
93
80077
535ef1cccea5 (ifconfig): Renamed from ipconfig.
Richard M. Stallman <rms@gnu.org>
parents: 79714
diff changeset
94 (defcustom ifconfig-program
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (if (eq system-type 'windows-nt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 "ipconfig"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 "ifconfig")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 "Program to print network configuration information."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
100 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101
80077
535ef1cccea5 (ifconfig): Renamed from ipconfig.
Richard M. Stallman <rms@gnu.org>
parents: 79714
diff changeset
102 (defcustom ifconfig-program-options
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
103 (list
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
104 (if (eq system-type 'windows-nt)
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
105 "/all" "-a"))
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
106 "Options for the ifconfig program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
108 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109
92133
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
110 (defcustom iwconfig-program "iwconfig"
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
111 "Program to print wireless network configuration information."
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
112 :group 'net-utils
92134
ce1187e14779 (iwconfig-program, iwconfig-program-options): Add :version.
Glenn Morris <rgm@gnu.org>
parents: 92133
diff changeset
113 :type 'string
ce1187e14779 (iwconfig-program, iwconfig-program-options): Add :version.
Glenn Morris <rgm@gnu.org>
parents: 92133
diff changeset
114 :version "23.1")
92133
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
115
94025
a8f8b0947a08 Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
116 (define-obsolete-variable-alias 'ipconfig-program-options
a8f8b0947a08 Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
117 'ifconfig-program-options "22.2")
a8f8b0947a08 Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
118
92133
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
119 (defcustom iwconfig-program-options nil
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
120 "Options for the iwconfig program."
92133
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
121 :group 'net-utils
92134
ce1187e14779 (iwconfig-program, iwconfig-program-options): Add :version.
Glenn Morris <rgm@gnu.org>
parents: 92133
diff changeset
122 :type '(repeat string)
ce1187e14779 (iwconfig-program, iwconfig-program-options): Add :version.
Glenn Morris <rgm@gnu.org>
parents: 92133
diff changeset
123 :version "23.1")
92133
7c818ca7aedb Yoni Rabkin <yoni at rabkins.net> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 79714
diff changeset
124
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
125 (defcustom netstat-program "netstat"
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 "Program to print network statistics."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
128 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
130 (defcustom netstat-program-options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (list "-a")
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
132 "Options for the netstat program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
134 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
136 (defcustom arp-program "arp"
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 "Program to print IP to address translation tables."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
139 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
141 (defcustom arp-program-options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 (list "-a")
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
143 "Options for the arp program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
145 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
147 (defcustom route-program
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 (if (eq system-type 'windows-nt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 "route"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 "netstat")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 "Program to print routing tables."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
153 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
155 (defcustom route-program-options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 (if (eq system-type 'windows-nt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 (list "print")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (list "-r"))
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
159 "Options for the route program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
161 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
163 (defcustom nslookup-program "nslookup"
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 "Program to interactively query DNS information."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
166 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
168 (defcustom nslookup-program-options nil
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
169 "Options for the nslookup program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
171 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 (defcustom nslookup-prompt-regexp "^> "
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
174 "Regexp to match the nslookup prompt.
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
175
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
176 This variable is only used if the variable
61875
cff214e628c2 (nslookup-prompt-regexp, ftp-prompt-regexp, smbclient-prompt-regexp):
Luc Teirlinck <teirllm@auburn.edu>
parents: 57161
diff changeset
177 `comint-use-prompt-regexp' is non-nil."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
179 :type 'regexp)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
181 (defcustom dig-program "dig"
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 "Program to query DNS information."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
184 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (defcustom ftp-program "ftp"
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
187 "Program to run to do FTP transfers."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
189 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (defcustom ftp-program-options nil
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
192 "Options for the ftp program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
194 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196 (defcustom ftp-prompt-regexp "^ftp>"
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
197 "Regexp which matches the FTP program's prompt.
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
198
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
199 This variable is only used if the variable
61875
cff214e628c2 (nslookup-prompt-regexp, ftp-prompt-regexp, smbclient-prompt-regexp):
Luc Teirlinck <teirllm@auburn.edu>
parents: 57161
diff changeset
200 `comint-use-prompt-regexp' is non-nil."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
202 :type 'regexp)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
204 (defcustom smbclient-program "smbclient"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 "Smbclient program."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
207 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
209 (defcustom smbclient-program-options nil
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
210 "Options for the smbclient program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
212 :type '(repeat string))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214 (defcustom smbclient-prompt-regexp "^smb: \>"
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
215 "Regexp which matches the smbclient program's prompt.
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
216
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
217 This variable is only used if the variable
61875
cff214e628c2 (nslookup-prompt-regexp, ftp-prompt-regexp, smbclient-prompt-regexp):
Luc Teirlinck <teirllm@auburn.edu>
parents: 57161
diff changeset
218 `comint-use-prompt-regexp' is non-nil."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
220 :type 'regexp)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
222 (defcustom dns-lookup-program "host"
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
223 "Program to interactively query DNS information."
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
224 :group 'net-utils
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
225 :type 'string)
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
226
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
227 (defcustom dns-lookup-program-options nil
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
228 "Options for the dns-lookup program."
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
229 :group 'net-utils
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
230 :type '(repeat string))
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
231
28419
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
232 ;; Internal variables
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
233 (defvar network-connection-service nil)
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
234 (defvar network-connection-host nil)
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
235
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237 ;; Nslookup goodies
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
240 (defvar nslookup-font-lock-keywords
92227
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
241 (list
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
242 (list "^[A-Za-z0-9 _]+:" 0 'font-lock-type-face)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
243 (list "\\<\\(SOA\\|NS\\|MX\\|A\\|CNAME\\)\\>"
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
244 1 'font-lock-keyword-face)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
245 ;; Dotted quads
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
246 (list
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
247 (mapconcat 'identity
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
248 (make-list 4 "[0-9]+")
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
249 "\\.")
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
250 0 'font-lock-variable-name-face)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
251 ;; Host names
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
252 (list
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
253 (let ((host-expression "[-A-Za-z0-9]+"))
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
254 (concat
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
255 (mapconcat 'identity
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
256 (make-list 2 host-expression)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
257 "\\.")
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
258 "\\(\\." host-expression "\\)*"))
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
259 0 'font-lock-variable-name-face))
32158
b048135b76bc (nslookup-font-lock-keywords, ftp-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 32123
diff changeset
260 "Expressions to font-lock for nslookup.")
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
263 ;; General network utilities mode
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
264 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
265
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
266 (defvar net-utils-font-lock-keywords
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
267 (list
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
268 ;; Dotted quads
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
269 (list
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
270 (mapconcat 'identity (make-list 4 "[0-9]+") "\\.")
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
271 0 'font-lock-variable-name-face)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
272 ;; Simple rfc4291 addresses
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
273 (list (concat
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
274 "\\( \\([[:xdigit:]]+\\(:\\|::\\)\\)+[[:xdigit:]]+\\)"
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
275 "\\|"
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
276 "\\(::[[:xdigit:]]+\\)")
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
277 0 'font-lock-variable-name-face)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
278 ;; Host names
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
279 (list
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
280 (let ((host-expression "[-A-Za-z0-9]+"))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
281 (concat
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
282 (mapconcat 'identity (make-list 2 host-expression) "\\.")
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
283 "\\(\\." host-expression "\\)*"))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
284 0 'font-lock-variable-name-face))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
285 "Expressions to font-lock for general network utilities.")
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
286
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
287 (define-derived-mode net-utils-mode special-mode "NetworkUtil"
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
288 "Major mode for interacting with an external network utility."
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
289 (set (make-local-variable 'font-lock-defaults)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
290 '((net-utils-font-lock-keywords))))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
291
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
292 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 ;; Utility functions
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 ;; Simplified versions of some at-point functions from ffap.el.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 ;; It's not worth loading all of ffap just for these.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (defun net-utils-machine-at-point ()
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 (let ((pt (point)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 (buffer-substring-no-properties
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 (save-excursion
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302 (skip-chars-backward "-a-zA-Z0-9.")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (point))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (save-excursion
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (skip-chars-forward "-a-zA-Z0-9.")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 (skip-chars-backward "." pt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307 (point)))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (defun net-utils-url-at-point ()
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (let ((pt (point)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 (buffer-substring-no-properties
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312 (save-excursion
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (skip-chars-backward "--:=&?$+@-Z_a-z~#,%")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 (skip-chars-forward "^A-Za-z0-9" pt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 (point))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 (save-excursion
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317 (skip-chars-forward "--:=&?$+@-Z_a-z~#,%")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 (skip-chars-backward ":;.,!?" pt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319 (point)))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 (defun net-utils-remove-ctrl-m-filter (process output-string)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322 "Remove trailing control Ms."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 (let ((old-buffer (current-buffer))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 (filtered-string output-string))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 (unwind-protect
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326 (let ((moving))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (set-buffer (process-buffer process))
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
328 (let ((inhibit-read-only t))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
329 (setq moving (= (point) (process-mark process)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
331 (while (string-match "\r" filtered-string)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
332 (setq filtered-string
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
333 (replace-match "" nil nil filtered-string)))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
334
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
335 (save-excursion
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
336 ;; Insert the text, moving the process-marker.
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
337 (goto-char (process-mark process))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
338 (insert filtered-string)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
339 (set-marker (process-mark process) (point))))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (if moving (goto-char (process-mark process))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (set-buffer old-buffer))))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
342
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
343 (defun net-utils-run-program (name header program args)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 "Run a network information program."
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
345 (let ((buf (get-buffer-create (concat "*" name "*"))))
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
346 (set-buffer buf)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
347 (erase-buffer)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
348 (insert header "\n")
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
349 (set-process-filter
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
350 (apply 'start-process name buf program args)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
351 'net-utils-remove-ctrl-m-filter)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
352 (display-buffer buf)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
353 buf))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
354
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
355 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
356 ;; General network utilities (diagnostic)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
357 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
358
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
359 (defun net-utils-run-simple (buffer-name program-name args)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
360 "Run a network utility for diagnostic output only."
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
361 (interactive)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
362 (when (get-buffer buffer-name)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
363 (kill-buffer buffer-name))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
364 (get-buffer-create buffer-name)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
365 (with-current-buffer buffer-name
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
366 (net-utils-mode)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
367 (set-process-filter
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
368 (apply 'start-process (format "%s" program-name)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
369 buffer-name program-name args)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
370 'net-utils-remove-ctrl-m-filter)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
371 (goto-char (point-min)))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
372 (display-buffer buffer-name))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
373
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
374 ;;;###autoload
105170
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
375 (defun ifconfig ()
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
376 "Run ifconfig and display diagnostic output."
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
377 (interactive)
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
378 (net-utils-run-simple
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
379 (format "*%s*" ifconfig-program)
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
380 ifconfig-program
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
381 ifconfig-program-options))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
382
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
383 (defalias 'ipconfig 'ifconfig)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
384
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
385 ;;;###autoload
105170
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
386 (defun iwconfig ()
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
387 "Run iwconfig and display diagnostic output."
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
388 (interactive)
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
389 (net-utils-run-simple
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
390 (format "*%s*" iwconfig-program)
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
391 iwconfig-program
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
392 iwconfig-program-options))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
393
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
394 ;;;###autoload
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
395 (defun netstat ()
105170
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
396 "Run netstat and display diagnostic output."
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
397 (interactive)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
398 (net-utils-run-simple
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
399 (format "*%s*" netstat-program)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
400 netstat-program
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
401 netstat-program-options))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
402
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
403 ;;;###autoload
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
404 (defun arp ()
105170
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104770
diff changeset
405 "Run arp and display diagnostic output."
104206
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
406 (interactive)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
407 (net-utils-run-simple
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
408 (format "*%s*" arp-program)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
409 arp-program
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
410 arp-program-options))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
411
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
412 ;;;###autoload
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
413 (defun route ()
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
414 "Run route and display diagnostic output."
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
415 (interactive)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
416 (net-utils-run-simple
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
417 (format "*%s*" route-program)
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
418 route-program
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
419 route-program-options))
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
420
336e9dde5b1f * net/net-utils.el (net-utils-font-lock-keywords): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
421 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
422 ;; Wrappers for external network programs
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
424
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
425 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 (defun traceroute (target)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427 "Run traceroute program for TARGET."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428 (interactive "sTarget: ")
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
429 (let ((options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
430 (if traceroute-program-options
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
431 (append traceroute-program-options (list target))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (list target))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 (net-utils-run-program
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434 (concat "Traceroute" " " target)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 (concat "** Traceroute ** " traceroute-program " ** " target)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436 traceroute-program
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
437 options)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440 (defun ping (host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 "Ping HOST.
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
442 If your system's ping continues until interrupted, you can try setting
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 `ping-program-options'."
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
444 (interactive
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (list (read-from-minibuffer "Ping host: " (net-utils-machine-at-point))))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
446 (let ((options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 (if ping-program-options
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 (append ping-program-options (list host))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 (list host))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450 (net-utils-run-program
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451 (concat "Ping" " " host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452 (concat "** Ping ** " ping-program " ** " host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453 ping-program
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
454 options)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
455
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 ;; FIXME -- Needs to be a process filter
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457 ;; (defun netstat-with-filter (filter)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 ;; "Run netstat program."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
459 ;; (interactive "sFilter: ")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 ;; (netstat)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
461 ;; (set-buffer (get-buffer "*Netstat*"))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
462 ;; (goto-char (point-min))
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
463 ;; (delete-matching-lines filter))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
465 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
466 (defun nslookup-host (host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
467 "Lookup the DNS information for HOST."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
468 (interactive
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
469 (list (read-from-minibuffer "Lookup host: " (net-utils-machine-at-point))))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
470 (let ((options
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
471 (if nslookup-program-options
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
472 (append nslookup-program-options (list host))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
473 (list host))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
474 (net-utils-run-program
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
475 "Nslookup"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
476 (concat "** "
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
477 (mapconcat 'identity
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
478 (list "Nslookup" host nslookup-program)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
479 " ** "))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
480 nslookup-program
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
481 options)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
482
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
483 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
484 (defun nslookup ()
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
485 "Run nslookup program."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
486 (interactive)
104770
603c369f665b (nslookup): Use make-comint rather than comint-run.
Glenn Morris <rgm@gnu.org>
parents: 104206
diff changeset
487 (switch-to-buffer (make-comint "nslookup" nslookup-program))
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
488 (nslookup-mode))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
489
92227
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
490 (defvar comint-prompt-regexp)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
491 (defvar comint-input-autoexpand)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
492
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
493 (autoload 'comint-mode "comint" nil t)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
494
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
495 ;; Using a derived mode gives us keymaps, hooks, etc.
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
496 (define-derived-mode nslookup-mode comint-mode "Nslookup"
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
497 "Major mode for interacting with the nslookup program."
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
498 (set
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
499 (make-local-variable 'font-lock-defaults)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
500 '((nslookup-font-lock-keywords)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
501 (setq comint-prompt-regexp nslookup-prompt-regexp)
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
502 (setq comint-input-autoexpand t))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
503
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
504 (define-key nslookup-mode-map "\t" 'comint-dynamic-complete)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
505
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
506 ;;;###autoload
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
507 (defun dns-lookup-host (host)
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
508 "Lookup the DNS information for HOST (name or IP address)."
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
509 (interactive
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
510 (list (read-from-minibuffer "Lookup host: " (net-utils-machine-at-point))))
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
511 (let ((options
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
512 (if dns-lookup-program-options
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
513 (append dns-lookup-program-options (list host))
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
514 (list host))))
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
515 (net-utils-run-program
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
516 (concat "DNS Lookup [" host "]")
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
517 (concat "** "
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
518 (mapconcat 'identity
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
519 (list "DNS Lookup" host dns-lookup-program)
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
520 " ** "))
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
521 dns-lookup-program
80216
e2cf0e9f1f88 (ftp-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 80081
diff changeset
522 options)))
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
523
92227
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
524 (autoload 'ffap-string-at-point "ffap")
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
525
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
526 ;;;###autoload
64805
9612798470fd (run-dig): Renamed from `dig'.
Richard M. Stallman <rms@gnu.org>
parents: 64701
diff changeset
527 (defun run-dig (host)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
528 "Run dig program."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
529 (interactive
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
530 (list
92227
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
531 (read-from-minibuffer "Lookup host: "
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
532 (or (ffap-string-at-point 'machine) ""))))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
533 (net-utils-run-program
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
534 "Dig"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
535 (concat "** "
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
536 (mapconcat 'identity
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
537 (list "Dig" host dig-program)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
538 " ** "))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
539 dig-program
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
540 (list host)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
541
92227
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
542 (autoload 'comint-exec "comint")
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
543
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
544 ;; This is a lot less than ange-ftp, but much simpler.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
545 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
546 (defun ftp (host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
547 "Run ftp program."
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
548 (interactive
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
549 (list
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
550 (read-from-minibuffer
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
551 "Ftp to Host: " (net-utils-machine-at-point))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
552 (let ((buf (get-buffer-create (concat "*ftp [" host "]*"))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
553 (set-buffer buf)
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
554 (ftp-mode)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
555 (comint-exec buf (concat "ftp-" host) ftp-program nil
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
556 (if ftp-program-options
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
557 (append (list host) ftp-program-options)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
558 (list host)))
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
559 (pop-to-buffer buf)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
560
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
561 (define-derived-mode ftp-mode comint-mode "FTP"
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
562 "Major mode for interacting with the ftp program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
563 (setq comint-prompt-regexp ftp-prompt-regexp)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
564 (setq comint-input-autoexpand t)
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
565 ;; Only add the password-prompting hook if it's not already in the
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
566 ;; global hook list. This stands a small chance of losing, if it's
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
567 ;; later removed from the global list (very small, since any
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
568 ;; password prompts will probably immediately follow the initial
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
569 ;; connection), but it's better than getting prompted twice for the
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
570 ;; same password.
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
571 (unless (memq 'comint-watch-for-password-prompt
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
572 (default-value 'comint-output-filter-functions))
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
573 (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
574 nil t)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
575
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
576 ;; Occasionally useful
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
577 (define-key ftp-mode-map "\t" 'comint-dynamic-complete)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
578
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
579 (defun smbclient (host service)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
580 "Connect to SERVICE on HOST via SMB."
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
581 (interactive
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
582 (list
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
583 (read-from-minibuffer
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
584 "Connect to Host: " (net-utils-machine-at-point))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
585 (read-from-minibuffer "SMB Service: ")))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
586 (let* ((name (format "smbclient [%s\\%s]" host service))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
587 (buf (get-buffer-create (concat "*" name "*")))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
588 (service-name (concat "\\\\" host "\\" service)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
589 (set-buffer buf)
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
590 (smbclient-mode)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
591 (comint-exec buf name smbclient-program nil
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
592 (if smbclient-program-options
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
593 (append (list service-name) smbclient-program-options)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
594 (list service-name)))
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
595 (pop-to-buffer buf)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
596
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
597 (defun smbclient-list-shares (host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
598 "List services on HOST."
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
599 (interactive
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
600 (list
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
601 (read-from-minibuffer
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
602 "Connect to Host: " (net-utils-machine-at-point))))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
603 (let ((buf (get-buffer-create (format "*SMB Shares on %s*" host))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
604 (set-buffer buf)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
605 (smbclient-mode)
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
606 (comint-exec buf "smbclient-list-shares"
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
607 smbclient-program nil (list "-L" host))
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
608 (pop-to-buffer buf)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
609
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
610 (define-derived-mode smbclient-mode comint-mode "smbclient"
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
611 "Major mode for interacting with the smbclient program."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
612 (setq comint-prompt-regexp smbclient-prompt-regexp)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
613 (setq comint-input-autoexpand t)
32197
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
614 ;; Only add the password-prompting hook if it's not already in the
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
615 ;; global hook list. This stands a small chance of losing, if it's
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
616 ;; later removed from the global list (very small, since any
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
617 ;; password prompts will probably immediately follow the initial
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
618 ;; connection), but it's better than getting prompted twice for the
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
619 ;; same password.
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
620 (unless (memq 'comint-watch-for-password-prompt
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
621 (default-value 'comint-output-filter-functions))
b949d342e936 (nslookup-prompt-regexp, ftp-prompt-regexp)
Miles Bader <miles@gnu.org>
parents: 32158
diff changeset
622 (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
623 nil t)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
624
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
625
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
626 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
627 ;; Network Connections
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
628 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
629
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
630 ;; Full list is available at:
57161
c83be5f31fc5 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
631 ;; http://www.iana.org/assignments/port-numbers
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
632 (defvar network-connection-service-alist
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
633 (list
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
634 (cons 'echo 7)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
635 (cons 'active-users 11)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
636 (cons 'daytime 13)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
637 (cons 'chargen 19)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
638 (cons 'ftp 21)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
639 (cons 'telnet 23)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
640 (cons 'smtp 25)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
641 (cons 'time 37)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
642 (cons 'whois 43)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
643 (cons 'gopher 70)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
644 (cons 'finger 79)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
645 (cons 'www 80)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
646 (cons 'pop2 109)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
647 (cons 'pop3 110)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
648 (cons 'sun-rpc 111)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
649 (cons 'nntp 119)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
650 (cons 'ntp 123)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
651 (cons 'netbios-name 137)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
652 (cons 'netbios-data 139)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
653 (cons 'irc 194)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
654 (cons 'https 443)
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
655 (cons 'rlogin 513))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
656 "Alist of services and associated TCP port numbers.
41257
0605a90581d4 (network-connection-service-abbrev-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
657 This list is not complete.")
0605a90581d4 (network-connection-service-abbrev-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
658
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
659 ;; Workhorse routine
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
660 (defun run-network-program (process-name host port &optional initial-string)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
661 (let ((tcp-connection)
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
662 (buf))
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
663 (setq buf (get-buffer-create (concat "*" process-name "*")))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
664 (set-buffer buf)
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
665 (or
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
666 (setq tcp-connection
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
667 (open-network-stream process-name buf host port))
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
668 (error "Could not open connection to %s" host))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
669 (erase-buffer)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
670 (set-marker (process-mark tcp-connection) (point-min))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
671 (set-process-filter tcp-connection 'net-utils-remove-ctrl-m-filter)
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
672 (and initial-string
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
673 (process-send-string tcp-connection
92740
9f968e893cca (iwconfig-program-options): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 92360
diff changeset
674 (concat initial-string "\r\n")))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
675 (display-buffer buf)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
676
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
677 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
678 ;; Simple protocols
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
679 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
680
29303
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
681 (defcustom finger-X.500-host-regexps nil
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
682 "A list of regular expressions matching host names.
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
683 If a host name passed to `finger' matches one of these regular
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
684 expressions, it is assumed to be a host that doesn't accept
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
685 queries of the form USER@HOST, and wants a query containing USER only."
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
686 :group 'net-utils
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
687 :type '(repeat regexp)
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
688 :version "21.1")
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
689
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
690 ;; Finger protocol
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
691 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
692 (defun finger (user host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
693 "Finger USER on HOST."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
694 ;; One of those great interactive statements that's actually
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
695 ;; longer than the function call! The idea is that if the user
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
696 ;; uses a string like "pbreton@cs.umb.edu", we won't ask for the
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
697 ;; host name. If we don't see an "@", we'll prompt for the host.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
698 (interactive
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
699 (let* ((answer (read-from-minibuffer "Finger User: "
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
700 (net-utils-url-at-point)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
701 (index (string-match (regexp-quote "@") answer)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
702 (if index
29303
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
703 (list (substring answer 0 index)
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
704 (substring answer (1+ index)))
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
705 (list answer
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
706 (read-from-minibuffer "At Host: "
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
707 (net-utils-machine-at-point))))))
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
708 (let* ((user-and-host (concat user "@" host))
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
709 (process-name (concat "Finger [" user-and-host "]"))
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
710 (regexps finger-X.500-host-regexps)
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
711 found)
50281
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
712 (and regexps
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
713 (while (not (string-match (car regexps) host))
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
714 (setq regexps (cdr regexps)))
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
715 (when regexps
33ca9e7e717a Add dns-lookup-program wrapper
Peter Breton <pbreton@attbi.com>
parents: 42571
diff changeset
716 (setq user-and-host user)))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
717 (run-network-program
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
718 process-name
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
719 host
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
720 (cdr (assoc 'finger network-connection-service-alist))
29303
a3541330de52 (finger-X.500-host-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents: 28419
diff changeset
721 user-and-host)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
722
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
723 (defcustom whois-server-name "rs.internic.net"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
724 "Default host name for the whois service."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
725 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
726 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
727
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
728 (defcustom whois-server-list
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
729 '(("whois.arin.net") ; Networks, ASN's, and related POC's (numbers)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
730 ("rs.internic.net") ; domain related info
76162
7d0cfbd2c01a (whois-server-tld): Update server for .org.
Romain Francoise <romain@orebokech.com>
parents: 75347
diff changeset
731 ("whois.publicinterestregistry.net")
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
732 ("whois.abuse.net")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
733 ("whois.apnic.net")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
734 ("nic.ddn.mil")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
735 ("whois.nic.mil")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
736 ("whois.nic.gov")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
737 ("whois.ripe.net"))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
738 "A list of whois servers that can be queried."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
739 :group 'net-utils
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
740 :type '(repeat (list string)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
741
76162
7d0cfbd2c01a (whois-server-tld): Update server for .org.
Romain Francoise <romain@orebokech.com>
parents: 75347
diff changeset
742 ;; FIXME: modern whois clients include a much better tld <-> whois server
7d0cfbd2c01a (whois-server-tld): Update server for .org.
Romain Francoise <romain@orebokech.com>
parents: 75347
diff changeset
743 ;; list, Emacs should probably avoid specifying the server as the client
7d0cfbd2c01a (whois-server-tld): Update server for .org.
Romain Francoise <romain@orebokech.com>
parents: 75347
diff changeset
744 ;; will DTRT anyway... -rfr
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
745 (defcustom whois-server-tld
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
746 '(("rs.internic.net" . "com")
76162
7d0cfbd2c01a (whois-server-tld): Update server for .org.
Romain Francoise <romain@orebokech.com>
parents: 75347
diff changeset
747 ("whois.publicinterestregistry.net" . "org")
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
748 ("whois.ripe.net" . "be")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
749 ("whois.ripe.net" . "de")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
750 ("whois.ripe.net" . "dk")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
751 ("whois.ripe.net" . "it")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
752 ("whois.ripe.net" . "fi")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
753 ("whois.ripe.net" . "fr")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
754 ("whois.ripe.net" . "uk")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
755 ("whois.apnic.net" . "au")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
756 ("whois.apnic.net" . "ch")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
757 ("whois.apnic.net" . "hk")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
758 ("whois.apnic.net" . "jp")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
759 ("whois.nic.gov" . "gov")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
760 ("whois.nic.mil" . "mil"))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
761 "Alist to map top level domains to whois servers."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
762 :group 'net-utils
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
763 :type '(repeat (cons string string)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
764
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
765 (defcustom whois-guess-server t
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
766 "If non-nil then whois will try to deduce the appropriate whois
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
767 server from the query. If the query doesn't look like a domain or hostname
76162
7d0cfbd2c01a (whois-server-tld): Update server for .org.
Romain Francoise <romain@orebokech.com>
parents: 75347
diff changeset
768 then the server named by `whois-server-name' is used."
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
769 :group 'net-utils
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
770 :type 'boolean)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
771
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
772 (defun whois-get-tld (host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
773 "Return the top level domain of `host', or nil if it isn't a domain name."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
774 (let ((i (1- (length host)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
775 (max-len (- (length host) 5)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
776 (while (not (or (= i max-len) (char-equal (aref host i) ?.)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
777 (setq i (1- i)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
778 (if (= i max-len)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
779 nil
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
780 (substring host (1+ i)))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
781
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
782 ;; Whois protocol
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
783 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
784 (defun whois (arg search-string)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
785 "Send SEARCH-STRING to server defined by the `whois-server-name' variable.
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
786 If `whois-guess-server' is non-nil, then try to deduce the correct server
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
787 from SEARCH-STRING. With argument, prompt for whois server."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
788 (interactive "P\nsWhois: ")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
789 (let* ((whois-apropos-host (if whois-guess-server
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
790 (rassoc (whois-get-tld search-string)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
791 whois-server-tld)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
792 nil))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
793 (server-name (if whois-apropos-host
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
794 (car whois-apropos-host)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
795 whois-server-name))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
796 (host
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
797 (if arg
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
798 (completing-read "Whois server name: "
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
799 whois-server-list nil nil "whois.")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
800 server-name)))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
801 (run-network-program
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
802 "Whois"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
803 host
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
804 (cdr (assoc 'whois network-connection-service-alist))
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
805 search-string)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
806
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
807 (defcustom whois-reverse-lookup-server "whois.arin.net"
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
808 "Server which provides inverse DNS mapping."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
809 :group 'net-utils
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
810 :type 'string)
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
811
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
812 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
813 (defun whois-reverse-lookup ()
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
814 (interactive)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
815 (let ((whois-server-name whois-reverse-lookup-server))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
816 (call-interactively 'whois)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
817
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
818 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
819 ;;; General Network connection
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
820 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
821
28419
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
822 ;; Using a derived mode gives us keymaps, hooks, etc.
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
823 (define-derived-mode
28419
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
824 network-connection-mode comint-mode "Network-Connection"
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
825 "Major mode for interacting with the network-connection program.")
28419
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
826
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
827 (defun network-connection-mode-setup (host service)
42303
c5ddbcd62234 (ftp-mode-abbrev-table): Don't define it.
Richard M. Stallman <rms@gnu.org>
parents: 41257
diff changeset
828 (make-local-variable 'network-connection-host)
c5ddbcd62234 (ftp-mode-abbrev-table): Don't define it.
Richard M. Stallman <rms@gnu.org>
parents: 41257
diff changeset
829 (setq network-connection-host host)
c5ddbcd62234 (ftp-mode-abbrev-table): Don't define it.
Richard M. Stallman <rms@gnu.org>
parents: 41257
diff changeset
830 (make-local-variable 'network-connection-service)
42310
3eb9f60af733 Fix previous change.
Pavel Janík <Pavel@Janik.cz>
parents: 42303
diff changeset
831 (setq network-connection-service service))
28419
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
832
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
833 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
834 (defun network-connection-to-service (host service)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
835 "Open a network connection to SERVICE on HOST."
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
836 (interactive
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
837 (list
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
838 (read-from-minibuffer "Host: " (net-utils-machine-at-point))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
839 (completing-read "Service: "
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
840 (mapcar
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
841 (function
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
842 (lambda (elt)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
843 (list (symbol-name (car elt)))))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
844 network-connection-service-alist))))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
845 (network-connection
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
846 host
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
847 (cdr (assoc (intern service) network-connection-service-alist))))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
848
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
849 ;;;###autoload
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
850 (defun network-connection (host port)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
851 "Open a network connection to HOST on PORT."
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
852 (interactive "sHost: \nnPort: ")
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
853 (network-service-connection host (number-to-string port)))
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
854
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
855 (defun network-service-connection (host service)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
856 "Open a network connection to SERVICE on HOST."
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
857 (let* ((process-name (concat "Network Connection [" host " " service "]"))
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
858 (portnum (string-to-number service))
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
859 (buf (get-buffer-create (concat "*" process-name "*"))))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
860 (or (zerop portnum) (setq service portnum))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
861 (make-comint
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
862 process-name
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
863 (cons host service))
28419
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
864 (set-buffer buf)
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
865 (network-connection-mode)
fed834403704 network-connection-mode is derived from comint-mode
Peter Breton <pbreton@attbi.com>
parents: 28210
diff changeset
866 (network-connection-mode-setup host service)
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
867 (pop-to-buffer buf)))
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
868
92227
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
869 (defvar comint-input-ring)
a68825f42cef (top-level): Don't require comint when compiling.
Glenn Morris <rgm@gnu.org>
parents: 92148
diff changeset
870
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
871 (defun network-connection-reconnect ()
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
872 "Reconnect a network connection, preserving the old input ring."
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
873 (interactive)
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
874 (let ((proc (get-buffer-process (current-buffer)))
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
875 (old-comint-input-ring comint-input-ring)
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
876 (host network-connection-host)
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
877 (service network-connection-service))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
878 (if (not (or (not proc)
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
879 (eq (process-status proc) 'closed)))
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
880 (message "Still connected")
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
881 (goto-char (point-max))
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
882 (insert (format "Reopening connection to %s\n" host))
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
883 (network-connection host
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
884 (if (numberp service)
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
885 service
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
886 (cdr (assoc service network-connection-service-alist))))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
887 (and old-comint-input-ring
42571
c4fdc37d21f5 (nslookup-font-lock-keywords): Defvar font-lock variables to prevent
Pavel Janík <Pavel@Janik.cz>
parents: 42310
diff changeset
888 (setq comint-input-ring old-comint-input-ring)))))
32123
2e9fda397ea2 * net/net-utils.el (nslookup-font-lock-keywords,
Peter Breton <pbreton@attbi.com>
parents: 30548
diff changeset
889
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
890 (provide 'net-utils)
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
891
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92740
diff changeset
892 ;; arch-tag: 97119e91-9edb-4376-838b-bf7058fa1314
28210
b56f9152e329 Moved here from lisp.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
893 ;;; net-utils.el ends here