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