annotate lisp/net/net-utils.el @ 92242:4e775ca003e8

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