/[meta-cvs]/meta-cvs/F-6BD7679FED76D6E5A7D36DC36C205FC1.lisp
ViewVC logotype

Diff of /meta-cvs/F-6BD7679FED76D6E5A7D36DC36C205FC1.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by kaz, Sat Aug 31 20:53:13 2002 UTC revision 1.6 by kaz, Fri Sep 6 02:17:27 2002 UTC
# Line 141  Line 141 
141  (defgeneric symlink-p (file))  (defgeneric symlink-p (file))
142  (defgeneric is-root-p (file))  (defgeneric is-root-p (file))
143  (defgeneric get-parent (file))  (defgeneric get-parent (file))
144    (defgeneric executable-p (file))
145    (defgeneric make-executable (file))
146    (defgeneric make-non-executable (file))
147    
148  (defmethod same-file-p ((f1 file-info) (f2 file-info))  (defmethod same-file-p ((f1 file-info) (f2 file-info))
149    (= (inode f1) (inode f2)))    (= (inode f1) (inode f2)))
# Line 194  Line 197 
197  (defmethod get-parent ((filename string))  (defmethod get-parent ((filename string))
198    (stat (format nil "~a/.." filename)))    (stat (format nil "~a/.." filename)))
199    
200    (defmethod executable-p ((file file-info))
201      (with-slots ((mode mode-flags)) file
202        (and (not (zerop (logand mode unix-funcs:s-ixusr)))
203             (not (zerop (logand mode unix-funcs:s-ixgrp))))))
204    
205    (defmethod make-executable ((file file-info))
206      (with-slots ((mode mode-flags) file-name) file
207        (let ((saved-mode mode))
208          (unless (zerop (logand mode unix-funcs:s-irusr))
209            (setf mode (logior mode unix-funcs:s-ixusr)))
210          (unless (zerop (logand mode unix-funcs:s-irgrp))
211            (setf mode (logior mode unix-funcs:s-ixgrp)))
212          (unless (zerop (logand mode unix-funcs:s-iroth))
213            (setf mode (logior mode unix-funcs:s-ixoth)))
214          (unless (= mode saved-mode)
215            (unix-funcs:chmod file-name mode)))))
216    
217    (defmethod make-executable ((filename string))
218      (make-executable (stat filename)))
219    
220    (defmethod make-non-executable ((file file-info))
221      (with-slots ((mode mode-flags) file-name) file
222        (let ((saved-mode mode))
223          (setf mode (logand mode
224                             (lognot (logior unix-funcs:s-ixusr
225                                             unix-funcs:s-ixgrp
226                                             unix-funcs:s-ixoth))))
227          (unless (= mode saved-mode)
228            (unix-funcs:chmod file-name mode)))))
229    
230    (defmethod make-non-executable ((filename string))
231      (make-non-executable (stat filename)))
232    
233  (defun stat (name &key through-link)  (defun stat (name &key through-link)
234    (if (typep name 'file-info)    (if (typep name 'file-info)
235      name      name

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.5