diff --git a/bin/Zaliases b/bin/Zaliases index f7c4ddff..8091a62b 100644 --- a/bin/Zaliases +++ b/bin/Zaliases @@ -1,6 +1,8 @@ set top_src=`pwd` alias Zautoreconf "(cd $top_src ; autoreconf --install)" +set ZENV="" + switch ( `uname` ) case FreeBSD*: set ZENV="MAKE=gmake " diff --git a/doc/field-roles.rst b/doc/field-roles.rst index 4de810c6..3499aea8 100644 --- a/doc/field-roles.rst +++ b/doc/field-roles.rst @@ -180,6 +180,11 @@ Labels are text that appears before a value:: xo_emit("{Lwc:Cost}{:cost/%u}\n", cost); +If a label needs to include a slash, it must be escaped using two +backslashes, one for the C compiler and one for libxo:: + + xo_emit("{Lc:Low\\/warn level}{:level/%s}\n", level); + .. index:: Field Roles; Note .. _note-role: diff --git a/libxo/xo_format.5 b/libxo/xo_format.5 index 52653598..3c7ddc9d 100644 --- a/libxo/xo_format.5 +++ b/libxo/xo_format.5 @@ -242,6 +242,13 @@ Labels are text that appears before a value. .Bd -literal -offset indent xo_emit("{Lwc:Cost}{:cost/%u}\\n", cost); .Ed +.Pp +If a label needs to include a slash, it must be escaped using two +backslashes, one for the C compiler and one for +.Nm libxo . +.Bd -literal -offset indent + xo_emit("{Lc:Low\\\\/warn level}{:level/%s}\\n", level); +.Ed .Ss "The Note Role ({N:})" Notes are text that appears after a value. .Bd -literal -offset indent diff --git a/tests/core/saved/test_02.E.out b/tests/core/saved/test_02.E.out index e554b30b..7550b680 100644 --- a/tests/core/saved/test_02.E.out +++ b/tests/core/saved/test_02.E.out @@ -23,6 +23,7 @@ op content: [bytes] [2] [0x2004] op content: [bytes] [3] [0x2004] op content: [bytes] [4] [0x2004] op close_leaf_list: [bytes] [] [0] +op content: [granularity-lw] [155] [0] op content: [mbuf-current] [10] [0] op content: [mbuf-cache] [20] [0] op content: [mbuf-total] [30] [0] diff --git a/tests/core/saved/test_02.H.out b/tests/core/saved/test_02.H.out index a3d88030..03daf89f 100644 --- a/tests/core/saved/test_02.H.out +++ b/tests/core/saved/test_02.H.out @@ -2,7 +2,7 @@
abcdef: Bad file descriptor
improper use of profanity; ten yard penalty; first down
length
abcdef
close
-1
returned
Bad file descriptor
good
close
-1
returned
Bad fi
good
improper use of profanity; ten yard penalty; first down -
20
30
40
file
0
bytes
1
byte
2
bytes
3
bytes
4
bytes
10
/
20
/
30
mbufs <&> in use (current/cache/total)
50
from
Boston
64
left out of
640
64
left out of
640
beforeworkingafter:
string
:
10
11
1010
packets here/there/everywhere
1010
packets here/there/everywhere
(
15
/
20
/
125
)
(
15
/
20
/
125
)
(
15
/
20
/
125
)
(
15
/
20
/
125
)
Humanize:
21
,
57 K
,
96M
,
44M
,
1.2G
one
two
three
(null)
1:
1000
2:
test5000
3:
ten-longx
4:
xtest
this is an error
two more errors
this is an warning
two more warnings
V1/V2 packets
:
10
0004
tries
improper use of profanity; ten yard penalty; first down +
20
30
40
file
0
bytes
1
byte
2
bytes
3
bytes
4
bytes
Low/warn granularity
:
155
10
/
20
/
30
mbufs <&> in use (current/cache/total)
50
from
Boston
64
left out of
640
64
left out of
640
beforeworkingafter:
string
:
10
11
1010
packets here/there/everywhere
1010
packets here/there/everywhere
(
15
/
20
/
125
)
(
15
/
20
/
125
)
(
15
/
20
/
125
)
(
15
/
20
/
125
)
Humanize:
21
,
57 K
,
96M
,
44M
,
1.2G
one
two
three
(null)
1:
1000
2:
test5000
3:
ten-longx
4:
xtest
this is an error
two more errors
this is an warning
two more warnings
V1/V2 packets
:
10
0004
tries
improper use of profanity; ten yard penalty; first down
Shut 'er down, Clancey! She's a-pumpin' mud! <>!,"!<>
err message (1)
err message (2)
err message (1) diff --git a/tests/core/saved/test_02.HIPx.out b/tests/core/saved/test_02.HIPx.out index 984caa32..6859660f 100644 --- a/tests/core/saved/test_02.HIPx.out +++ b/tests/core/saved/test_02.HIPx.out @@ -78,6 +78,13 @@
bytes
+
+
Low/warn granularity
+
:
+
+
155
+
+
10
/
diff --git a/tests/core/saved/test_02.HP.out b/tests/core/saved/test_02.HP.out index f2634522..6bf93277 100644 --- a/tests/core/saved/test_02.HP.out +++ b/tests/core/saved/test_02.HP.out @@ -78,6 +78,13 @@
bytes
+
+
Low/warn granularity
+
:
+
+
155
+
+
10
/
diff --git a/tests/core/saved/test_02.J.out b/tests/core/saved/test_02.J.out index c34e685b..5e01fa9a 100644 --- a/tests/core/saved/test_02.J.out +++ b/tests/core/saved/test_02.J.out @@ -1 +1 @@ -{"top": {"data": {"name":"em0","flags":"0x8843","name":"em0","flags":"0x8843","what":"braces","length":"abcdef","fd":-1,"error":"Bad file descriptor","test":"good","fd":-1,"error":"Bad fi","test":"good","lines":20,"words":30,"characters":40, "bytes": [0,1,2,3,4],"mbuf-current":10,"mbuf-cache":20,"mbuf-total":30,"distance":50,"location":"Boston","memory":64,"total":640,"memory":64,"total":640,"ten":10,"eleven":11,"unknown":1010,"unknown":1010,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"val1":21,"val2":58368,"val3":100663296,"val4":44470272,"val5":1342172800, "flag": ["one","two","three"],"works":null,"empty-tag":true,"t1":"1000","t2":"test5000","t3":"ten-longx","t4":"xtest", "__error": {"message":"this is an error"}, "__error": {"message":"two more errors"}, "__warning": {"message":"this is an warning"}, "__warning": {"message":"two more warnings"},"count":10,"test":4, "error": {"message":"Shut 'er down, Clancey! She's a-pumpin' mud! <>!,\"!<>\n"}, "error": {"message":"err message (1)"}, "error": {"message":"err message (2)\n"}, "error": {"message":"err message (1)\n"}, "error": {"message":"err message (2)\n"}}}} +{"top": {"data": {"name":"em0","flags":"0x8843","name":"em0","flags":"0x8843","what":"braces","length":"abcdef","fd":-1,"error":"Bad file descriptor","test":"good","fd":-1,"error":"Bad fi","test":"good","lines":20,"words":30,"characters":40, "bytes": [0,1,2,3,4],"granularity-lw":155,"mbuf-current":10,"mbuf-cache":20,"mbuf-total":30,"distance":50,"location":"Boston","memory":64,"total":640,"memory":64,"total":640,"ten":10,"eleven":11,"unknown":1010,"unknown":1010,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"val1":21,"val2":58368,"val3":100663296,"val4":44470272,"val5":1342172800, "flag": ["one","two","three"],"works":null,"empty-tag":true,"t1":"1000","t2":"test5000","t3":"ten-longx","t4":"xtest", "__error": {"message":"this is an error"}, "__error": {"message":"two more errors"}, "__warning": {"message":"this is an warning"}, "__warning": {"message":"two more warnings"},"count":10,"test":4, "error": {"message":"Shut 'er down, Clancey! She's a-pumpin' mud! <>!,\"!<>\n"}, "error": {"message":"err message (1)"}, "error": {"message":"err message (2)\n"}, "error": {"message":"err message (1)\n"}, "error": {"message":"err message (2)\n"}}}} diff --git a/tests/core/saved/test_02.JP.out b/tests/core/saved/test_02.JP.out index 1a3b4642..ef39233d 100644 --- a/tests/core/saved/test_02.JP.out +++ b/tests/core/saved/test_02.JP.out @@ -23,6 +23,7 @@ 3, 4 ], + "granularity-lw": 155, "mbuf-current": 10, "mbuf-cache": 20, "mbuf-total": 30, diff --git a/tests/core/saved/test_02.JPu.out b/tests/core/saved/test_02.JPu.out index 83b1029e..d0b868a5 100644 --- a/tests/core/saved/test_02.JPu.out +++ b/tests/core/saved/test_02.JPu.out @@ -23,6 +23,7 @@ 3, 4 ], + "granularity_lw": 155, "mbuf_current": 10, "mbuf_cache": 20, "mbuf_total": 30, diff --git a/tests/core/saved/test_02.T.out b/tests/core/saved/test_02.T.out index 5b22c161..552e9539 100644 --- a/tests/core/saved/test_02.T.out +++ b/tests/core/saved/test_02.T.out @@ -12,6 +12,7 @@ improper use of profanity; ten yard penalty; first down 2 bytes 3 bytes 4 bytes +Low/warn granularity: 155 mAh 10/20/30 mbufs <&> in use (current/cache/total) 50 miles from Boston 64k left out of 640kb diff --git a/tests/core/saved/test_02.X.out b/tests/core/saved/test_02.X.out index 598480be..3c491c3e 100644 --- a/tests/core/saved/test_02.X.out +++ b/tests/core/saved/test_02.X.out @@ -2,7 +2,7 @@ abcdef: Bad file descriptor improper use of profanity; ten yard penalty; first down abcdef-1Bad file descriptorgood-1Bad figoodimproper use of profanity; ten yard penalty; first down -2030400123410203050Boston646406464010111010101015201251520125152012515201252158368100663296444702721342172800onetwothreenull1000test5000ten-longxxtest<__error>this is an error<__error>two more errors<__warning>this is an warning<__warning>two more warnings104improper use of profanity; ten yard penalty; first down +2030400123415510203050Boston646406464010111010101015201251520125152012515201252158368100663296444702721342172800onetwothreenull1000test5000ten-longxxtest<__error>this is an error<__error>two more errors<__warning>this is an warning<__warning>two more warnings104improper use of profanity; ten yard penalty; first down Shut 'er down, Clancey! She's a-pumpin' mud! <>!,"!<> err message (1)err message (2) err message (1) diff --git a/tests/core/saved/test_02.XP.out b/tests/core/saved/test_02.XP.out index 9a0755e0..c9e85cb4 100644 --- a/tests/core/saved/test_02.XP.out +++ b/tests/core/saved/test_02.XP.out @@ -28,6 +28,7 @@ 2 3 4 + 155 10 20 30 diff --git a/tests/core/test_02.c b/tests/core/test_02.c index 4ea8c459..7591eb17 100644 --- a/tests/core/test_02.c +++ b/tests/core/test_02.c @@ -85,6 +85,8 @@ main (int argc, char **argv) for (i = 0; i < 5; i++) xo_emit("{lw:bytes/%d}{Np:byte,bytes}\n", i); + xo_emit("{Lc:Low\\/warn granularity}{P:\t}{:granularity-lw/%d}{Uw:/%sh}\n", + 155, "mA"); xo_emit("{:mbuf-current/%u}/{:mbuf-cache/%u}/{:mbuf-total/%u} " "{N:mbufs <&> in use (current\\/cache\\/total)}\n",