annotate lisp/efs/efs-pc.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 8fc7fe29b841
children 7e54bd776075 8619ce7e4c50
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
1 ;; -*-Emacs-Lisp-*-
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
3 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
4 ;; File: efs-pc.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Release: $efs release: 1.15 $
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
6 ;; Version: $Revision: 1.1 $
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
7 ;; RCS:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; Description: PC support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: Sandy Rutherford <sandy@tsmi19.sissa.it>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Thu Mar 18 13:06:25 1993
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Modified: Sun Nov 27 18:40:46 1994 by sandy on gandalf
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12 ;; Language: Emacs-Lisp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
13 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16 ;;; This file is part of efs. See efs.el for copyright
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17 ;;; (it's copylefted) and warrranty (there isn't one) information.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19 ;;; Thanks to jrs@world.std.com (Rick Sladkey) for providing support for
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 ;;; the Frontier Technologies Super-TCP server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22 ;;; Many thanks to the following people for beta testing:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 ;;; Mike Northam <mbn@hfglobe.intel.com>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 ;;; bagman@austin.ibm.com (Doug Bagley)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 ;;; Jens Petersen <J.Petersen@qmw.ac.uk>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26 ;;; Jeff Morgenthaler <jpmorgen@wisp4.physics.wisc.edu>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 (provide 'efs-pc)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 (defconst efs-pc-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 (concat (substring "$efs release: 1.15 $" 14 -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 (substring "$Revision: 1.1 $" 11 -2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;;;-----------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 ;;; PC support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 ;;;-----------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;; Works for the DOS FTP servers:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;;; Novell LAN WorkPlace v4.01 (NetWare & EXOS)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;;; PC/TCP Version 2.05 pl2 FTP Server by FTP Software
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;;; Microsoft FTP Server service (beta 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;;; NCSA DOS ftp server.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;;; Frontier Technologies super tcp server (runs under MS WINDOWS)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;;; Alun's Windows FTP daemon for Winsock, v1.8b
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;;; Works for IBM OS/2 TCP/IP FTP Version 1.2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;;; Currently support for all of the above FTP servers are in this file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;;; Should they live in separate files?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;;; host and listing type hierarchy in this file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;;; dos: dos:novell, dos:ftp, dos:ncsa, dos:microsoft, dos:stcp, dos:winsock
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;;; os2:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;;; DOS and OS/2 have slightly different filename syntaxes.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 ;;; DOS only allows at most one extension (".") per filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 ;;; A directory name usually has the extension ".DIR" implicit, but
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 ;;; it seems that other extensions can be used.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 ;;; OS/2 running the FAT file system uses the same 8.3 format for
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 ;;; filenames as DOS, except that extensions are allowed in directory names.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 ;;; OS/2 running the HPFS (high performance file system allows an arbitrary
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 ;;; number of extensions in a filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 ;;; Mostly these differences are unimportant here, except in the dos
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 ;;; definition of efs-allow-child-lookup.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 ;;;; ----------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 ;;;; Utility functions and macros
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 ;;;; ----------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 (defun efs-fix-pc-path (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 ;; Convert PATH from UNIX-ish to DOS or OS/2.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 ;; If REVERSE do just that.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 (let ((n 0)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 len res)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 (if (string-match "^[a-zA-Z0-9]:" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 ;; there's a disk
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 (setq res (concat "\\" path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 (setq res (copy-sequence path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 (setq len (length res))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (while (< n len)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (and (= (aref res n) ?\\ ) (aset res n ?/))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 (setq n (1+ n)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 res)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 (let ((n 0)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 len res)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 (if (string-match "^/[a-zA-Z0-9]:" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (setq res (substring path 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 (setq res (copy-sequence path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 (setq len (length res))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 (while (< n len)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 (and (= (aref res n) ?/) (aset res n ?\\ ))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 (setq n (1+ n)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 res))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 (defmacro efs-dired-pc-move-to-end-of-filename (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 ;; This is the DOS and OS/2 version. It is common to all of the PC ftp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 ;; servers since it depends only on the file name character set.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 (`
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 (null (, no-error))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 (1- (or (, bol) (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 (skip-chars-forward "-_+=a-zA-Z0-9.$~")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 (if (= opoint (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 (if (, no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 (defun efs-dired-pc-insert-headerline (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 ;; Insert a blank line for aesthetics.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (insert " \n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (forward-char -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (efs-real-dired-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 ;;;;-----------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 ;;;; General DOS support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 ;;;;-----------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 ;;; Regexps to be used for host and listing-type identification.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (defconst efs-dos:ftp-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 " *\\([0-9]+\\|<dir>\\) +\\([-_+=a-zA-Z0-9$~.]+\\)"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 " +\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) "
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 "\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 "Oct\\|Nov\\|Dec\\) [0-3][0-9] "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 (defconst efs-dos:microsoft-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 ;; matches all the way to the first char of the filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 "[01][0-9]-[0-3][0-9]-[0-9][0-9] +[012][0-9]:[0-5][0-9][AP]M +"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 "\\(<DIR>\\|[0-9]+\\) +"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 (defconst efs-dos:ncsa-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 "\\([-_+=a-zA-Z0-9$.~]+\\) +\\(<DIR>\\|[0-9]+\\)[ \n]")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 (defconst efs-dos:stcp-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 "\\([-_+=a-zA-Z0-9$~.]+\\) +\\(<DIR>\\|[0-9]+\\) "
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 "+[0-9][0-9]?-[0-3][0-9]-[12][90][0-9][0-9] +"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 "[0-9][0-9]?:[0-5][0-9]"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 (defconst efs-dos:winsock-date-and-size-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 " \\([0-9]+\\) "
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 "\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 "Dec\\) [ 0-3][0-9] \\( [12][0-9][0-9][0-9]\\|[0-2][0-9]:[0-6][0-9]\\) +"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 (efs-defun efs-parse-listing dos
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 ;; Examine the listing, which is assumed to be either a DOS or OS/2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 ;; listing, and determine the operating system type and FTP server.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 ;; No need to check for OS/2, as it gets ID'ed by a SYST in
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 ;; efs-guess-host-type.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 ;; Check for the Microsoft server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 ((re-search-forward efs-dos:microsoft-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190 (efs-add-listing-type 'dos:microsoft host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 (efs-parse-listing 'dos:microsoft host user dir path switches))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 ;; Check for the Novell FTP server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 ((save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 (goto-char (point-max))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 (forward-line -1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 (looking-at " [0-9]+ File(s)\n"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198 (efs-add-listing-type 'dos:novell host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 (efs-parse-listing 'dos:novell host user dir path switches))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 ;; Check for FTP software's server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 ((re-search-forward efs-dos:ftp-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 (efs-add-listing-type 'dos:ftp host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 (efs-parse-listing 'dos:ftp host user dir path switches))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 ;; Check for winsock
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 ((re-search-forward efs-dos:winsock-date-and-size-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 (efs-add-listing-type 'dos:winsock host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 (efs-parse-listing 'dos:winsock host user dir path switches))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 ;; Check for the NCSA FTP server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 ((re-search-forward efs-dos:ncsa-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 (efs-add-listing-type 'dos:ncsa host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214 (efs-parse-listing 'dos:ncsa host user dir path switches))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216 ;; Check for Frontier's Super-TCP server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 ((re-search-forward efs-dos:stcp-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 (efs-add-listing-type 'dos:stcp host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 (efs-parse-listing 'dos:stcp host user dir path switches))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 ((string-match "^/\\([A-Za-z0-9]:/\\)?$" dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 ;; root always exists
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 (let ((tbl (efs-make-hashtable)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 ;; an error message?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 nil))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231 ;; Some DOS servers (NCSA), return a 501 message for an empty disk.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 (efs-defun efs-ls-dumb-check dos (line host file path lsargs msg noparse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 noerror nowait cont)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 (and (string-match "^501 " line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 (string-match "^/[A-Za-z0-9]:/?$" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 (let ((parse (or (null noparse) (eq noparse 'parse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 (efs-parsable-switches-p lsargs t))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 (efs-add-to-ls-cache file lsargs "\n" parse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 (if parse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240 (efs-set-files file (let ((tbl (efs-make-hashtable)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
242 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
243 tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
244 (if nowait
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
245 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
246 (if cont
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
247 (efs-call-cont cont "\n"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
248 t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
249 (if cont
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
250 (efs-call-cont cont "\n"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
251 "\n"))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
252
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
253 (efs-defun efs-fix-path dos (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
254 (efs-fix-pc-path path reverse))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
255
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
256 (efs-defun efs-fix-dir-path dos (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
257 ;; Convert path from UNIX-ish to DOS for a DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
258 (cond ((string-match "^/\\(.:\\)?$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
259 (error "Can't list DOS or OS/2 disks"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
260 ;; Neither DOS nor OS/2 allows us to end the name of a directory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
261 ;; with an "\".
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
262 ;; Adding *.* to the end also allows us to distinguish plain files from
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
263 ;; directries. All DOS servers seem to understand this except
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
264 ;; Frontier Technologies' super-tcp server.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
265 ((string-match "/$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
266 (concat (efs-fix-pc-path dir-path) "*.*"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
267 (t (efs-fix-pc-path dir-path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
268
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
269 (efs-defun efs-get-pwd dos (host user &optional xpwd)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
270 ;; Parses PWD output for the current working directory. Hopefully this is
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
271 ;; DOS proof.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
272 (let* ((result (efs-send-cmd host user (list 'quote
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
273 (if xpwd 'xpwd 'pwd))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
274 "Getting PWD"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
275 (line (nth 1 result))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
276 dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
277 (if (car result)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
278 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
279 (and (or (string-match "\"\\([^\"]*\\)\"" line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
280 ;; FTP software's output. They should know better...
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
281 (string-match "Current working directory is +\\([^ ]+\\)$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
282 line))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
283 (setq dir (substring line
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
284 (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
285 (match-end 1))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
286 (cons dir line)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
287
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
288 (efs-defun efs-allow-child-lookup dos (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
289 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
290 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
291 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
292
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
293 ;; Subdirs in DOS usually don't have an extension.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
294 (not (string-match "\\." file)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
295
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
296 ;;;;-----------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
297 ;;;; Support for the Novell FTP server
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
298 ;;;;-----------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
299
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
300 (defconst efs-dos:novell-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
301 ;; Matches from the first character of the filename to the end of the date.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
302 ;; Does not match parent directories which the server might decide
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
303 ;; to put in front of the filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
304 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
305 "\\([-_+=a-zA-Z0-9$.~]+\\) +\\(<DIR>\\|[0-9]+\\) +"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
306 "[ 0-9][0-9]-[0-9][0-9]-[0-9][0-9] "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
307
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
308 (efs-defun efs-parse-listing dos:novell
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
309 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
310 ;; Parse the current buffer which is assumed to be a Novell DOS FTP listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
311 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
312 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
313 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
314 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
315 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
316 file size dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
317 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
318 ;; Can we check somehow if the listing is really for something
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
319 ;; that doesn't exist?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
320 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
321 (while (re-search-forward efs-dos:novell-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
322 nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
323 (setq file (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
324 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
325 size (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
326 (match-end 2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
327 (if (string-equal size "<DIR>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
328 (setq size nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
329 dir-p t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
330 (setq size (string-to-int size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
331 dir-p nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
332 (efs-put-hash-entry file (list dir-p size) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
333 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
334 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
335 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
336 tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
337
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
338 ;;; Tree Dired Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
339
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
340 (defconst efs-dired-dos:novell-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
341 "^. [ \t]+[-_+=a-zA-Z0-9$~]+\\.exe ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
342
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
343 (or (assq 'dos:novell efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
344 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
345 (cons (cons 'dos:novell efs-dired-dos:novell-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
346 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
347
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
348 (defconst efs-dired-dos:novell-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
349 "^. [ \t]+[-_+=a-zA-Z0-9$~]+ +<DIR>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
350
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
351 (or (assq 'dos:novell efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
352 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
353 (cons (cons 'dos:novell efs-dired-dos:novell-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
354 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
355
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
356 (efs-defun efs-dired-insert-headerline dos:novell (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
357 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
358
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
359 (efs-defun efs-dired-manual-move-to-filename dos:novell
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
360 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
361 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
362 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
363 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
364 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
365 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
366 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
367 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
368 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
369 ;; move over marker
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
370 (if (re-search-forward efs-dos:novell-file-line-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
371 (goto-char (match-beginning 0)) ; returns (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
372 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
373
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
374 (efs-defun efs-dired-manual-move-to-end-of-filename dos:novell
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
375 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
376 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
377 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
378 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
379 (efs-dired-pc-move-to-end-of-filename no-error bol eol))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
380
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
381 (efs-defun efs-dired-fixup-listing dos:novell
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
382 (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
383 ;; DOS may insert the entire directory name in front of the file name.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
384 ;; Scrape it off. The Novell server seems to do weird things when insert
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
385 ;; the full-path, so be liberal with the hatchet.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
386 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
387 (while (re-search-forward efs-dos:novell-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
388 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
389 (delete-region (point) (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
390 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
391 ;; the novell server outputs lines in seemingly random order
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
392 ;; this isn't as good as sorting switches, but at least it's not random.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
393 (sort-fields 1 (point-min) (progn (goto-char (point-max))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
394 (forward-line -1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
395 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
396
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
397 (efs-defun efs-dired-ls-trim dos:novell ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
398 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
399 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
400 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
401 (if (looking-at " [0-9]+ File(s)\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
402 (delete-region (match-beginning 0) (match-end 0)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
403
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
404
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
405 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
406 ;;;; PC/TCP (by FTP software) support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
407 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
408
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
409 (efs-defun efs-parse-listing dos:ftp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
410 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
411 ;; Parse the current buffer which is assumed to be an FTP Software DOS
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
412 ;; listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
413 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
414 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
415 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
416 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
417 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
418 file size dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
419 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
420 ;; Can we check somehow if an empty directory is really
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
421 ;; a nonexistent directory?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
422 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
423 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
424 (while (looking-at efs-dos:ftp-file-line-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
425 (setq file (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
426 (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
427 size (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
428 (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
429 (if (string-equal size "<dir>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
430 (setq size nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
431 dir-p t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
432 (setq size (string-to-int size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
433 dir-p nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
434 (efs-put-hash-entry file (list dir-p size) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
435 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
436 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
437 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
438 tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
439
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
440 ;;; Tree Dired Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
441
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
442 (defconst efs-dired-dos:ftp-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
443 "^. [ \t]*[0-9]+ +[-_+=a-zA-Z0-9$~]+\\.exe ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
444
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
445 (or (assq 'dos:ftp efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
446 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
447 (cons (cons 'dos:ftp efs-dired-dos:ftp-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
448 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
449
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
450 (defconst efs-dired-dos:ftp-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
451 "^. [ \t]*<dir> ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
452
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
453 (or (assq 'dos:ftp efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
454 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
455 (cons (cons 'dos:ftp efs-dired-dos:ftp-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
456 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
457
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
458 (efs-defun efs-dired-insert-headerline dos:ftp (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
459 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
460
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
461 ;;; Because dos:ftp listings have the file names right justified,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
462 ;;; I have reversed what -move-to-filename and -move-to-end-of-filename
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
463 ;;; actually do. This shouldn't confuse dired, and should make browsing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
464 ;;; a dos:ftp listing more aesthetically pleasing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
465
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
466 (efs-defun efs-dired-manual-move-to-filename dos:ftp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
467 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
468 ;; In dired, move to the *last* char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
469 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
470 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
471 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
472 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
473 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
474 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
475 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
476 (if (re-search-forward efs-dos:ftp-file-line-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
477 (goto-char (match-end 2)) ; returns (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
478 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
479
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
480 (efs-defun efs-dired-manual-move-to-end-of-filename dos:ftp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
481 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
482 ;; Assumes point is at the *end* of filename. Really moves the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
483 ;; point to the beginning of the filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
484 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
485 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
486 ;; This is the DOS version. It is common to all of the DOS ftp servers
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
487 ;; since it depends only on the file name character set.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
488 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
489 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
490 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
491 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
492 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
493 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
494 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
495 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
496 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
497 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
498 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
499 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
500 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
501 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
502 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
503 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
504 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
505 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
506 (skip-chars-backward "-_+=a-zA-Z0-9.$~" bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
507 (if (= opoint (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
508 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
509 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
510 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
511 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
512
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
513 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
514 ;;;; NCSA FTP support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
515 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
516
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
517 (efs-defun efs-parse-listing dos:ncsa
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
518 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
519 ;; Parse the current buffer which is assumed to be a Novell DOS FTP listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
520 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
521 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
522 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
523 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
524 (let (tbl file size dir-p next)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
525 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
526 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
527 (while (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
528 efs-dos:ncsa-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
529 (setq next (save-excursion (forward-line 1) (point))) t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
530 (setq file (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
531 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
532 size (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
533 (match-end 2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
534 (if (string-equal size "<DIR>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
535 (setq size nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
536 dir-p t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
537 (setq size (string-to-int size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
538 dir-p nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
539 (efs-put-hash-entry file (list dir-p size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
540 (or tbl (setq tbl (efs-make-hashtable))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
541 (goto-char next))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
542 ;; DOS does not put . and .. in the root directory.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
543 (if (or tbl
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
544 ;; root always exists
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
545 (string-match "^/\\([A-Za-z0-9]:/\\)?$" dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
546 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
547 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
548 (efs-put-hash-entry ".." '(t) tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
549 tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
550
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
551 ;;; Tree Dired Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
552
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
553 (defconst efs-dired-dos:ncsa-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
554 "^. [ \t]+[-_+=a-zA-Z0-9$~]+\\.exe ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
555
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
556 (or (assq 'dos:ncsa efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
557 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
558 (cons (cons 'dos:ncsa efs-dired-dos:ncsa-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
559 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
560
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
561 (defconst efs-dired-dos:ncsa-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
562 "^. [ \t]+[-_+=a-zA-Z0-9$~]+ +<DIR>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
563
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
564 (or (assq 'dos:ncsa efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
565 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
566 (cons (cons 'dos:ncsa efs-dired-dos:ncsa-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
567 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
568
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
569 (efs-defun efs-dired-insert-headerline dos:ncsa (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
570 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
571
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
572 (efs-defun efs-dired-manual-move-to-filename dos:ncsa
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
573 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
574 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
575 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
576 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
577 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
578 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
579 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
580 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
581 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
582 (if (re-search-forward "[-_+=a-zA-Z0-9$.~]+ +\\(<DIR>\\|[0-9]\\)" eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
583 (goto-char (match-beginning 0)) ; returns (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
584 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
585
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
586 (efs-defun efs-dired-manual-move-to-end-of-filename dos:ncsa
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
587 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
588 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
589 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
590 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
591 (efs-dired-pc-move-to-end-of-filename no-error bol eol))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
592
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
593 (efs-defun efs-dired-fixup-listing dos:ncsa
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
594 (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
595 ;; DOS may insert the entire directory name in front of the file name.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
596 ;; Scrape it off.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
597 (let (bonl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
598 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
599 (while (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
600 efs-dos:ncsa-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
601 (setq bonl (save-excursion (forward-line 1) (point))) t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
602 (goto-char (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
603 (delete-region (point) (progn (beginning-of-line) (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
604 (goto-char bonl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
605 ;; sort the buffer
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
606 (sort-fields 1 (point-min) (point-max)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
607
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
608 (efs-defun efs-dired-ls-trim dos:ncsa ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
609 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
610 (if (re-search-forward efs-dos:ncsa-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
611 (delete-region (point-min) (match-beginning 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
612
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
613 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
614 ;;;; Microsoft DOS FTP support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
615 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
616
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
617 (defconst efs-dos:microsoft-valid-listing-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
618 (concat efs-dos:microsoft-file-line-regexp "\\."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
619
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
620 (efs-defun efs-parse-listing dos:microsoft
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
621 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
622 ;; Parse the current buffer which is assumed to be a Novell DOS FTP listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
623 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
624 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
625 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
626 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
627
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
628 ;; Use the existence of a "." file as confirmation that it's really
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
629 ;; a directory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
630 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
631 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
632 (if (or (string-match "^/.:/$" dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
633 (re-search-forward efs-dos:microsoft-valid-listing-regexp nil t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
634 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
635 size dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
636 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
637 (while (re-search-forward efs-dos:microsoft-file-line-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
638 (setq size (buffer-substring (match-beginning 1) (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
639 (if (string-equal size "<DIR>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
640 (setq size nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
641 dir-p t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
642 (setq size (string-to-int size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
643 dir-p nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
644 (efs-put-hash-entry (buffer-substring (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
645 (progn (end-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
646 (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
647 (list dir-p size) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
648 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
649 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
650 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
651 tbl))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
652
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
653 ;;; Tree Dired Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
654
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
655 (defconst efs-dired-dos:microsoft-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
656 "^[^\n]+ +[-_+=a-zA-Z0-9$~]+\\.\\(EXE\\|exe\\)$")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
657
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
658 (or (assq 'dos:microsoft efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
659 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
660 (cons (cons 'dos:microsoft efs-dired-dos:microsoft-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
661 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
662
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
663 (defconst efs-dired-dos:microsoft-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
664 "^[^\n]+ <DIR> ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
665
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
666 (or (assq 'dos:microsoft efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
667 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
668 (cons (cons 'dos:microsoft efs-dired-dos:microsoft-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
669 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
670
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
671 (efs-defun efs-dired-insert-headerline dos:microsoft (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
672 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
673
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
674 (efs-defun efs-dired-manual-move-to-filename dos:microsoft
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
675 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
676 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
677 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
678 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
679 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
680 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
681 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
682 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
683 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
684 (if (re-search-forward efs-dos:microsoft-file-line-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
685 (goto-char (match-end 0)) ; returns (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
686 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
687
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
688 (efs-defun efs-dired-manual-move-to-end-of-filename dos:microsoft
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
689 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
690 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
691 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
692 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
693 (efs-dired-pc-move-to-end-of-filename no-error bol eol))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
694
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
695 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
696 ;;;; Frontier's Super-TCP FTP Server for Windows
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
697 ;;;;-----------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
698
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
699 (efs-defun efs-parse-listing dos:stcp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
700 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
701 ;; Parse the current buffer which is assumed to be a Super-TCP FTP listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
702 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
703 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
704 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
705 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
706
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
707 ;; Use the existence of a strict file line pattern as
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
708 ;; confirmation that it's really a directory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
709 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
710 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
711 (let ((regexp (concat "^" efs-dos:stcp-file-line-regexp)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
712 (if (let ((eol (save-excursion (end-of-line) (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
713 (re-search-forward regexp eol t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
714 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
715 size dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
716 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
717 (while (re-search-forward regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
718 (setq size (buffer-substring (match-beginning 2) (match-end 2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
719 (if (string-equal size "<DIR>")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
720 (setq size nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
721 dir-p t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
722 (setq size (string-to-int size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
723 dir-p nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
724 (efs-put-hash-entry (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
725 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
726 (list dir-p size) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
727 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
728 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
729 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
730 tbl)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
731
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
732 ;;; Tree Dired Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
733
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
734 (defconst efs-dired-dos:stcp-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
735 "^[-_+=a-zA-Z0-9$~]+\\.\\(EXE\\|exe\\) ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
736
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
737 (or (assq 'dos:stcp efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
738 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
739 (cons (cons 'dos:stcp efs-dired-dos:stcp-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
740 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
741
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
742 (defconst efs-dired-dos:stcp-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
743 "^[^\n ]+ +<DIR> ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
744
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
745 (or (assq 'dos:stcp efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
746 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
747 (cons (cons 'dos:stcp efs-dired-dos:stcp-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
748 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
749
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
750 (efs-defun efs-dired-insert-headerline dos:stcp (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
751 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
752
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
753 (efs-defun efs-dired-manual-move-to-filename dos:stcp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
754 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
755 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
756 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
757 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
758 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
759 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
760 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
761 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
762 (skip-chars-backward "^\n\r")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
763 (setq bol (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
764 (if (re-search-forward efs-dos:stcp-file-line-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
765 (goto-char (match-beginning 0)) ; returns (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
766 (if raise-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
767 (error "No file on this line")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
768 (goto-char bol)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
769
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
770 (efs-defun efs-dired-manual-move-to-end-of-filename dos:stcp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
771 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
772 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
773 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
774 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
775 (efs-dired-pc-move-to-end-of-filename no-error bol eol))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
776
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
777 (efs-defun efs-dired-fixup-listing dos:stcp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
778 (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
779 ;; The Super-TCP server outputs lines in seemingly random order.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
780 ;; This isn't as good as sorting switches, but at least it's not random.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
781 (sort-fields 1 (point-min) (point-max)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
782
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
783 ;;;;----------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
784 ;;;; Winsock DOS FTP server (Alun's FTP server)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
785 ;;;;----------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
786
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
787 (efs-defun efs-parse-listing dos:winsock
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
788 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
789 ;; Parse the current buffer which is assumed to be a DOS Winsock listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
790 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
791 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
792 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
793 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
794
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
795 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
796 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
797 (if (re-search-forward efs-dos:winsock-date-and-size-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
798 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
799 size dirp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
800 (while
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
801 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
802 (setq size (string-to-int (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
803 (match-end 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
804 dirp (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
805 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
806 (skip-chars-forward " ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
807 (char-equal (following-char) ?d)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
808 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
809 (buffer-substring (point) (progn (end-of-line) (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
810 (list dirp size) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
811 (re-search-forward efs-dos:winsock-date-and-size-regexp nil t)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
812 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
813 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
814 tbl))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
815
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
816 (defconst efs-dired-dos:winsock-re-exe "\\.exe$")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
817
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
818 (or (assq 'dos:winsock efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
819 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
820 (cons (cons 'dos:winsock efs-dired-dos:winsock-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
821 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
822
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
823 (defconst efs-dired-dos:winsock-re-dir "^. +d")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
824
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
825 (or (assq 'dos:winsock efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
826 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
827 (cons (cons 'dos:winsock efs-dired-dos:winsock-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
828 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
829
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
830 (efs-defun efs-dired-insert-headerline dos:winsock (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
831 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
832
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
833 (efs-defun efs-dired-manual-move-to-filename dos:winsock
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
834 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
835 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
836 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
837 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
838 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
839 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
840 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
841 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
842 (skip-chars-backward "^\n\r")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
843 (setq bol (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
844 (if (re-search-forward efs-dos:winsock-date-and-size-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
845 (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
846 (if raise-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
847 (error "No file on this line")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
848 (goto-char bol)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
849
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
850 (efs-defun efs-dired-manual-move-to-end-of-filename dos:winsock
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
851 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
852 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
853 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
854 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
855 (efs-dired-pc-move-to-end-of-filename no-error bol eol))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
856
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
857 (efs-defun efs-dired-fixup-listing dos:winsock
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
858 (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
859 ;; The Winsock server outputs lines in seemingly random order.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
860 ;; This isn't as good as sorting switches, but at least it's not random.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
861 (sort-fields 9 (point-min) (point-max)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
862
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
863 ;;;;-----------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
864 ;;;; OS/2 Support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
865 ;;;;-----------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
866
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
867 ;;; OS/2 has two types of file systems, FAT and HPFS. In the FAT file system
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
868 ;;; filenames are restricted to the traditional DOS 8 + 3 syntax. In the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
869 ;;; HPFS file system, filenames can have arbitrarily many extensions (.'s).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
870 ;;; As well, file lines for "." and ".." are listed for HPFS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
871 ;;; For the FAT FS, "." and ".." lines are only listed for sudirs, it seems.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
872 ;;; Go figure...
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
873
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
874 (defconst efs-os2-file-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
875 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
876 " +\\([0-9]+\\) +\\([^ ]+\\)? +[01][0-9]-[0-3][0-9]-[0-9][0-9] +"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
877 "[0-2][0-9]:[0-6][0-9] +"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
878
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
879 (efs-defun efs-fix-path os2 (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
880 (efs-fix-pc-path path reverse))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
881
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
882 (efs-defun efs-fix-dir-path os2 (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
883 ;; Convert path from UNIX-ish to DOS for a DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
884 (cond ((string-match "^/\\(.:\\)?$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
885 (error "Can't list DOS or OS/2 disks"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
886 ;; Neither DOS nor OS/2 allows us to end the name of a directory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
887 ;; with an "\".
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
888 ;; Can't just hack it off, because if the dir is C:, we'll get the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
889 ;; default dir.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
890 ;; Don't apend the filename wildcard to distinguish
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
891 ;; plain files from directories, because OS/2 and DOS may
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
892 ;; not agree on what the wildcard is. Also, can't then tell
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
893 ;; the difference between plain files and empty directories.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
894 ((string-match "/$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
895 (concat (efs-fix-pc-path dir-path) "."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
896 (t (efs-fix-pc-path dir-path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
897
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
898 (defconst efs-os2-dot-line-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
899 (concat efs-os2-file-line-regexp "\\.\n"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
900
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
901 (efs-defun efs-parse-listing os2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
902 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
903 ;; Parse the current buffer which is assumed to be an OS/2 listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
904 ;; To make sure that it is really a directory listing and not a bogus
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
905 ;; listing of a single file, make sure that there is an entry for ".".
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
906 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
907 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
908 ;; DIR = directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
909 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
910 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
911 (if (or
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
912 (string-match "^/.:/$" dir) ; FAT proofing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
913 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
914 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
915 (re-search-forward efs-os2-dot-line-regexp nil t)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
916 (let ((tbl (efs-make-hashtable)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
917 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
918 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
919 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
920 (while (looking-at efs-os2-file-line-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
921 (end-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
922 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
923 (buffer-substring (match-end 0) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
924 (list (and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
925 (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
926 (string-equal "DIR"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
927 (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
928 (match-end 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
929 (string-to-int (buffer-substring (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
930 (match-end 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
931 tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
932 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
933 tbl))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
934
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
935 ;;; Tree Dired
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
936
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
937 (defconst efs-dired-os2-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
938 "^[^\n]+\\.EXEC?$")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
939
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
940 (or (assq 'os2 efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
941 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
942 (cons (cons 'os2 efs-dired-os2-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
943 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
944
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
945 (defconst efs-dired-os2-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
946 "^ +[0-9]+ +DIR ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
947
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
948 (or (assq 'os2 efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
949 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
950 (cons (cons 'os2 efs-dired-os2-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
951 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
952
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
953 (efs-defun efs-dired-manual-move-to-filename os2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
954 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
955 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
956 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
957 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
958 ;; This version is for OS/2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
959 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
960 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
961 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
962 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
963 (skip-chars-backward "^\n\r")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
964 (setq bol (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
965 (if (and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
966 (> (- eol bol) 24)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
967 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
968 (forward-char 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
969 (looking-at efs-os2-file-line-regexp)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
970 (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
971 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
972
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
973 (efs-defun efs-dired-manual-move-to-end-of-filename os2
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
974 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
975 (efs-dired-pc-move-to-end-of-filename no-error bol eol))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
976
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
977 (efs-defun efs-dired-insert-headerline os2 (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
978 (efs-dired-pc-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
979
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
980 ;; end of efs-pc.el