annotate src/dehqx.py @ 442:c36697964844

updated for version 7.0115
author vimboss
date Sun, 24 Jul 2005 21:16:51 +0000
parents 3fc0f57ecb91
children f90bb88c2615
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 # Python script to get both the data and resource fork from a BinHex encoded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 # file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 # Author: Taro Muraoka
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 # Last Change: 2003 Oct 25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 import sys
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 import binhex
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 input = sys.argv[1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 conv = binhex.HexBin(input)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 info = conv.FInfo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 out = conv.FName
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 out_data = out
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 out_rsrc = out + '.rsrcfork'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #print 'out_rsrc=' + out_rsrc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 print 'In file: ' + input
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 outfile = open(out_data, 'wb')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 print ' Out data fork: ' + out_data
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 while 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 d = conv.read(128000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 if not d: break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 outfile.write(d)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 outfile.close()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 conv.close_data()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 d = conv.read_rsrc(128000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 if d:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 print ' Out rsrc fork: ' + out_rsrc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 outfile = open(out_rsrc, 'wb')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 outfile.write(d)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 while 1:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 d = conv.read_rsrc(128000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 if not d: break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 outfile.write(d)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 outfile.close()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 conv.close()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 # vim:set ts=8 sts=4 sw=4 et: