diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-08-23 14:53:53 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-08-23 14:53:53 +0000 |
commit | 9057916e1c4a5c696e3ef4038139f3ec6184891e (patch) | |
tree | c541e0c406ace09b049ee56d2cc4e00b14129ce9 /lib/libexpat/tests/minicheck.c | |
parent | 56e025925648e3c4c9596ffec473f1dc24c567bc (diff) |
Update libexpat to 2.2.4. Fix copying partial UTF-8 characters.
OK deraadt@
Diffstat (limited to 'lib/libexpat/tests/minicheck.c')
-rw-r--r-- | lib/libexpat/tests/minicheck.c | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/lib/libexpat/tests/minicheck.c b/lib/libexpat/tests/minicheck.c index a6cae231b75..be1e37e761b 100644 --- a/lib/libexpat/tests/minicheck.c +++ b/lib/libexpat/tests/minicheck.c @@ -1,14 +1,44 @@ /* Miniature re-implementation of the "check" library. - * - * This is intended to support just enough of check to run the Expat - * tests. This interface is based entirely on the portion of the - * check library being used. - */ + + This is intended to support just enough of check to run the Expat + tests. This interface is based entirely on the portion of the + check library being used. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #include <stdio.h> #include <stdlib.h> #include <setjmp.h> #include <assert.h> +#include <string.h> #include "internal.h" /* for UNUSED_P only */ #include "minicheck.h" @@ -186,8 +216,10 @@ _fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(l we have a failure, so there's no reason to be quiet about what it is. */ - if (msg != NULL) - printf("%s", msg); + if (msg != NULL) { + const int has_newline = (msg[strlen(msg) - 1] == '\n'); + fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n"); + } longjmp(env, 1); } |