Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2015 16:26:21 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287111 - in head: bin/ls bin/ps contrib/libxo contrib/libxo/bin contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/test contrib/libxo/libxo contri...
Message-ID:  <201508241626.t7OGQLGF017708@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Mon Aug 24 16:26:20 2015
New Revision: 287111
URL: https://svnweb.freebsd.org/changeset/base/287111

Log:
  Upgrade libxo to 0.4.5.
  
  Local changes incorporated by 0.4.5: r284340
  Local changes retained: r276260, r282117
  
  Obtained from:	https://github.com/Juniper/libxo

Added:
  head/contrib/libxo/INSTALL.md
  head/contrib/libxo/encoder/
  head/contrib/libxo/encoder/Makefile.am   (contents, props changed)
  head/contrib/libxo/encoder/cbor/
  head/contrib/libxo/encoder/cbor/Makefile.am   (contents, props changed)
  head/contrib/libxo/encoder/cbor/enc_cbor.c   (contents, props changed)
  head/contrib/libxo/encoder/test/
  head/contrib/libxo/encoder/test/Makefile.am   (contents, props changed)
  head/contrib/libxo/encoder/test/enc_test.c   (contents, props changed)
  head/contrib/libxo/libxo/add.man
  head/contrib/libxo/libxo/add.man.in   (contents, props changed)
  head/contrib/libxo/libxo/xo_buf.h   (contents, props changed)
  head/contrib/libxo/libxo/xo_config.h
     - copied, changed from r287110, head/contrib/libxo/libxo/xoconfig.h
  head/contrib/libxo/libxo/xo_emit_err.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_encoder.c   (contents, props changed)
  head/contrib/libxo/libxo/xo_encoder.h   (contents, props changed)
  head/contrib/libxo/libxo/xo_humanize.h   (contents, props changed)
  head/contrib/libxo/libxo/xo_message.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_set_syslog_enterprise_id.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_syslog.3   (contents, props changed)
  head/contrib/libxo/libxo/xo_syslog.c   (contents, props changed)
  head/contrib/libxo/libxo/xo_wcwidth.h   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_01.E.err
  head/contrib/libxo/tests/core/saved/test_01.E.out
  head/contrib/libxo/tests/core/saved/test_02.E.err
  head/contrib/libxo/tests/core/saved/test_02.E.out
  head/contrib/libxo/tests/core/saved/test_03.E.err
  head/contrib/libxo/tests/core/saved/test_03.E.out
  head/contrib/libxo/tests/core/saved/test_04.E.err
  head/contrib/libxo/tests/core/saved/test_04.E.out
  head/contrib/libxo/tests/core/saved/test_05.E.err
  head/contrib/libxo/tests/core/saved/test_05.E.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_06.E.err
  head/contrib/libxo/tests/core/saved/test_06.E.out
  head/contrib/libxo/tests/core/saved/test_07.E.err
  head/contrib/libxo/tests/core/saved/test_07.E.out
  head/contrib/libxo/tests/core/saved/test_08.E.err
  head/contrib/libxo/tests/core/saved/test_08.E.out
  head/contrib/libxo/tests/core/saved/test_09.E.err
  head/contrib/libxo/tests/core/saved/test_09.E.out
  head/contrib/libxo/tests/core/saved/test_10.E.err
  head/contrib/libxo/tests/core/saved/test_10.E.out
  head/contrib/libxo/tests/core/saved/test_11.E.err
  head/contrib/libxo/tests/core/saved/test_11.E.out
  head/contrib/libxo/tests/core/saved/test_11.H.err
  head/contrib/libxo/tests/core/saved/test_11.H.out
  head/contrib/libxo/tests/core/saved/test_11.HIPx.err
  head/contrib/libxo/tests/core/saved/test_11.HIPx.out
  head/contrib/libxo/tests/core/saved/test_11.HP.err
  head/contrib/libxo/tests/core/saved/test_11.HP.out
  head/contrib/libxo/tests/core/saved/test_11.J.err
  head/contrib/libxo/tests/core/saved/test_11.J.out
  head/contrib/libxo/tests/core/saved/test_11.JP.err
  head/contrib/libxo/tests/core/saved/test_11.JP.out
  head/contrib/libxo/tests/core/saved/test_11.T.err
  head/contrib/libxo/tests/core/saved/test_11.T.out
  head/contrib/libxo/tests/core/saved/test_11.X.err
  head/contrib/libxo/tests/core/saved/test_11.X.out
  head/contrib/libxo/tests/core/saved/test_11.XP.err
  head/contrib/libxo/tests/core/saved/test_11.XP.out
  head/contrib/libxo/tests/core/test_11.c   (contents, props changed)
  head/contrib/libxo/tests/gettext/
  head/contrib/libxo/tests/gettext/Makefile.am   (contents, props changed)
  head/contrib/libxo/tests/gettext/gt_01.c   (contents, props changed)
  head/contrib/libxo/tests/gettext/gt_01.pot
  head/contrib/libxo/tests/gettext/ldns.pot
  head/contrib/libxo/tests/gettext/po/
  head/contrib/libxo/tests/gettext/po/pig_latin/
  head/contrib/libxo/tests/gettext/po/pig_latin/gt_01.po
  head/contrib/libxo/tests/gettext/po/pig_latin/ldns.po
  head/contrib/libxo/tests/gettext/po/pig_latin/strerror.po
  head/contrib/libxo/tests/gettext/saved/
  head/contrib/libxo/tests/gettext/saved/gt_01.H.err
  head/contrib/libxo/tests/gettext/saved/gt_01.H.out
  head/contrib/libxo/tests/gettext/saved/gt_01.HIPx.err
  head/contrib/libxo/tests/gettext/saved/gt_01.HIPx.out
  head/contrib/libxo/tests/gettext/saved/gt_01.HP.err
  head/contrib/libxo/tests/gettext/saved/gt_01.HP.out
  head/contrib/libxo/tests/gettext/saved/gt_01.J.err
  head/contrib/libxo/tests/gettext/saved/gt_01.J.out
  head/contrib/libxo/tests/gettext/saved/gt_01.JP.err
  head/contrib/libxo/tests/gettext/saved/gt_01.JP.out
  head/contrib/libxo/tests/gettext/saved/gt_01.T.err
  head/contrib/libxo/tests/gettext/saved/gt_01.T.out
  head/contrib/libxo/tests/gettext/saved/gt_01.X.err
  head/contrib/libxo/tests/gettext/saved/gt_01.X.out
  head/contrib/libxo/tests/gettext/saved/gt_01.XP.err
  head/contrib/libxo/tests/gettext/saved/gt_01.XP.out
  head/contrib/libxo/tests/gettext/strerror.pot
  head/contrib/libxo/xopo/
  head/contrib/libxo/xopo/Makefile.am   (contents, props changed)
  head/contrib/libxo/xopo/xopo.1   (contents, props changed)
  head/contrib/libxo/xopo/xopo.c   (contents, props changed)
