Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
dhcp
Commits
c1cc0a71
Commit
c1cc0a71
authored
Mar 06, 2000
by
Ted Lemon
Browse files
Generalize binary operator printing and add new binary operators.
parent
fa392aea
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/print.c
View file @
c1cc0a71
...
...
@@ -22,7 +22,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: print.c,v 1.4
0
2000/0
2/15 19:41:32
mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: print.c,v 1.4
1
2000/0
3/06 23:19:47
mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include
"dhcpd.h"
...
...
@@ -393,9 +393,14 @@ static unsigned print_subexpression (expr, buf, len)
break
;
case
expr_and
:
if
(
len
>
7
)
{
rv
=
5
;
strcpy
(
buf
,
"(and "
);
s
=
"and"
;
binop:
rv
=
strlen
(
s
);
if
(
len
>
rv
+
4
)
{
buf
[
0
]
=
'('
;
strcpy
(
&
buf
[
1
],
s
);
rv
+=
1
;
buf
[
rv
++
]
=
' '
;
rv
+=
print_subexpression
(
expr
->
data
.
and
[
0
],
buf
+
rv
,
len
-
rv
-
2
);
buf
[
rv
++
]
=
' '
;
...
...
@@ -408,20 +413,29 @@ static unsigned print_subexpression (expr, buf, len)
break
;
case
expr_or
:
if
(
len
>
6
)
{
rv
=
4
;
strcpy
(
buf
,
"(or "
);
rv
+=
print_subexpression
(
expr
->
data
.
or
[
0
],
buf
+
rv
,
len
-
rv
-
2
);
buf
[
rv
++
]
=
' '
;
rv
+=
print_subexpression
(
expr
->
data
.
or
[
1
],
buf
+
rv
,
len
-
rv
-
1
);
buf
[
rv
++
]
=
')'
;
buf
[
rv
]
=
0
;
return
rv
;
}
break
;
s
=
"or"
;
goto
binop
;
case
expr_add
:
s
=
"+"
;
goto
binop
;
case
expr_subtract
:
s
=
"-"
;
goto
binop
;
case
expr_multiply
:
s
=
"*"
;
goto
binop
;
case
expr_divide
:
s
=
"/"
;
goto
binop
;
case
expr_remainder
:
s
=
"%"
;
goto
binop
;
case
expr_not
:
if
(
len
>
6
)
{
rv
=
5
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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