0
|
1 ;;; url-nfs.el --- NFS URL interface
|
|
2 ;; Author: wmperry
|
|
3 ;; Created: 1996/05/29 15:07:01
|
|
4 ;; Version: 1.19
|
|
5 ;; Keywords: comm, data, processes
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@spry.com)
|
|
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
|
|
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
26
|
|
27 (require 'url-vars)
|
|
28 (require 'url-parse)
|
|
29 (require 'cl)
|
|
30
|
|
31 (defvar url-nfs-automounter-directory-spec
|
|
32 "file:/net/%h%f"
|
|
33 "*How to invoke the NFS automounter. Certain % sequences are recognized.
|
|
34
|
|
35 %h -- the hostname of the NFS server
|
|
36 %n -- the port # of the NFS server
|
|
37 %u -- the username to use to authenticate
|
|
38 %p -- the password to use to authenticate
|
|
39 %f -- the filename on the remote server
|
|
40 %% -- a literal %
|
|
41
|
|
42 Each can be used any number of times.")
|
|
43
|
|
44 (defun url-nfs-unescape (format host port user pass file)
|
|
45 (save-excursion
|
|
46 (set-buffer (get-buffer-create " *nfs-parse*"))
|
|
47 (erase-buffer)
|
|
48 (insert format)
|
|
49 (goto-char (point-min))
|
|
50 (while (re-search-forward "%\\(.\\)" nil t)
|
|
51 (let ((escape (aref (match-string 1) 0)))
|
|
52 (replace-match "" t t)
|
|
53 (case escape
|
|
54 (?% (insert "%"))
|
|
55 (?h (insert host))
|
|
56 (?n (insert (or port "")))
|
|
57 (?u (insert (or user "")))
|
|
58 (?p (insert (or pass "")))
|
|
59 (?f (insert (or file "/"))))))
|
|
60 (buffer-string)))
|
|
61
|
|
62 (defun url-nfs (url)
|
|
63 (let* ((urlobj (url-generic-parse-url url))
|
|
64 (host (url-host urlobj))
|
|
65 (port (string-to-int (url-port urlobj)))
|
|
66 (pass (url-password urlobj))
|
|
67 (user (url-user urlobj))
|
|
68 (file (url-filename urlobj)))
|
|
69 (url-retrieve (url-nfs-unescape url-nfs-automounter-directory-spec
|
|
70 host port user pass file))))
|
|
71
|