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