102 | | raise RuntimeError, "Not implemented !" |
| 102 | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
| 103 | sys.argv.append("-") |
| 104 | totalsize = 0 |
| 105 | for arg in sys.argv[1:] : |
| 106 | if arg == "-" : |
| 107 | infile = sys.stdin |
| 108 | mustclose = 0 |
| 109 | else : |
| 110 | infile = open(arg, "rb") |
| 111 | mustclose = 1 |
| 112 | try : |
| 113 | parser = PostScriptParser(infile, debug=1) |
| 114 | totalsize += parser.getJobSize() |
| 115 | except PDLParserError, msg : |
| 116 | sys.stderr.write("ERROR: %s\n" % msg) |
| 117 | sys.stderr.flush() |
| 118 | if mustclose : |
| 119 | infile.close() |
| 120 | print "%s" % totalsize |