Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HardenedBSD
HardenedBSD
Commits
76c53ac6
Commit
76c53ac6
authored
Aug 03, 2017
by
Phil Shafer
Browse files
Import libxo 0.8.4
parent
f652982a
Changes
60
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
76c53ac6
...
...
@@ -38,7 +38,14 @@ GH_PAGES_DIR = gh-pages/
GH_PAGES_DIR_VER
=
gh-pages/
${PACKAGE_VERSION}
PACKAGE_FILE
=
${PACKAGE_TARNAME}
-
${PACKAGE_VERSION}
.tar.gz
upload
:
dist upload-docs
XOHTML_FILES
=
\
${top_srcdir}
/xohtml/xohtml.css
\
${top_srcdir}
/xohtml/xohtml.js
\
${top_srcdir}
/xohtml/external/jquery.js
\
${top_srcdir}
/xohtml/external/jquery.qtip.css
\
${top_srcdir}
/xohtml/external/jquery.qtip.js
upload
:
dist upload-docs upload-xohtml-files
@
echo
"Remember to run:"
@
echo
" gt tag
${PACKAGE_VERSION}
"
...
...
@@ -56,6 +63,18 @@ upload-docs: docs
libxo-manual.html
${PACKAGE_VERSION}
\
&&
git push origin gh-pages
)
;
true
upload-xohtml-files
:
@
echo
"Uploading xohtml files ... "
@
-[
-d
${GH_PAGES_DIR}
]
\
&&
echo
"Updating xohtml files on gh-pages ..."
\
&&
mkdir
-p
${GH_PAGES_DIR_VER}
/xohtml
\
&&
cp
${XOHTML_FILES}
${GH_PAGES_DIR_VER}
/xohtml
\
&&
(
cd
${GH_PAGES_DIR}
\
&&
git add
${PACKAGE_VERSION}
/xohtml
\
&&
git commit
-m
'new xohtml files'
\
${PACKAGE_VERSION}
/xohtml
\
&&
git push origin gh-pages
)
;
true
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfig_DATA
=
packaging/
${PACKAGE_NAME}
.pc
...
...
configure.ac
View file @
76c53ac6
...
...
@@ -12,7 +12,7 @@
#
AC_PREREQ(2.2)
AC_INIT([libxo], [0.8.
1
], [phil@juniper.net])
AC_INIT([libxo], [0.8.
4
], [phil@juniper.net])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
# Support silent build rules. Requires at least automake-1.11.
...
...
doc/libxo-manual.html
View file @
76c53ac6
...
...
@@ -515,7 +515,7 @@ li.indline1 {
}
@top-right {
content: "
June
2017";
content: "
August
2017";
}
@top-center {
...
...
@@ -22011,7 +22011,7 @@ jQuery(function ($) {
</tr>
<tr>
<td class="header left"></td>
<td class="header right">
June 14
, 2017</td>
<td class="header right">
August 3
, 2017</td>
</tr>
</table></div>
<p id="title" class="title">libxo: The Easy Way to Generate text, XML, JSON, and HTML output<br><span class="filename">libxo-manual</span></p>
...
...
libxo/libxo.3
View file @
76c53ac6
...
...
@@ -311,3 +311,13 @@ to use an alternative set of low-level output functions.
.Xr xo_set_style 3 ,
.Xr xo_set_writer 3 ,
.Xr xo_format 5
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/libxo.c
View file @
76c53ac6
...
...
@@ -137,7 +137,7 @@ static const char xo_default_format[] = "%s";
#define XO_INDENT_BY 2
/* Amount to indent when pretty printing */
#define XO_DEPTH 128
/* Default stack depth */
#define XO_MAX_ANCHOR_WIDTH (8*1024)
/* Anything wider is just silly
b
*/
#define XO_MAX_ANCHOR_WIDTH (8*1024)
/* Anything wider is just silly */
#define XO_FAILURE_NAME "failure"
...
...
@@ -5071,16 +5071,60 @@ xo_find_width (xo_handle_t *xop, xo_field_info_t *xfip,
bp
[
vlen
]
=
'\0'
;
width
=
strtol
(
bp
,
&
cp
,
0
);
if
(
width
==
LONG_MIN
||
width
==
LONG_MAX
||
bp
==
cp
||
*
cp
!=
'\0'
)
{
if
(
width
==
LONG_MIN
||
width
==
LONG_MAX
||
bp
==
cp
||
*
cp
!=
'\0'
)
{
width
=
0
;
xo_failure
(
xop
,
"invalid width for anchor: '%s'"
,
bp
);
}
}
else
if
(
flen
)
{
if
(
flen
!=
2
||
strncmp
(
"%d"
,
fmt
,
flen
)
!=
0
)
xo_failure
(
xop
,
"invalid width format: '%*.*s'"
,
flen
,
flen
,
fmt
);
if
(
!
XOF_ISSET
(
xop
,
XOF_NO_VA_ARG
))
width
=
va_arg
(
xop
->
xo_vap
,
int
);
/*
* We really expect the format for width to be "{:/%d}" or
* "{:/%u}", so if that's the case, we just grab our width off
* the argument list. But we need to avoid optimized logic if
* there's a custom formatter.
*/
if
(
xop
->
xo_formatter
==
NULL
&&
flen
==
2
&&
strncmp
(
"%d"
,
fmt
,
flen
)
==
0
)
{
if
(
!
XOF_ISSET
(
xop
,
XOF_NO_VA_ARG
))
width
=
va_arg
(
xop
->
xo_vap
,
int
);
}
else
if
(
xop
->
xo_formatter
==
NULL
&&
flen
==
2
&&
strncmp
(
"%u"
,
fmt
,
flen
)
==
0
)
{
if
(
!
XOF_ISSET
(
xop
,
XOF_NO_VA_ARG
))
width
=
va_arg
(
xop
->
xo_vap
,
unsigned
);
}
else
{
/*
* So we have a format and it's not a simple one like
* "{:/%d}". That means we need to format the field,
* extract the value from the formatted output, and then
* discard that output.
*/
int
anchor_was_set
=
FALSE
;
xo_buffer_t
*
xbp
=
&
xop
->
xo_data
;
ssize_t
start_offset
=
xo_buf_offset
(
xbp
);
bp
=
xo_buf_cur
(
xbp
);
/* Save start of the string */
cp
=
NULL
;
if
(
XOIF_ISSET
(
xop
,
XOIF_ANCHOR
))
{
XOIF_CLEAR
(
xop
,
XOIF_ANCHOR
);
anchor_was_set
=
TRUE
;
}
ssize_t
rc
=
xo_do_format_field
(
xop
,
xbp
,
fmt
,
flen
,
0
);
if
(
rc
>=
0
)
{
xo_buf_append
(
xbp
,
""
,
1
);
/* Append a NUL */
width
=
strtol
(
bp
,
&
cp
,
0
);
if
(
width
==
LONG_MIN
||
width
==
LONG_MAX
||
bp
==
cp
||
*
cp
!=
'\0'
)
{
width
=
0
;
xo_failure
(
xop
,
"invalid width for anchor: '%s'"
,
bp
);
}
}
/* Reset the cur pointer to where we found it */
xbp
->
xb_curp
=
xbp
->
xb_bufp
+
start_offset
;
if
(
anchor_was_set
)
XOIF_SET
(
xop
,
XOIF_ANCHOR
);
}
}
return
width
;
...
...
@@ -5107,9 +5151,6 @@ static void
xo_anchor_start
(
xo_handle_t
*
xop
,
xo_field_info_t
*
xfip
,
const
char
*
value
,
ssize_t
vlen
)
{
if
(
xo_style
(
xop
)
!=
XO_STYLE_TEXT
&&
xo_style
(
xop
)
!=
XO_STYLE_HTML
)
return
;
if
(
XOIF_ISSET
(
xop
,
XOIF_ANCHOR
))
xo_failure
(
xop
,
"the anchor already recording is discarded"
);
...
...
@@ -5129,9 +5170,6 @@ static void
xo_anchor_stop
(
xo_handle_t
*
xop
,
xo_field_info_t
*
xfip
,
const
char
*
value
,
ssize_t
vlen
)
{
if
(
xo_style
(
xop
)
!=
XO_STYLE_TEXT
&&
xo_style
(
xop
)
!=
XO_STYLE_HTML
)
return
;
if
(
!
XOIF_ISSET
(
xop
,
XOIF_ANCHOR
))
{
xo_failure
(
xop
,
"no start anchor"
);
return
;
...
...
libxo/xo_attr.3
View file @
76c53ac6
...
...
@@ -58,3 +58,13 @@ already emitted in other form.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_create.3
View file @
76c53ac6
...
...
@@ -65,3 +65,13 @@ resources associated with the default handle.
.Xr xo_emit 3 ,
.Xr xo_set_options 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_emit.3
View file @
76c53ac6
...
...
@@ -102,3 +102,13 @@ then the number of display columns consumed by the output will be returned.
.Xr xo_open_list 3 ,
.Xr xo_format 5 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_emit_err.3
View file @
76c53ac6
...
...
@@ -70,3 +70,13 @@ parameter.
.Xr xo_format 5 ,
.Xr xo_err 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_emit_f.3
View file @
76c53ac6
...
...
@@ -109,3 +109,13 @@ for details.
.Xr xo_open_list 3 ,
.Xr xo_format 5 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_err.3
View file @
76c53ac6
...
...
@@ -72,3 +72,13 @@ parameter.
.Xr xo_emit 3 ,
.Xr xo_emit_err 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_error.3
View file @
76c53ac6
...
...
@@ -39,3 +39,13 @@ calls.
.Xr printf 3 ,
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_finish.3
View file @
76c53ac6
...
...
@@ -37,3 +37,13 @@ especially for the non-TEXT output styles.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_flush.3
View file @
76c53ac6
...
...
@@ -33,3 +33,13 @@ function is used for this.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_format.5
View file @
76c53ac6
...
...
@@ -965,3 +965,13 @@ names to make that difference more obvious.
.Xr libxo 3 ,
.Xr xolint 1 ,
.Xr xo_emit 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_message.3
View file @
76c53ac6
...
...
@@ -66,3 +66,13 @@ and
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_no_setlocale.3
View file @
76c53ac6
...
...
@@ -41,3 +41,13 @@ function.
.Xr xo_open_list 3 ,
.Xr xo_format 5 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_open_container.3
View file @
76c53ac6
...
...
@@ -186,3 +186,13 @@ and the name recorded do not match.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_open_list.3
View file @
76c53ac6
...
...
@@ -156,3 +156,13 @@ are rendered as multiple leaf elements.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
libxo/xo_open_marker.3
View file @
76c53ac6
...
...
@@ -103,3 +103,13 @@ properly.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr libxo 3
.Sh HISTORY
The
.Nm libxo
library first appeared in
.Fx 11.0 .
.Sh AUTHORS
.Nm libxo
was written by
.An Phil Shafer Aq Mt phil@freebsd.org .
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment