Merge branch 'vim-with-runtime' into feat/tagfunc
[vim_extended.git] / src / dehqx.py
blob9c9cefb4f86f9faa39faf68bb08b6a50917b7c51
1 # Python script to get both the data and resource fork from a BinHex encoded
2 # file.
3 # Author: Taro Muraoka
4 # Last Change: 2003 Oct 25
6 import sys
7 import binhex
9 input = sys.argv[1]
10 conv = binhex.HexBin(input)
11 info = conv.FInfo
12 out = conv.FName
13 out_data = out
14 out_rsrc = out + '.rsrcfork'
15 #print 'out_rsrc=' + out_rsrc
16 print 'In file: ' + input
18 outfile = open(out_data, 'wb')
19 print ' Out data fork: ' + out_data
20 while 1:
21 d = conv.read(128000)
22 if not d: break
23 outfile.write(d)
24 outfile.close()
25 conv.close_data()
27 d = conv.read_rsrc(128000)
28 if d:
29 print ' Out rsrc fork: ' + out_rsrc
30 outfile = open(out_rsrc, 'wb')
31 outfile.write(d)
32 while 1:
33 d = conv.read_rsrc(128000)
34 if not d: break
35 outfile.write(d)
36 outfile.close()
38 conv.close()
40 # vim:set ts=8 sts=4 sw=4 et: