754 |
;; They should have the format |
;; They should have the format |
755 |
;; |
;; |
756 |
;; \s-\{2,2} - leading spaces |
;; \s-\{2,2} - leading spaces |
757 |
;; \S-\(.*\S-\)\s-* - file name, 32 chars, left bound |
;; \S-\(.*\S-\)\s-* - file name, 30 chars, left bound |
758 |
|
;; \s-+[ADHRSV]* - permissions, 7 chars, right bound |
759 |
;; \s- - space delimeter |
;; \s- - space delimeter |
760 |
;; \s-*[ADHRS]* - permissions, 5 chars, right bound |
;; \s-+[0-9]+ - size, 8 chars, right bound |
|
;; \s- - space delimeter |
|
|
;; \s-*[0-9]+ - size, 8 (Samba) or 7 (Windows) |
|
|
;; chars, right bound |
|
761 |
;; \s-\{2,2\} - space delimeter |
;; \s-\{2,2\} - space delimeter |
762 |
;; \w\{3,3\} - weekday |
;; \w\{3,3\} - weekday |
763 |
;; \s- - space delimeter |
;; \s- - space delimeter |
764 |
|
;; \w\{3,3\} - month |
765 |
|
;; \s- - space delimeter |
766 |
;; [ 19][0-9] - day |
;; [ 19][0-9] - day |
767 |
;; \s- - space delimeter |
;; \s- - space delimeter |
768 |
;; [0-9]\{2,2\}:[0-9]\{2,2\}:[0-9]\{2,2\} - time |
;; [0-9]\{2,2\}:[0-9]\{2,2\}:[0-9]\{2,2\} - time |
769 |
;; \s- - space delimeter |
;; \s- - space delimeter |
770 |
;; [0-9]\{4,4\} - year |
;; [0-9]\{4,4\} - year |
771 |
;; |
;; |
772 |
|
;; samba/src/client.c (http://samba.org/doxygen/samba/client_8c-source.html) |
773 |
|
;; has function display_finfo: |
774 |
|
;; |
775 |
|
;; d_printf(" %-30s%7.7s %8.0f %s", |
776 |
|
;; finfo->name, |
777 |
|
;; attrib_string(finfo->mode), |
778 |
|
;; (double)finfo->size, |
779 |
|
;; asctime(LocalTime(&t))); |
780 |
|
;; |
781 |
|
;; in Samba 1.9, there's the following code: |
782 |
|
;; |
783 |
|
;; DEBUG(0,(" %-30s%7.7s%10d %s", |
784 |
|
;; CNV_LANG(finfo->name), |
785 |
|
;; attrib_string(finfo->mode), |
786 |
|
;; finfo->size, |
787 |
|
;; asctime(LocalTime(&t)))); |
788 |
|
;; |
789 |
;; Problems: |
;; Problems: |
790 |
;; * Modern regexp constructs, like spy groups and counted repetitions, aren't |
;; * Modern regexp constructs, like spy groups and counted repetitions, aren't |
791 |
;; available in older Emacsen. |
;; available in older Emacsen. |
845 |
|
|
846 |
;; size |
;; size |
847 |
(if (string-match "\\([0-9]+\\)$" line) |
(if (string-match "\\([0-9]+\\)$" line) |
848 |
(setq |
(let ((length (- (max 10 (1+ (length (match-string 1 line))))))) |
849 |
size (string-to-number (match-string 1 line)) |
(setq size (string-to-number (match-string 1 line))) |
850 |
line (substring |
(when (string-match "\\([ADHRSV]+\\)" (substring line length)) |
851 |
line 0 (- (max 8 (1+ (length (match-string 1 line))))))) |
(setq length (+ length (match-end 0)))) |
852 |
|
(setq line (substring line 0 length))) |
853 |
(return)) |
(return)) |
854 |
|
|
855 |
;; mode |
;; mode: ARCH, DIR, HIDDEN, RONLY, SYSTEM, VOLID |
856 |
(if (string-match "\\(\\([ADHRS]+\\)?\\s-?\\)$" line) |
(if (string-match "\\([ADHRSV]+\\)?$" line) |
857 |
(setq |
(setq |
858 |
mode (or (match-string 2 line) "") |
mode (or (match-string 1 line) "") |
859 |
mode (save-match-data (format |
mode (save-match-data (format |
860 |
"%s%s" |
"%s%s" |
861 |
(if (string-match "D" mode) "d" "-") |
(if (string-match "D" mode) "d" "-") |
862 |
(mapconcat |
(mapconcat |
863 |
(lambda (x) "") " " |
(lambda (x) "") " " |
864 |
(concat "r" (if (string-match "R" mode) "-" "w") "x")))) |
(concat "r" (if (string-match "R" mode) "-" "w") "x")))) |
865 |
line (substring line 0 (- (1+ (length (match-string 2 line)))))) |
line (substring line 0 -7)) |
866 |
(return)) |
(return)) |
867 |
|
|
868 |
;; localname |
;; localname |
869 |
(if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-+$" line) |
(if (string-match "^\\s-+\\(\\S-\\(.*\\S-\\)?\\)\\s-*$" line) |
870 |
(setq localname (match-string 1 line)) |
(setq localname (match-string 1 line)) |
871 |
(return)))) |
(return)))) |
872 |
|
|