diff options
author | Simon Josefsson <simon@josefsson.org> | 2011-10-25 15:41:14 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2011-10-25 15:41:14 +0200 |
commit | 6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f (patch) | |
tree | 1587c8082568070f23275fd45b50a133e9e754ac /src | |
parent | 26da37cb350ad84d3088cf1b07b15cf9d345edb1 (diff) | |
download | libtasn1-6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f.tar.gz libtasn1-6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f.tar.bz2 libtasn1-6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f.zip |
asn1Coding: Implement the -c parameter.
Diffstat (limited to 'src')
-rw-r--r-- | src/asn1Coding.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/asn1Coding.c b/src/asn1Coding.c index 106e0d0..3230984 100644 --- a/src/asn1Coding.c +++ b/src/asn1Coding.c @@ -309,29 +309,31 @@ main (int argc, char *argv[]) asn1_delete_structure (&definitions); asn1_delete_structure (&structure); + if (!checkSyntaxOnly) + { + if (outputFileName == NULL) + createFileName (inputFileAssignmentName, &outputFileName); - if (outputFileName == NULL) - createFileName (inputFileAssignmentName, &outputFileName); + printf ("\nOutputFile=%s\n", outputFileName); - printf ("\nOutputFile=%s\n", outputFileName); + outputFile = fopen (outputFileName, "w"); - outputFile = fopen (outputFileName, "w"); + if (outputFile == NULL) + { + printf ("asn1Coding: output file '%s' not available\n", outputFileName); + free (der); + free (inputFileAsnName); + free (inputFileAssignmentName); + free (outputFileName); + exit (1); + } - if (outputFile == NULL) - { - printf ("asn1Coding: output file '%s' not available\n", outputFileName); - free (der); - free (inputFileAsnName); - free (inputFileAssignmentName); - free (outputFileName); - exit (1); + for (k = 0; k < der_len; k++) + fprintf (outputFile, "%c", der[k]); + fclose (outputFile); + printf ("\nWriting: done.\n"); } - for (k = 0; k < der_len; k++) - fprintf (outputFile, "%c", der[k]); - fclose (outputFile); - printf ("\nWriting: done.\n"); - free (der); free (inputFileAsnName); |