use com_err/error_message API
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11314 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include "der_locl.h"
|
||||
#include <com_right.h>
|
||||
#include <com_err.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <getarg.h>
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
static struct et_list *et_list;
|
||||
|
||||
const char *class_names[] = {
|
||||
"UNIV", /* 0 */
|
||||
"APPL", /* 1 */
|
||||
@@ -99,7 +97,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
|
||||
ret = der_get_tag (buf, len, &class, &type, &tag, &sz);
|
||||
if (ret)
|
||||
errx (1, "der_get_tag: %s", com_right (et_list, ret));
|
||||
errx (1, "der_get_tag: %s", error_message (ret));
|
||||
if (sz > len)
|
||||
errx (1, "unreasonable length (%u) > %u",
|
||||
(unsigned)sz, (unsigned)len);
|
||||
@@ -114,7 +112,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
printf ("tag %d = ", tag);
|
||||
ret = der_get_length (buf, len, &length, &sz);
|
||||
if (ret)
|
||||
errx (1, "der_get_tag: %s", com_right (et_list, ret));
|
||||
errx (1, "der_get_tag: %s", error_message (ret));
|
||||
buf += sz;
|
||||
len -= sz;
|
||||
|
||||
@@ -135,7 +133,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
|
||||
ret = der_get_int (buf, length, &val, NULL);
|
||||
if (ret)
|
||||
errx (1, "der_get_int: %s", com_right (et_list, ret));
|
||||
errx (1, "der_get_int: %s", error_message (ret));
|
||||
printf ("integer %d\n", val);
|
||||
break;
|
||||
}
|
||||
@@ -146,8 +144,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
|
||||
ret = der_get_octet_string (buf, length, &str, NULL);
|
||||
if (ret)
|
||||
errx (1, "der_get_octet_string: %s",
|
||||
com_right (et_list, ret));
|
||||
errx (1, "der_get_octet_string: %s", error_message (ret));
|
||||
printf ("(length %lu), ", (unsigned long)length);
|
||||
uc = (unsigned char *)str.data;
|
||||
for (i = 0; i < 16; ++i)
|
||||
@@ -163,7 +160,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
ret = der_get_general_string (buf, length, &str, NULL);
|
||||
if (ret)
|
||||
errx (1, "der_get_general_string: %s",
|
||||
com_right (et_list, ret));
|
||||
error_message (ret));
|
||||
printf ("\"%s\"\n", str);
|
||||
free (str);
|
||||
break;
|
||||
@@ -174,8 +171,7 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
|
||||
ret = der_get_oid(buf, length, &o, NULL);
|
||||
if (ret)
|
||||
errx (1, "der_get_oid: %s",
|
||||
com_right (et_list, ret));
|
||||
errx (1, "der_get_oid: %s", error_message (ret));
|
||||
|
||||
for (i = 0; i < o.length ; i++)
|
||||
printf("%d%s", o.components[i],
|
||||
@@ -242,7 +238,7 @@ main(int argc, char **argv)
|
||||
int optind = 0;
|
||||
|
||||
setprogname (argv[0]);
|
||||
initialize_asn1_error_table_r (&et_list);
|
||||
initialize_asn1_error_table ();
|
||||
if(getarg(args, num_args, argc, argv, &optind))
|
||||
usage(1);
|
||||
if(help_flag)
|
||||
|
Reference in New Issue
Block a user