aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/obsolete
diff options
context:
space:
mode:
authorStefan Kangas2019-10-01 16:20:02 +0200
committerStefan Kangas2019-10-01 18:05:09 +0200
commit41f59e71e2fc60a10991b4e1457fa787e87ab2b3 (patch)
treec58816d143a4b2d54189586f5a3cb6084f917196 /lisp/obsolete
parentd8e741548cd5221d51536a0cbeabde2e4d925054 (diff)
downloademacs-41f59e71e2fc60a10991b4e1457fa787e87ab2b3.tar.gz
emacs-41f59e71e2fc60a10991b4e1457fa787e87ab2b3.zip
Move url-ns.el to obsolete/
* lisp/url/url-ns.el: Move from here... * lisp/obsolete/url-ns.el: ...to here. (Bug#19822)
Diffstat (limited to 'lisp/obsolete')
-rw-r--r--lisp/obsolete/url-ns.el110
1 files changed, 110 insertions, 0 deletions
diff --git a/lisp/obsolete/url-ns.el b/lisp/obsolete/url-ns.el
new file mode 100644
index 00000000000..a301e461ad7
--- /dev/null
+++ b/lisp/obsolete/url-ns.el
@@ -0,0 +1,110 @@
1;;; url-ns.el --- Various netscape-ish functions for proxy definitions
2
3;; Copyright (C) 1997-1999, 2004-2019 Free Software Foundation, Inc.
4
5;; Keywords: comm, data, processes, hypermedia
6;; Obsolete-since: 27.1
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; This file is obsolete. For more information, see:
26;; https://debbugs.gnu.org/19822
27
28;;; Code:
29
30(require 'url-gw)
31
32;;;###autoload
33(defun isPlainHostName (host)
34 (not (string-match "\\." host)))
35
36;;;###autoload
37(defun dnsDomainIs (host dom)
38 (string-match (concat (regexp-quote dom) "$") host))
39
40;;;###autoload
41(defun dnsResolve (host)
42 (url-gateway-nslookup-host host))
43
44;;;###autoload
45(defun isResolvable (host)
46 (if (string-match "^[0-9.]+$" host)
47 t
48 (not (string= host (url-gateway-nslookup-host host)))))
49
50;;;###autoload
51(defun isInNet (ip net mask)
52 (let ((netc (split-string ip "\\."))
53 (ipc (split-string net "\\."))
54 (maskc (split-string mask "\\.")))
55 (if (or (/= (length netc) (length ipc))
56 (/= (length ipc) (length maskc)))
57 nil
58 (setq netc (mapcar 'string-to-number netc)
59 ipc (mapcar 'string-to-number ipc)
60 maskc (mapcar 'string-to-number maskc))
61 (and
62 (= (logand (nth 0 netc) (nth 0 maskc))
63 (logand (nth 0 ipc) (nth 0 maskc)))
64 (= (logand (nth 1 netc) (nth 1 maskc))
65 (logand (nth 1 ipc) (nth 1 maskc)))
66 (= (logand (nth 2 netc) (nth 2 maskc))
67 (logand (nth 2 ipc) (nth 2 maskc)))
68 (= (logand (nth 3 netc) (nth 3 maskc))
69 (logand (nth 3 ipc) (nth 3 maskc)))))))
70
71;; Netscape configuration file parsing
72(defvar url-ns-user-prefs nil
73 "Internal, do not use.")
74
75;;;###autoload
76(defun url-ns-prefs (&optional file)
77 (if (not file)
78 (setq file (expand-file-name "~/.netscape/preferences.js")))
79 (if (not (and (file-exists-p file)
80 (file-readable-p file)))
81 (message "Could not open %s for reading" file)
82 (save-excursion
83 (let ((false nil)
84 (true t))
85 (setq url-ns-user-prefs (make-hash-table :size 13 :test 'equal))
86 (set-buffer (get-buffer-create " *ns-parse*"))
87 (erase-buffer)
88 (insert-file-contents file)
89 (goto-char (point-min))
90 (while (re-search-forward "^//" nil t)
91 (replace-match ";;"))
92 (goto-char (point-min))
93 (while (re-search-forward "^user_pref(" nil t)
94 (replace-match "(url-ns-set-user-pref "))
95 (goto-char (point-min))
96 (while (re-search-forward "\"," nil t)
97 (replace-match "\""))
98 (goto-char (point-min))
99 (eval-buffer)))))
100
101(defun url-ns-set-user-pref (key val)
102 (puthash key val url-ns-user-prefs))
103
104;;;###autoload
105(defun url-ns-user-pref (key &optional default)
106 (gethash key url-ns-user-prefs default))
107
108(provide 'url-ns)
109
110;;; url-ns.el ends here