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