Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 27 lines (24 sloc) 0.614 kb
8738fc6 @phooky rough unpackbits
authored
1 #!/usr/bin/python
2 import sys
3
4 skip = int(sys.argv[1])
5 count = int(sys.argv[2])
6 sys.stdin.read(skip)
7
8 while True:
9 r = sys.stdin.read(1)
10 if not r:
11 break
12 n = ord(r[0])
13 if n < 128:
14 sys.stderr.write("COPY "+str(n+1)+"\n")
15 sys.stdout.write(sys.stdin.read(n+1))
16 elif n == 128:
17 sys.stderr.write("SKIP\n")
18 pass
19 elif n < 256:
20 count = (256-n) + 1
21 sys.stderr.write("RPT "+str(count)+"\n")
22 r = sys.stdin.read(1)
23 for i in range(count):
24 sys.stdout.write(r)
25 else:
26 sys.stderr.write("ERROR- VAL OUT OF RANGE\n")
Something went wrong with that request. Please try again.