41 | | raise RuntimeError, "Not implemented !" |
| 41 | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
| 42 | sys.argv.append("-") |
| 43 | totalsize = 0 |
| 44 | for arg in sys.argv[1:] : |
| 45 | if arg == "-" : |
| 46 | infile = sys.stdin |
| 47 | mustclose = 0 |
| 48 | else : |
| 49 | infile = open(arg, "rb") |
| 50 | mustclose = 1 |
| 51 | try : |
| 52 | parser = PDFParser(infile, debug=1) |
| 53 | totalsize += parser.getJobSize() |
| 54 | except PDLParserError, msg : |
| 55 | sys.stderr.write("ERROR: %s\n" % msg) |
| 56 | sys.stderr.flush() |
| 57 | if mustclose : |
| 58 | infile.close() |
| 59 | print "%s" % totalsize |