Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/appveyor/02-install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ REM Preserve the current working directory:
set CHERE_INVOKING=yes
REM Start a 64 bit Mingw environment:
set MSYSTEM=MINGW64
C:\msys64\usr\bin\bash -lc 'PATH="/mingw64/bin:$PATH" ; export PATH ; pwd ; ccache -sv || echo "SKIP: Could not query ccache stats" ; ccache -o sloppiness=file_macro || true ; ccache -o compression=true || true ; ccache -o max_size=750M || true '
C:\msys64\usr\bin\bash -lc 'PATH="/mingw64/bin:$PATH" ; export PATH ; pwd ; if ! ccache -sv ; then echo "SKIP: Could not query ccache stats" ; fi ; ccache -o compression=true ; echo "ccache settings: max_size=`ccache -k max_size` compression=`ccache -k compression`" ; true '
if errorlevel 1 exit /b %ERRORLEVEL%
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ environment:
# (see ci_build.sh for details):
CI_AUTOGEN_STABLE_VERSION: true
CCACHE_DIR: /home/appveyor/.ccache
CCACHE_MAXSIZE: 750MiB
DO_CLEAN_NUTCI_CACHE: no
DO_USE_NUTCI_CACHE: yes
MSYS: "winsymlinks:nativestrict"
Expand Down
2 changes: 1 addition & 1 deletion clients/upsset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ static void savesettings(void)
static void savesettings(void)
{
int changed = 0;
char *desc;
char *desc = NULL;
uvtype_t *upsvar;

if (!checkhost(monups, &desc))
Expand Down
67 changes: 44 additions & 23 deletions docs/man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,11 @@ CLEANFILES += *.xml *.html *.pdf
# NOTE: MKDIR_P may be defined via expanded $(top_builddir)/install-sh
# so should be run from $(abs_builddir) to be safe, as we jump around
# the build workspace
# For some reason, parallel builds of man pages on FreeBSD 15 with tmpfs
# (to create a tarball during `make dist`, or inside `make distcheck`
# context) fail sufficiently often to be noticeable. May be a system
# problem with some files not becoming visible in time (some other
# tests had failed suspiciously similarly). Sleep just in case...
DOCBUILD_BEGIN = { \
if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \
rm -rf "./$${A2X_OUTDIR}" || true ; \
Expand All @@ -2101,6 +2106,12 @@ DOCBUILD_BEGIN = { \
; then chmod u+w "${builddir}/docbook-xsl.css" ; fi ; \
chmod -R u+w "./$${A2X_OUTDIR}" || true ; \
A2X_VERBOSE="$(ASCIIDOC_VERBOSE)"; if [ "$(V)" = 1 ]; then A2X_VERBOSE="--verbose"; fi; \
case "-$(MAKEFLAGS) $(AM_MAKEFLAGS)" in \
*-j|*-j" "*|*-{j,l}{0,1,2,3,4,5,6,7,8,9}*|*-[jl][0123456789]*|*{-l,--jobs,--load-average,--max-load}" "{-,0,1,2,3,4,5,6,7,8,9}*|*--jobserver*|*--jobs" "[0123456789]*|*--load-average" "[0123456789]*|*--max-load" "[0123456789]*) \
case "`uname -s | tr 'A-Z' 'a-z'`" in \
*freebsd*) sleep 1 ;; \
esac ;; \
esac ; \
}

# Note that documents with sub-pages (see LIBNUTCLIENT_*_DEPS above)
Expand All @@ -2113,12 +2124,37 @@ DOCBUILD_END = { \
for F in $(LINKMAN_INCLUDE_GENERATED) ; do \
rm -f "./$${A2X_OUTDIR}/$$F" || true ; \
done ; \
mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || exit ; \
mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \
rm -rf "./$${A2X_OUTDIR}" ; \
RESMV=0; \
mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || RESMV=$$? ; \
if [ 0 = $$RESMV ] ; then \
mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \
rm -rf "./$${A2X_OUTDIR}" ; \
else \
RES=$$RESMV ; \
fi ; \
fi ; \
}

DOCBUILD_MAN = { \
echo " DOC-MAN Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; \
if [ 0 = "$${RES}" ] ; then exit 0 ; fi ; \
case "-$(MAKEFLAGS) $(AM_MAKEFLAGS)" in \
*-j|*-j" "*|*-{j,l}{0,1,2,3,4,5,6,7,8,9}*|*-[jl][0123456789]*|*{-l,--jobs,--load-average,--max-load}" "{-,0,1,2,3,4,5,6,7,8,9}*|*--jobserver*|*--jobs" "[0123456789]*|*--load-average" "[0123456789]*|*--max-load" "[0123456789]*) \
case "`uname -s | tr 'A-Z' 'a-z'`" in \
*freebsd*) sleep 1 ; \
echo " DOC-MAN RETRY: Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; \
;; \
esac ;; \
esac ; \
exit $$RES ; \
}

### Call the prep step consistently to create symlinks (out-of-tree)
### or just touch-files for peace of mind (in-tree builds). Then we
### use these path names (truncated "-prepped") now surely located
Expand Down Expand Up @@ -2188,38 +2224,23 @@ else !KNOWN_UNABLE_MANS

.txt-prepped.$(MAN_SECTION_CMD_USR):
@A2X_OUTDIR="tmp/man$(MAN_SECTION_CMD_USR).$(@F).$$$$" ; \
echo " DOC-MAN Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; exit $$RES
$(DOCBUILD_MAN)

.txt-prepped.$(MAN_SECTION_API):
@A2X_OUTDIR="tmp/man$(MAN_SECTION_API).$(@F).$$$$" ; \
echo " DOC-MAN Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; exit $$RES
$(DOCBUILD_MAN)

