66 | | def test() : |
67 | | """Test function.""" |
68 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
69 | | sys.argv.append("-") |
70 | | totalsize = 0 |
71 | | for arg in sys.argv[1:] : |
72 | | if arg == "-" : |
73 | | infile = sys.stdin |
74 | | mustclose = 0 |
75 | | else : |
76 | | infile = open(arg, "rb") |
77 | | mustclose = 1 |
78 | | try : |
79 | | parser = Parser(infile, debug=1) |
80 | | totalsize += parser.getJobSize() |
81 | | except pdlparser.PDLParserError, msg : |
82 | | sys.stderr.write("ERROR: %s\n" % msg) |
83 | | sys.stderr.flush() |
84 | | if mustclose : |
85 | | infile.close() |
86 | | print "%s" % totalsize |
87 | | |