107 | | def test() : |
108 | | """Test function.""" |
109 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
110 | | sys.argv.append("-") |
111 | | totalsize = 0 |
112 | | for arg in sys.argv[1:] : |
113 | | if arg == "-" : |
114 | | infile = sys.stdin |
115 | | mustclose = 0 |
116 | | else : |
117 | | infile = open(arg, "rb") |
118 | | mustclose = 1 |
119 | | try : |
120 | | parser = Parser(infile, debug=1) |
121 | | totalsize += parser.getJobSize() |
122 | | except pdlparser.PDLParserError, msg : |
123 | | sys.stderr.write("ERROR: %s\n" % msg) |
124 | | sys.stderr.flush() |
125 | | if mustclose : |
126 | | infile.close() |
127 | | print "%s" % totalsize |
128 | | |