diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index e636c7d66..3fce13687 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -180,7 +180,8 @@ void ROKEN_LIB_FUNCTION endusershell(void); #ifndef HAVE_SNPRINTF #define snprintf rk_snprintf #endif -int ROKEN_LIB_FUNCTION snprintf (char *, size_t, const char *, ...) +int ROKEN_LIB_FUNCTION + rk_snprintf (char *, size_t, const char *, ...) __attribute__ ((format (printf, 3, 4))); #endif @@ -189,7 +190,7 @@ int ROKEN_LIB_FUNCTION snprintf (char *, size_t, const char *, ...) #define vsnprintf rk_vsnprintf #endif int ROKEN_LIB_FUNCTION - vsnprintf (char *, size_t, const char *, va_list) + rk_vsnprintf (char *, size_t, const char *, va_list) __attribute__((format (printf, 3, 0))); #endif @@ -198,7 +199,7 @@ int ROKEN_LIB_FUNCTION #define asprintf rk_asprintf #endif int ROKEN_LIB_FUNCTION - asprintf (char **, const char *, ...) + rk_asprintf (char **, const char *, ...) __attribute__ ((format (printf, 2, 3))); #endif @@ -207,7 +208,7 @@ int ROKEN_LIB_FUNCTION #define vasprintf rk_vasprintf #endif int ROKEN_LIB_FUNCTION - vasprintf (char **, const char *, va_list) + rk_vasprintf (char **, const char *, va_list) __attribute__((format (printf, 2, 0))); #endif @@ -216,7 +217,7 @@ int ROKEN_LIB_FUNCTION #define asnprintf rk_asnprintf #endif int ROKEN_LIB_FUNCTION - asnprintf (char **, size_t, const char *, ...) + rk_asnprintf (char **, size_t, const char *, ...) __attribute__ ((format (printf, 3, 4))); #endif diff --git a/lib/roken/snprintf-test.c b/lib/roken/snprintf-test.c index dd7d5fb8d..670ce8956 100644 --- a/lib/roken/snprintf-test.c +++ b/lib/roken/snprintf-test.c @@ -31,7 +31,6 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include -#include "snprintf-test.h" #include "roken.h" #include @@ -45,7 +44,7 @@ try (const char *format, ...) char buf1[256], buf2[256]; va_start (ap, format); - ret = vsnprintf (buf1, sizeof(buf1), format, ap); + ret = rk_vsnprintf (buf1, sizeof(buf1), format, ap); if (ret >= sizeof(buf1)) errx (1, "increase buf and try again"); va_end (ap); @@ -222,7 +221,7 @@ cmp_with_sprintf_float (void) static int test_null (void) { - return snprintf (NULL, 0, "foo") != 3; + return rk_snprintf (NULL, 0, "foo") != 3; } static int @@ -240,7 +239,7 @@ test_sizet (void) tot += try("%zX", sizet_values[i]); #else char buf[256]; - snprintf(buf, sizeof(buf), "%zu", sizet_values[i]); + rk_snprintf(buf, sizeof(buf), "%zu", sizet_values[i]); if (strcmp(buf, result[i]) != 0) { printf("%s != %s", buf, result[i]); tot++; diff --git a/lib/roken/snprintf-test.h b/lib/roken/snprintf-test.h deleted file mode 100644 index 874ffd2d5..000000000 --- a/lib/roken/snprintf-test.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2001 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of KTH nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* $Id$ */ -/* - * we cannot use the real names of the functions when testing, since - * they might have different prototypes as the system functions, hence - * these evil hacks - */ - - -#undef snprintf -#define snprintf test_snprintf -#undef asprintf -#define asprintf test_asprintf -#undef asnprintf -#define asnprintf test_asnprintf -#undef vasprintf -#define vasprintf test_vasprintf -#undef vasnprintf -#define vasnprintf test_vasnprintf -#undef vsnprintf -#define vsnprintf test_vsnprintf