Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
7bee1282
Commit
7bee1282
authored
Apr 28, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganizing output method
parent
1e1cf7cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
skeletons/asn-decoder-template.c
skeletons/asn-decoder-template.c
+22
-14
No files found.
skeletons/asn-decoder-template.c
View file @
7bee1282
...
...
@@ -30,7 +30,11 @@ static void *data_decode_from_file(asn_TYPE_descriptor_t *asnTypeOfPDU,
static
int
opt_check
;
/* -c */
static
int
opt_print
;
/* -p */
static
int
opt_stack
;
/* -s */
static
int
opt_toxml
;
/* -x */
static
enum
output_method
{
OUT_NONE
,
/* No pretty-printing */
OUT_PRINT
,
/* -p flag */
OUT_XML
,
/* -x flag */
}
opt_ometh
;
/* -p or -x */
#define DEBUG(fmt, args...) do { \
if(!opt_debug) break; \
...
...
@@ -76,8 +80,7 @@ main(int ac, char **av) {
}
break
;
case
'p'
:
opt_toxml
=
0
;
/* Override '-x' */
opt_print
++
;
opt_ometh
=
OUT_PRINT
;
break
;
case
's'
:
opt_stack
=
atoi
(
optarg
);
...
...
@@ -89,8 +92,7 @@ main(int ac, char **av) {
}
break
;
case
'x'
:
opt_print
=
0
;
/* Override '-p' */
opt_toxml
++
;
opt_ometh
=
OUT_XML
;
break
;
case
'h'
:
default:
...
...
@@ -121,7 +123,7 @@ main(int ac, char **av) {
}
#ifdef ASN_DECODER_DEFAULT_OUTPUT_XML
if
(
!
opt_print
)
opt_toxml
++
;
if
(
opt_ometh
==
OUT_NONE
)
opt_ometh
=
OUT_XML
;
#endif
setvbuf
(
stdout
,
0
,
_IOLBF
,
0
);
...
...
@@ -145,14 +147,20 @@ main(int ac, char **av) {
exit
(
EX_DATAERR
);
}
fprintf
(
stderr
,
"%s: decoded successfully
\n
"
,
fname
);
if
(
opt_print
)
asn_fprint
(
stdout
,
pduType
,
structure
);
if
(
opt_toxml
&&
xer_fprint
(
stdout
,
pduType
,
structure
))
{
fprintf
(
stderr
,
"%s: Cannot convert into XML
\n
"
,
fname
);
exit
(
EX_UNAVAILABLE
);
switch
(
opt_ometh
)
{
case
OUT_NONE
:
fprintf
(
stderr
,
"%s: decoded successfully
\n
"
,
fname
);
break
;
case
OUT_PRINT
:
/* -p */
asn_fprint
(
stdout
,
pduType
,
structure
);
break
;
case
OUT_XML
:
/* -x */
if
(
xer_fprint
(
stdout
,
pduType
,
structure
))
{
fprintf
(
stderr
,
"%s: Cannot convert into XML
\n
"
,
fname
);
exit
(
EX_UNAVAILABLE
);
}
break
;
}
/* Check ASN.1 constraints */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment