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