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