.txt-prepped.$(MAN_SECTION_CFG):
@A2X_OUTDIR="tmp/man$(MAN_SECTION_CFG).$(@F).$$$$" ; \
echo " DOC-MAN Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; exit $$RES
$(DOCBUILD_MAN)

.txt-prepped.$(MAN_SECTION_CMD_SYS):
@A2X_OUTDIR="tmp/man$(MAN_SECTION_CMD_SYS).$(@F).$$$$" ; \
echo " DOC-MAN Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; exit $$RES
$(DOCBUILD_MAN)

.txt-prepped.$(MAN_SECTION_MISC):
@A2X_OUTDIR="tmp/man$(MAN_SECTION_MISC).$(@F).$$$$" ; \
echo " DOC-MAN Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \
$(DOCBUILD_END) ; exit $$RES
$(DOCBUILD_MAN)

endif !KNOWN_UNABLE_MANS

Expand Down
58 changes: 29 additions & 29 deletions tests/parseconf-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
#endif

typedef struct {
const char *name;
const char *input;
size_t numargs;
const char *args[8];
const char *name;
const char *input;
size_t numargs;
const char *args[8];
} testcase_t;

static const testcase_t cases[] = {
static const testcase_t cases[] = {
{ "ordinary", "one two\n", 2, { "one", "two" } },
{ "empty", " \t\n", 0, { NULL } },
{ "comment", "# ignored\n", 0, { NULL } },
Expand Down Expand Up @@ -65,11 +65,11 @@ static const testcase_t cases[] = {
{ "character filter", "\"a\001\t\r\200\377b\177\"\n", 1, { "ab\177" } }
};

static int failures = 0;
static int failures = 0;

static void check_args(PCONF_CTX_t *ctx, const testcase_t *test, const char *mode)
{
size_t i;
size_t i;

if (pconf_parse_error(ctx)) {
fprintf(stderr, "%s/%s: unexpected parse error: %s\n",
Expand Down Expand Up @@ -112,9 +112,9 @@ static void file_input(PCONF_CTX_t *ctx, const char *input)

static void check_case(const testcase_t *test)
{
PCONF_CTX_t ctx;
size_t i, len = strlen(test->input);
int ret;
PCONF_CTX_t ctx;
size_t i, len = strlen(test->input);
int ret;

pconf_init(&ctx, NULL);
check_result(pconf_line(&ctx, test->input), 1, test->name);
Expand All @@ -141,20 +141,20 @@ static void check_case(const testcase_t *test)

static void check_boundaries(void)
{
PCONF_CTX_t ctx;
static const testcase_t incomplete = {
PCONF_CTX_t ctx;
static const testcase_t incomplete = {
"incomplete quote", "key \"unfinished", 2, { "key", "unfinished" }
};
static const testcase_t limited = {
static const testcase_t limited = {
"limits", "abcde fghij discarded\n", 2, { "abcd", "fghi" }
};
static const testcase_t trailing = {
static const testcase_t trailing = {
"trailing backslash", "key value\\", 2, { "key", "value" }
};
static const testcase_t next = {
static const testcase_t next = {
"next line", "next\n", 1, { "next" }
};
size_t i;
size_t i;

/* These incomplete inputs historically return their collected words. */
pconf_init(&ctx, NULL);
Expand Down Expand Up @@ -197,12 +197,12 @@ static void check_boundaries(void)

static void check_encoder(void)
{
static const char raw[] = "# \\\"' = end#";
static const char encoded[] = "\\# \\\\\\\"' = end\\#";
PCONF_CTX_t ctx;
char output[128], input[132];
const testcase_t roundtrip = { "encoder roundtrip", NULL, 1, { raw } };
const testcase_t short_result = { "short encoder roundtrip", NULL, 1, { "#" } };
static const char raw[] = "# \\\"' = end#";
static const char encoded[] = "\\# \\\\\\\"' = end\\#";
PCONF_CTX_t ctx;
char output[128], input[132];
const testcase_t roundtrip = { "encoder roundtrip", NULL, 1, { raw } };
const testcase_t short_result = { "short encoder roundtrip", NULL, 1, { "#" } };

check_result(pconf_encode(raw, output, sizeof(output)) == output, 1, "encoder return");
check_result(strcmp(output, encoded), 0, "encoder bytes (including escaped hash)");
Expand All @@ -228,10 +228,10 @@ static void check_encoder(void)
/* Parse input with stderr sent to a temporary file, return what was written */
static void capture_stderr(const char *input, int from_file, char *out, size_t outlen)
{
PCONF_CTX_t ctx;
FILE *cap = tmpfile();
int saved;
size_t n;
PCONF_CTX_t ctx;
FILE *cap = tmpfile();
int saved;
size_t n;

out[0] = '\0';
if (!cap)
Expand Down Expand Up @@ -261,8 +261,8 @@ static void capture_stderr(const char *input, int from_file, char *out, size_t o

static void check_attached_hash_warning(void)
{
static const char line[] = "MONITOR ups@localhost 1 upsmon Example#123 primary\n";
char msg[512];
static const char line[] = "MONITOR ups@localhost 1 upsmon Example#123 primary\n";
char msg[512];

/* A config file line cut by a glued hash names its position, and
* none of the text before the hash */
Expand All @@ -283,7 +283,7 @@ static void check_attached_hash_warning(void)

int main(void)
{
size_t i;
size_t i;

for (i = 0; i < sizeof(cases) / sizeof(cases[0]); i++)
check_case(&cases[i]);
Expand Down
Loading
Loading