diff --git a/twander.py b/twander.py index 145809c..558a23a 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ 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] @@ -178,10 +178,10 @@ 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 @@ -1126,6 +1126,11 @@ 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' @@ -1142,9 +1147,23 @@ 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]