659 | | def test() : |
660 | | """Test function.""" |
661 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
662 | | sys.argv.append("-") |
663 | | totalsize = 0 |
664 | | for arg in sys.argv[1:] : |
665 | | if arg == "-" : |
666 | | infile = sys.stdin |
667 | | mustclose = 0 |
668 | | else : |
669 | | infile = open(arg, "rb") |
670 | | mustclose = 1 |
671 | | try : |
672 | | parser = Parser(infile, debug=1) |
673 | | totalsize += parser.getJobSize() |
674 | | except pdlparser.PDLParserError, msg : |
675 | | sys.stderr.write("ERROR: %s\n" % msg) |
676 | | sys.stderr.flush() |
677 | | if mustclose : |
678 | | infile.close() |
679 | | print "%s" % totalsize |
680 | | |