feat: complete kyofilter with CUPS main() entrypoint
This commit is contained in:
parent
fc57b48eb8
commit
183a265d77
@ -43,5 +43,23 @@ def process_stream(lines, account_code):
|
|||||||
sys.stderr.write("kyofilter: WARNING: no injection point found in PostScript stream\n")
|
sys.stderr.write("kyofilter: WARNING: no injection point found in PostScript stream\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) < 6:
|
||||||
|
sys.stderr.write("Usage: kyofilter job-id user title copies options [file]\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
options = parse_options(sys.argv[5])
|
||||||
|
account_code = get_account_code(options)
|
||||||
|
|
||||||
|
infile = open(sys.argv[6], 'rb') if len(sys.argv) > 6 else sys.stdin.buffer
|
||||||
|
try:
|
||||||
|
for chunk in process_stream(infile, account_code):
|
||||||
|
sys.stdout.buffer.write(chunk)
|
||||||
|
finally:
|
||||||
|
if len(sys.argv) > 6:
|
||||||
|
infile.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pass
|
main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user