Marcel, is there a way to get libxo programs to emit time series data?  

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
> 
> Log:
>  Upgrade libxo to 0.1.6.
> 
>  Summary of changes:
>  1.  Coverity defect fixes
> 
>  Obtained from:  https://github.com/Juniper/libxo/releases/tag/0.1.6
> 
> 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
> 
> Modified: head/contrib/libxo/configure.ac
> ==============================================================================
> --- 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 @@
> #
> 
> AC_PREREQ(2.2)
> -AC_INIT([libxo], [0.1.5], [p...@juniper.net])
> +AC_INIT([libxo], [0.1.6], [p...@juniper.net])
> AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
> 
> # Support silent build rules.  Requires at least automake-1.11.
> 
> Modified: head/contrib/libxo/libxo/libxo.c
> ==============================================================================
> --- 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 = getenv("LC_ALL");
>       if (cp == NULL)
>           cp = "UTF-8";       /* Optimistic? */
> -     cp = setlocale(LC_CTYPE, cp);
> +     (void) setlocale(LC_CTYPE, cp);
>     }
> 
>     /*
> @@ -607,8 +607,10 @@ xo_vsnprintf (xo_handle_t *xop, xo_buffe
>       rc = vsnprintf(xbp->xb_curp, left, fmt, va_local);
> 
>     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;
> +     }
> 
>       /*
>        * 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 = vsnprintf(xbp->xb_curp, left, fmt, va_local);
> 
>     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;
> +     }
> 
>       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 = xbp->xb_size - (xbp->xb_curp - xbp->xb_bufp);
>       int rc = 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;
> +         }
> 
>           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 = xbp->xb_size - (xbp->xb_curp - xbp->xb_bufp);
>       rc = 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;
> +         }
> 
>           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
> 
>           va_copy(va_local, vap);
> 
> -         rc = vsnprintf(buf, bufsiz, fmt, va_local);
> +         rc = vsnprintf(bp, bufsiz, fmt, va_local);
>           if (rc > bufsiz) {
>               bufsiz = rc + BUFSIZ;
>               bp = alloca(bufsiz);
>               va_end(va_local);
>               va_copy(va_local, vap);
> -             rc = vsnprintf(buf, bufsiz, fmt, va_local);
> +             rc = vsnprintf(bp, bufsiz, fmt, va_local);
>           }
> +         va_end(va_local);
>           cp = bp + rc;
> 
>           if (need_nl) {
> @@ -1302,9 +1311,9 @@ xo_create_to_file (FILE *fp, xo_style_t 
>  * @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 = xo_default(xop);
> +    xo_handle_t *xop = xo_default(xop_arg);
> 
>     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);
> 
> -    if (xop == &xo_default_handle) {
> +    if (xop_arg == NULL) {
>       bzero(&xo_default_handle, sizeof(&xo_default_handle));
>       xo_default_inited = 0;
>     } else
> @@ -1743,7 +1752,7 @@ xo_format_string_direct (xo_handle_t *xo
>                        int need_enc, int have_enc)
> {
>     int cols = 0;
> -    wchar_t wc;
> +    wchar_t wc = 0;
>     int ilen, olen, width;
>     int attr = (flags & XFF_ATTR);
>     const char *sp;
> 
> Modified: head/contrib/libxo/libxo/xoconfig.h
> ==============================================================================
> --- 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"
> 
> /* Define to the full name and version of this package. */
> -#define PACKAGE_STRING "libxo 0.1.5"
> +#define PACKAGE_STRING "libxo 0.1.6"
> 
> /* Define to the one symbol short name of this package. */
> #define PACKAGE_TARNAME "libxo"
> @@ -167,7 +167,7 @@
> #define PACKAGE_URL ""
> 
> /* Define to the version of this package. */
> -#define PACKAGE_VERSION "0.1.5"
> +#define PACKAGE_VERSION "0.1.6"
> 
> /* 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
> 
> /* Version number of package */
> -#define VERSION "0.1.5"
> +#define VERSION "0.1.6"
> 
> /* 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.  */
> 
> Modified: head/contrib/libxo/libxo/xoversion.h
> ==============================================================================
> --- 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"
> 
> /**
>  * The version number
>  */
> -#define LIBXO_VERSION_NUMBER 1004
> +#define LIBXO_VERSION_NUMBER 1006
> 
> /**
>  * The version number as a string
>  */
> -#define LIBXO_VERSION_STRING "1004"
> +#define LIBXO_VERSION_STRING "1006"
> 
> /**
>  * The version number extra info as a string
> 
> Modified: head/contrib/libxo/xolint/xolint.pl
> ==============================================================================
> --- 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/;
>     }
> 
> +    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 = $prev;
>               next;
>           }
> +         $prev = $ch;
>       }
> 
> -     $prev = $ch;
>       $build[$phase] .= $ch;
>     }
> 
> @@ -346,18 +359,6 @@ sub check_field {
>       info("potential missing slash after N, L, or T with format")
>           if $field[1] =~ /%/;
> 
> -     #@ 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];
>     }
> 
> +    # Field is a decoration, label, or title
> +    if ($field[0] =~ /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]) == 0 || $field[0] =~ /V/) {
> 
> @@ -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 >= 2 && $fc =~ /[sS]/;
> +     if $#chunks >= 2 && $fc !~ /[sS]/;
> }
> 
> sub error {
> 

_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to