summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2011-10-25 15:41:14 +0200
committerSimon Josefsson <simon@josefsson.org>2011-10-25 15:41:14 +0200
commit6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f (patch)
tree1587c8082568070f23275fd45b50a133e9e754ac /src
parent26da37cb350ad84d3088cf1b07b15cf9d345edb1 (diff)
downloadlibtasn1-6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f.tar.gz
libtasn1-6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f.tar.bz2
libtasn1-6172ede34fb7c69727b5e3a828ecbf0b78fe3e4f.zip
asn1Coding: Implement the -c parameter.
Diffstat (limited to 'src')
-rw-r--r--src/asn1Coding.c36
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);