81 | | def test() : |
82 | | """Test function.""" |
83 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
84 | | sys.argv.append("-") |
85 | | totalsize = 0 |
86 | | for arg in sys.argv[1:] : |
87 | | if arg == "-" : |
88 | | infile = sys.stdin |
89 | | mustclose = 0 |
90 | | else : |
91 | | infile = open(arg, "rb") |
92 | | mustclose = 1 |
93 | | try : |
94 | | parser = Parser(infile, debug=1) |
95 | | totalsize += parser.getJobSize() |
96 | | except pdlparser.PDLParserError, msg : |
97 | | sys.stderr.write("ERROR: %s\n" % msg) |
98 | | sys.stderr.flush() |
99 | | if mustclose : |
100 | | infile.close() |
101 | | print "%s" % totalsize |
102 | | |