Commit 7415bffa authored by Lev Walkin's avatar Lev Walkin

-t option and minor changes

parent b4eb8b5f
......@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
-I${top_srcdir}/libasn1parser \
-I${top_srcdir}/libasn1print \
-I${top_srcdir}/libasn1fix \
-I${top_srcdir}/skeletons \
-DDATADIR=\"${pkgdatadir}\"
LDADD = \
......@@ -15,6 +16,8 @@ LDADD = \
${top_builddir}/libasn1print/libasn1print.la \
${top_builddir}/libasn1compiler/libasn1compiler.la
asn1c_SOURCES = asn1c.c decoder.c decoder.h
bin_PROGRAMS = asn1c
dist_man1_MANS = asn1c.1
......
......@@ -14,7 +14,7 @@
@SET_MAKE@
SOURCES = asn1c.c
SOURCES = $(asn1c_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
......@@ -53,8 +53,8 @@ CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
asn1c_SOURCES = asn1c.c
asn1c_OBJECTS = asn1c.$(OBJEXT)
am_asn1c_OBJECTS = asn1c.$(OBJEXT) decoder.$(OBJEXT)
asn1c_OBJECTS = $(am_asn1c_OBJECTS)
asn1c_LDADD = $(LDADD)
asn1c_DEPENDENCIES = ${top_builddir}/libasn1parser/libasn1parser.la \
${top_builddir}/libasn1fix/libasn1fix.la \
......@@ -63,7 +63,7 @@ asn1c_DEPENDENCIES = ${top_builddir}/libasn1parser/libasn1parser.la \
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/asn1c.Po
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/asn1c.Po ./$(DEPDIR)/decoder.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
......@@ -72,8 +72,8 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = asn1c.c
DIST_SOURCES = asn1c.c
SOURCES = $(asn1c_SOURCES)
DIST_SOURCES = $(asn1c_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
......@@ -204,6 +204,7 @@ AM_CPPFLAGS = \
-I${top_srcdir}/libasn1parser \
-I${top_srcdir}/libasn1print \
-I${top_srcdir}/libasn1fix \
-I${top_srcdir}/skeletons \
-DDATADIR=\"${pkgdatadir}\"
LDADD = \
......@@ -212,6 +213,7 @@ LDADD = \
${top_builddir}/libasn1print/libasn1print.la \
${top_builddir}/libasn1compiler/libasn1compiler.la
asn1c_SOURCES = asn1c.c decoder.c decoder.h
dist_man1_MANS = asn1c.1
check_SCRIPTS = check-parsing.sh
TESTS = check-parsing.sh
......@@ -289,6 +291,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asn1c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoder.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
......
......@@ -19,14 +19,16 @@
#include <asn1c_compat.h> /* Portable basename(3) and dirname(3) */
#include "decoder.h" /* -t: decode TL[V?] string */
static void usage(char *av0); /* Print the Usage screen and exit(EX_USAGE) */
int
main(int ac, char **av) {
enum asn1p_flags asn1_parser_flags = A1P_NOFLAGS;
enum asn1f_flags asn1_fixer_flags = A1F_NOFLAGS;
enum asn1c_flags asn1_compiler_flags = A1C_NOFLAGS;
enum asn1print_flags_e print_arg__flags = APF_NOFLAGS;
enum asn1c_flags asn1_compiler_flags= A1C_NOFLAGS;
enum asn1print_flags asn1_print_flags = APF_NOFLAGS;
int print_arg__print_out = 0; /* Don't compile, just print parsed */
int print_arg__fix_n_print = 0; /* Fix and print */
int warnings_as_errors = 0; /* Treat warnings as errors */
......@@ -39,7 +41,7 @@ main(int ac, char **av) {
/*
* Process command-line options.
*/
while((ch = getopt(ac, av, "EFf:LPRS:W:")) != -1)
while((ch = getopt(ac, av, "EFf:LPRS:t:W:")) != -1)
switch(ch) {
case 'E':
print_arg__print_out = 1;
......@@ -62,13 +64,16 @@ main(int ac, char **av) {
char *known_type = optarg + 18;
ret = asn1f_make_known_external_type(known_type);
assert(ret == 0 || errno == EEXIST);
} else if(strcmp(optarg, "undoc") == 0) {
/* Enable undocumented operation */
asn1_print_flags |= APF_FULL_CONSTRAINTS;
} else {
fprintf(stderr, "-f%s: Invalid argument\n", optarg);
exit(EX_USAGE);
}
break;
case 'L':
print_arg__flags |= APF_LINE_COMMENTS;
asn1_print_flags |= APF_LINE_COMMENTS;
break;
case 'P':
asn1_compiler_flags |= A1C_PRINT_COMPILED;
......@@ -79,6 +84,10 @@ main(int ac, char **av) {
case 'S':
skeletons_dir = optarg;
break;
case 't':
if(decode_tlv_from_string(optarg))
exit(EX_DATAERR);
exit(0);
case 'W':
if(strcmp(optarg, "error") == 0) {
warnings_as_errors = 1;
......@@ -151,10 +160,10 @@ main(int ac, char **av) {
}
/*
* Dump the parsed ASN.1 tree if -E specified and -F is not given.
* Dump the parsed ASN.1 tree if -E specified and -F is NOT given.
*/
if(print_arg__print_out && !print_arg__fix_n_print) {
if(asn1print(asn, print_arg__flags))
if(asn1print(asn, asn1_print_flags))
exit(EX_SOFTWARE);
return 0;
}
......@@ -181,7 +190,7 @@ main(int ac, char **av) {
* Dump the parsed ASN.1 tree if -E specified and -F is given.
*/
if(print_arg__print_out && print_arg__fix_n_print) {
if(asn1print(asn, print_arg__flags))
if(asn1print(asn, asn1_print_flags))
exit(EX_SOFTWARE);
return 0;
}
......@@ -248,6 +257,8 @@ usage(char *av0) {
"\t \t(Default is \"%s\")\n"
"\t-R \tRestrict output (tables only, no support code)\n"
"\n"
"\t-t <data>\tDecode the given tag[/length] sequence\n"
"\n"
"\t-ftypes88\tUse only ASN.1:1988 embedded types\n"
/*
"\t-fconstr90\tUse only ASN.1:1990 constructs (not available)\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment