summaryrefslogtreecommitdiff
path: root/src/asn1Parser.c
diff options
context:
space:
mode:
authorPawel Kowalski <p.kowalski2@partner.samsung.com>2019-08-28 14:28:40 +0200
committerPawel Kowalski <p.kowalski2@partner.samsung.com>2019-08-28 14:28:40 +0200
commit26bea900a531662c6028ecc06f4adea825658434 (patch)
tree1db3d30bddc8b8336fa7a8f2bf5a3615001071e1 /src/asn1Parser.c
parente527f54afdf27ab8ce73a22d05d69e5482f5e92b (diff)
downloadlibtasn1-26bea900a531662c6028ecc06f4adea825658434.tar.gz
libtasn1-26bea900a531662c6028ecc06f4adea825658434.tar.bz2
libtasn1-26bea900a531662c6028ecc06f4adea825658434.zip
Imported Upstream version 4.14upstream/4.14
Diffstat (limited to 'src/asn1Parser.c')
-rw-r--r--src/asn1Parser.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/asn1Parser.c b/src/asn1Parser.c
index 475bfc9..b6844a8 100644
--- a/src/asn1Parser.c
+++ b/src/asn1Parser.c
@@ -25,11 +25,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
+#include <assert.h>
#include <libtasn1.h>
-#include <progname.h>
-#include <version-etc.h>
+#define program_name "asn1Parser"
/* This feature is available in gcc versions 2.5 and later. */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
@@ -58,7 +58,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-n, --name=NAME array name\n\
-h, --help display this help and exit\n\
-v, --version output version information and exit\n");
- emit_bug_reporting_address ();
+ printf ("Report bugs to "PACKAGE_BUGREPORT);
}
exit (status);
}
@@ -84,8 +84,6 @@ main (int argc, char *argv[])
char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
int parse_result = ASN1_SUCCESS;
- set_program_name (argv[0]);
-
opterr = 0; /* disable error messages from getopt */
while (1)
@@ -111,8 +109,9 @@ main (int argc, char *argv[])
usage (EXIT_SUCCESS);
break;
case 'v': /* VERSION */
- version_etc (stdout, program_name, PACKAGE, VERSION,
- "Fabio Fiorina", NULL);
+ printf(program_name" "PACKAGE" " VERSION"\n");
+ printf("Copyright (C) 2017-2019 Free Software Foundation, Inc.\n\n");
+ printf("Written by Fabio Fiorina\n");
free (outputFileName);
free (vectorName);
exit (0);
@@ -121,12 +120,22 @@ main (int argc, char *argv[])
checkSyntaxOnly = 1;
break;
case 'o': /* OUTPUT */
- outputFileName = (char *) malloc (strlen (optarg) + 1);
- strcpy (outputFileName, optarg);
+ assert(optarg != NULL);
+ outputFileName = strdup(optarg);
+ if (outputFileName == NULL)
+ {
+ fprintf(stderr, "Memory error\n");
+ exit(1);
+ }
break;
case 'n': /* VECTOR NAME */
- vectorName = (char *) malloc (strlen (optarg) + 1);
- strcpy (vectorName, optarg);
+ assert(optarg != NULL);
+ vectorName = strdup(optarg);
+ if (vectorName == NULL)
+ {
+ fprintf(stderr, "Memory error\n");
+ exit(1);
+ }
break;
case '?': /* UNKNOW OPTION */
fprintf (stderr,