Replaced individual column calculations w/ divmod()
Based version string on RCS information
1 parent 5c07dd5 commit bd76452de73cb5e147e526363ccecd17ab2e1351
@tundra tundra authored on 23 Jun 2001
Showing 1 changed file
View
17
tdir
tdir - Display Formatted Directory Listings
Copyright (c) 2001, TundraWare Inc., All Rights Reserved.
"""
 
# python Library Imports
 
import getopt
import os
import string
import sys
 
# Version info
 
VERSION = "$Id: tdir,v 1.52 2001/06/24 00:54:18 tundra Exp $"
 
 
# Booleans
 
FALSE = 0
 
OWIDTH = 80 # Output width
COLWIDTH = 19 # Width of each column
TWIDTH = COLWIDTH - 1 # Text width
MAXCOL = OWIDTH/COLWIDTH # Number of output columns
INDENT = OWIDTH%COLWIDTH # Indentation of main listing
MAXCOL, INDENT = divmod(OWIDTH, COLWIDTH) # No of output cols & indent
PAD = " " # Padding character
SEP = "." # Filename "extension" separator
TRUNC = "^" # Character indicating name truncation
 
# Misc.
 
RECURSE = FALSE # No recursion is the default
VERSION = "tdir Version 1.51 - Released 2001-06-20"
 
 
def OrderByExtension(list):
ExtList = {}
ExtList[""] = [] # List of files with no extension
sys.stdout.write("Huh? Column width exceeds output width!\n")
sys.exit(2)
TWIDTH = COLWIDTH - 1 # Text width
MAXCOL = OWIDTH/COLWIDTH # Number of output columns
INDENT = OWIDTH%COLWIDTH # Indentation of main listing
MAXCOL, INDENT = divmod(OWIDTH, COLWIDTH) # No of output cols & indent
 
if len(args) == 0: # Default to local directory if none given
args = ["./"]