Deleted:
  head/contrib/libxo/libxo/xoconfig.h
  head/contrib/libxo/libxo/xoconfig.h.in
  head/contrib/libxo/libxo/xoversion.h
  head/contrib/libxo/libxo/xoversion.h.in
Modified:
  head/bin/ls/Makefile
  head/bin/ps/Makefile
  head/contrib/libxo/.gitignore
  head/contrib/libxo/.travis.yml
  head/contrib/libxo/Makefile.am
  head/contrib/libxo/bin/Zaliases
  head/contrib/libxo/bin/setup.sh
  head/contrib/libxo/configure.ac
  head/contrib/libxo/doc/Makefile.am
  head/contrib/libxo/doc/libxo.txt
  head/contrib/libxo/libxo/Makefile.am
  head/contrib/libxo/libxo/libxo.3
  head/contrib/libxo/libxo/libxo.c
  head/contrib/libxo/libxo/xo.h
  head/contrib/libxo/libxo/xo_attr.3
  head/contrib/libxo/libxo/xo_create.3
  head/contrib/libxo/libxo/xo_emit.3
  head/contrib/libxo/libxo/xo_err.3
  head/contrib/libxo/libxo/xo_error.3
  head/contrib/libxo/libxo/xo_finish.3
  head/contrib/libxo/libxo/xo_flush.3
  head/contrib/libxo/libxo/xo_format.5
  head/contrib/libxo/libxo/xo_no_setlocale.3
  head/contrib/libxo/libxo/xo_open_container.3
  head/contrib/libxo/libxo/xo_open_list.3
  head/contrib/libxo/libxo/xo_open_marker.3
  head/contrib/libxo/libxo/xo_parse_args.3
  head/contrib/libxo/libxo/xo_set_allocator.3
  head/contrib/libxo/libxo/xo_set_flags.3
  head/contrib/libxo/libxo/xo_set_info.3
  head/contrib/libxo/libxo/xo_set_options.3
  head/contrib/libxo/libxo/xo_set_style.3
  head/contrib/libxo/libxo/xo_set_version.3
  head/contrib/libxo/libxo/xo_set_writer.3
  head/contrib/libxo/tests/Makefile.am
  head/contrib/libxo/tests/core/Makefile.am
  head/contrib/libxo/tests/core/saved/test_01.H.out
  head/contrib/libxo/tests/core/saved/test_01.HIPx.out
  head/contrib/libxo/tests/core/saved/test_01.HP.out
  head/contrib/libxo/tests/core/saved/test_01.J.out
  head/contrib/libxo/tests/core/saved/test_01.JP.out
  head/contrib/libxo/tests/core/saved/test_01.T.out
  head/contrib/libxo/tests/core/saved/test_01.X.out
  head/contrib/libxo/tests/core/saved/test_01.XP.out
  head/contrib/libxo/tests/core/saved/test_02.H.out
  head/contrib/libxo/tests/core/saved/test_02.HIPx.out
  head/contrib/libxo/tests/core/saved/test_02.HP.out
  head/contrib/libxo/tests/core/saved/test_02.J.out
  head/contrib/libxo/tests/core/saved/test_02.JP.out
  head/contrib/libxo/tests/core/saved/test_02.T.out
  head/contrib/libxo/tests/core/saved/test_02.X.out
  head/contrib/libxo/tests/core/saved/test_02.XP.out
  head/contrib/libxo/tests/core/saved/test_05.H.out
  head/contrib/libxo/tests/core/saved/test_05.HIPx.out
  head/contrib/libxo/tests/core/saved/test_05.HP.out
  head/contrib/libxo/tests/core/saved/test_05.J.out
  head/contrib/libxo/tests/core/saved/test_05.JP.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_05.T.out
  head/contrib/libxo/tests/core/saved/test_05.X.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_05.XP.out   (contents, props changed)
  head/contrib/libxo/tests/core/saved/test_08.H.err
  head/contrib/libxo/tests/core/saved/test_08.HIPx.err
  head/contrib/libxo/tests/core/saved/test_08.HIPx.out
  head/contrib/libxo/tests/core/saved/test_08.HP.err
  head/contrib/libxo/tests/core/saved/test_08.J.err
  head/contrib/libxo/tests/core/saved/test_08.J.out
  head/contrib/libxo/tests/core/saved/test_08.JP.err
  head/contrib/libxo/tests/core/saved/test_08.JP.out
  head/contrib/libxo/tests/core/saved/test_08.T.err
  head/contrib/libxo/tests/core/saved/test_08.X.err
  head/contrib/libxo/tests/core/saved/test_08.X.out
  head/contrib/libxo/tests/core/saved/test_08.XP.err
  head/contrib/libxo/tests/core/saved/test_08.XP.out
  head/contrib/libxo/tests/core/test_01.c
  head/contrib/libxo/tests/core/test_02.c
  head/contrib/libxo/tests/core/test_05.c
  head/contrib/libxo/tests/core/test_08.c
  head/contrib/libxo/xo/Makefile.am
  head/contrib/libxo/xo/xo.1
  head/contrib/libxo/xo/xo.c
  head/contrib/libxo/xohtml/Makefile.am
  head/contrib/libxo/xohtml/xohtml.1
  head/contrib/libxo/xolint/Makefile.am
  head/contrib/libxo/xolint/xolint.1
  head/contrib/libxo/xolint/xolint.pl
  head/etc/mtree/BSD.usr.dist
  head/lib/libxo/Makefile
  head/libexec/ftpd/Makefile
  head/sbin/savecore/Makefile
  head/usr.bin/iscsictl/Makefile
  head/usr.bin/netstat/Makefile
  head/usr.bin/w/Makefile
  head/usr.bin/wc/Makefile
  head/usr.bin/xo/Makefile

Modified: head/bin/ls/Makefile
==============================================================================
--- head/bin/ls/Makefile	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/bin/ls/Makefile	Mon Aug 24 16:26:20 2015	(r287111)
@@ -5,7 +5,7 @@
 
 PROG=	ls
 SRCS=	cmp.c ls.c print.c util.c
-LIBADD=	util xo
+LIBADD=	xo util
 
 .if !defined(RELEASE_CRUNCH) && \
 	${MK_LS_COLORS} != no

Modified: head/bin/ps/Makefile
==============================================================================
--- head/bin/ps/Makefile	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/bin/ps/Makefile	Mon Aug 24 16:26:20 2015	(r287111)
@@ -11,6 +11,6 @@ SRCS=	fmt.c keyword.c nlist.c print.c ps
 # on large systems.
 #
 CFLAGS+=-DLAZY_PS
