296 | | def test() : |
297 | | """Test function.""" |
298 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
299 | | sys.argv.append("-") |
300 | | totalsize = 0 |
301 | | for arg in sys.argv[1:] : |
302 | | if arg == "-" : |
303 | | infile = sys.stdin |
304 | | mustclose = 0 |
305 | | else : |
306 | | infile = open(arg, "rb") |
307 | | mustclose = 1 |
308 | | try : |
309 | | parser = Parser(infile, debug=1) |
310 | | totalsize += parser.getJobSize() |
311 | | except pdlparser.PDLParserError, msg : |
312 | | sys.stderr.write("ERROR: %s\n" % msg) |
313 | | sys.stderr.flush() |
314 | | if mustclose : |
315 | | infile.close() |
316 | | print "%s" % totalsize |
317 | | |