/[rdesktop]/jpeg/rdpproxy/trunk/txt2bin.py
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /jpeg/rdpproxy/trunk/txt2bin.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 430 - (hide annotations)
Mon Jun 30 08:59:07 2003 UTC (20 years, 10 months ago) by forsberg
Original Path: sourceforge.net/trunk/rdpproxy/txt2bin.py
File MIME type: text/x-python
File size: 947 byte(s)
This commit was generated by cvs2svn to compensate for changes in r428,
which included commits to RCS files with non-trunk default branches.

1 forsberg 429 #!/usr/bin/python
2    
3     import getopt
4     import sys
5     import string
6     import struct
7    
8     def txt2bin(infn, outfn, offset=0):
9     infile = sys.stdin
10     outfile = sys.stdout
11    
12     if '-' != infn:
13     infile = open(infn, 'r')
14    
15     if '-' != outfn:
16     outfile = open(outfn, 'w')
17    
18     bytes = infile.read().replace("\n", ' ').strip().split(' ')
19     for t in bytes[offset:]:
20     if '' == t:
21     continue
22     outfile.write(struct.pack("B", string.atoi(t, 16)))
23    
24     infile.close()
25     outfile.close()
26    
27    
28     if '__main__' == __name__:
29     offset = 0
30     optlist, args = getopt.getopt(sys.argv[1:], 'o:')
31     if len(args) < 2:
32     print "Usage: %s [-t offset] <infile> <outfile>" % sys.argv[0]
33     sys.exit(1)
34    
35     for opt, arg in optlist:
36     if '-o' == opt:
37     offset = int(arg)
38     else:
39     print "Unrecognized option %s" % opt
40     sys.exit(1)
41    
42     txt2bin(args[0], args[1], offset=offset)
43    
44    
45    
46    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26