annotate lisp/url/url-nfs.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; url-nfs.el --- NFS URL interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Created: 1996/05/29 15:07:01
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Version: 1.19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: comm, data, processes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@spry.com)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (require 'url-vars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (require 'url-parse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (require 'cl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defvar url-nfs-automounter-directory-spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 "file:/net/%h%f"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 "*How to invoke the NFS automounter. Certain % sequences are recognized.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 %h -- the hostname of the NFS server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 %n -- the port # of the NFS server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 %u -- the username to use to authenticate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 %p -- the password to use to authenticate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 %f -- the filename on the remote server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 %% -- a literal %
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 Each can be used any number of times.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defun url-nfs-unescape (format host port user pass file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (set-buffer (get-buffer-create " *nfs-parse*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (insert format)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (while (re-search-forward "%\\(.\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (let ((escape (aref (match-string 1) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (replace-match "" t t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (case escape
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (?% (insert "%"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (?h (insert host))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (?n (insert (or port "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (?u (insert (or user "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (?p (insert (or pass "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (?f (insert (or file "/"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (buffer-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defun url-nfs (url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (let* ((urlobj (url-generic-parse-url url))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (host (url-host urlobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (port (string-to-int (url-port urlobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (pass (url-password urlobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (user (url-user urlobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (file (url-filename urlobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (url-retrieve (url-nfs-unescape url-nfs-automounter-directory-spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 host port user pass file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71