Revert.
authorSimon Josefsson <simon@josefsson.org>
Fri, 12 Aug 2005 13:35:03 +0000 (13:35 +0000)
committerSimon Josefsson <simon@josefsson.org>
Fri, 12 Aug 2005 13:35:03 +0000 (13:35 +0000)
NEWS
src/asn1Coding.c
src/asn1Decoding.c
src/asn1Parser.c

diff --git a/NEWS b/NEWS
index d279ad7..4beaafa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,5 @@
 Version 0.2.15
 - Gnulib is used to implement memmove if your system does not have it.
-- The command line tools now always use long parameters.
 - Simplified assert/error handling slightly.
 
 Version 0.2.14
index 62804cb..5a7ad07 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *      Copyright (C) 2002, 2005 Fabio Fiorina
+ *      Copyright (C) 2002 Fabio Fiorina
  *
  * This file is part of LIBTASN1.
  *
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <getopt.h>
+
+#ifdef HAVE_GETOPT_H
+  #include <getopt.h>
+#endif
 
 char version_man[] = "asn1Coding (GNU libtasn1) " VERSION;
 
@@ -46,6 +49,7 @@ char help_man[] = "asn1Coding generates a DER encoding from a file\n"
                   " <file1> file with ASN1 definitions.\n"
                   " <file2> file with assignments.\n"
                   "\n"
+#ifdef HAVE_GETOPT_LONG
                   "Operation modes:\n"
                   "  -h, --help    shows this message and exit.\n"
                   "  -v, --version shows version information and exit.\n"
@@ -53,6 +57,15 @@ char help_man[] = "asn1Coding generates a DER encoding from a file\n"
                   "\n"
                   "Output:\n"
                   "  -o <file>, --output <file>  output file.\n";
+#else
+                  "Operation modes:\n"
+                  "  -h    shows this message and exit.\n"
+                  "  -v    shows version information and exit.\n"
+                  "  -c    checks the syntax only.\n"
+                  "\n"
+                  "Output:\n"
+                  "  -o <file>  output file.\n";
+#endif
 
 
 #define ASSIGNMENT_SUCCESS 1
@@ -114,6 +127,7 @@ int
 main(int argc,char *argv[])
 {
 
+#ifdef HAVE_GETOPT_LONG
   static struct option long_options[] =
   {
     {"help",    no_argument,       0, 'h'},
@@ -123,6 +137,8 @@ main(int argc,char *argv[])
     {0, 0, 0, 0}
   };
   int option_index=0;
+#endif
+
  int option_result;
  char *outputFileName=NULL;
  char *inputFileAsnName=NULL;
@@ -146,7 +162,11 @@ main(int argc,char *argv[])
 
  while(1){
 
+#ifdef HAVE_GETOPT_LONG
    option_result=getopt_long(argc,argv,"hvco:",long_options,&option_index);
+#else
+   option_result=getopt(argc,argv,"hvco:");
+#endif
 
    if(option_result == -1) break;
 
index 05c5193..3176ba6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *      Copyright (C) 2002, 2005 Fabio Fiorina
+ *      Copyright (C) 2002 Fabio Fiorina
  *
  * This file is part of LIBTASN1.
  *
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <getopt.h>
+
+#ifdef HAVE_GETOPT_H
+  #include <getopt.h>
+#endif
 
 char version_man[] = "asn1Decoding (GNU libtasn1) " VERSION;
 
@@ -47,10 +50,17 @@ char help_man[] = "asn1Decoding generates an ASN1 type from a file\n"
                   " <file2> file with a DER coding.\n"
                   " <type>  ASN1 type name\n"
                   "\n"
+#ifdef HAVE_GETOPT_LONG
                   "Operation modes:\n"
                   "  -h, --help    shows this message and exit.\n"
                   "  -v, --version shows version information and exit.\n"
                   "  -c, --check   checks the syntax only.\n";
+#else
+                  "Operation modes:\n"
+                  "  -h    shows this message and exit.\n"
+                  "  -v    shows version information and exit.\n"
+                  "  -c    checks the syntax only.\n";
+#endif
 
 
 
@@ -62,6 +72,7 @@ int
 main(int argc,char *argv[])
 {
 
+#ifdef HAVE_GETOPT_LONG
   static struct option long_options[] =
   {
     {"help",    no_argument,       0, 'h'},
@@ -70,6 +81,8 @@ main(int argc,char *argv[])
     {0, 0, 0, 0}
   };
  int option_index = 0;
+#endif
+
  int option_result;
  char *inputFileAsnName=NULL;
  char *inputFileDerName=NULL; 
@@ -90,7 +103,11 @@ main(int argc,char *argv[])
 
  while(1){
 
+#ifdef HAVE_GETOPT_LONG
    option_result=getopt_long(argc,argv,"hvc",long_options,&option_index);
+#else
+   option_result=getopt(argc,argv,"hvc");
+#endif
 
    if(option_result == -1) break;
 
index 0acfd35..c67b104 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *      Copyright (C) 2002, 2005 Fabio Fiorina\r
+ *      Copyright (C) 2002 Fabio Fiorina\r
  *\r
  * This file is part of LIBTASN1.\r
  *\r
 #ifdef HAVE_UNISTD_H\r
 #include <unistd.h>\r
 #endif\r
-#include <getopt.h>\r
+\r
+#ifdef HAVE_GETOPT_H\r
+  #include <getopt.h>\r
+#endif\r
 \r
 char version_man[] = "asn1Parser (GNU libasn1) " VERSION;\r
 \r
@@ -44,6 +47,7 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n"
                   "\n"\r
                   "Usage: asn1Parser [options] file\n"\r
                   "\n"\r
+#ifdef HAVE_GETOPT_LONG\r
                   "Operation modes:\n"\r
                   "  -h, --help    shows this message and exit\n"\r
                   "  -v, --version shows version information and exit.\n"\r
@@ -52,6 +56,16 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n"
                   "Output:\n"\r
                   "  -o <file>, --output <file>  output file\n"\r
                   "  -n <name>, --name <name>    array name\n";\r
+#else\r
+                  "Operation modes:\n"\r
+                  "  -h    shows this message and exit\n"\r
+                  "  -v    shows version information and exit.\n"\r
+                  "  -c    checks the syntax only.\n"\r
+                  "\n"\r
+                  "Output:\n"\r
+                  "  -o <file>  output file\n"\r
+                  "  -n <name>  array name\n";\r
+#endif\r
 \r
 /********************************************************/\r
 /* Function : main                                      */\r
@@ -60,6 +74,8 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n"
 int\r
 main(int argc,char *argv[])\r
 {\r
+\r
+#ifdef HAVE_GETOPT_LONG\r
   static struct option long_options[] =\r
   {\r
     {"help",    no_argument,       0, 'h'},\r
@@ -70,6 +86,8 @@ main(int argc,char *argv[])
     {0, 0, 0, 0}\r
   };\r
   int option_index = 0;\r
+#endif\r
+\r
  int option_result;\r
  char *outputFileName=NULL;\r
  char *inputFileName=NULL;\r
@@ -85,7 +103,11 @@ main(int argc,char *argv[])
 \r
  while(1){\r
 \r
+#ifdef HAVE_GETOPT_LONG\r
    option_result=getopt_long(argc,argv,"hvco:n:",long_options,&option_index);\r
+#else\r
+   option_result=getopt(argc,argv,"hvco:n:");\r
+#endif\r
 \r
    if(option_result == -1) break;\r
 \r