541 | | def test() : |
542 | | """Test function.""" |
543 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
544 | | sys.argv.append("-") |
545 | | totalsize = 0 |
546 | | for arg in sys.argv[1:] : |
547 | | if arg == "-" : |
548 | | infile = sys.stdin |
549 | | mustclose = 0 |
550 | | else : |
551 | | infile = open(arg, "rb") |
552 | | mustclose = 1 |
553 | | try : |
554 | | parser = Parser(infile, debug=1) |
555 | | totalsize += parser.getJobSize() |
556 | | except pdlparser.PDLParserError, msg : |
557 | | sys.stderr.write("ERROR: %s\n" % msg) |
558 | | sys.stderr.flush() |
559 | | if mustclose : |
560 | | infile.close() |
561 | | print "%s" % totalsize |
562 | | |