Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2014 22:04:46 -0800
From:      Alfred Perlstein <bright@mu.org>
To:        Marcel Moolenaar <marcel@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r274672 - in head/contrib/libxo: . libxo xolint
Message-ID:  <18F6425B-A767-426D-8EEF-57B7CFF3D54B@mu.org>
In-Reply-To: <201411181803.sAII3fCg079794@svn.freebsd.org>
References:  <201411181803.sAII3fCg079794@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Marcel, is there a way to get libxo programs to emit time series data? =20=


Any examples of this in the tree right now?

Example would be if "netstat -1" was libxo-ified, it would also emit a =
timestamp.

-Alfred

On Nov 18, 2014, at 10:03 AM, Marcel Moolenaar wrote:

> Author: marcel
> Date: Tue Nov 18 18:03:40 2014
> New Revision: 274672
> URL: https://svnweb.freebsd.org/changeset/base/274672
>=20
> Log:
>  Upgrade libxo to 0.1.6.
>=20
>  Summary of changes:
>  1.  Coverity defect fixes
>=20
>  Obtained from:  https://github.com/Juniper/libxo/releases/tag/0.1.6
>=20
> Modified:
>  head/contrib/libxo/configure.ac
>  head/contrib/libxo/libxo/libxo.c
>  head/contrib/libxo/libxo/xoconfig.h
>  head/contrib/libxo/libxo/xoversion.h
>  head/contrib/libxo/xolint/xolint.pl
>=20
> Modified: head/contrib/libxo/configure.ac
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/contrib/libxo/configure.ac	Tue Nov 18 17:37:33 2014	=
(r274671)
> +++ head/contrib/libxo/configure.ac	Tue Nov 18 18:03:40 2014	=
(r274672)
> @@ -12,7 +12,7 @@
> #
>=20
> AC_PREREQ(2.2)
> -AC_INIT([libxo], [0.1.5], [phil@juniper.net])
> +AC_INIT([libxo], [0.1.6], [phil@juniper.net])
> AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
>=20
> # Support silent build rules.  Requires at least automake-1.11.
>=20
> Modified: head/contrib/libxo/libxo/libxo.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/contrib/libxo/libxo/libxo.c	Tue Nov 18 17:37:33 2014	=
(r274671)
> +++ head/contrib/libxo/libxo/libxo.c	Tue Nov 18 18:03:40 2014	=
(r274672)
> @@ -317,7 +317,7 @@ xo_init_handle (xo_handle_t *xop)
> 	    cp =3D getenv("LC_ALL");
> 	if (cp =3D=3D NULL)
> 	    cp =3D "UTF-8";	/* Optimistic? */
> -	cp =3D setlocale(LC_CTYPE, cp);
> +	(void) setlocale(LC_CTYPE, cp);
>     }
>=20
>     /*
> @@ -607,8 +607,10 @@ xo_vsnprintf (xo_handle_t *xop, xo_buffe
> 	rc =3D vsnprintf(xbp->xb_curp, left, fmt, va_local);
>=20
>     if (rc > xbp->xb_size) {
> -	if (!xo_buf_has_room(xbp, rc))
> +	if (!xo_buf_has_room(xbp, rc)) {
> +	    va_end(va_local);
> 	    return -1;
> +	}
>=20
> 	/*
> 	 * After we call vsnprintf(), the stage of vap is not defined.
> @@ -648,8 +650,10 @@ xo_printf_v (xo_handle_t *xop, const cha
>     rc =3D vsnprintf(xbp->xb_curp, left, fmt, va_local);
>=20
>     if (rc > xbp->xb_size) {
> -	if (!xo_buf_has_room(xbp, rc))
> +	if (!xo_buf_has_room(xbp, rc)) {
> +	    va_end(va_local);
> 	    return -1;
> +	}
>=20
> 	va_end(va_local);	/* Reset vap to the start */
> 	va_copy(va_local, vap);
> @@ -974,8 +978,10 @@ xo_warn_hcv (xo_handle_t *xop, int code,
> 	int left =3D xbp->xb_size - (xbp->xb_curp - xbp->xb_bufp);
> 	int rc =3D vsnprintf(xbp->xb_curp, left, newfmt, vap);
> 	if (rc > xbp->xb_size) {
> -	    if (!xo_buf_has_room(xbp, rc))
> +	    if (!xo_buf_has_room(xbp, rc)) {
> +		va_end(va_local);
> 		return;
> +	    }
>=20
> 	    va_end(vap);	/* Reset vap to the start */
> 	    va_copy(vap, va_local);
> @@ -1118,8 +1124,10 @@ xo_message_hcv (xo_handle_t *xop, int co
> 	int left =3D xbp->xb_size - (xbp->xb_curp - xbp->xb_bufp);
> 	rc =3D vsnprintf(xbp->xb_curp, left, fmt, vap);
> 	if (rc > xbp->xb_size) {
> -	    if (!xo_buf_has_room(xbp, rc))
> +	    if (!xo_buf_has_room(xbp, rc)) {
> +		va_end(va_local);
> 		return;
> +	    }
>=20
> 	    va_end(vap);	/* Reset vap to the start */
> 	    va_copy(vap, va_local);
> @@ -1154,14 +1162,15 @@ xo_message_hcv (xo_handle_t *xop, int co
>=20
> 	    va_copy(va_local, vap);
>=20
> -	    rc =3D vsnprintf(buf, bufsiz, fmt, va_local);
> +	    rc =3D vsnprintf(bp, bufsiz, fmt, va_local);
> 	    if (rc > bufsiz) {
> 		bufsiz =3D rc + BUFSIZ;
> 		bp =3D alloca(bufsiz);
> 		va_end(va_local);
> 		va_copy(va_local, vap);
> -		rc =3D vsnprintf(buf, bufsiz, fmt, va_local);
> +		rc =3D vsnprintf(bp, bufsiz, fmt, va_local);
> 	    }
> +	    va_end(va_local);
> 	    cp =3D bp + rc;
>=20
> 	    if (need_nl) {
> @@ -1302,9 +1311,9 @@ xo_create_to_file (FILE *fp, xo_style_t=20
>  * @xop XO handle to alter (or NULL for default handle)
>  */
> void
> -xo_destroy (xo_handle_t *xop)
> +xo_destroy (xo_handle_t *xop_arg)
> {
> -    xop =3D xo_default(xop);
> +    xo_handle_t *xop =3D xo_default(xop_arg);
>=20
>     if (xop->xo_close && (xop->xo_flags & XOF_CLOSE_FP))
> 	xop->xo_close(xop->xo_opaque);
> @@ -1315,7 +1324,7 @@ xo_destroy (xo_handle_t *xop)
>     xo_buf_cleanup(&xop->xo_predicate);
>     xo_buf_cleanup(&xop->xo_attrs);
>=20
> -    if (xop =3D=3D &xo_default_handle) {
> +    if (xop_arg =3D=3D NULL) {
> 	bzero(&xo_default_handle, sizeof(&xo_default_handle));
> 	xo_default_inited =3D 0;
>     } else
> @@ -1743,7 +1752,7 @@ xo_format_string_direct (xo_handle_t *xo
> 			 int need_enc, int have_enc)
> {
>     int cols =3D 0;
> -    wchar_t wc;
> +    wchar_t wc =3D 0;
>     int ilen, olen, width;
>     int attr =3D (flags & XFF_ATTR);
>     const char *sp;
>=20
> Modified: head/contrib/libxo/libxo/xoconfig.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/contrib/libxo/libxo/xoconfig.h	Tue Nov 18 17:37:33 2014	=
(r274671)
> +++ head/contrib/libxo/libxo/xoconfig.h	Tue Nov 18 18:03:40 2014	=
(r274672)
> @@ -158,7 +158,7 @@
> #define PACKAGE_NAME "libxo"
>=20
> /* Define to the full name and version of this package. */
> -#define PACKAGE_STRING "libxo 0.1.5"
> +#define PACKAGE_STRING "libxo 0.1.6"
>=20
> /* Define to the one symbol short name of this package. */
> #define PACKAGE_TARNAME "libxo"
> @@ -167,7 +167,7 @@
> #define PACKAGE_URL ""
>=20
> /* Define to the version of this package. */
> -#define PACKAGE_VERSION "0.1.5"
> +#define PACKAGE_VERSION "0.1.6"
>=20
> /* If using the C implementation of alloca, define if you know the
>    direction of stack growth for your system; otherwise it will be
> @@ -181,7 +181,7 @@
> #define STDC_HEADERS 1
>=20
> /* Version number of package */
> -#define VERSION "0.1.5"
> +#define VERSION "0.1.6"
>=20
> /* 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.  */
>=20
> Modified: head/contrib/libxo/libxo/xoversion.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/contrib/libxo/libxo/xoversion.h	Tue Nov 18 17:37:33 2014	=
(r274671)
> +++ head/contrib/libxo/libxo/xoversion.h	Tue Nov 18 18:03:40 2014	=
(r274672)
> @@ -18,17 +18,17 @@
> /**
>  * The version string
>  */
> -#define LIBXO_VERSION		"0.1.5"
> +#define LIBXO_VERSION		"0.1.6"
>=20
> /**
>  * The version number
>  */
> -#define LIBXO_VERSION_NUMBER	1004
> +#define LIBXO_VERSION_NUMBER	1006
>=20
> /**
>  * The version number as a string
>  */
> -#define LIBXO_VERSION_STRING	"1004"
> +#define LIBXO_VERSION_STRING	"1006"
>=20
> /**
>  * The version number extra info as a string
>=20
> Modified: head/contrib/libxo/xolint/xolint.pl
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/contrib/libxo/xolint/xolint.pl	Tue Nov 18 17:37:33 2014	=
(r274671)
> +++ head/contrib/libxo/xolint/xolint.pl	Tue Nov 18 18:03:40 2014	=
(r274672)
> @@ -28,6 +28,19 @@ sub main {
> 	extract_samples() if /^-X/;
>     }
>=20
> +    if ($#ARGV < 0) {
> +	print STDERR "xolint [options] files ...\n";
> +	print STDERR "    -c    invoke 'cpp' on input\n";
> +	print STDERR "    -C flags   Pass flags to cpp\n";
> +	print STDERR "    -d         Show debug output\n";
> +	print STDERR "    -D         Extract xolint documentation\n";
> +	print STDERR "    -I         Print xo_info_t data\n";
> +	print STDERR "    -p         Print input data on errors\n";
> +	print STDERR "    -V         Print vocabulary (list of tags)\n";
> +	print STDERR "    -X         Print examples of invalid use\n";
> +	exit(1);
> +    }
> +
>     for $file (@ARGV) {
> 	parse_file($file);
>     }
> @@ -269,9 +282,9 @@ sub check_format {
> 		$last =3D $prev;
> 		next;
> 	    }
> +	    $prev =3D $ch;
> 	}
>=20
> -	$prev =3D $ch;
> 	$build[$phase] .=3D $ch;
>     }
>=20
> @@ -346,18 +359,6 @@ sub check_field {
> 	info("potential missing slash after N, L, or T with format")
> 	    if $field[1] =3D~ /%/;
>=20
> -	#@ Format cannot be given when content is present (roles: DNLT)
> -	#@    xo_emit("{T:Max/%6.6s}", "Max");
> -	#@ Fields with the D, N, L, or T roles can't have both
> -	#@ static literal content ("{T:Title}") and a
> -	#@ format ("{T:/%s}").
> -	#@ This error will also occur when the content has a backslash
> -	#@ in it, like "{N:Type of I/O}"; backslashes should be escaped,
> -	#@ like "{N:Type of I\\/O}".  Note the double backslash, one for
> -	#@ handling 'C' strings, and one for libxo.
> -	error("format cannot be given when content is present")
> -	    if $field[1] && $field[2];
> -
> 	#@ An encoding format cannot be given (roles: DNLT)
> 	#@    xo_emit("{T:Max//%s}", "Max");
> 	#@ Fields with the D, N, L, and T roles are not emitted in
> @@ -367,6 +368,21 @@ sub check_field {
> 	    if $field[3];
>     }
>=20
> +    # Field is a decoration, label, or title
> +    if ($field[0] =3D~ /DLN/) {
> +	#@ Format cannot be given when content is present (roles: DLN)
> +	#@    xo_emit("{N:Max/%6.6s}", "Max");
> +	#@ Fields with the D, L, or N roles can't have both
> +	#@ static literal content ("{L:Label}") and a
> +	#@ format ("{L:/%s}").
> +	#@ This error will also occur when the content has a backslash
> +	#@ in it, like "{N:Type of I/O}"; backslashes should be escaped,
> +	#@ like "{N:Type of I\\/O}".  Note the double backslash, one for
> +	#@ handling 'C' strings, and one for libxo.
> +	error("format cannot be given when content is present")
> +	    if $field[1] && $field[2];
> +    }
> +
>     # A value field
>     if (length($field[0]) =3D=3D 0 || $field[0] =3D~ /V/) {
>=20
> @@ -527,7 +543,7 @@ sub check_field_format {
>     #@ for non-strings.  This error may occur from a typo,
>     #@ like "{:tag/%6..6d}" where only one period should be used.
>     error("max width only valid for strings")
> -	if $#chunks >=3D 2 && $fc =3D~ /[sS]/;
> +	if $#chunks >=3D 2 && $fc !~ /[sS]/;
> }
>=20
> sub error {
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18F6425B-A767-426D-8EEF-57B7CFF3D54B>