asn1Coding: Implement the -c parameter.
authorSimon Josefsson <simon@josefsson.org>
Tue, 25 Oct 2011 13:41:14 +0000 (15:41 +0200)
committerSimon Josefsson <simon@josefsson.org>
Tue, 25 Oct 2011 13:41:14 +0000 (15:41 +0200)
NEWS
src/asn1Coding.c

diff --git a/NEWS b/NEWS
index 8c91b4c..49f0c36 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ GNU Libtasn1 NEWS                                     -*- outline -*-
 
 * Noteworthy changes in release 2.10 (????-??-??) [stable]
 - build: Update gnulib files.
+- asn1Coding: actually implement the -c parameter.
 
 * Noteworthy changes in release 2.9 (2010-12-06) [stable]
 - tests: Link to gnulib to avoid build error related to 'rpl_ftello' on Solaris.
index 106e0d0..3230984 100644 (file)
@@ -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);