Skip to content
Snippets Groups Projects
Commit f90264d5 authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

...

parent bd6d584e
No related branches found
No related tags found
No related merge requests found
......@@ -3,14 +3,14 @@
import sys
from trans import pretty_c14n
def error_and_exit(x):
def error_exit(x):
print('ERROR: ', str(x), file=sys.stderr)
sys.exit(1)
if len(sys.argv) < 3:
error_and_exit('too few arguments')
error_exit('too few arguments')
if sys.argv[1] == sys.argv[2]:
error_and_exit('"infile" and "outfile" must be different')
error_exit('"infile" and "outfile" must be different')
infile = sys.argv[1]
outfile = sys.argv[2]
......@@ -21,12 +21,12 @@ try:
with open(outfile, 'w') as f2:
err, xml = pretty_c14n(xml)
if err:
error_and_exit(xml)
error_exit(xml)
f2.write(xml)
except Exception as error:
error_and_exit(error)
error_exit(error)
print('\nFile »' + infile + '« was successfully canonized to file »' + \
print('\nFile »' + infile + '« was successfully canonicalized to file »' + \
outfile + '«\n')
sys.exit(0)
......@@ -39,7 +39,6 @@ def cert_to_xml(cert_doc):
err, xml = pretty_c14n(xml)
if err:
xml = '<error>' + xml + '</error>\n'
except Exception as error:
xml = '<error>' + str(error) + '</error>\n'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment