4 import string, sys, os, glob
23 m1 = string.lower( s1 )
24 m2 = string.lower( s2 )
27 if i >= l2
or m1[i] > m2[i]:
48 new_list = order_list[:]
50 if not id
in order_list:
62 if output_dir
and output_dir !=
"":
63 filename = output_dir + os.sep + filename
65 old_stdout = sys.stdout
66 new_file =
open( filename,
"w" )
69 return ( new_file, old_stdout )
76 sys.stdout = output[1]
85 if not os.path.isdir( output_dir ):
86 sys.stderr.write(
"argument" +
" '" + output_dir +
"' " + \
87 "is not a valid directory" )
94 """checks that a given file exists""" 97 file =
open( pathname,
"r" ) 101 sys.stderr.write( pathname +
" couldn't be accessed\n" )
107 """builds a list of input files from command-line arguments""" 114 for pathname
in args:
115 if string.find( pathname,
'*' ) >= 0:
116 newpath = glob.glob( pathname )
122 file_list.extend( newpath )
124 if len( file_list ) == 0:
128 file_list = filter( file_exists, file_list )
def open_output(filename)
def sort_order_list(input_list, order_list)
def make_file_list(args=None)
int open(const char *name, int flags, int mode)
def file_exists(pathname)