| |
---|
| | # Copyright (c) 2002 TundraWare Inc. All Rights Reserved. |
---|
| | |
---|
| | |
---|
| | PROGNAME = "twander" |
---|
| | RCSID = "$Id: twander.py,v 1.86 2002/11/27 03:13:09 tundra Exp $" |
---|
| | RCSID = "$Id: twander.py,v 1.87 2002/12/01 16:45:57 tundra Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | |
---|
| | #----------------------------------------------------------# |
---|
| |
---|
| | ST_SZNLINK = 5 |
---|
| | ST_SZUNAME = 12 |
---|
| | ST_SZGNAME = 12 |
---|
| | ST_SZLEN = 12 |
---|
| | ST_SZCTIME = 21 |
---|
| | ST_SZMTIME = 18 |
---|
| | |
---|
| | ST_SZTOTAL = ST_SZMODE + ST_SZNLINK + ST_SZUNAME + ST_SZGNAME + \ |
---|
| | ST_SZLEN + ST_SZCTIME |
---|
| | ST_SZLEN + ST_SZMTIME |
---|
| | |
---|
| | |
---|
| | # String used to separate symlink entry from its real path |
---|
| | |
---|
| |
---|
| | if OSNAME == 'posix': |
---|
| | owner = pwd.getpwuid(stinfo[ST_UID])[0][:ST_SZUNAME-1] |
---|
| | group = grp.getgrgid(stinfo[ST_GID])[0][:ST_SZGNAME-1] |
---|
| | |
---|
| | # Handle Win32 systems |
---|
| | elif OSNAME == 'nt': |
---|
| | owner = 'win32user' |
---|
| | group = 'win32group' |
---|
| | |
---|
| | # Default names for all other OSs |
---|
| | else: |
---|
| | owner = OSNAME + 'user' |
---|
| | group = OSNAME + 'group' |
---|
| |
---|
| | flen = FileLength(stinfo[ST_SIZE]) |
---|
| | UI.TotalSize += stinfo[ST_SIZE] |
---|
| | detlist[index] += flen + (ST_SZLEN - len(flen)) * " " |
---|
| | |
---|
| | # Ctime |
---|
| | ftime = " ".join(time.ctime(stinfo[ST_CTIME]).split()[1:]) |
---|
| | detlist[index] += ftime + (ST_SZCTIME - len(ftime)) * " " |
---|
| | # mtime |
---|
| | |
---|
| | # Get the whole time value |
---|
| | ftime = time.ctime(stinfo[ST_MTIME]).split()[1:] |
---|
| | |
---|
| | # Pad single-digit dates with leading space |
---|
| | |
---|
| | if len(ftime[1]) == 1: |
---|
| | ftime[1] = " " + ftime[1] |
---|
| | |
---|
| | # Drop the seconds |
---|
| | ftime[-2] = ":".join(ftime[-2].split(":")[:-1]) |
---|
| | |
---|
| | # Turn into a single string |
---|
| | ftime = " ".join(ftime) |
---|
| | |
---|
| | detlist[index] += ftime + (ST_SZMTIME - len(ftime)) * " " |
---|
| | |
---|
| | # File name |
---|
| | detlist[index] += all[index] |
---|
| | |
---|
| |
---|
| | |