aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Shafer <phil@FreeBSD.org>2019-11-07 18:05:26 +0000
committerPhil Shafer <phil@FreeBSD.org>2019-11-07 18:05:26 +0000
commit5fe9672cf6a4e4e6c6bbdb133c9d998f577f88f2 (patch)
treece84af655647e03c5efa9ea2fb92f12e0aa3f803
parent0922e92a305ac1fd58f814909bbaf2f9fed56552 (diff)
downloadsrc-5fe9672cf6a4e4e6c6bbdb133c9d998f577f88f2.tar.gz
src-5fe9672cf6a4e4e6c6bbdb133c9d998f577f88f2.zip
Import libxo 1.3.1vendor/Juniper/libxo/1.3.1
Notes
Notes: svn path=/vendor/Juniper/libxo/dist/; revision=354453 svn path=/vendor/Juniper/libxo/1.3.1/; revision=354454; tag=vendor/Juniper/libxo/1.3.1
-rw-r--r--configure.ac2
-rw-r--r--libxo/libxo.c4
-rw-r--r--tests/core/test_01.c3
3 files changed, 7 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index b042f7e2c28b..62d5a0383f79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@
#
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])
# Support silent build rules. Requires at least automake-1.11.
diff --git a/libxo/libxo.c b/libxo/libxo.c
index 09d2bd827f93..14268d1b250e 100644
--- a/libxo/libxo.c
+++ b/libxo/libxo.c
@@ -8104,12 +8104,14 @@ xo_parse_args (int argc, char **argv)
cp = strrchr(xo_program, '/');
if (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 */
size_t len = strlen(xo_program);
static const char gnu_ext[] = ".test";
if (len >= sizeof(gnu_ext)) {
- cp = &cp[len + 1 - sizeof(gnu_ext)];
+ cp += len + 1 - sizeof(gnu_ext);
if (xo_streq(cp, gnu_ext))
*cp = '\0';
}
diff --git a/tests/core/test_01.c b/tests/core/test_01.c
index 35dc15df6112..aeeb0c9ca67a 100644
--- a/tests/core/test_01.c
+++ b/tests/core/test_01.c
@@ -50,6 +50,9 @@ main (int argc, char **argv)
{ "sold", "number", "Number of items sold" },
{ XO_INFO_NULL },
};
+
+ char name[] = "test_01.test"; /* test trimming of xo_program */
+ argv[0] = name;
argc = xo_parse_args(argc, argv);
if (argc < 0)