-LIBADD=	m kvm jail xo
+LIBADD=	m kvm jail xo util
 
 .include <bsd.prog.mk>

Modified: head/contrib/libxo/.gitignore
==============================================================================
--- head/contrib/libxo/.gitignore	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/.gitignore	Mon Aug 24 16:26:20 2015	(r287111)
@@ -27,14 +27,17 @@ config.guess
 config.h.in
 config.sub
 depcomp
+install-sh
 ltmain.sh
 missing
+m4
 
 Makefile.in
 configure
 .DS_Store
 
 xoconfig.h.in
+xo_config.h.in
 
 .gdbinit
 .gdbinit.local

Modified: head/contrib/libxo/.travis.yml
==============================================================================
--- head/contrib/libxo/.travis.yml	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/.travis.yml	Mon Aug 24 16:26:20 2015	(r287111)
@@ -1,6 +1,6 @@
 language: c
 
-script: printenv && uname -a && /bin/sh ./bin/setup.sh && cd build && ../configure --enable-warnings && make && sudo make install && make test
+script: printenv && uname -a && ls -l && /bin/sh -x ./bin/setup.sh && cd build && ../configure --enable-warnings && make && sudo make install && make test
 
 notifications:
   recipients:

Added: head/contrib/libxo/INSTALL.md
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/libxo/INSTALL.md	Mon Aug 24 16:26:20 2015	(r287111)
@@ -0,0 +1,15 @@
+<!---
+# $Id$
+#
+# Copyright 2015, Juniper Networks, Inc.
+# All rights reserved.
+# This SOFTWARE is licensed under the LICENSE provided in the
+# ../Copyright file. By downloading, installing, copying, or otherwise
+# using the SOFTWARE, you agree to be bound by the terms of that
+# LICENSE.
+#-->
+
+## Instructions for building libxo
+
+Instructions for building libxo are now available in the
+[wiki](http://juniper.github.io/libxo/libxo-manual.html#getting-libxo).

Modified: head/contrib/libxo/Makefile.am
==============================================================================
--- head/contrib/libxo/Makefile.am	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/Makefile.am	Mon Aug 24 16:26:20 2015	(r287111)
@@ -10,7 +10,7 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = libxo xo xolint xohtml tests doc
+SUBDIRS = libxo xo xopo xolint xohtml tests doc encoder
 bin_SCRIPTS=libxo-config
 dist_doc_DATA = Copyright
 
@@ -94,3 +94,9 @@ packages:
 			&& git commit -m 'new packaging data' \
                                ${GH_PACKAGING_DIR} \
 			&& git push origin gh-pages ) ; true
+
+ANALYZE_DIR = ~/trash/libxo
+ANALYZE_CMD = scan-build-mp-3.6
+
+analyze:
+	${ANALYZE_CMD} -o ${ANALYZE_DIR} ${MAKE}

Modified: head/contrib/libxo/bin/Zaliases
==============================================================================
--- head/contrib/libxo/bin/Zaliases	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/bin/Zaliases	Mon Aug 24 16:26:20 2015	(r287111)
@@ -6,6 +6,7 @@ set opts=' \
 --enable-debug \
 --enable-warnings \
 --enable-printflike \
+--with-gettext=/opt/local \
 --prefix ${HOME}/work/root \
 '
 set opts=`echo $opts`
@@ -22,3 +23,7 @@ cd build
 
 
 alias xx 'cc -I.. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wnested-externs -Wparentheses -Wreturn-type -Wshadow -Wswitch -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings -fno-inline-functions-called-once -g -O2 -o xtest -DUNIT_TEST libxo.c'
+
+alias mm "make CFLAGS='-O0 -g'"
+
+alias mmi 'mm && mi'

Modified: head/contrib/libxo/bin/setup.sh
==============================================================================
--- head/contrib/libxo/bin/setup.sh	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/bin/setup.sh	Mon Aug 24 16:26:20 2015	(r287111)
@@ -11,6 +11,8 @@ if [ ! -f configure ]; then
     vers=`autoreconf --version | head -1`
     echo "Using" $vers
 
+    mkdir -p m4
+
     autoreconf --install
 
     if [ ! -f configure ]; then

Modified: head/contrib/libxo/configure.ac
==============================================================================
--- head/contrib/libxo/configure.ac	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/configure.ac	Mon Aug 24 16:26:20 2015	(r287111)
@@ -12,7 +12,7 @@
 #
 
 AC_PREREQ(2.2)
-AC_INIT([libxo], [0.3.2], [phil@juniper.net])
+AC_INIT([libxo], [0.4.5], [phil@juniper.net])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
 
 # Support silent build rules.  Requires at least automake-1.11.
@@ -54,12 +54,16 @@ AC_CHECK_FUNCS([sranddev srand strlcpy])
 AC_CHECK_FUNCS([fdopen getrusage])
 AC_CHECK_FUNCS([gettimeofday ctime])
 AC_CHECK_FUNCS([getpass])
+AC_CHECK_FUNCS([getprogname])
 AC_CHECK_FUNCS([sysctlbyname])
 AC_CHECK_FUNCS([flock])
 AC_CHECK_FUNCS([asprintf])
 AC_CHECK_FUNCS([__flbf])
+AC_CHECK_FUNCS([sysctlbyname])
+
 
 AC_CHECK_HEADERS([dlfcn.h])
+AC_CHECK_HEADERS([dlfcn.h])
 AC_CHECK_HEADERS([stdio_ext.h])
 AC_CHECK_HEADERS([tzfile.h])
 AC_CHECK_HEADERS([stdtime/tzfile.h])
@@ -69,10 +73,139 @@ AC_CHECK_HEADERS([sys/time.h])
 AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h])
 AC_CHECK_HEADERS([string.h sys/param.h unistd.h ])
 AC_CHECK_HEADERS([sys/sysctl.h])
