Import libxo-1.3.1:

- handle argv[0] without '/'
- add test case for argv[0] without '/'
This commit is contained in:
Phil Shafer 2019-11-07 18:06:44 +00:00
commit 67322d1642
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354455
7 changed files with 18 additions and 12 deletions

View File

@ -12,7 +12,7 @@
# #
AC_PREREQ(2.2) AC_PREREQ(2.2)
AC_INIT([libxo], [1.3.0], [phil@juniper.net]) AC_INIT([libxo], [1.3.1], [phil@juniper.net])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
# Support silent build rules. Requires at least automake-1.11. # Support silent build rules. Requires at least automake-1.11.

View File

@ -8104,12 +8104,14 @@ xo_parse_args (int argc, char **argv)
cp = strrchr(xo_program, '/'); cp = strrchr(xo_program, '/');
if (cp) if (cp)
xo_program = ++cp; xo_program = ++cp;
else
cp = argv[0]; /* Reset to front of string */
/* GNU tools add an annoying ".test" as the program extension; remove it */ /* GNU tools add an annoying ".test" as the program extension; remove it */
size_t len = strlen(xo_program); size_t len = strlen(xo_program);
static const char gnu_ext[] = ".test"; static const char gnu_ext[] = ".test";
if (len >= sizeof(gnu_ext)) { if (len >= sizeof(gnu_ext)) {
cp = &cp[len + 1 - sizeof(gnu_ext)]; cp += len + 1 - sizeof(gnu_ext);
if (xo_streq(cp, gnu_ext)) if (xo_streq(cp, gnu_ext))
*cp = '\0'; *cp = '\0';
} }

View File

@ -50,6 +50,9 @@ main (int argc, char **argv)
{ "sold", "number", "Number of items sold" }, { "sold", "number", "Number of items sold" },
{ XO_INFO_NULL }, { XO_INFO_NULL },
}; };
char name[] = "test_01.test"; /* test trimming of xo_program */
argv[0] = name;
argc = xo_parse_args(argc, argv); argc = xo_parse_args(argc, argv);
if (argc < 0) if (argc < 0)

View File

@ -3,10 +3,10 @@
.Fx .Fx
uses uses
.Nm libxo .Nm libxo
version 1.3.0. version 1.3.1.
Complete documentation can be found on github: Complete documentation can be found on github:
.Bd -literal -offset indent .Bd -literal -offset indent
https://juniper.github.io/libxo/1.3.0/html/index.html https://juniper.github.io/libxo/1.3.1/html/index.html
.Ed .Ed
.Pp .Pp
.Nm libxo .Nm libxo

View File

@ -2,7 +2,7 @@
LIBXODIR= ${STAGEDIR}${PREFIX}/usr/lib/libxo/encoder LIBXODIR= ${STAGEDIR}${PREFIX}/usr/lib/libxo/encoder
SHLIBDIR?= ${LIBXODIR} SHLIBDIR?= ${LIBXODIR}
LIBDIR?= ${LIBXODIR} LIBDIR?= ${LIBXODIR}
.include <src.opts.mk> .include <src.opts.mk>
@ -21,6 +21,7 @@ CFLAGS+=-I${LIBXOSRC}/libxo -I${.CURDIR}
CFLAGS+=-DXO_ENCODERDIR=\"/usr/lib/libxo/encoder\" CFLAGS+=-DXO_ENCODERDIR=\"/usr/lib/libxo/encoder\"
LIBADD= util xo LIBADD= util xo
LDFLAGS += -L${.OBJDIR}/../../wildebeast
WARNS?= 5 WARNS?= 5

View File

@ -183,16 +183,16 @@
/* #undef LIBXO_TEXT_ONLY */ /* #undef LIBXO_TEXT_ONLY */
/* Version number as dotted value */ /* Version number as dotted value */
#define LIBXO_VERSION "1.3.0" #define LIBXO_VERSION "1.3.1"
/* Version number extra information */ /* Version number extra information */
#define LIBXO_VERSION_EXTRA "" #define LIBXO_VERSION_EXTRA ""
/* Version number as a number */ /* Version number as a number */
#define LIBXO_VERSION_NUMBER 1003000 #define LIBXO_VERSION_NUMBER 1003001
/* Version number as string */ /* Version number as string */
#define LIBXO_VERSION_STRING "1003000" #define LIBXO_VERSION_STRING "1003001"
/* Enable local wcwidth implementation */ /* Enable local wcwidth implementation */
#define LIBXO_WCWIDTH 1 #define LIBXO_WCWIDTH 1
@ -210,7 +210,7 @@
#define PACKAGE_NAME "libxo" #define PACKAGE_NAME "libxo"
/* Define to the full name and version of this package. */ /* Define to the full name and version of this package. */
#define PACKAGE_STRING "libxo 1.3.0" #define PACKAGE_STRING "libxo 1.3.1"
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libxo" #define PACKAGE_TARNAME "libxo"
@ -219,7 +219,7 @@
#define PACKAGE_URL "" #define PACKAGE_URL ""
/* Define to the version of this package. */ /* Define to the version of this package. */
#define PACKAGE_VERSION "1.3.0" #define PACKAGE_VERSION "1.3.1"
/* If using the C implementation of alloca, define if you know the /* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be direction of stack growth for your system; otherwise it will be
@ -236,7 +236,7 @@
/* #undef USE_INT_RETURN_CODES */ /* #undef USE_INT_RETURN_CODES */
/* Version number of package */ /* Version number of package */
#define VERSION "1.3.0" #define VERSION "1.3.1"
/* Retain hash bucket size */ /* Retain hash bucket size */
/* #undef XO_RETAIN_SIZE */ /* #undef XO_RETAIN_SIZE */

View File

@ -12,7 +12,7 @@
# #
BASE=/usr/share/libxo BASE=/usr/share/libxo
VERSION=1.3.0 VERSION=1.3.1
CMD=cat CMD=cat
DONE= DONE=
WEB=http://juniper.github.io/libxo/${VERSION}/xohtml WEB=http://juniper.github.io/libxo/${VERSION}/xohtml