Changeset 872:6ee82a8d62dd

Show
Ignore:
Timestamp:
2010-06-17 10:39:38 (3 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Support for more file type characters.

TODO: support "S" (for user and group), "t" and "T" (see `ls`
manpage).
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ftp_stat.py

    r870 r872  
    9898        `ftp_error.ParserError`. 
    9999        """ 
    100         st_mode = 0 
    101100        if len(mode_string) != 10: 
    102101            raise ftp_error.ParserError("invalid mode string '%s'" % 
    103102                                        mode_string) 
     103        st_mode = 0 
     104        #TODO add support for "S" and sticky bit ("t", "T") 
    104105        for bit in mode_string[1:10]: 
    105106            bit = (bit != '-') 
     
    109110        if mode_string[6] == 's': 
    110111            st_mode = st_mode | stat.S_ISGID 
    111         file_type_to_mode = {'d': stat.S_IFDIR, 'l': stat.S_IFLNK, 
    112                              'c': stat.S_IFCHR, '-': stat.S_IFREG, 
    113                              's': stat.S_IFSOCK, 
     112        file_type_to_mode = {'b': stat.S_IFBLK, 'c': stat.S_IFCHR, 
     113                             'd': stat.S_IFDIR, 'l': stat.S_IFLNK, 
     114                             'p': stat.S_IFIFO, 's': stat.S_IFSOCK, 
     115                             '-': stat.S_IFREG, 
     116                             # ignore types which `ls` can't make sense of 
     117                             #  (assuming the FTP server behaves like `ls`) 
     118                             '?': 0, 
    114119                            } 
    115120        file_type = mode_string[0]