comparison lisp/w3/url-ns.el @ 44:8d2a9b52c682 r19-15prefinal

Import from CVS: tag r19-15prefinal
author cvs
date Mon, 13 Aug 2007 08:55:10 +0200
parents
children d2f30a177268
comparison
equal deleted inserted replaced
43:23cafc5d2038 44:8d2a9b52c682
1 ;;; url-ns.el --- Various netscape-ish functions for proxy definitions
2 ;; Author: wmperry
3 ;; Created: 1997/03/24 20:16:16
4 ;; Version: 1.1
5 ;; Keywords: comm, data, processes, hypermedia
6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1997 Free Software Foundation, Inc.
9 ;;;
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
11 ;;;
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2, or (at your option)
15 ;;; any later version.
16 ;;;
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;;; Boston, MA 02111-1307, USA.
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27
28 (defun isPlainHostName (host)
29 (string-match "\\." host))
30
31 (defun dnsDomainIs (host dom)
32 (setq host (url-gateway-nslookup-host host))
33 (string-match (concat (regexp-quote dom) "$") host))
34
35 (defun dnsResolve (host)
36 (url-gateway-nslookup-host host))
37
38 (defun isResolvable (host)
39 (if (string-match "^[0-9.]+$" host)
40 t
41 (not (string= host (url-gateway-nslookup-host host)))))
42
43 (defun isInNet (ip net mask)
44 (let ((netc (split-string ip "\\."))
45 (ipc (split-string net "\\."))
46 (maskc (split-string mask "\\.")))
47 (if (or (/= (length netc) (length ipc))
48 (/= (length ipc) (length maskc)))
49 nil
50 (setq netc (mapcar 'string-to-int netc)
51 ipc (mapcar 'string-to-int ipc)
52 maskc (mapcar 'string-to-int maskc))
53 (and
54 (= (logand (nth 0 netc) (nth 0 maskc))
55 (logand (nth 0 ipc) (nth 0 maskc)))
56 (= (logand (nth 1 netc) (nth 1 maskc))
57 (logand (nth 1 ipc) (nth 1 maskc)))
58 (= (logand (nth 2 netc) (nth 2 maskc))
59 (logand (nth 2 ipc) (nth 2 maskc)))
60 (= (logand (nth 3 netc) (nth 3 maskc))
61 (logand (nth 3 ipc) (nth 3 maskc)))))))
62
63 (provide 'url-ns)