diff options
author | Simon Josefsson <simon@josefsson.org> | 2005-08-12 13:12:07 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2005-08-12 13:12:07 +0000 |
commit | 41e487f26b3ffb7a61569bfbf4eb8f786a7b8965 (patch) | |
tree | 7f556c67093112286aa2c415ab2a246c53cef6cc /src | |
parent | 4f953fda50a112104f0ba3b1356cdc49ef716b88 (diff) | |
download | libtasn1-41e487f26b3ffb7a61569bfbf4eb8f786a7b8965.tar.gz libtasn1-41e487f26b3ffb7a61569bfbf4eb8f786a7b8965.tar.bz2 libtasn1-41e487f26b3ffb7a61569bfbf4eb8f786a7b8965.zip |
Use getopt gnulib module. Always use getopt_long.
Diffstat (limited to 'src')
-rw-r--r-- | src/asn1Coding.c | 24 | ||||
-rw-r--r-- | src/asn1Decoding.c | 21 | ||||
-rw-r--r-- | src/asn1Parser.c | 26 |
3 files changed, 6 insertions, 65 deletions
diff --git a/src/asn1Coding.c b/src/asn1Coding.c index 5a7ad07..62804cb 100644 --- a/src/asn1Coding.c +++ b/src/asn1Coding.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Fabio Fiorina + * Copyright (C) 2002, 2005 Fabio Fiorina * * This file is part of LIBTASN1. * @@ -35,10 +35,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - -#ifdef HAVE_GETOPT_H - #include <getopt.h> -#endif +#include <getopt.h> char version_man[] = "asn1Coding (GNU libtasn1) " VERSION; @@ -49,7 +46,6 @@ 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" @@ -57,15 +53,6 @@ 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 @@ -127,7 +114,6 @@ int main(int argc,char *argv[]) { -#ifdef HAVE_GETOPT_LONG static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -137,8 +123,6 @@ main(int argc,char *argv[]) {0, 0, 0, 0} }; int option_index=0; -#endif - int option_result; char *outputFileName=NULL; char *inputFileAsnName=NULL; @@ -162,11 +146,7 @@ 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 3176ba6..05c5193 100644 --- a/src/asn1Decoding.c +++ b/src/asn1Decoding.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Fabio Fiorina + * Copyright (C) 2002, 2005 Fabio Fiorina * * This file is part of LIBTASN1. * @@ -35,10 +35,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - -#ifdef HAVE_GETOPT_H - #include <getopt.h> -#endif +#include <getopt.h> char version_man[] = "asn1Decoding (GNU libtasn1) " VERSION; @@ -50,17 +47,10 @@ 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 @@ -72,7 +62,6 @@ int main(int argc,char *argv[]) { -#ifdef HAVE_GETOPT_LONG static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -81,8 +70,6 @@ main(int argc,char *argv[]) {0, 0, 0, 0} }; int option_index = 0; -#endif - int option_result; char *inputFileAsnName=NULL; char *inputFileDerName=NULL; @@ -103,11 +90,7 @@ 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 c67b104..0acfd35 100644 --- a/src/asn1Parser.c +++ b/src/asn1Parser.c @@ -1,5 +1,5 @@ /*
- * Copyright (C) 2002 Fabio Fiorina
+ * Copyright (C) 2002, 2005 Fabio Fiorina
*
* This file is part of LIBTASN1.
*
@@ -35,10 +35,7 @@ #ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-
-#ifdef HAVE_GETOPT_H
- #include <getopt.h>
-#endif
+#include <getopt.h>
char version_man[] = "asn1Parser (GNU libasn1) " VERSION;
@@ -47,7 +44,6 @@ 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"
@@ -56,16 +52,6 @@ char help_man[] = "asn1Parser reads files with ASN1 definitions and\n" "Output:\n"
" -o <file>, --output <file> output file\n"
" -n <name>, --name <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 <file> output file\n"
- " -n <name> array name\n";
-#endif
/********************************************************/
/* Function : main */
@@ -74,8 +60,6 @@ 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'},
@@ -86,8 +70,6 @@ main(int argc,char *argv[]) {0, 0, 0, 0}
};
int option_index = 0;
-#endif
-
int option_result;
char *outputFileName=NULL;
char *inputFileName=NULL;
@@ -103,11 +85,7 @@ 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;
|