From 9c84977588b6e2e8f5388a06a4f0b9c0dd8c5850 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 12 Aug 2005 13:35:03 +0000 Subject: [PATCH] Revert. --- NEWS | 1 - src/asn1Coding.c | 24 ++++++++++++++++++++++-- src/asn1Decoding.c | 21 +++++++++++++++++++-- src/asn1Parser.c | 26 ++++++++++++++++++++++++-- 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index d279ad7..4beaafa 100644 --- 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 diff --git a/src/asn1Coding.c b/src/asn1Coding.c index 62804cb..5a7ad07 100644 --- a/src/asn1Coding.c +++ b/src/asn1Coding.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002, 2005 Fabio Fiorina + * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. * @@ -35,7 +35,10 @@ #ifdef HAVE_UNISTD_H #include #endif -#include + +#ifdef HAVE_GETOPT_H + #include +#endif char version_man[] = "asn1Coding (GNU libtasn1) " VERSION; @@ -46,6 +49,7 @@ char help_man[] = "asn1Coding generates a DER encoding from a file\n" " file with ASN1 definitions.\n" " 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 , --output 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 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; diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c index 05c5193..3176ba6 100644 --- a/src/asn1Decoding.c +++ b/src/asn1Decoding.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002, 2005 Fabio Fiorina + * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. * @@ -35,7 +35,10 @@ #ifdef HAVE_UNISTD_H #include #endif -#include + +#ifdef HAVE_GETOPT_H + #include +#endif char version_man[] = "asn1Decoding (GNU libtasn1) " VERSION; @@ -47,10 +50,17 @@ char help_man[] = "asn1Decoding generates an ASN1 type from a file\n" " file with a DER coding.\n" " 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; diff --git a/src/asn1Parser.c b/src/asn1Parser.c index 0acfd35..c67b104 100644 --- a/src/asn1Parser.c +++ b/src/asn1Parser.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002, 2005 Fabio Fiorina + * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBTASN1. * @@ -35,7 +35,10 @@ #ifdef HAVE_UNISTD_H #include #endif -#include + +#ifdef HAVE_GETOPT_H + #include +#endif char version_man[] = "asn1Parser (GNU libasn1) " VERSION; @@ -44,6 +47,7 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n" "\n" "Usage: asn1Parser [options] file\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" @@ -52,6 +56,16 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n" "Output:\n" " -o , --output output file\n" " -n , --name array name\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 output file\n" + " -n array name\n"; +#endif /********************************************************/ /* Function : main */ @@ -60,6 +74,8 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n" int main(int argc,char *argv[]) { + +#ifdef HAVE_GETOPT_LONG static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -70,6 +86,8 @@ main(int argc,char *argv[]) {0, 0, 0, 0} }; int option_index = 0; +#endif + int option_result; char *outputFileName=NULL; char *inputFileName=NULL; @@ -85,7 +103,11 @@ main(int argc,char *argv[]) while(1){ +#ifdef HAVE_GETOPT_LONG option_result=getopt_long(argc,argv,"hvco:n:",long_options,&option_index); +#else + option_result=getopt(argc,argv,"hvco:n:"); +#endif if(option_result == -1) break; -- 2.7.4