+ if gopts.output_filename:
+ outfile = open(gopts.output_filename, 'w')
+ else:
+ gopts.output_filename = '-'
+ outfile = sys.stdout
+ elif la in (1, 2):
+ if (arguments[0] == '-'):
+ gopts.input_filename = '-'
+ infile = sys.stdin
+ else:
+ gopts.input_filename = arguments[0]
+ infile = open(arguments[0], 'r')
+ if la == 1:
+ if gopts.output_filename:
+ outfile = open(gopts.output_filename, 'w')
+ else:
+ gopts.output_filename = '-'
+ outfile = sys.stdout
+ elif la == 2:
+ if gopts.output_filename:
+ usage(1, 'Too many output filenames')
+ if (arguments[1] == '-'):
+ gopts.output_filename = '-'
+ outfile = sys.stdout
+ else:
+ gopts.output_filename = arguments[1]
+ outfile = open(arguments[1], 'w')