- # Get the assembly
- if opt_asmfile:
- try:
- asm = file(opt_asmfile).read()
- except IOError, e:
- print "Could not read asmfile %s: %s" % (e.filename, e.strerror)
- sys.exit(1)
- else:
- try:
- bin = file(opt_binfile).read()
- except IOError, e:
- print "Could not read binfile %s: %s" % (e.filename, e.strerror)
- sys.exit(1)
- asm = Disassembler(bin, "").getAsm()
+ try:
+ asm = file(opt_asmfile).read()
+ except IOError, e:
+ print "Could not read asmfile %s: %s" % (e.filename, e.strerror)
+ return 1
+ try:
+ b = B43Beautifier(asm, opt_defsfiles)
+ sys.stdout.write(b.getAsm())
+ except B43Exception:
+ return 1
+ return 0