+AC_CHECK_HEADERS([threads.h])
+
+dnl humanize_number(3) is a great function, but it's not standard.
+dnl Note Macosx has the function in libutil.a but doesn't ship the
+dnl header file, so I'll need to carry my own implementation.  See:
+dnl    https://devforums.apple.com/thread/271121
+AC_CHECK_HEADERS([libutil.h])
+AC_CHECK_LIB([util], [humanize_number],
+     [HAVE_HUMANIZE_NUMBER=$ac_cv_header_libutil_h],
+     [HAVE_HUMANIZE_NUMBER=no])
+
+AC_MSG_RESULT(humanize_number results: :${HAVE_HUMANIZE_NUMBER}:${ac_cv_header_libutil_h}:)
+
+if test "$HAVE_HUMANIZE_NUMBER" = "yes"; then
+    AC_DEFINE([HAVE_HUMANIZE_NUMBER], [1], [humanize_number(3)])
+fi
+
+AM_CONDITIONAL([HAVE_HUMANIZE_NUMBER], [test "$HAVE_HUMANIZE_NUMBER" = "yes"])
+
+AC_ARG_ENABLE([gettext],
+    [  --disable-gettext  Turn off support for gettext],
+    [GETTEXT_ENABLE=$enableval],
+    [GETTEXT_ENABLE=yes])
+
+dnl Looking for gettext(), assumably in libintl
+AC_ARG_WITH(gettext,
+        [  --with-gettext=[PFX]           Specify location of gettext installation],
+        [GETTEXT_PREFIX=$withval],
+	[GETTEXT_PREFIX=/usr],
+)
+
+HAVE_GETTEXT=no
+
+if test "$GETTEXT_ENABLE" != "no"; then
+
+  AC_MSG_CHECKING([gettext in ${GETTEXT_PREFIX}])
+
+  _save_cflags="$CFLAGS"
+  CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
+  AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <libintl.h>]
+             [int main() {char *cp = dgettext(NULL, "xx"); return 0; }]])],
+             [HAVE_GETTEXT=yes],
+             [HAVE_GETTEXT=no])
+  CFLAGS="$_save_cflags"
+
+  AC_MSG_RESULT([$HAVE_GETTEXT])
+
+  if test "$HAVE_GETTEXT" != "yes"; then
+      GETTEXT_PREFIX=/opt/local
+      AC_MSG_CHECKING([gettext in ${GETTEXT_PREFIX}])
+
+      _save_cflags="$CFLAGS"
+      CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
+      AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <libintl.h>]
+                 [int main() {char *cp = dgettext(NULL, "xx"); return 0; }]])],
+                 [HAVE_GETTEXT=yes],
+                 [HAVE_GETTEXT=no])
+      CFLAGS="$_save_cflags"
+
+      AC_MSG_RESULT([$HAVE_GETTEXT])
+  fi
+fi
+
+if test "$HAVE_GETTEXT" = "yes"; then
+    AC_DEFINE([HAVE_GETTEXT], [1], [gettext(3)])
+    GETTEXT_CFLAGS="-I${GETTEXT_PREFIX}/include"
+    GETTEXT_LIBS="-L${GETTEXT_PREFIX}/lib -lintl"
+else
+    GETTEXT_PREFIX=none
+    GETTEXT_CFLAGS=
+    GETTEXT_LIBS=
+fi
+AC_SUBST(GETTEXT_CFLAGS)
+AC_SUBST(GETTEXT_LIBS)
 
+GETTEXT_BINDIR=${GETTEXT_PREFIX}/bin
+AC_SUBST(GETTEXT_BINDIR)
+GETTEXT_LIBDIR=${GETTEXT_PREFIX}/lib
+AC_SUBST(GETTEXT_LIBDIR)
+
+AM_CONDITIONAL([HAVE_GETTEXT], [test "$HAVE_GETTEXT" = "yes"])
+
+dnl Looking for how to do thread-local variables
+AC_ARG_WITH(threads,
+        [  --with-threads=[STYLE]           Specify style of thread-local support (none)],
+        [THREAD_LOCAL=$withval],
+	[THREAD_LOCAL=unknown],
+)
+
+AC_MSG_CHECKING([thread-locals are ${THREAD_LOCAL}])
+
+if test "$THREAD_LOCAL" = "unknown"; then
+     AC_LINK_IFELSE([AC_LANG_SOURCE([[]
+           [__thread int foo; int main() { foo++; return foo; }]])],
+           [THREAD_LOCAL=before],
+           [THREAD_LOCAL=unknown])
+
+    AC_MSG_RESULT([$THREAD_LOCAL])
+fi
+
+if test "$THREAD_LOCAL" = "unknown"; then
+    AC_LINK_IFELSE([AC_LANG_SOURCE([[]
+           [int __thread foo; int main() { foo++; return foo; }]])],
+           [THREAD_LOCAL=after],
+           [THREAD_LOCAL=unknown])
+    AC_MSG_RESULT([$THREAD_LOCAL])
+fi
+
+if test "$THREAD_LOCAL" = "unknown"; then
+    AC_LINK_IFELSE([AC_LANG_SOURCE([[]
+           [__declspec(int) foo; int main() { foo++; return foo; }]])],
+           [THREAD_LOCAL=declspec],
+           [THREAD_LOCAL=unknown])
+    AC_MSG_RESULT([$THREAD_LOCAL])
+fi
+
+if test "$THREAD_LOCAL" != "unknown"; then
+    AC_DEFINE_UNQUOTED([HAVE_THREAD_LOCAL], 
+              THREAD_LOCAL_${THREAD_LOCAL}, [thread-local setting])
+fi
+
+dnl Looking for libcrypto....
 AC_CHECK_LIB([crypto], [MD5_Init])
 AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "$HAVE_LIBCRYPTO" != "no"])
 
+AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
+    [HAVE_SUN_LEN=yes ;
+        AC_DEFINE([HAVE_SUN_LEN], [1], [Have struct sockaddr_un.sun_len])],
+    [HAS_SUN_LEN=no], [[#include <sys/un.h>]])
+
+AC_CHECK_DECLS([__isthreaded], [], [], [#include <stdio.h>])
+HAVE_ISTHREADED=${ac_cv_have_decl___isthreaded}
+
 dnl
 dnl Some packages need to be checked against version numbers so we
 dnl define a function here for later use
@@ -107,12 +240,15 @@ then
 	SLAX_BINDIR="`$SLAX_CONFIG --bindir | head -1`"
 	SLAX_OXTRADOCDIR="`$SLAX_CONFIG --oxtradoc | head -1`"
 	AC_MSG_RESULT($LIBSLAX_VERSION found)
+	HAVE_OXTRADOC=yes
 else
 	LIBSLAX_VERSION=
 	SLAX_BINDIR=
 	SLAX_OXTRADOCDIR=
 	AC_MSG_RESULT([no])
+	HAVE_OXTRADOC=no
 fi
+AM_CONDITIONAL([HAVE_OXTRADOC], [test "$HAVE_OXTRADOC" != "no"])
 
 AC_SUBST(SLAX_BINDIR)
 AC_SUBST(SLAX_OXTRADOCDIR)
@@ -141,6 +277,16 @@ AC_ARG_ENABLE([text-only],
 AC_MSG_RESULT([$LIBXO_TEXT_ONLY])
 AM_CONDITIONAL([LIBXO_TEXT_ONLY], [test "$LIBXO_TEXT_ONLY" != "no"])
 
+AC_MSG_CHECKING([whether to build with local wcwidth implementation])
+AC_ARG_ENABLE([wcwidth],
+    [  --disable-wcwidth        Disable local wcwidth implementation],
+    [LIBXO_WCWIDTH=$enableval],
+    [LIBXO_WCWIDTH=yes])
+AC_MSG_RESULT([$LIBXO_WCWIDTH])
+if test "${LIBXO_WCWIDTH}" != "no"; then
+  AC_DEFINE([LIBXO_WCWIDTH], [1], [Enable local wcwidth implementation])
+fi
+
 AC_CHECK_LIB([m], [lrint])
 AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"])
 
@@ -177,13 +323,16 @@ AM_CONDITIONAL([NO_LIBXO_OPTIONS], [test
 case $host_os in
      darwin*)
         LIBTOOL=glibtool
+	XO_LIBEXT=dylib
 	;;
      Linux*|linux*)
         CFLAGS="-D_GNU_SOURCE $CFLAGS"
 	LDFLAGS=-ldl
+	XO_LIBEXT=so
 	;;
      cygwin*|CYGWIN*)
 	LDFLAGS=-no-undefined
+	XO_LIBEXT=ddl
 	;;
 esac
 
@@ -203,6 +352,14 @@ AC_SUBST(XO_SRCDIR)
 AC_SUBST(XO_LIBDIR)
 AC_SUBST(XO_BINDIR)
 AC_SUBST(XO_INCLUDEDIR)
+AC_SUBST(XO_LIBEXT)
+
+AC_ARG_WITH(encoder-dir,
+        [  --with-encoder-dir=[DIR]           Specify location of encoder libraries],
+        [XO_ENCODERDIR=$withval],
+        [XO_ENCODERDIR=$libdir/libxo/encoder]
+)
+AC_SUBST(XO_ENCODERDIR)
 
 AC_ARG_WITH(share-dir,
         [  --with-share-dir=[DIR]           Specify location of shared files],
@@ -232,20 +389,34 @@ AC_SUBST(LIBXO_VERSION)
 AC_SUBST(LIBXO_VERSION_NUMBER)
 AC_SUBST(LIBXO_VERSION_EXTRA)
 
-AC_CONFIG_HEADERS([libxo/xoconfig.h])
+AC_DEFINE_UNQUOTED(LIBXO_VERSION, ["$LIBXO_VERSION"],
+    [Version number as dotted value])
+AC_DEFINE_UNQUOTED(LIBXO_VERSION_NUMBER, [$LIBXO_VERSION_NUMBER],
+    [Version number as a number])
+AC_DEFINE_UNQUOTED(LIBXO_VERSION_STRING, ["$LIBXO_VERSION_NUMBER"],
+    [Version number as string])
+AC_DEFINE_UNQUOTED(LIBXO_VERSION_EXTRA, ["$LIBXO_VERSION_EXTRA"],
+    [Version number extra information])
+
+AC_CONFIG_HEADERS([libxo/xo_config.h])
 AC_CONFIG_FILES([
   Makefile
   libxo-config
   xohtml/xohtml.sh
   libxo/Makefile
-  libxo/xoversion.h
+  libxo/add.man
+  encoder/Makefile
+  encoder/cbor/Makefile
+  encoder/test/Makefile
   xo/Makefile
   xolint/Makefile
   xohtml/Makefile
+  xopo/Makefile
   packaging/libxo.pc
   doc/Makefile
   tests/Makefile
   tests/core/Makefile
+  tests/gettext/Makefile
   tests/xo/Makefile
   packaging/libxo.spec
   packaging/libxo.rb.base
@@ -262,6 +433,7 @@ AC_MSG_NOTICE([summary of build options:
   bindir:           ${XO_BINDIR}
   includedir:       ${XO_INCLUDEDIR}
   share dir:        ${XO_SHAREDIR}
+  extensions dir:   ${XO_ENCODERDIR}
   oxtradoc dir:     ${SLAX_OXTRADOCDIR}
 
   compiler:         ${CC} (${HAVE_GCC:-no})
@@ -273,4 +445,8 @@ AC_MSG_NOTICE([summary of build options:
   printf-like:      ${HAVE_PRINTFLIKE:-no}
   libxo-options:    ${LIBXO_OPTS:-no}
   text-only:        ${LIBXO_TEXT_ONLY:-no}
+  gettext:          ${HAVE_GETTEXT:-no} (${GETTEXT_PREFIX})
+  isthreaded:       ${HAVE_ISTHREADED:-no}
+  thread-local:     ${THREAD_LOCAL:-no}
+  local wcwidth:    ${LIBXO_WCWIDTH:-no}
 ])

Modified: head/contrib/libxo/doc/Makefile.am
==============================================================================
--- head/contrib/libxo/doc/Makefile.am	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/doc/Makefile.am	Mon Aug 24 16:26:20 2015	(r287111)
@@ -8,6 +8,7 @@
 # using the SOFTWARE, you agree to be bound by the terms of that
 # LICENSE.
 
+if HAVE_OXTRADOC
 OXTRADOC_DIR = ${SLAX_OXTRADOCDIR}
 OXTRADOC_PREFIX = ${OXTRADOC_DIR}
 OXTRADOC = ${OXTRADOC_DIR}/oxtradoc
@@ -38,28 +39,32 @@ OX_ARGS += -S ${SLAXPROC} -p doc
 OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS}
 OXTRADOC_CMD = ${OX_CMD}
 
-
 OUTPUT = libxo-manual
-INPUT = libxo.txt
+INPUT = libxo
 
 EXTRA_DIST = \
-    ${INPUT} \
+    ${INPUT}.txt \
     ${OUTPUT}.html \
     ${OUTPUT}.txt
 
 doc docs: ${OUTPUT}.txt ${OUTPUT}.html
 
-${OUTPUT}.txt: ${INPUT} ${OXTRADOC} xolint.txt
+${OUTPUT}.txt: ${INPUT}.txt ${OXTRADOC} xolint.txt
 	${OXTRADOC_CMD} -m text -o $@ $<
 
-${OUTPUT}.html: ${INPUT} ${OXTRADOC} ${XML2HTMLBIN} xolint.txt
+${OUTPUT}.html: ${INPUT}.txt ${OXTRADOC} ${XML2HTMLBIN} xolint.txt
 	${OXTRADOC_CMD} -m html -o $@ $<
 
 xolint.txt: ${top_srcdir}/xolint/xolint.pl
 	perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt
 
 CLEANFILES = \
-${OUTPUT}.xml \
-${OUTPUT}.txt \
-${OUTPUT}.fxml \
-${OUTPUT}.html
+xolint.txt \
+${INPUT}.xml \
+${INPUT}.txt \
+${INPUT}.fxml \
+${INPUT}.html
+else
+doc docs:
+	@${ECHO} "The 'oxtradoc' tool is not installed; see libslax.org"
+endif

Modified: head/contrib/libxo/doc/libxo.txt
==============================================================================
--- head/contrib/libxo/doc/libxo.txt	Mon Aug 24 14:32:57 2015	(r287110)
+++ head/contrib/libxo/doc/libxo.txt	Mon Aug 24 16:26:20 2015	(r287111)
@@ -8,7 +8,7 @@
 # Phil Shafer, July 2014
 #
 
-* libxo
+* Overview
 
 libxo - A Library for Generating Text, XML, JSON, and HTML Output
 
@@ -28,10 +28,10 @@ decides at run time which output style s
 application calls a function "xo_emit" to product output that is
 described in a format string.  A "field descriptor" tells libxo what
 the field is and what it means.  Each field descriptor is placed in
-braces with a printf-like format string:
+braces with a printf-like format string (^format-strings^):
 
     xo_emit(" {:lines/%7ju} {:words/%7ju} "
-            "{:characters/%7ju}{d:filename/%s}\n",
+            "{:characters/%7ju} {d:filename/%s}\n",
             linect, wordct, charct, file);
 
 Each field can have a role, with the 'value' role being the default,
@@ -43,10 +43,10 @@ can then be generated in various style, 
     % wc --libxo xml,pretty,warn /etc/motd
     <wc>
       <file>
-        <filename>/etc/motd</filename>
         <lines>25</lines>
         <words>165</words>
         <characters>1140</characters>
+        <filename>/etc/motd</filename>
       </file>
     </wc>
     % wc --libxo json,pretty,warn /etc/motd
@@ -54,10 +54,10 @@ can then be generated in various style, 
       "wc": {
         "file": [
           {
-            "filename": "/etc/motd",
             "lines": 25,
             "words": 165,
-            "characters": 1140
+            "characters": 1140,
+            "filename": "/etc/motd"
           }
         ]
       }
@@ -95,10 +95,151 @@ command:
 We're using semantic release numbering, as defined in
 ^http://semver.org/spec/v2.0.0.html^.
 
-libxo is open source, distributed under the BSD license.  It
-is shipped as part of FreeBSD 11.0.
+libxo is open source, distributed under the BSD license.  It shipped
+as part of the FreeBSD operating system starting with release 11.0.
 
-* Overview
+Issues, problems, and bugs should be directly to the issues page on
+our github site.
+
+*** Downloading libxo Source Code
+
+You can retrieve the source for libxo in two ways:
+
+A) Use a "distfile" for a specific release.  We use
+github to maintain our releases.  Visit
+github release page (^https://github.com/Juniper/libxo/releases^)
+to see the list of releases.  To download the latest, look for the
+release with the green "Latest release" button and the green
+"libxo-RELEASE.tar.gz" button under that section.
+
+After downloading that release's distfile, untar it as follows:
+
+    tar -zxf libxo-RELEASE.tar.gz
+    cd libxo-RELEASE
+
+[Note: for Solaris users, your "tar" command lacks the "-z" flag,
+so you'll need to substitute "gzip -dc "file" | tar xf -" instead of
+"tar -zxf "file"".]
+
+B) Use the current build from github.  This gives you the most recent
+source code, which might be less stable than a specific release.  To
+build libxo from the git repo:
+
+    git clone https://github.com/Juniper/libxo.git
+    cd libxo
+
+_BE AWARE_: The github repository does _not_ contain the files
+generated by "autoreconf", with the notable exception of the "m4"
+directory.  Since these files (depcomp, configure, missing,
+install-sh, etc) are generated files, we keep them out of the source
+code repository.
+
+This means that if you download the a release distfile, these files
+will be ready and you'll just need to run "configure", but if you
+download the source code from svn, then you'll need to run
+"autoreconf" by hand.  This step is done for you by the "setup.sh"
+script, described in the next section.
+
+*** Building libxo
+
+To build libxo, you'll need to set up the build, run the "configure"
+script, run the "make" command, and run the regression tests.
+
+The following is a summary of the commands needed.  These commands are
+explained in detail in the rest of this section.
+
+    sh bin/setup.sh
+    cd build
+    ../configure
+    make
+    make test
+    sudo make install
+
+The following sections will walk thru each of these steps with
+additional details and options, but the above directions should be all
+that's needed.
+
+**** Setting up the build
+
+[If you downloaded a distfile, you can skip this step.]
+
+Run the "setup.sh" script to set up the build.  This script runs the
+"autoreconf" command to generate the "configure" script and other
+generated files.
+
+    sh bin/setup.sh
+
+Note: We're are currently using autoreconf version 2.69.
+
+**** Running the "configure" Script
+
+Configure (and autoconf in general) provides a means of building
+software in diverse environments.  Our configure script supports
+a set of options that can be used to adjust to your operating
+environment. Use "configure --help" to view these options.
+
+We use the "build" directory to keep object files and generated files
+away from the source tree.
+
+To run the configure script, change into the "build" directory, and
+run the "configure" script.  Add any required options to the
+"../configure" command line.
+
+    cd build
+    ../configure
+
+Expect to see the "configure" script generate the following error:
+
+    /usr/bin/rm: cannot remove `libtoolT': No such file or directory
+
+This error is harmless and can be safely ignored.
+
+By default, libxo installs architecture-independent files, including
+extension library files, in the /usr/local directories. To specify an
+installation prefix other than /usr/local for all installation files,
+include the --prefix=prefix option and specify an alternate
+location. To install just the extension library files in a different,
+user-defined location, include the --with-extensions-dir=dir option
+and specify the location where the extension libraries will live.
+
+    cd build
+    ../configure [OPTION]... [VAR=VALUE]...
+
+**** Running the "make" command
+
+Once the "configure" script is run, build the images using the "make"
+command:
+
+    make
+
+**** Running the Regression Tests
+
+libxo includes a set of regression tests that can be run to ensure
+the software is working properly.  These test are optional, but will
+help determine if there are any issues running libxo on your
+machine.  To run the regression tests:
+
+    make test
+
+**** Installing libxo
+
+Once the software is built, you'll need to install libxo using the
+"make install" command.  If you are the root user, or the owner of the
+installation directory, simply issue the command:
+
+    make install
+
+If you are not the "root" user and are using the "sudo" package, use:
+
+    sudo make install
+
+Verify the installation by viewing the output of "xo --version":
+
+    % xo --version
+    libxo version 0.3.5-git-develop
+    xo version 0.3.5-git-develop
+
+* Formatting with libxo
 
 Most unix commands emit text output aimed at humans.  It is designed
 to be parsed and understood by a user.  Humans are gifted at
@@ -128,26 +269,41 @@ A single libxo function call in source c
 
     xo_emit("Connecting to {:host}.{:domain}...\n", host, domain);
 
-    Text:
-      Connection to my-box.example.com...
+    TEXT:
+      Connecting to my-box.example.com...
     XML:
       <host>my-box</host>
       <domain>example.com</domain>
     JSON:
       "host": "my-box",
       "domain": "example.com"
-      
-For brevity, the HTML output is emitted.
+    HTML:
+       <div class="line">
+         <div class="text">Connecting to </div>
+         <div class="data" data-tag="host" 
+              data-xpath="/top/host">my-box</div>
+         <div class="text">.</div>
+         <div class="data" data-tag="domain"
+              data-xpath="/top/domain">example.com</div>
+         <div class="text">...</div>
+       </div>
 
 ** Encoding Styles
 
-There are four encoding styles supported by libxo: TEXT, HTML, JSON,
-and XML.  JSON and XML are suitable for encoding data, while TEXT and
-HTML are suited for display to the user.  TEXT output can be display
-on a terminal session, allowing compatibility with traditional usage.
-HTML can be matched with a small CSS file to permit rendering in any
-HTML5 browser.  XML output is suitable for tools like XPath and
-protocols like NETCONF.  JSON output can be used for RESTful APIs.
+There are four encoding styles supported by libxo:
+
+- TEXT output can be display on a terminal session, allowing
+compatibility with traditional command line usage.
+- XML output is suitable for tools like XPath and protocols like
+NETCONF.
+- JSON output can be used for RESTful APIs and integration with
+languages like Javascript and Python.
+- HTML can be matched with a small CSS file to permit rendering in any
+HTML5 browser.
+
+In general, XML and JSON are suitable for encoding data, while TEXT is
+suited for terminal output and HTML is suited for display in a web
+browser (see ^xohtml^).
 
 *** Text Output
 
@@ -164,7 +320,7 @@ data might look like:
     printf("%d\t%s\n", num_blocks, path);
 
 Simple, direct, obvious.  But it's only making text output.  Imagine
-using a single code path to make text, XML, JSON or HTML, deciding at
+using a single code path to make TEXT, XML, JSON or HTML, deciding at
 run time which to generate.
 
 libxo expands on the idea of printf format strings to make a single
@@ -257,7 +413,7 @@ field descriptions within the format str
 
 The field description is given as follows:
 
-    '{' [ role | modifier ]* ':' [ content ]
+    '{' [ role | modifier ]* [',' long-names ]* ':' [ content ]
             [ '/' field-format [ '/' encoding-format ]] '}'
 
 The role describes the function of the field, while the modifiers
@@ -271,23 +427,31 @@ label ("In stock"), and the third is a v
 in-stock field has a "%u" format that will parse the next argument
 passed to the xo_emit function as an unsigned integer.
 
-        xo_emit("{P:   }{Lwc:In stock}{:in-stock/%u}\n", 65);
+    xo_emit("{P:   }{Lwc:In stock}{:in-stock/%u}\n", 65);
 
 This single line of code can generate text (" In stock: 65\n"), XML
 ("<in-stock>65</in-stock>"), JSON ('"in-stock": 6'), or HTML (too
 lengthy to be listed here).
 
-*** Modifier Roles
+While roles and modifiers typically use single character for brevity,
+there are alternative names for each which allow more verbose
+formatting strings.  These names must be preceded by a comma, and may
+follow any single-character values:
+
+    xo_emit("{L,white,colon:In stock}{,key:in-stock/%u}\n", 65);
 
-Modifiers are optional, and indicate the role and formatting of the
+*** Field Roles
+
+Field roles are optional, and indicate the role and formatting of the
 content.  The roles are listed below; only one role is permitted:
 
 |---+--------------+-------------------------------------------------|
-| M | Name         | Description                                     |
+| R | Name         | Description                                     |
 |---+--------------+-------------------------------------------------|
-| C | color/effect | Field has color and effect controls             |
+| C | color        | Field has color and effect controls             |
 | D | decoration   | Field is non-text (e.g., colon, comma)          |
 | E | error        | Field is an error message                       |
+| G | gettext      | Call gettext(3) on the format string            |
 | L | label        | Field is text that prefixes a value             |
 | N | note         | Field is text that follows a value              |
 | P | padding      | Field is spaces needed for vertical alignment   |
@@ -295,25 +459,59 @@ content.  The roles are listed below; on
 | U | units        | Field is the units for the previous value field |
 | V | value        | Field is the name of field (the default)        |
 | W | warning      | Field is a warning message                      |
-| [ | start anchor | Begin a section of anchored variable-width text |
-| ] | stop anchor  | End a section of anchored variable-width text   |
+| [ | start-anchor | Begin a section of anchored variable-width text |
+| ] | stop-anchor  | End a section of anchored variable-width text   |
 |---+--------------+-------------------------------------------------|
 
-**** The Color Role ({C:})
+    EXAMPLE:
+        xo_emit("{L:Free}{D::}{P:   }{:free/%u} {U:Blocks}\n",
+                free_blocks);
+
+When a role is not provided, the "value" role is used as the default.
+
+Roles and modifiers can also use more verbose names, when preceeded by
+a comma:
+
+    EXAMPLE:
+        xo_emit("{,label:Free}{,decoration::}{,padding:   }"
+                "{,value:free/%u} {,units:Blocks}\n",
+                free_blocks);
+
+**** The Color Role ({C:}) @color-role@
 
 Colors and effects control how text values are displayed; they are
-used for display styles (TEXT and HTML).  The color content can be
-either static, when placed directly within the field descriptor, or a
-printf-style format descriptor can be used, if preceded by a slash ("/"):
+used for display styles (TEXT and HTML).
+
+    xo_emit("{C:bold}{:value}{C:no-bold}\n", value);
+
+Colors and effects remain in effect until modified by other "C"-role
+fields.
+
+    xo_emit("{C:bold}{C:inverse}both{C:no-bold}only inverse\n");
+
+If the content is empty, the "reset" action is performed.
+
+    xo_emit("{C:both,underline}{:value}{C:}\n", value);
+
+The content should be a comma-separated list of zero or more colors or
+display effects.
+
+    xo_emit("{C:bold,inverse}Ugly{C:no-bold,no-inverse}\n");
+
+The color content can be either static, when placed directly within
+the field descriptor, or a printf-style format descriptor can be used,
+if preceded by a slash ("/"):
+
+   xo_emit("{C:/%s%s}{:value}{C:}", need_bold ? "bold" : "",
+           need_underline ? "underline" : "", value);
+
+Color names are prefixed with either "fg-" or "bg-" to change the
+foreground and background colors, respectively.
 
-    xo_emit("{C:bold}{Lwc:Cost}{:cost/%u}{C:reset}\n", cost);
     xo_emit("{C:/fg-%s,bg-%s}{Lwc:Cost}{:cost/%u}{C:reset}\n",
             fg_color, bg_color, cost);
 
-The content should be a comma-separated list of zero or more colors or
-display effects.  Colors and effects remain in effect until
-modified by other "C" roles.  If the content is empty, the "reset"
-action is performed.
+The following table lists the supported effects:
 
 |---------------+-------------------------------------------------|
 |  Name         | Description                                     |
@@ -332,22 +530,19 @@ action is performed.
 
 The following color names are supported:
 
-|---------------|
-|  Name         |
-|---------------|
-| black         |
-| blue          |
-| cyan          |
-| default       |
-| green         |
-| magenta       |
-| red           |
-| white         |
-| yellow        |
-|---------------|
-
-Color names are prefixed with either "fg-" or "bg-" to change the
-foreground and background colors, respectively.
+|---------+--------------------------------------------|
+| Name    | Description                                |
+|---------+--------------------------------------------|
+| black   |                                            |
+| blue    |                                            |
+| cyan    |                                            |
+| default | Default color for foreground or background |
+| green   |                                            |
+| magenta |                                            |
+| red     |                                            |
+| white   |                                            |
+| yellow  |                                            |
+|---------+--------------------------------------------|
 
 **** The Decoration Role ({D:})
 
@@ -358,6 +553,37 @@ can use CSS to direct their display para
 
     xo_emit("{D:((}{:name}{D:))}\n", name);
 
+**** The Gettext Role ({G:}) @gettext-role@
+
+libxo supports internationalization (i18n) through its use of
+gettext(3).  Use the "{G:}" role to request that the remaining part of
+the format string, following the "{G:}" field, be handled using
+gettext().
+
+Since gettext() uses the string as the key into the message catalog,
+libxo uses a simplified version of the format string that removes
+unimportant field formatting and modifiers, stopping minor formatting
+changes from impacting the expensive translation process.  A developer
+change such as changing "/%06d" to "/%08d" should not force hand
+inspection of all .po files.
+
+The simplified version can be generated for a single message using the
+"xopo -s <text>" command, or an entire .pot can be translated using
+the "xopo -f <input> -o <output>" command.
+
+   xo_emit("{G:}Invalid token\n");
+
+The {G:} role allows a domain name to be set.  gettext calls will
+continue to use that domain name until the current format string
+processing is complete, enabling a library function to emit strings
+using it's own catalog.  The domain name can be either static as the
+content of the field, or a format can be used to get the domain name
+from the arguments.
+
+   xo_emit("{G:libc}Service unavailable in restricted mode\n");
+
+See ^howto-i18n^ for additional details.
+
 **** The Label Role ({L:})
 
 Labels are text that appears before a value.
@@ -370,7 +596,7 @@ Notes are text that appears after a valu
 
     xo_emit("{:cost/%u} {N:per year}\n", cost);
 
-**** The Padding Role ({P:})
+**** The Padding Role ({P:}) @padding-role@
 
 Padding represents whitespace used before and between fields.
 
@@ -440,7 +666,7 @@ format descriptors default to "%s".
     xo_emit("{:author} wrote \"{:poem}\" in {:year/%4d}\n,
             author, poem, year);
 
-**** The Anchor Modifiers ({[:} and {]:})
+**** The Anchor Roles ({[:} and {]:}) @anchor-role@
 
 The anchor roles allow a set of strings by be padded as a group,
 but still be visible to xo_emit as distinct fields.  Either the start
@@ -468,29 +694,38 @@ than the absolute value of the given wid
 Widths over 8k are considered probable errors and not supported.  If
 XOF_WARN is set, a warning will be generated.
 
-*** Modifier Flags
+*** Field Modifiers
 
-The modifiers can also include the following flags, which modify the
-content emitted for some output styles:
+Field modifiers are flags which modify the way content emitted for
+particular output styles:
 
-|---+--------------+-------------------------------------------------|
-| M | Name         | Description                                     |
-|---+--------------+-------------------------------------------------|
-| c | colon        | A colon (":") is appended after the label       |
-| d | display      | Only emit field for display styles (text/HTML)  |
-| e | encoding     | Only emit for encoding styles (XML/JSON)        |
-| k | key          | Field is a key, suitable for XPath predicates   |
-| l | leaf-list    | Field is a leaf-list
-| n | no-quotes    | Do not quote the field when using JSON style    |
-| q | quotes       | Quote the field when using JSON style           |
-| w | white space  | A blank (" ") is appended after the label       |
-|---+--------------+-------------------------------------------------|
-
-For example, the modifier string "Lwc" means the field has a label
-role (text that describes the next field) and should be followed by a
-colon ('c') and a space ('w').  The modifier string "Vkq" means the
-field has a value role, that it is a key for the current instance, and
-that the value should be quoted when encoded for JSON.
+|---+---------------+-------------------------------------------------|
+| M | Name          | Description                                     |
+|---+---------------+-------------------------------------------------|
+| c | colon         | A colon (":") is appended after the label       |
+| d | display       | Only emit field for display styles (text/HTML)  |
+| e | encoding      | Only emit for encoding styles (XML/JSON)        |
+| g | gettext       | Call gettext on field's render content          |
+| h | humanize (hn) | Format large numbers in human-readable style    |
+|   | hn-space      | Humanize: Place space between numeric and unit  |
+|   | hn-decimal    | Humanize: Add a decimal digit, if number < 10   |
+|   | hn-1000       | Humanize: Use 1000 as divisor instead of 1024   |
+| k | key           | Field is a key, suitable for XPath predicates   |
+| l | leaf-list     | Field is a leaf-list                            |
+| n | no-quotes     | Do not quote the field when using JSON style    |
+| p | plural        | Gettext: Use comma-separated plural form        |
+| q | quotes        | Quote the field when using JSON style           |
+| t | trim          | Trim leading and trailing whitespace            |
+| w | white         | A blank (" ") is appended after the label       |
+|---+---------------+-------------------------------------------------|
+
+Roles and modifiers can also use more verbose names, when preceeded by
+a comma.  For example, the modifier string "Lwc" (or "L,white,colon")
+means the field has a label role (text that describes the next field)
+and should be followed by a colon ('c') and a space ('w').  The
+modifier string "Vkq" (or ":key,quote") means the field has a value
+role (the default role), that it is a key for the current instance,
+and that the value should be quoted when encoded for JSON.
 
 **** The Colon Modifier ({c:})
 
@@ -535,6 +770,58 @@ the display output styles, TEXT and HTML
 The encoding modifier is the opposite of the display modifier, and
 they are often used to give to distinct views of the underlying data.
 
+**** The Gettext Modifier ({g:}) @gettext-modifier@
+
+The gettext modifier is used to translate individual fields using the

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508241626.t7OGQLGF017708>