annotate lisp/net-utils.el @ 27206:4e9dc4b55f44

Copyright up-date.
author Dave Love <fx@gnu.org>
date Wed, 05 Jan 2000 22:59:31 +0000
parents 9b2b851efc39
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1 ;;; net-utils.el --- Network functions
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3 ;; Author: Peter Breton <pbreton@cs.umb.edu>
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4 ;; Created: Sun Mar 16 1997
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
5 ;; Keywords: network communications
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
6 ;; Time-stamp: <1999-11-13 10:19:01 pbreton>
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
7
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
9
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
13 ;; any later version.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
14
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
18 ;; GNU General Public License for more details.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
19
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
24
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
25 ;;; Commentary:
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
26 ;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
27 ;; There are three main areas of functionality:
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
28 ;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
29 ;; * Wrap common network utility programs (ping, traceroute, netstat,
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
30 ;; nslookup, arp, route). Note that these wrappers are of the diagnostic
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
31 ;; functions of these programs only.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
32 ;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
33 ;; * Implement some very basic protocols in Emacs Lisp (finger and whois)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
34 ;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
35 ;; * Support connections to HOST/PORT, generally for debugging and the like.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
36 ;; In other words, for doing much the same thing as "telnet HOST PORT", and
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
37 ;; then typing commands.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
38 ;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
39 ;; PATHS
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
40 ;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
41 ;; On some systems, some of these programs are not in normal user path,
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
42 ;; but rather in /sbin, /usr/sbin, and so on.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
43
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
44
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
45 ;;; Code:
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
46 (eval-when-compile
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
47 (require 'comint))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
48
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
49 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
50 ;; Customization Variables
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
52
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
53 (defgroup net-utils nil
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
54 "Network utility functions."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
55 :prefix "net-utils-"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
56 :group 'comm
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
57 :version "20.3"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
58 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
59
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
60 (defcustom net-utils-remove-ctl-m
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
61 (member system-type (list 'windows-nt 'msdos))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
62 "If non-nil, remove control-Ms from output."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
63 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
64 :type 'boolean
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
65 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
66
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
67 (defcustom traceroute-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
68 (if (eq system-type 'windows-nt)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
69 "tracert"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
70 "traceroute")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
71 "Program to trace network hops to a destination."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
72 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
73 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
74 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
75
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
76 (defcustom traceroute-program-options nil
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
77 "Options for the traceroute program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
78 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
79 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
80 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
81
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
82 (defcustom ping-program "ping"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
83 "Program to send network test packets to a host."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
84 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
85 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
86 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
87
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
88 ;; On Linux and Irix, the system's ping program seems to send packets
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
89 ;; indefinitely unless told otherwise
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
90 (defcustom ping-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
91 (and (memq system-type (list 'linux 'gnu/linux 'irix))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
92 (list "-c" "4"))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
93 "Options for the ping program.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
94 These options can be used to limit how many ICMP packets are emitted."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
95 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
96 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
97 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
98
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
99 (defcustom ipconfig-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
100 (if (eq system-type 'windows-nt)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
101 "ipconfig"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
102 "ifconfig")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
103 "Program to print network configuration information."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
104 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
105 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
106 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
107
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
108 (defcustom ipconfig-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
109 (list
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
110 (if (eq system-type 'windows-nt)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
111 "/all" "-a"))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
112 "Options for ipconfig-program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
113 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
114 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
115 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
116
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
117 (defcustom netstat-program "netstat"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
118 "Program to print network statistics."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
119 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
120 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
121 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
122
23187
205f3fab9564 (netstat-program-options): Changed from nil to "-a"
Karl Heuer <kwzh@gnu.org>
parents: 22537
diff changeset
123 (defcustom netstat-program-options
205f3fab9564 (netstat-program-options): Changed from nil to "-a"
Karl Heuer <kwzh@gnu.org>
parents: 22537
diff changeset
124 (list "-a")
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
125 "Options for netstat-program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
126 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
127 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
128 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
129
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
130 (defcustom arp-program "arp"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
131 "Program to print IP to address translation tables."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
132 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
133 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
134 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
135
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
136 (defcustom arp-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
137 (list "-a")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
138 "Options for arp-program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
139 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
140 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
141 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
142
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
143 (defcustom route-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
144 (if (eq system-type 'windows-nt)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
145 "route"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
146 "netstat")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
147 "Program to print routing tables."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
148 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
149 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
150 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
151
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
152 (defcustom route-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
153 (if (eq system-type 'windows-nt)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
154 (list "print")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
155 (list "-r"))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
156 "Options for route-program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
157 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
158 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
159 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
160
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
161 (defcustom nslookup-program "nslookup"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
162 "Program to interactively query DNS information."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
163 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
164 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
165 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
166
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
167 (defcustom nslookup-program-options nil
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
168 "List of options to pass to the nslookup program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
169 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
170 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
171 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
172
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
173 (defcustom nslookup-prompt-regexp "^> "
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
174 "Regexp to match the nslookup prompt."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
175 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
176 :type 'regexp
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
177 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
178
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
179 (defcustom dig-program "dig"
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
180 "Program to query DNS information."
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
181 :group 'net-utils
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
182 :type 'string
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
183 )
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
184
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
185 (defcustom ftp-program "ftp"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
186 "Progam to run to do FTP transfers."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
187 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
188 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
189 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
190
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
191 (defcustom ftp-program-options nil
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
192 "List of options to pass to the FTP program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
193 :group 'net-utils
23269
16780f249ece (traceroute-program-options, ping-program-options,
Andreas Schwab <schwab@suse.de>
parents: 23187
diff changeset
194 :type '(repeat string)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
195 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
196
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
197 (defcustom ftp-prompt-regexp "^ftp>"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
198 "Regexp which matches the FTP program's prompt."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
199 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
200 :type 'regexp
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
201 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
202
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
203 (defcustom smbclient-program "smbclient"
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
204 "Smbclient program."
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
205 :group 'net-utils
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
206 :type 'string
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
207 )
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
208
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
209 (defcustom smbclient-program-options nil
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
210 "List of options to pass to the smbclient program."
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
211 :group 'net-utils
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
212 :type '(repeat string)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
213 )
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
214
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
215 (defcustom smbclient-prompt-regexp "^smb: \>"
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
216 "Regexp which matches the smbclient program's prompt."
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
217 :group 'net-utils
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
218 :type 'regexp
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
219 )
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
220
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
221 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
222 ;; Nslookup goodies
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
224
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
225 (defconst nslookup-font-lock-keywords
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
226 (and window-system
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
227 (progn
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
228 (require 'font-lock)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
229 (list
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
230 (list nslookup-prompt-regexp 0 font-lock-reference-face)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
231 (list "^[A-Za-z0-9 _]+:" 0 font-lock-type-face)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
232 (list "\\<\\(SOA\\|NS\\|MX\\|A\\|CNAME\\)\\>"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
233 1 font-lock-keyword-face)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
234 ;; Dotted quads
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
235 (list
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
236 (mapconcat 'identity
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
237 (make-list 4 "[0-9]+")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
238 "\\.")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
239 0 font-lock-variable-name-face)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
240 ;; Host names
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
241 (list
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
242 (let ((host-expression "[-A-Za-z0-9]+"))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
243 (concat
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
244 (mapconcat 'identity
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
245 (make-list 2 host-expression)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
246 "\\.")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
247 "\\(\\." host-expression "\\)*")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
248 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
249 0 font-lock-variable-name-face)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
250 )))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
251 "Expressions to font-lock for nslookup.")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
252
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
253 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
254 ;; FTP goodies
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
256
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
257 (defconst ftp-font-lock-keywords
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
258 (and window-system
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
259 (progn
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
260 (require 'font-lock)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
261 (list
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
262 (list ftp-prompt-regexp 0 font-lock-reference-face)))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
263
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
264 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
265 ;; smbclient goodies
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
266 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
267
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
268 (defconst smbclient-font-lock-keywords
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
269 (and window-system
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
270 (progn
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
271 (require 'font-lock)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
272 (list
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
273 (list smbclient-prompt-regexp 0 font-lock-reference-face)))))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
274
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
275 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
276 ;; Utility functions
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
278
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
279 ;; Simplified versions of some at-point functions from ffap.el.
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
280 ;; It's not worth loading all of ffap just for these.
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
281 (defun net-utils-machine-at-point ()
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
282 (let ((pt (point)))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
283 (buffer-substring-no-properties
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
284 (save-excursion
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
285 (skip-chars-backward "-a-zA-Z0-9.")
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
286 (point))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
287 (save-excursion
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
288 (skip-chars-forward "-a-zA-Z0-9.")
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
289 (skip-chars-backward "." pt)
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
290 (point)))))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
291
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
292 (defun net-utils-url-at-point ()
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
293 (let ((pt (point)))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
294 (buffer-substring-no-properties
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
295 (save-excursion
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
296 (skip-chars-backward "--:=&?$+@-Z_a-z~#,%")
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
297 (skip-chars-forward "^A-Za-z0-9" pt)
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
298 (point))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
299 (save-excursion
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
300 (skip-chars-forward "--:=&?$+@-Z_a-z~#,%")
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
301 (skip-chars-backward ":;.,!?" pt)
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
302 (point)))))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
303
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
304
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
305 (defun net-utils-remove-ctrl-m-filter (process output-string)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
306 "Remove trailing control Ms."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
307 (let ((old-buffer (current-buffer))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
308 (filtered-string output-string))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
309 (unwind-protect
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
310 (let ((moving))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
311 (set-buffer (process-buffer process))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
312 (setq moving (= (point) (process-mark process)))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
313
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
314 (while (string-match "\r" filtered-string)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
315 (setq filtered-string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
316 (replace-match "" nil nil filtered-string)))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
317
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
318 (save-excursion
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
319 ;; Insert the text, moving the process-marker.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
320 (goto-char (process-mark process))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
321 (insert filtered-string)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
322 (set-marker (process-mark process) (point)))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
323 (if moving (goto-char (process-mark process))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
324 (set-buffer old-buffer))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
325
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
326 (defmacro net-utils-run-program (name header program &rest args)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
327 "Run a network information program."
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
328 ` (let ((buf (get-buffer-create (concat "*" ,name "*"))))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
329 (set-buffer buf)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
330 (erase-buffer)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
331 (insert ,header "\n")
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
332 (set-process-filter
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
333 (apply 'start-process ,name buf ,program ,@args)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
334 'net-utils-remove-ctrl-m-filter)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
335 (display-buffer buf)))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
336
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
337 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
338 ;; Wrappers for external network programs
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
339 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
340
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
341 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
342 (defun traceroute (target)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
343 "Run traceroute program for TARGET."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
344 (interactive "sTarget: ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
345 (let ((options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
346 (if traceroute-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
347 (append traceroute-program-options (list target))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
348 (list target))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
349 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
350 (concat "Traceroute" " " target)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
351 (concat "** Traceroute ** " traceroute-program " ** " target)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
352 traceroute-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
353 options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
354 )))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
355
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
356 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
357 (defun ping (host)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
358 "Ping HOST.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
359 If your system's ping continues until interrupted, you can try setting
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
360 `ping-program-options'."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
361 (interactive
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
362 (list (read-from-minibuffer "Ping host: " (net-utils-machine-at-point))))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
363 (let ((options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
364 (if ping-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
365 (append ping-program-options (list host))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
366 (list host))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
367 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
368 (concat "Ping" " " host)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
369 (concat "** Ping ** " ping-program " ** " host)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
370 ping-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
371 options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
372 )))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
373
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
374 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
375 (defun ipconfig ()
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
376 "Run ipconfig program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
377 (interactive)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
378 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
379 "Ipconfig"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
380 (concat "** Ipconfig ** " ipconfig-program " ** ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
381 ipconfig-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
382 ipconfig-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
383 ))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
384
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
385 ;; This is the normal name on most Unixes.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
386 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
387 (defalias 'ifconfig 'ipconfig)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
388
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
389 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
390 (defun netstat ()
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
391 "Run netstat program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
392 (interactive)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
393 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
394 "Netstat"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
395 (concat "** Netstat ** " netstat-program " ** ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
396 netstat-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
397 netstat-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
398 ))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
399
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
400 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
401 (defun arp ()
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
402 "Run the arp program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
403 (interactive)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
404 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
405 "Arp"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
406 (concat "** Arp ** " arp-program " ** ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
407 arp-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
408 arp-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
409 ))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
410
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
411 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
412 (defun route ()
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
413 "Run the route program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
414 (interactive)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
415 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
416 "Route"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
417 (concat "** Route ** " route-program " ** ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
418 route-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
419 route-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
420 ))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
421
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
422 ;; FIXME -- Needs to be a process filter
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
423 ;; (defun netstat-with-filter (filter)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
424 ;; "Run netstat program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
425 ;; (interactive "sFilter: ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
426 ;; (netstat)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
427 ;; (set-buffer (get-buffer "*Netstat*"))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
428 ;; (goto-char (point-min))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
429 ;; (delete-matching-lines filter)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
430 ;; )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
431
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
432 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
433 (defun nslookup-host (host)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
434 "Lookup the DNS information for HOST."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
435 (interactive
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
436 (list (read-from-minibuffer "Lookup host: " (net-utils-machine-at-point))))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
437 (let ((options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
438 (if nslookup-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
439 (append nslookup-program-options (list host))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
440 (list host))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
441 (net-utils-run-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
442 "Nslookup"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
443 (concat "** "
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
444 (mapconcat 'identity
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
445 (list "Nslookup" host nslookup-program)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
446 " ** "))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
447 nslookup-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
448 options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
449 )))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
450
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
451
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
452 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
453 (defun nslookup ()
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
454 "Run nslookup program."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
455 (interactive)
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
456 (require 'comint)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
457 (comint-run nslookup-program)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
458 (set-process-filter (get-buffer-process "*nslookup*")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
459 'net-utils-remove-ctrl-m-filter)
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
460 (nslookup-mode)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
461 )
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
462
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
463 ;; Using a derived mode gives us keymaps, hooks, etc.
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
464 (define-derived-mode
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
465 nslookup-mode comint-mode "Nslookup"
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
466 "Major mode for interacting with the nslookup program."
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
467 (set
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
468 (make-local-variable 'font-lock-defaults)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
469 '((nslookup-font-lock-keywords)))
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
470 (setq local-abbrev-table nslookup-mode-abbrev-table)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
471 (abbrev-mode t)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
472 (make-local-variable 'comint-prompt-regexp)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
473 (setq comint-prompt-regexp nslookup-prompt-regexp)
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
474 (make-local-variable 'comint-input-autoexpand)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
475 (setq comint-input-autoexpand t)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
476 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
477
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
478 (define-key nslookup-mode-map "\t" 'comint-dynamic-complete)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
479
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
480 (define-abbrev nslookup-mode-abbrev-table "e" "exit")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
481 (define-abbrev nslookup-mode-abbrev-table "f" "finger")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
482 (define-abbrev nslookup-mode-abbrev-table "h" "help")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
483 (define-abbrev nslookup-mode-abbrev-table "lse" "lserver")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
484 (define-abbrev nslookup-mode-abbrev-table "q" "exit")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
485 (define-abbrev nslookup-mode-abbrev-table "r" "root")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
486 (define-abbrev nslookup-mode-abbrev-table "s" "set")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
487 (define-abbrev nslookup-mode-abbrev-table "se" "server")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
488 (define-abbrev nslookup-mode-abbrev-table "v" "viewer")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
489
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
490 ;;;###autoload
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
491 (defun dig (host)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
492 "Run dig program."
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
493 (interactive
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
494 (list
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
495 (progn
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
496 (require 'ffap)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
497 (read-from-minibuffer
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
498 "Lookup host: "
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
499 (or (ffap-string-at-point 'machine) "")))))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
500 (net-utils-run-program
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
501 "Dig"
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
502 (concat "** "
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
503 (mapconcat 'identity
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
504 (list "Dig" host dig-program)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
505 " ** "))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
506 dig-program
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
507 (list host)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
508 ))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
509
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
510 ;; This is a lot less than ange-ftp, but much simpler.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
511 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
512 (defun ftp (host)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
513 "Run ftp program."
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
514 (interactive
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
515 (list
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
516 (read-from-minibuffer
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
517 "Ftp to Host: " (net-utils-machine-at-point))))
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
518 (require 'comint)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
519 (let ((buf (get-buffer-create (concat "*ftp [" host "]*"))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
520 (set-buffer buf)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
521 (comint-mode)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
522 (comint-exec buf (concat "ftp-" host) ftp-program nil
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
523 (if ftp-program-options
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
524 (append (list host) ftp-program-options)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
525 (list host)))
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
526 (ftp-mode)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
527 (switch-to-buffer-other-window buf)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
528 ))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
529
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
530 (define-derived-mode
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
531 ftp-mode comint-mode "FTP"
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
532 "Major mode for interacting with the ftp program."
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
533
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
534 (set
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
535 (make-local-variable 'font-lock-defaults)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
536 '((ftp-font-lock-keywords)))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
537
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
538 (make-local-variable 'comint-prompt-regexp)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
539 (setq comint-prompt-regexp ftp-prompt-regexp)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
540
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
541 (make-local-variable 'comint-input-autoexpand)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
542 (setq comint-input-autoexpand t)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
543
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
544 ;; Already buffer local!
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
545 (setq comint-output-filter-functions
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
546 (list 'comint-watch-for-password-prompt))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
547
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
548 (setq local-abbrev-table ftp-mode-abbrev-table)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
549 (abbrev-mode t)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
550 )
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
551
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
552 (define-abbrev ftp-mode-abbrev-table "q" "quit")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
553 (define-abbrev ftp-mode-abbrev-table "g" "get")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
554 (define-abbrev ftp-mode-abbrev-table "p" "prompt")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
555 (define-abbrev ftp-mode-abbrev-table "anon" "anonymous")
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
556
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
557 ;; Occasionally useful
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
558 (define-key ftp-mode-map "\t" 'comint-dynamic-complete)
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
559
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
560 (defun smbclient (host service)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
561 "Connect to SERVICE on HOST via SMB."
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
562 (interactive
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
563 (list
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
564 (read-from-minibuffer
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
565 "Connect to Host: " (net-utils-machine-at-point))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
566 (read-from-minibuffer "SMB Service: ")))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
567 (require 'comint)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
568 (let* ((name (format "smbclient [%s\\%s]" host service))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
569 (buf (get-buffer-create (concat "*" name "*")))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
570 (service-name (concat "\\\\" host "\\" service)))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
571 (set-buffer buf)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
572 (comint-mode)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
573 (comint-exec buf name smbclient-program nil
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
574 (if smbclient-program-options
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
575 (append (list service-name) smbclient-program-options)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
576 (list service-name)))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
577 (smbclient-mode)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
578 (switch-to-buffer-other-window buf)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
579 ))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
580
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
581 (defun smbclient-list-shares (host)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
582 "List services on HOST."
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
583 (interactive
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
584 (list
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
585 (read-from-minibuffer
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
586 "Connect to Host: " (net-utils-machine-at-point))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
587 ))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
588 (let ((buf (get-buffer-create (format "*SMB Shares on %s*" host))))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
589 (set-buffer buf)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
590 (comint-mode)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
591 (comint-exec
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
592 buf
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
593 "smbclient-list-shares"
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
594 smbclient-program
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
595 nil
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
596 (list "-L" host)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
597 )
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
598 (smbclient-mode)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
599 (switch-to-buffer-other-window buf)))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
600
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
601 (define-derived-mode
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
602 smbclient-mode comint-mode "smbclient"
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
603 "Major mode for interacting with the smbclient program."
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
604
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
605 (set
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
606 (make-local-variable 'font-lock-defaults)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
607 '((smbclient-font-lock-keywords)))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
608
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
609 (make-local-variable 'comint-prompt-regexp)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
610 (setq comint-prompt-regexp smbclient-prompt-regexp)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
611
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
612 (make-local-variable 'comint-input-autoexpand)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
613 (setq comint-input-autoexpand t)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
614
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
615 ;; Already buffer local!
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
616 (setq comint-output-filter-functions
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
617 (list 'comint-watch-for-password-prompt))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
618
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
619 (setq local-abbrev-table smbclient-mode-abbrev-table)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
620 (abbrev-mode t)
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
621 )
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
622
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
623 (define-abbrev smbclient-mode-abbrev-table "q" "quit")
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
624
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
625
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
626 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
627 ;; Network Connections
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
628 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
629
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
630 ;; Full list is available at:
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
631 ;; ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
632 (defvar network-connection-service-alist
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
633 (list
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
634 (cons 'echo 7)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
635 (cons 'active-users 11)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
636 (cons 'daytime 13)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
637 (cons 'chargen 19)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
638 (cons 'ftp 21)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
639 (cons 'telnet 23)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
640 (cons 'smtp 25)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
641 (cons 'time 37)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
642 (cons 'whois 43)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
643 (cons 'gopher 70)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
644 (cons 'finger 79)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
645 (cons 'www 80)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
646 (cons 'pop2 109)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
647 (cons 'pop3 110)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
648 (cons 'sun-rpc 111)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
649 (cons 'nntp 119)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
650 (cons 'ntp 123)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
651 (cons 'netbios-name 137)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
652 (cons 'netbios-data 139)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
653 (cons 'irc 194)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
654 (cons 'https 443)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
655 (cons 'rlogin 513)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
656 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
657 "Alist of services and associated TCP port numbers.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
658 This list in not complete.")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
659
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
660 ;; Workhorse macro
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
661 (defmacro run-network-program (process-name host port
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
662 &optional initial-string)
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
663 `
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
664 (let ((tcp-connection)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
665 (buf)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
666 )
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
667 (setq buf (get-buffer-create (concat "*" ,process-name "*")))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
668 (set-buffer buf)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
669 (or
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
670 (setq tcp-connection
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
671 (open-network-stream
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
672 ,process-name
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
673 buf
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
674 ,host
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
675 ,port
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
676 ))
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
677 (error "Could not open connection to %s" ,host))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
678 (erase-buffer)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
679 (set-marker (process-mark tcp-connection) (point-min))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
680 (set-process-filter tcp-connection 'net-utils-remove-ctrl-m-filter)
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
681 (and ,initial-string
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
682 (process-send-string tcp-connection
26430
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
683 (concat ,initial-string "\r\n")))
9b2b851efc39 (net-utils-run-program): Changed backquotes to new style
Peter Breton <pbreton@attbi.com>
parents: 26041
diff changeset
684 (display-buffer buf)))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
685
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
686 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
687 ;; Simple protocols
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
688 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
689
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
690 ;; Finger protocol
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
691 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
692 (defun finger (user host)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
693 "Finger USER on HOST."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
694 ;; One of those great interactive statements that's actually
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
695 ;; longer than the function call! The idea is that if the user
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
696 ;; uses a string like "pbreton@cs.umb.edu", we won't ask for the
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
697 ;; host name. If we don't see an "@", we'll prompt for the host.
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
698 (interactive
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
699 (let* ((answer (read-from-minibuffer "Finger User: "
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
700 (net-utils-url-at-point)))
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
701 (index (string-match (regexp-quote "@") answer)))
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
702 (if index
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
703 (list
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
704 (substring answer 0 index)
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
705 (substring answer (1+ index)))
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
706 (list
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
707 answer
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
708 (read-from-minibuffer "At Host: " (net-utils-machine-at-point))))))
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
709 (let* (
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
710 (user-and-host (concat user "@" host))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
711 (process-name
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
712 (concat "Finger [" user-and-host "]"))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
713 )
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
714 (run-network-program
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
715 process-name
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
716 host
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
717 (cdr (assoc 'finger network-connection-service-alist))
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
718 user-and-host
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
719 )))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
720
26041
01eac276e455 (whois-server-name): Changed to rs.internic.net
Peter Breton <pbreton@attbi.com>
parents: 25131
diff changeset
721 (defcustom whois-server-name "rs.internic.net"
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
722 "Default host name for the whois service."
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
723 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
724 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
725 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
726
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
727 (defcustom whois-server-list
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
728 '(("whois.arin.net") ; Networks, ASN's, and related POC's (numbers)
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
729 ("rs.internic.net") ; domain related info
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
730 ("whois.abuse.net")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
731 ("whois.apnic.net")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
732 ("nic.ddn.mil")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
733 ("whois.nic.mil")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
734 ("whois.nic.gov")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
735 ("whois.ripe.net"))
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
736 "A list of whois servers that can be queried."
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
737 :group 'net-utils
23479
8256c4d22113 (whois-server-list): Fix customization type.
Richard M. Stallman <rms@gnu.org>
parents: 23391
diff changeset
738 :type '(repeat (list string)))
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
739
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
740 (defcustom whois-server-tld
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
741 '(("rs.internic.net" . "com")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
742 ("rs.internic.net" . "org")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
743 ("whois.ripe.net" . "be")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
744 ("whois.ripe.net" . "de")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
745 ("whois.ripe.net" . "dk")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
746 ("whois.ripe.net" . "it")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
747 ("whois.ripe.net" . "fi")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
748 ("whois.ripe.net" . "fr")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
749 ("whois.ripe.net" . "uk")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
750 ("whois.apnic.net" . "au")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
751 ("whois.apnic.net" . "ch")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
752 ("whois.apnic.net" . "hk")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
753 ("whois.apnic.net" . "jp")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
754 ("whois.nic.gov" . "gov")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
755 ("whois.nic.mil" . "mil"))
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
756 "Alist to map top level domains to whois servers."
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
757 :group 'net-utils
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
758 :type '(repeat (cons string string)))
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
759
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
760 (defcustom whois-guess-server t
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
761 "If non-nil then whois will try to deduce the appropriate whois
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
762 server from the query. If the query doesn't look like a domain or hostname
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
763 then the server named by whois-server-name is used."
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
764 :group 'net-utils
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
765 :type 'boolean)
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
766
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
767 (defun whois-get-tld (host)
23529
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
768 "Return the top level domain of `host', or nil if it isn't a domain name."
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
769 (let ((i (1- (length host)))
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
770 (max-len (- (length host) 5)))
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
771 (while (not (or (= i max-len) (char-equal (aref host i) ?.)))
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
772 (setq i (1- i)))
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
773 (if (= i max-len)
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
774 nil
ccedc9675dab (whois-get-tld): Rewrite not to use `do'.
Richard M. Stallman <rms@gnu.org>
parents: 23479
diff changeset
775 (substring host (1+ i)))))
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
776
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
777 ;; Whois protocol
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
778 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
779 (defun whois (arg search-string)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
780 "Send SEARCH-STRING to server defined by the `whois-server-name' variable.
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
781 If `whois-guess-server' is non-nil, then try to deduce the correct server
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
782 from SEARCH-STRING. With argument, prompt for whois server."
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
783 (interactive "P\nsWhois: ")
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
784 (let* ((whois-apropos-host (if whois-guess-server
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
785 (rassoc (whois-get-tld search-string)
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
786 whois-server-tld)
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
787 nil))
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
788 (server-name (if whois-apropos-host
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
789 (car whois-apropos-host)
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
790 whois-server-name))
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
791 (host
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
792 (if arg
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
793 (completing-read "Whois server name: "
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
794 whois-server-list nil nil "whois.")
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
795 server-name)))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
796 (run-network-program
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
797 "Whois"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
798 host
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
799 (cdr (assoc 'whois network-connection-service-alist))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
800 search-string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
801 )))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
802
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
803 (defcustom whois-reverse-lookup-server "whois.arin.net"
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
804 "Server which provides inverse DNS mapping."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
805 :group 'net-utils
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
806 :type 'string
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
807 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
808
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
809 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
810 (defun whois-reverse-lookup ()
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
811 (interactive)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
812 (let ((whois-server-name whois-reverse-lookup-server))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
813 (call-interactively 'whois)))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
814
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
815 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
816 ;;; General Network connection
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
817 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
818
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
819 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
820 (defun network-connection-to-service (host service)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
821 "Open a network connection to SERVICE on HOST."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
822 (interactive
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
823 (list
23359
0757f6ee2e53 Don't require ffap.
Karl Heuer <kwzh@gnu.org>
parents: 23269
diff changeset
824 (read-from-minibuffer "Host: " (net-utils-machine-at-point))
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
825 (completing-read "Service: "
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
826 (mapcar
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
827 (function
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
828 (lambda (elt)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
829 (list (symbol-name (car elt)))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
830 network-connection-service-alist))))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
831 (network-connection
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
832 host
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
833 (cdr (assoc (intern service) network-connection-service-alist)))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
834 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
835
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
836 ;;;###autoload
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
837 (defun network-connection (host port)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
838 "Open a network connection to HOST on PORT."
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
839 (interactive "sHost: \nnPort: ")
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
840 (network-service-connection host (number-to-string port)))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
841
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
842 (defun network-service-connection (host service)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
843 "Open a network connection to SERVICE on HOST."
23391
4120f9e06191 (ftp, nslookup): Require comint.
Karl Heuer <kwzh@gnu.org>
parents: 23359
diff changeset
844 (require 'comint)
22537
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
845 (let (
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
846 (process-name (concat "Network Connection [" host " " service "]"))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
847 (portnum (string-to-number service))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
848 )
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
849 (or (zerop portnum) (setq service portnum))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
850 (make-comint
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
851 process-name
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
852 (cons host service))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
853 (pop-to-buffer (get-buffer (concat "*" process-name "*")))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
854 ))
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
855
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
856 (provide 'net-utils)
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
857
7947a4ea28a8 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
858 ;;; net-utils.el ends here