diff --git a/configure.ac b/configure.ac
index e7bc61dfc127..1d86f0e5030c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@
#
AC_PREREQ(2.2)
-AC_INIT([libxo], [0.4.6], [phil@juniper.net])
+AC_INIT([libxo], [0.4.7], [phil@juniper.net])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
# Support silent build rules. Requires at least automake-1.11.
diff --git a/doc/libxo-manual.html b/doc/libxo-manual.html
index bc4463d363b9..47881da91ab5 100644
--- a/doc/libxo-manual.html
+++ b/doc/libxo-manual.html
@@ -515,7 +515,7 @@ li.indline1 {
}
@top-right {
- content: "August 2015";
+ content: "December 2015";
}
@top-center {
@@ -22009,7 +22009,7 @@ jQuery(function ($) {
-
+
libxo: The Easy Way to Generate text, XML, JSON, and HTML output
libxo-manual
diff --git a/libxo/libxo.c b/libxo/libxo.c
index cceebfa3a3d7..bae810f179c7 100644
--- a/libxo/libxo.c
+++ b/libxo/libxo.c
@@ -3374,6 +3374,15 @@ xo_buf_append_div (xo_handle_t *xop, const char *class, xo_xff_flags_t flags,
static char div_end[] = "\">";
static char div_close[] = "";
+ /* The encoding format defaults to the normal format */
+ if (encoding == NULL) {
+ char *enc = alloca(vlen + 1);
+ memcpy(enc, value, vlen);
+ enc[vlen] = '\0';
+ encoding = xo_fix_encoding(xop, enc);
+ elen = strlen(encoding);
+ }
+
/*
* To build our XPath predicate, we need to save the va_list before
* we format our data, and then restore it before we format the
@@ -3406,15 +3415,6 @@ xo_buf_append_div (xo_handle_t *xop, const char *class, xo_xff_flags_t flags,
else
xo_buf_append(pbp, "='", 2);
- /* The encoding format defaults to the normal format */
- if (encoding == NULL) {
- char *enc = alloca(vlen + 1);
- memcpy(enc, value, vlen);
- enc[vlen] = '\0';
- encoding = xo_fix_encoding(xop, enc);
- elen = strlen(encoding);
- }
-
xo_xff_flags_t pflags = flags | XFF_XML | XFF_ATTR;
pflags &= ~(XFF_NO_OUTPUT | XFF_ENCODE_ONLY);
xo_do_format_field(xop, pbp, encoding, elen, pflags);
diff --git a/libxo/xo_config.h.in b/libxo/xo_config.h.in
deleted file mode 100644
index 614e7fec728a..000000000000
--- a/libxo/xo_config.h.in
+++ /dev/null
@@ -1,246 +0,0 @@
-/* libxo/xo_config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-#undef CRAY_STACKSEG_END
-
-/* Define to 1 if using `alloca.c'. */
-#undef C_ALLOCA
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define to 1 if you have and it should be used (not on Ultrix).
- */
-#undef HAVE_ALLOCA_H
-
-/* Define to 1 if you have the `asprintf' function. */
-#undef HAVE_ASPRINTF
-
-/* Define to 1 if you have the `bzero' function. */
-#undef HAVE_BZERO
-
-/* Define to 1 if you have the `ctime' function. */
-#undef HAVE_CTIME
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_CTYPE_H
-
-/* Define to 1 if you have the declaration of `__isthreaded', and to 0 if you
- don't. */
-#undef HAVE_DECL___ISTHREADED
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the `dlfunc' function. */
-#undef HAVE_DLFUNC
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_ERRNO_H
-
-/* Define to 1 if you have the `fdopen' function. */
-#undef HAVE_FDOPEN
-
-/* Define to 1 if you have the `flock' function. */
-#undef HAVE_FLOCK
-
-/* Define to 1 if you have the `getpass' function. */
-#undef HAVE_GETPASS
-
-/* Define to 1 if you have the `getprogname' function. */
-#undef HAVE_GETPROGNAME
-
-/* Define to 1 if you have the `getrusage' function. */
-#undef HAVE_GETRUSAGE
-
-/* gettext(3) */
-#undef HAVE_GETTEXT
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
-/* humanize_number(3) */
-#undef HAVE_HUMANIZE_NUMBER
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `crypto' library (-lcrypto). */
-#undef HAVE_LIBCRYPTO
-
-/* Define to 1 if you have the `m' library (-lm). */
-#undef HAVE_LIBM
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_LIBUTIL_H
-
-/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
- to 0 otherwise. */
-#undef HAVE_MALLOC
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_MEMORY_H
-
-/* Support printflike */
-#undef HAVE_PRINTFLIKE
-
-/* Define to 1 if your system has a GNU libc compatible `realloc' function,
- and to 0 otherwise. */
-#undef HAVE_REALLOC
-
-/* Define to 1 if you have the `srand' function. */
-#undef HAVE_SRAND
-
-/* Define to 1 if you have the `sranddev' function. */
-#undef HAVE_SRANDDEV
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDIO_EXT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDIO_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDTIME_TZFILE_H
-
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
-/* Define to 1 if you have the `strcspn' function. */
-#undef HAVE_STRCSPN
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strlcpy' function. */
-#undef HAVE_STRLCPY
-
-/* Define to 1 if you have the `strspn' function. */
-#undef HAVE_STRSPN
-
-/* Have struct sockaddr_un.sun_len */
-#undef HAVE_SUN_LEN
-
-/* Define to 1 if you have the `sysctlbyname' function. */
-#undef HAVE_SYSCTLBYNAME
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_SYSCTL_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_THREADS_H
-
-/* thread-local setting */
-#undef HAVE_THREAD_LOCAL
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_TZFILE_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if you have the `__flbf' function. */
-#undef HAVE___FLBF
-
-/* Enable debugging */
-#undef LIBXO_DEBUG
-
-/* Enable text-only rendering */
-#undef LIBXO_TEXT_ONLY
-
-/* Version number as dotted value */
-#undef LIBXO_VERSION
-
-/* Version number extra information */
-#undef LIBXO_VERSION_EXTRA
-
-/* Version number as a number */
-#undef LIBXO_VERSION_NUMBER
-
-/* Version number as string */
-#undef LIBXO_VERSION_STRING
-
-/* Enable local wcwidth implementation */
-#undef LIBXO_WCWIDTH
-
-/* Define to the sub-directory where libtool stores uninstalled libraries. */
-#undef LT_OBJDIR
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at runtime.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-#undef inline
-#endif
-
-/* Define to rpl_malloc if the replacement function should be used. */
-#undef malloc
-
-/* Define to rpl_realloc if the replacement function should be used. */
-#undef realloc
-
-/* Define to `unsigned int' if does not define. */
-#undef size_t
diff --git a/libxo/xo_format.5 b/libxo/xo_format.5
index 1db4fc8dc118..8c3cbea31248 100644
--- a/libxo/xo_format.5
+++ b/libxo/xo_format.5
@@ -367,7 +367,7 @@ particular output styles:
.It l "leaf-list " "Field is a leaf-list, a list of leaf values"
.It n "no-quotes " "Do not quote the field when using JSON style"
.It q "quotes " "Quote the field when using JSON style"
-.It q "trim " "Trim leading and trailing whitespace"
+.It t "trim " "Trim leading and trailing whitespace"
.It w "white space " "A blank ("" "") is appended after the label"
.El
.Pp
diff --git a/tests/core/saved/test_01.E.out b/tests/core/saved/test_01.E.out
index 296a34ef996a..ed615a5aab84 100644
--- a/tests/core/saved/test_01.E.out
+++ b/tests/core/saved/test_01.E.out
@@ -114,6 +114,16 @@ op close_list: [item] []
op close_container: [data4] []
op content: [cost] [425]
op content: [cost] [455]
+op string: [mode] [mode]
+op string: [mode_octal] [octal]
+op string: [links] [links]
+op string: [user] [user]
+op string: [group] [group]
+op string: [mode] [/some/file]
+op content: [mode_octal] [640]
+op content: [links] [1]
+op string: [user] [user]
+op string: [group] [group]
op close_container: [top] []
op finish: [] []
op flush: [] []
diff --git a/tests/core/saved/test_01.H.out b/tests/core/saved/test_01.H.out
index ead320e0e610..39d8bd4e8a6f 100644
--- a/tests/core/saved/test_01.H.out
+++ b/tests/core/saved/test_01.H.out
@@ -1 +1 @@
-Connecting to
my-box
.
example.com
...
Item
Total Sold
In Stock
On Order
SKU
gum
1412
54
10
GRO-000-415
bolt
4123
144
42
HRD-000-632
water
17
14
2
GRO-000-2331
\ No newline at end of file
+Connecting to
my-box
.
example.com
...
Item
Total Sold
In Stock
On Order
SKU
gum
1412
54
10
GRO-000-415
bolt
4123
144
42
HRD-000-632
water
17
14
2
GRO-000-2331
\ No newline at end of file
diff --git a/tests/core/saved/test_01.HIPx.out b/tests/core/saved/test_01.HIPx.out
index 2b8e2969a062..a3aa369310f1 100644
--- a/tests/core/saved/test_01.HIPx.out
+++ b/tests/core/saved/test_01.HIPx.out
@@ -301,3 +301,22 @@
455
+
+
+
links
+
+
user
+
+
group
+
+
+
+
/some/file
+
+
1
+
+
user
+
+
group
+
+
diff --git a/tests/core/saved/test_01.HP.out b/tests/core/saved/test_01.HP.out
index c8f2dbcb329f..c877dfd01928 100644
--- a/tests/core/saved/test_01.HP.out
+++ b/tests/core/saved/test_01.HP.out
@@ -301,3 +301,22 @@
455
+
+
+
links
+
+
user
+
+
group
+
+
+
+
/some/file
+
+
1
+
+
user
+
+
group
+
+
diff --git a/tests/core/saved/test_01.J.out b/tests/core/saved/test_01.J.out
index 69e3faa62126..0515a2a6e615 100644
--- a/tests/core/saved/test_01.J.out
+++ b/tests/core/saved/test_01.J.out
@@ -1,2 +1,2 @@
-{"top": {"host":"my-box","domain":"example.com", "data": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17,"in-stock":14,"on-order":2}]}, "data2": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412.0,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85.0,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123.0,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17.0,"in-stock":14,"on-order":2}]}, "data3": {"item": [{"sku":"GRO-000-533","name":"fish","sold":1321.0,"in-stock":45,"on-order":1}]}, "data4": {"item": ["gum","rope","ladder","bolt","water"]},"cost":425,"cost":455}
+{"top": {"host":"my-box","domain":"example.com", "data": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17,"in-stock":14,"on-order":2}]}, "data2": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412.0,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85.0,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123.0,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17.0,"in-stock":14,"on-order":2}]}, "data3": {"item": [{"sku":"GRO-000-533","name":"fish","sold":1321.0,"in-stock":45,"on-order":1}]}, "data4": {"item": ["gum","rope","ladder","bolt","water"]},"cost":425,"cost":455,"mode":"mode","mode_octal":"octal","links":"links","user":"user","group":"group","mode":"/some/file","mode_octal":640,"links":1,"user":"user","group":"group"}
}
diff --git a/tests/core/saved/test_01.JP.out b/tests/core/saved/test_01.JP.out
index e65897fe7244..210266d87f77 100644
--- a/tests/core/saved/test_01.JP.out
+++ b/tests/core/saved/test_01.JP.out
@@ -101,6 +101,16 @@
]
},
"cost": 425,
- "cost": 455
+ "cost": 455,
+ "mode": "mode",
+ "mode_octal": "octal",
+ "links": "links",
+ "user": "user",
+ "group": "group",
+ "mode": "/some/file",
+ "mode_octal": 640,
+ "links": 1,
+ "user": "user",
+ "group": "group"
}
}
diff --git a/tests/core/saved/test_01.T.out b/tests/core/saved/test_01.T.out
index 2ecf537dd21b..cdf704b880ad 100644
--- a/tests/core/saved/test_01.T.out
+++ b/tests/core/saved/test_01.T.out
@@ -45,3 +45,5 @@ Item: water
XXXXXXXX
X XCost: 425
X XCost: 455
+ links user group
+/some/file 1 user group
diff --git a/tests/core/saved/test_01.X.out b/tests/core/saved/test_01.X.out
index 46f501e24724..bc9ef84f63ec 100644
--- a/tests/core/saved/test_01.X.out
+++ b/tests/core/saved/test_01.X.out
@@ -1 +1 @@
-my-boxexample.com- GRO-000-415gum14125410
- HRD-000-212rope8542
- HRD-000-517ladder021
- HRD-000-632bolt412314442
- GRO-000-2331water17142
- GRO-000-415gum1412.05410
- HRD-000-212rope85.042
- HRD-000-517ladder021
- HRD-000-632bolt4123.014442
- GRO-000-2331water17.0142
- GRO-000-533fish1321.0451
- gum
- rope
- ladder
- bolt
- water
425455
\ No newline at end of file
+my-boxexample.com- GRO-000-415gum14125410
- HRD-000-212rope8542
- HRD-000-517ladder021
- HRD-000-632bolt412314442
- GRO-000-2331water17142
- GRO-000-415gum1412.05410
- HRD-000-212rope85.042
- HRD-000-517ladder021
- HRD-000-632bolt4123.014442
- GRO-000-2331water17.0142
- GRO-000-533fish1321.0451
- gum
- rope
- ladder
- bolt
- water
425455modeoctallinksusergroup/some/file6401usergroup
\ No newline at end of file
diff --git a/tests/core/saved/test_01.XP.out b/tests/core/saved/test_01.XP.out
index c7f4bfe8d98b..f7d7e5c9246f 100644
--- a/tests/core/saved/test_01.XP.out
+++ b/tests/core/saved/test_01.XP.out
@@ -93,4 +93,14 @@
425
455
+ mode
+ octal
+ links
+ user
+ group
+ /some/file
+ 640
+ 1
+ user
+ group
diff --git a/tests/core/test_01.c b/tests/core/test_01.c
index f7fe61ec1ebe..5c748772fb9f 100644
--- a/tests/core/test_01.c
+++ b/tests/core/test_01.c
@@ -169,6 +169,16 @@ main (int argc, char **argv)
xo_emit("X{P: }X{Lwc:Cost}{:cost/%u}\n", 425);
xo_emit("X{P:/%30s}X{Lwc:Cost}{:cost/%u}\n", "", 455);
+ xo_emit("{e:mode/%s}{e:mode_octal/%s} {t:links/%s} "
+ "{t:user/%s} {t:group/%s} \n",
+ "mode", "octal", "links",
+ "user", "group", "extra1", "extra2", "extra3");
+
+ xo_emit("{t:mode/%s}{e:mode_octal/%03o} {t:links/%*u} "
+ "{t:user/%-*s} {t:group/%-*s} \n",
+ "/some/file", (int) 0640, 8, 1,
+ 10, "user", 12, "group");
+
xo_close_container_h(NULL, "top");
xo_finish();