summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/chkdecimalpoint.c2
-rw-r--r--tests/libtest/first.c4
-rw-r--r--tests/libtest/lib1156.c2
-rw-r--r--tests/libtest/lib1502.c4
-rw-r--r--tests/libtest/lib1506.c12
-rw-r--r--tests/libtest/lib1510.c12
-rw-r--r--tests/libtest/lib1512.c12
-rw-r--r--tests/libtest/lib1515.c10
-rw-r--r--tests/libtest/lib1529.c5
-rw-r--r--tests/libtest/lib1560.c4
-rw-r--r--tests/libtest/lib1900.c4
-rw-r--r--tests/libtest/lib518.c64
-rw-r--r--tests/libtest/lib530.c4
-rw-r--r--tests/libtest/lib537.c66
-rw-r--r--tests/libtest/lib540.c4
-rw-r--r--tests/libtest/lib553.c4
-rw-r--r--tests/libtest/libauthretry.c4
-rw-r--r--tests/libtest/libntlmconnect.c4
-rw-r--r--tests/libtest/stub_gssapi.c9
-rw-r--r--tests/libtest/testtrace.c6
-rw-r--r--tests/server/fake_ntlm.c8
-rw-r--r--tests/server/rtspd.c32
-rw-r--r--tests/server/sockfilt.c16
-rw-r--r--tests/server/sws.c46
-rw-r--r--tests/server/tftpd.c10
-rw-r--r--tests/server/util.c15
-rw-r--r--tests/unit/unit1398.c4
-rw-r--r--tests/unit/unit1399.c4
-rw-r--r--tests/unit/unit1604.c28
-rw-r--r--tests/unit/unit1650.c12
-rw-r--r--tests/unit/unit1652.c2
31 files changed, 212 insertions, 201 deletions
diff --git a/tests/libtest/chkdecimalpoint.c b/tests/libtest/chkdecimalpoint.c
index b5f5070c0..7bb77150f 100644
--- a/tests/libtest/chkdecimalpoint.c
+++ b/tests/libtest/chkdecimalpoint.c
@@ -33,7 +33,7 @@ int main(void)
int chars;
setlocale(LC_NUMERIC, "");
- chars = snprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0);
+ chars = msnprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0);
if((chars == (TOTAL_STR_LEN - 1)) && (strcmp(zero, "0.0") == 0))
return 0;
else
diff --git a/tests/libtest/first.c b/tests/libtest/first.c
index 86d84cacd..405e6f84a 100644
--- a/tests/libtest/first.c
+++ b/tests/libtest/first.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -124,7 +124,7 @@ char *hexdump(const unsigned char *buffer, size_t len)
if(len > 200)
return NULL;
for(i = 0; i<len; i++, p += 3)
- snprintf(p, 4, "%02x ", buffer[i]);
+ msnprintf(p, 4, "%02x ", buffer[i]);
return dump;
}
diff --git a/tests/libtest/lib1156.c b/tests/libtest/lib1156.c
index 63348de76..cb8878c21 100644
--- a/tests/libtest/lib1156.c
+++ b/tests/libtest/lib1156.c
@@ -91,7 +91,7 @@ static int onetest(CURL *curl, const char *url, const testparams *p)
replyselector = p->flags & F_CONTENTRANGE? 1: 0;
if(p->flags & F_HTTP416)
replyselector += 2;
- snprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
+ msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
test_setopt(curl, CURLOPT_URL, urlbuf);
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME)? 3: 0);
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME)?
diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c
index bd7c7c864..6bde00a86 100644
--- a/tests/libtest/lib1502.c
+++ b/tests/libtest/lib1502.c
@@ -50,8 +50,8 @@ int test(char *URL)
/* DNS cache injection */
struct curl_slist *dns_cache_list;
- snprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
- libtest_arg3);
+ msnprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
+ libtest_arg3);
start_test_timing();
diff --git a/tests/libtest/lib1506.c b/tests/libtest/lib1506.c
index d456bc95c..1d5e8de4a 100644
--- a/tests/libtest/lib1506.c
+++ b/tests/libtest/lib1506.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -46,8 +46,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */
for(i = 0; i < NUM_HANDLES; i++) {
- snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
- i + 1, port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
+ i + 1, port, address);
printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
@@ -70,9 +70,9 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server%d.example.com:%s/path/1506%04i",
- i + 1, port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server%d.example.com:%s/path/1506%04i",
+ i + 1, port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib1510.c b/tests/libtest/lib1510.c
index d72749b24..4c7b670a0 100644
--- a/tests/libtest/lib1510.c
+++ b/tests/libtest/lib1510.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -44,8 +44,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */
for(i = 0; i < NUM_URLS; i++) {
- snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
- port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
+ port, address);
printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
@@ -74,9 +74,9 @@ int test(char *URL)
/* get NUM_HANDLES easy handles */
for(i = 0; i < NUM_URLS; i++) {
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server%d.example.com:%s/path/1510%04i",
- i + 1, port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server%d.example.com:%s/path/1510%04i",
+ i + 1, port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl, CURLOPT_URL, target_url);
diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c
index 1c2578958..0b71ad3f5 100644
--- a/tests/libtest/lib1512.c
+++ b/tests/libtest/lib1512.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -49,8 +49,8 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
- port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
+ port, address);
printf("%s\n", dnsentry);
slist = curl_slist_append(slist, dnsentry);
@@ -59,9 +59,9 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server.example.curl:%s/path/1512%04i",
- port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server.example.curl:%s/path/1512%04i",
+ port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c
index 39bccc59b..c72554a3b 100644
--- a/tests/libtest/lib1515.c
+++ b/tests/libtest/lib1515.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -123,8 +123,8 @@ int test(char *URL)
int i;
int count = 2;
- snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
- port, address);
+ msnprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
+ port, address);
start_test_timing();
@@ -133,8 +133,8 @@ int test(char *URL)
for(i = 1; i <= count; i++) {
char target_url[256];
- snprintf(target_url, sizeof(target_url),
- "http://testserver.example.com:%s/%s%04d", port, path, i);
+ msnprintf(target_url, sizeof(target_url),
+ "http://testserver.example.com:%s/%s%04d", port, path, i);
/* second request must succeed like the first one */
res = do_one_request(multi, target_url, dns_entry);
diff --git a/tests/libtest/lib1529.c b/tests/libtest/lib1529.c
index c63a109b8..8d2210e25 100644
--- a/tests/libtest/lib1529.c
+++ b/tests/libtest/lib1529.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -29,7 +29,8 @@ int test(char *URL)
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
char bURL[512];
- snprintf(bURL, sizeof(bURL), "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
+ msnprintf(bURL, sizeof(bURL),
+ "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index c95401bcc..7ae1025be 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -67,10 +67,10 @@ static int checkparts(CURLU *u, const char *in, const char *wanted,
size_t n;
rc = curl_url_get(u, parts[i].part, &p, getflags);
if(!rc && p) {
- snprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
+ msnprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
}
else
- snprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
+ msnprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
n = strlen(bufp);
bufp += n;
diff --git a/tests/libtest/lib1900.c b/tests/libtest/lib1900.c
index cf55fb332..1e10bdf34 100644
--- a/tests/libtest/lib1900.c
+++ b/tests/libtest/lib1900.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing, <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing, <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -113,7 +113,7 @@ static void setup_handle(char *base_url, CURLM *m, int handlenum)
{
char urlbuf[256];
- snprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]);
+ msnprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]);
curl_easy_setopt(handles[handlenum], CURLOPT_URL, urlbuf);
curl_easy_setopt(handles[handlenum], CURLOPT_VERBOSE, 1L);
curl_easy_setopt(handles[handlenum], CURLOPT_FAILONERROR, 1L);
diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c
index 81c5a5fad..1a3091fcc 100644
--- a/tests/libtest/lib518.c
+++ b/tests/libtest/lib518.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -55,10 +55,10 @@ static char msgbuff[256];
static void store_errmsg(const char *msg, int err)
{
if(!err)
- snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+ msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else
- snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
- err, strerror(err));
+ msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
+ err, strerror(err));
}
static void close_file_descriptors(void)
@@ -132,7 +132,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "initial soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -140,7 +140,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "initial hard limit: %s\n", strbuff);
/* show our constants */
@@ -198,7 +198,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "current soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -206,7 +206,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "current hard limit: %s\n", strbuff);
} /* (rl.rlim_cur != rl.rlim_max) */
@@ -233,10 +233,10 @@ static int rlimit(int keep_open)
(rl.rlim_cur != RLIM_INFINITY) &&
#endif
(rl.rlim_cur <= num_open.rlim_cur)) {
- snprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
- strbuff1, strbuff2);
+ msnprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+ strbuff1, strbuff2);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
return -4;
@@ -257,7 +257,7 @@ static int rlimit(int keep_open)
nitems = 0x40000;
do {
num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
if(!memchunk) {
@@ -285,9 +285,9 @@ static int rlimit(int keep_open)
/* verify that we won't overflow size_t in malloc() */
if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
- "file descriptors, would overflow size_t", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
+ "file descriptors, would overflow size_t", strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
@@ -296,7 +296,7 @@ static int rlimit(int keep_open)
/* allocate array for file descriptors */
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
@@ -316,14 +316,14 @@ static int rlimit(int keep_open)
num_open.rlim_cur++)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
/* open a dummy descriptor */
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
- snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+ msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
@@ -344,20 +344,20 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
fprintf(stderr, "%s\n", strbuff);
- snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+ msnprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
strbuff1);
fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = NUM_NEEDED;
- snprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+ msnprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
strbuff2, strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -375,7 +375,7 @@ static int rlimit(int keep_open)
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "%s file descriptors open\n", strbuff);
#if !defined(HAVE_POLL_FINE) && \
@@ -395,7 +395,7 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -410,7 +410,7 @@ static int rlimit(int keep_open)
rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -432,12 +432,12 @@ static int rlimit(int keep_open)
*/
if(!fopen_works()) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff),
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff),
"fopen fails with %s fds open()",
strbuff1);
fprintf(stderr, "%s\n", msgbuff);
- snprintf(strbuff, sizeof(strbuff),
+ msnprintf(strbuff, sizeof(strbuff),
"fopen fails with lots of fds open()");
store_errmsg(strbuff, 0);
close_file_descriptors();
diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c
index 7b71fa5e8..8581303ae 100644
--- a/tests/libtest/lib530.c
+++ b/tests/libtest/lib530.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -53,7 +53,7 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1);
+ msnprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c
index bdc2e62eb..e8fb16a49 100644
--- a/tests/libtest/lib537.c
+++ b/tests/libtest/lib537.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -56,10 +56,10 @@ static char msgbuff[256];
static void store_errmsg(const char *msg, int err)
{
if(!err)
- snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+ msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else
- snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err,
- strerror(err));
+ msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err,
+ strerror(err));
}
static void close_file_descriptors(void)
@@ -133,7 +133,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "initial soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -141,7 +141,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "initial hard limit: %s\n", strbuff);
/*
@@ -193,7 +193,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "current soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -201,7 +201,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "current hard limit: %s\n", strbuff);
} /* (rl.rlim_cur != rl.rlim_max) */
@@ -231,7 +231,7 @@ static int rlimit(int keep_open)
nitems = 0x40000;
do {
num_open.rlim_max = sizeof(*memchunk) * nitems;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
if(!memchunk) {
@@ -274,9 +274,9 @@ static int rlimit(int keep_open)
/* verify that we won't overflow size_t in malloc() */
if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
- "file descriptors, would overflow size_t", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
+ "file descriptors, would overflow size_t", strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
@@ -286,7 +286,7 @@ static int rlimit(int keep_open)
/* allocate array for file descriptors */
do {
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
if(!fd) {
@@ -310,14 +310,14 @@ static int rlimit(int keep_open)
num_open.rlim_cur++)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
/* open a dummy descriptor */
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
- snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+ msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
@@ -338,21 +338,21 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
fprintf(stderr, "%s\n", strbuff);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+ strbuff1);
fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN;
num_open.rlim_cur -= num_open.rlim_max;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
+ strbuff1);
fprintf(stderr, "%s\n", strbuff);
for(num_open.rlim_cur = num_open.rlim_max;
@@ -362,7 +362,7 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "shrinking array for %s file descriptors\n", strbuff);
/* we don't care if we can't shrink it */
@@ -379,7 +379,7 @@ static int rlimit(int keep_open)
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "%s file descriptors open\n", strbuff);
#if !defined(HAVE_POLL_FINE) && \
@@ -399,8 +399,8 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
- FD_SETSIZE);
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
@@ -414,8 +414,8 @@ static int rlimit(int keep_open)
rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
- FD_SETSIZE);
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
@@ -436,11 +436,11 @@ static int rlimit(int keep_open)
*/
if(!fopen_works()) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
+ strbuff1);
fprintf(stderr, "%s\n", msgbuff);
- snprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
+ msnprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
store_errmsg(strbuff, 0);
close_file_descriptors();
free(memchunk);
diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c
index ff8a9b059..a52d8c501 100644
--- a/tests/libtest/lib540.c
+++ b/tests/libtest/lib540.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -198,7 +198,7 @@ int test(char *URL)
if(test_argc < 4)
return 99;
- snprintf(buffer, sizeof(buffer), "Host: %s", HOST);
+ msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
/* now add a custom Host: header */
headers = curl_slist_append(headers, buffer);
diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c
index c06561e1d..95b5ac393 100644
--- a/tests/libtest/lib553.c
+++ b/tests/libtest/lib553.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -75,7 +75,7 @@ int test(char *URL)
}
for(i = 0; i < NUM_HEADERS; i++) {
- int len = snprintf(buf, sizeof(buf), "Header%d: ", i);
+ int len = msnprintf(buf, sizeof(buf), "Header%d: ", i);
memset(&buf[len], 'A', SIZE_HEADERS);
buf[len + SIZE_HEADERS] = 0; /* zero terminate */
hl = curl_slist_append(headerlist, buf);
diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c
index 8e348ad19..cfad6f3e9 100644
--- a/tests/libtest/libauthretry.c
+++ b/tests/libtest/libauthretry.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -38,7 +38,7 @@ static CURLcode send_request(CURL *curl, const char *url, int seq,
return CURLE_OUT_OF_MEMORY;
}
- snprintf(full_url, len, "%s%04d", url, seq);
+ msnprintf(full_url, len, "%s%04d", url, seq);
fprintf(stderr, "Sending new request %d to %s with credential %s "
"(auth %ld)\n", seq, full_url, userpwd, auth_scheme);
test_setopt(curl, CURLOPT_URL, full_url);
diff --git a/tests/libtest/libntlmconnect.c b/tests/libtest/libntlmconnect.c
index e17b991a4..426f6f245 100644
--- a/tests/libtest/libntlmconnect.c
+++ b/tests/libtest/libntlmconnect.c
@@ -135,11 +135,11 @@ int test(char *url)
easy_init(easy[num_handles]);
if(num_handles % 3 == 2) {
- snprintf(full_url, urllen, "%s0200", url);
+ msnprintf(full_url, urllen, "%s0200", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
}
else {
- snprintf(full_url, urllen, "%s0100", url);
+ msnprintf(full_url, urllen, "%s0100", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
}
easy_setopt(easy[num_handles], CURLOPT_FRESH_CONNECT, 1L);
diff --git a/tests/libtest/stub_gssapi.c b/tests/libtest/stub_gssapi.c
index aaa7796b3..254a01b31 100644
--- a/tests/libtest/stub_gssapi.c
+++ b/tests/libtest/stub_gssapi.c
@@ -28,6 +28,11 @@
#include "stub_gssapi.h"
+#define ENABLE_CURLX_PRINTF
+/* make the curlx header define all printf() functions to use the curlx_*
+ versions instead */
+#include "curlx.h" /* from the private lib dir */
+
#define MAX_CREDS_LENGTH 250
#define APPROX_TOKEN_LEN 250
@@ -202,8 +207,8 @@ OM_uint32 gss_init_sec_context(OM_uint32 *min,
}
/* Token format: creds:target:type:padding */
- used = snprintf(token, length, "%s:%s:%d:", creds,
- (char *) target_name, ctx->sent);
+ used = msnprintf(token, length, "%s:%s:%d:", creds,
+ (char *) target_name, ctx->sent);
if(used >= length) {
free(token);
diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c
index 0a98d006f..2718ef939 100644
--- a/tests/libtest/testtrace.c
+++ b/tests/libtest/testtrace.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -108,8 +108,8 @@ int libtest_debug_cb(CURL *handle, curl_infotype type,
}
secs = epoch_offset + tv.tv_sec;
now = localtime(&secs); /* not thread safe but we don't care */
- snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
- now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
+ msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
+ now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
}
switch(type) {
diff --git a/tests/server/fake_ntlm.c b/tests/server/fake_ntlm.c
index ec127a8af..c6e36b6f6 100644
--- a/tests/server/fake_ntlm.c
+++ b/tests/server/fake_ntlm.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010, Mandy Wu, <mandy.wu@intel.com>
- * Copyright (C) 2011 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2011 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -75,7 +75,7 @@ static char *printable(char *inbuf, size_t inlength)
return NULL;
if(!inlength) {
- snprintf(&outbuf[0], outsize, "%s", NOTHING_STR);
+ msnprintf(&outbuf[0], outsize, "%s", NOTHING_STR);
return outbuf;
}
@@ -97,7 +97,7 @@ static char *printable(char *inbuf, size_t inlength)
o++;
}
else {
- snprintf(&outbuf[o], outsize - o, HEX_FMT_STR, inbuf[i]);
+ msnprintf(&outbuf[o], outsize - o, HEX_FMT_STR, inbuf[i]);
o += HEX_STR_LEN;
}
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
}
/* logmsg cannot be used until this file name is set */
- snprintf(logfilename, sizeof(logfilename), LOGFILE, testnum);
+ msnprintf(logfilename, sizeof(logfilename), LOGFILE, testnum);
serverlogfile = logfilename;
logmsg("fake_ntlm (user: %s) (proto: %s) (domain: %s) (cached creds: %s)",
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index 0629d8a53..7563fd22a 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -382,11 +382,11 @@ static int ProcessRequest(struct httprequest *req)
char *filename;
if((strlen(doc) + strlen(request)) < 200)
- snprintf(logbuf, sizeof(logbuf), "Got request: %s %s %s/%d.%d",
- request, doc, prot_str, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf), "Got request: %s %s %s/%d.%d",
+ request, doc, prot_str, prot_major, prot_minor);
else
- snprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request %s/%d.%d",
- prot_str, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request %s/%d.%d",
+ prot_str, prot_major, prot_minor);
logmsg("%s", logbuf);
if(!strncmp("/verifiedserver", ptr, 15)) {
@@ -416,8 +416,8 @@ static int ProcessRequest(struct httprequest *req)
else
req->partno = 0;
- snprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
+ req->testno, req->partno);
logmsg("%s", logbuf);
filename = test2file(req->testno);
@@ -540,9 +540,9 @@ static int ProcessRequest(struct httprequest *req)
else {
if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d",
doc, &prot_major, &prot_minor) == 3) {
- snprintf(logbuf, sizeof(logbuf),
- "Received a CONNECT %s HTTP/%d.%d request",
- doc, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Received a CONNECT %s HTTP/%d.%d request",
+ doc, prot_major, prot_minor);
logmsg("%s", logbuf);
if(req->prot_version == 10)
@@ -947,12 +947,12 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
case DOCNUMBER_WERULEZ:
/* we got a "friends?" question, reply back that we sure are */
logmsg("Identifying ourselves as friends");
- snprintf(msgbuf, sizeof(msgbuf), "RTSP_SERVER WE ROOLZ: %ld\r\n",
- (long)getpid());
+ msnprintf(msgbuf, sizeof(msgbuf), "RTSP_SERVER WE ROOLZ: %ld\r\n",
+ (long)getpid());
msglen = strlen(msgbuf);
- snprintf(weare, sizeof(weare),
- "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s",
- msglen, msgbuf);
+ msnprintf(weare, sizeof(weare),
+ "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s",
+ msglen, msgbuf);
buffer = weare;
break;
case DOCNUMBER_INTERNAL:
@@ -985,7 +985,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
char partbuf[80]="data";
FILE *stream;
if(0 != req->partno)
- snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
+ msnprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
stream = fopen(filename, "rb");
if(!stream) {
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index 86a1ff52d..569be6f6c 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -486,20 +486,20 @@ static void lograw(unsigned char *buffer, ssize_t len)
for(i = 0; i<len; i++) {
switch(ptr[i]) {
case '\n':
- snprintf(optr, left, "\\n");
+ msnprintf(optr, left, "\\n");
width += 2;
optr += 2;
left -= 2;
break;
case '\r':
- snprintf(optr, left, "\\r");
+ msnprintf(optr, left, "\\r");
width += 2;
optr += 2;
left -= 2;
break;
default:
- snprintf(optr, left, "%c", (ISGRAPH(ptr[i]) ||
- ptr[i] == 0x20) ?ptr[i]:'.');
+ msnprintf(optr, left, "%c", (ISGRAPH(ptr[i]) ||
+ ptr[i] == 0x20) ?ptr[i]:'.');
width++;
optr++;
left--;
@@ -1062,9 +1062,9 @@ static bool juggle(curl_socket_t *sockfdp,
else if(!memcmp("PORT", buffer, 4)) {
/* Question asking us what PORT number we are listening to.
Replies to PORT with "IPv[num]/[port]" */
- snprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port);
+ msnprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port);
buffer_len = (ssize_t)strlen((char *)buffer);
- snprintf(data, sizeof(data), "PORT\n%04zx\n", buffer_len);
+ msnprintf(data, sizeof(data), "PORT\n%04zx\n", buffer_len);
if(!write_stdout(data, 10))
return FALSE;
if(!write_stdout(buffer, buffer_len))
@@ -1155,7 +1155,7 @@ static bool juggle(curl_socket_t *sockfdp,
nread_socket = sread(sockfd, buffer, sizeof(buffer));
if(nread_socket > 0) {
- snprintf(data, sizeof(data), "DATA\n%04zx\n", nread_socket);
+ msnprintf(data, sizeof(data), "DATA\n%04zx\n", nread_socket);
if(!write_stdout(data, 10))
return FALSE;
if(!write_stdout(buffer, nread_socket))
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 8df4d76e4..cf3d291d9 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -509,11 +509,11 @@ static int ProcessRequest(struct httprequest *req)
/* get the number after it */
if(ptr) {
if((strlen(doc) + strlen(request)) < 400)
- snprintf(logbuf, sizeof(logbuf), "Got request: %s %s HTTP/%d.%d",
- request, doc, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf), "Got request: %s %s HTTP/%d.%d",
+ request, doc, prot_major, prot_minor);
else
- snprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request HTTP/%d.%d",
- prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request HTTP/%d.%d",
+ prot_major, prot_minor);
logmsg("%s", logbuf);
if(!strncmp("/verifiedserver", ptr, 15)) {
@@ -545,8 +545,8 @@ static int ProcessRequest(struct httprequest *req)
if(req->testno) {
- snprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
+ req->testno, req->partno);
logmsg("%s", logbuf);
/* find and parse <servercmd> for this test */
@@ -565,9 +565,9 @@ static int ProcessRequest(struct httprequest *req)
doc, &prot_major, &prot_minor) == 3) {
char *portp = NULL;
- snprintf(logbuf, sizeof(logbuf),
- "Received a CONNECT %s HTTP/%d.%d request",
- doc, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Received a CONNECT %s HTTP/%d.%d request",
+ doc, prot_major, prot_minor);
logmsg("%s", logbuf);
req->connect_request = TRUE;
@@ -645,9 +645,9 @@ static int ProcessRequest(struct httprequest *req)
else
req->partno = 0;
- snprintf(logbuf, sizeof(logbuf),
- "Requested test number %ld part %ld (from host name)",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Requested test number %ld part %ld (from host name)",
+ req->testno, req->partno);
logmsg("%s", logbuf);
}
@@ -696,9 +696,9 @@ static int ProcessRequest(struct httprequest *req)
else
req->partno = 0;
- snprintf(logbuf, sizeof(logbuf),
- "Requested GOPHER test number %ld part %ld",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Requested GOPHER test number %ld part %ld",
+ req->testno, req->partno);
logmsg("%s", logbuf);
}
}
@@ -1117,14 +1117,14 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
case DOCNUMBER_WERULEZ:
/* we got a "friends?" question, reply back that we sure are */
logmsg("Identifying ourselves as friends");
- snprintf(msgbuf, sizeof(msgbuf), "WE ROOLZ: %ld\r\n", (long)getpid());
+ msnprintf(msgbuf, sizeof(msgbuf), "WE ROOLZ: %ld\r\n", (long)getpid());
msglen = strlen(msgbuf);
if(use_gopher)
- snprintf(weare, sizeof(weare), "%s", msgbuf);
+ msnprintf(weare, sizeof(weare), "%s", msgbuf);
else
- snprintf(weare, sizeof(weare),
- "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s",
- msglen, msgbuf);
+ msnprintf(weare, sizeof(weare),
+ "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s",
+ msglen, msgbuf);
buffer = weare;
break;
case DOCNUMBER_404:
@@ -1145,9 +1145,9 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
const char *section = req->connect_request?"connect":"data";
if(req->partno)
- snprintf(partbuf, sizeof(partbuf), "%s%ld", section, req->partno);
+ msnprintf(partbuf, sizeof(partbuf), "%s%ld", section, req->partno);
else
- snprintf(partbuf, sizeof(partbuf), "%s", section);
+ msnprintf(partbuf, sizeof(partbuf), "%s", section);
logmsg("Send response test%ld section <%s>", req->testno, partbuf);
@@ -2118,7 +2118,7 @@ int main(int argc, char *argv[])
}
}
- snprintf(port_str, sizeof(port_str), "port %hu", port);
+ msnprintf(port_str, sizeof(port_str), "port %hu", port);
#ifdef WIN32
win32_init();
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index c00731fa2..35419b0b9 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -15,7 +15,7 @@
*/
/*
- * Copyright (c) 1983, 2016 Regents of the University of California.
+ * Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -569,7 +569,7 @@ static ssize_t write_behind(struct testcase *test, int convert)
if(!test->ofile) {
char outfile[256];
- snprintf(outfile, sizeof(outfile), "log/upload.%ld", test->testno);
+ msnprintf(outfile, sizeof(outfile), "log/upload.%ld", test->testno);
#ifdef WIN32
test->ofile = open(outfile, O_CREAT|O_RDWR|O_BINARY, 0777);
#else
@@ -1141,8 +1141,8 @@ static int validate_access(struct testcase *test,
if(!strncmp("verifiedserver", filename, 14)) {
char weare[128];
- size_t count = snprintf(weare, sizeof(weare),
- "WE ROOLZ: %ld\r\n", (long)getpid());
+ size_t count = msnprintf(weare, sizeof(weare),
+ "WE ROOLZ: %ld\r\n", (long)getpid());
logmsg("Are-we-friendly question received");
test->buffer = strdup(weare);
@@ -1187,7 +1187,7 @@ static int validate_access(struct testcase *test,
file = test2file(testno);
if(0 != partno)
- snprintf(partbuf, sizeof(partbuf), "data%ld", partno);
+ msnprintf(partbuf, sizeof(partbuf), "data%ld", partno);
if(file) {
FILE *stream = fopen(file, "rb");
diff --git a/tests/server/util.c b/tests/server/util.c
index 07ef63ee1..df1e35da0 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -87,7 +87,7 @@ char *data_to_hex(char *data, size_t len)
if((data[i] >= 0x20) && (data[i] < 0x7f))
*optr++ = *iptr++;
else {
- snprintf(optr, 4, "%%%02x", *iptr++);
+ msnprintf(optr, 4, "%%%02x", *iptr++);
optr += 3;
}
}
@@ -121,11 +121,12 @@ void logmsg(const char *msg, ...)
sec = epoch_offset + tv.tv_sec;
now = localtime(&sec); /* not thread safe but we don't care */
- snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
- (int)now->tm_hour, (int)now->tm_min, (int)now->tm_sec, (long)tv.tv_usec);
+ msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
+ (int)now->tm_hour, (int)now->tm_min, (int)now->tm_sec,
+ (long)tv.tv_usec);
va_start(ap, msg);
- vsnprintf(buffer, sizeof(buffer), msg, ap);
+ mvsnprintf(buffer, sizeof(buffer), msg, ap);
va_end(ap);
logfp = fopen(serverlogfile, "ab");
@@ -151,7 +152,7 @@ void win32_perror(const char *msg)
if(!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
LANG_NEUTRAL, buf, sizeof(buf), NULL))
- snprintf(buf, sizeof(buf), "Unknown error %lu (%#lx)", err, err);
+ msnprintf(buf, sizeof(buf), "Unknown error %lu (%#lx)", err, err);
if(msg)
fprintf(stderr, "%s: ", msg);
fprintf(stderr, "%s\n", buf);
@@ -195,7 +196,7 @@ const char *path = ".";
char *test2file(long testno)
{
static char filename[256];
- snprintf(filename, sizeof(filename), TEST_DATA_PATH, path, testno);
+ msnprintf(filename, sizeof(filename), TEST_DATA_PATH, path, testno);
return filename;
}
diff --git a/tests/unit/unit1398.c b/tests/unit/unit1398.c
index b7260195a..22cc837e2 100644
--- a/tests/unit/unit1398.c
+++ b/tests/unit/unit1398.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -74,7 +74,7 @@ fail_unless(!strcmp(output, " bu"), "wrong output");
/* output a number in a limited output */
rc = curl_msnprintf(output, 4, "%d", 10240);
-/* TODO: this should return 5 to be POSIX/snprintf compliant! */
+/* TODO: this should return 5 to be POSIX/msnprintf compliant! */
fail_unless(rc == 4, "return code should be 4");
fail_unless(!strcmp(output, "102"), "wrong output");
diff --git a/tests/unit/unit1399.c b/tests/unit/unit1399.c
index 897a34319..7383fbd86 100644
--- a/tests/unit/unit1399.c
+++ b/tests/unit/unit1399.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -63,7 +63,7 @@ static bool usec_matches_seconds(time_t time_usec, int expected_seconds)
static void expect_timer_seconds(struct Curl_easy *data, int seconds)
{
char msg[64];
- snprintf(msg, sizeof(msg), "about %d seconds should have passed", seconds);
+ msnprintf(msg, sizeof(msg), "about %d seconds should have passed", seconds);
fail_unless(usec_matches_seconds(data->progress.t_nslookup, seconds), msg);
fail_unless(usec_matches_seconds(data->progress.t_connect, seconds), msg);
fail_unless(usec_matches_seconds(data->progress.t_appconnect, seconds), msg);
diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c
index fbfd2c423..c285ced43 100644
--- a/tests/unit/unit1604.c
+++ b/tests/unit/unit1604.c
@@ -46,11 +46,15 @@ static char *getflagstr(int flags)
{
char *buf = malloc(256);
if(buf) {
- snprintf(buf, 256, "%s,%s,%s,%s",
- ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""),
- ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""),
- ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""),
- ((flags & SANITIZE_ALLOW_TRUNCATE) ? "SANITIZE_ALLOW_TRUNCATE" : ""));
+ msnprintf(buf, 256, "%s,%s,%s,%s",
+ ((flags & SANITIZE_ALLOW_COLONS) ?
+ "SANITIZE_ALLOW_COLONS" : ""),
+ ((flags & SANITIZE_ALLOW_PATH) ?
+ "SANITIZE_ALLOW_PATH" : ""),
+ ((flags & SANITIZE_ALLOW_RESERVED) ?
+ "SANITIZE_ALLOW_RESERVED" : ""),
+ ((flags & SANITIZE_ALLOW_TRUNCATE) ?
+ "SANITIZE_ALLOW_TRUNCATE" : ""));
}
return buf;
}
@@ -59,13 +63,13 @@ static char *getcurlcodestr(int cc)
{
char *buf = malloc(256);
if(buf) {
- snprintf(buf, 256, "%s (%d)",
- (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
- cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
- cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :
- cc == SANITIZE_ERR_OUT_OF_MEMORY ? "SANITIZE_ERR_OUT_OF_MEMORY" :
- "unexpected error code - add name"),
- cc);
+ msnprintf(buf, 256, "%s (%d)",
+ (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
+ cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
+ cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :
+ cc == SANITIZE_ERR_OUT_OF_MEMORY ? "SANITIZE_ERR_OUT_OF_MEMORY":
+ "unexpected error code - add name"),
+ cc);
}
return buf;
}
diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c
index ddf228f8d..4962bfac9 100644
--- a/tests/unit/unit1650.c
+++ b/tests/unit/unit1650.c
@@ -200,7 +200,7 @@ UNITTEST_START
a = &d.addr[u];
if(resp[i].type == DNS_TYPE_A) {
p = &a->ip.v4[0];
- snprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
+ msnprintf(ptr, len, "%u.%u.%u.%u ", p[0], p[1], p[2], p[3]);
o = strlen(ptr);
len -= o;
ptr += o;
@@ -209,20 +209,20 @@ UNITTEST_START
int j;
for(j = 0; j < 16; j += 2) {
size_t l;
- snprintf(ptr, len, "%s%02x%02x", j?":":"", a->ip.v6[j],
+ msnprintf(ptr, len, "%s%02x%02x", j?":":"", a->ip.v6[j],
a->ip.v6[j + 1]);
l = strlen(ptr);
len -= l;
ptr += l;
}
- snprintf(ptr, len, " ");
+ msnprintf(ptr, len, " ");
len--;
ptr++;
}
}
for(u = 0; u < d.numcname; u++) {
size_t o;
- snprintf(ptr, len, "%s ", d.cname[u].alloc);
+ msnprintf(ptr, len, "%s ", d.cname[u].alloc);
o = strlen(ptr);
len -= o;
ptr += o;
@@ -271,8 +271,8 @@ UNITTEST_START
fail_if(d.numaddr != 1, "missing address");
a = &d.addr[0];
p = &a->ip.v4[0];
- snprintf((char *)buffer, sizeof(buffer),
- "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
+ msnprintf((char *)buffer, sizeof(buffer),
+ "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
if(rc || strcmp((char *)buffer, "127.0.0.1")) {
fprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc);
return 7;
diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c
index 496ab3cb2..9693fe63a 100644
--- a/tests/unit/unit1652.c
+++ b/tests/unit/unit1652.c
@@ -80,7 +80,7 @@ unit_stop(void)
UNITTEST_START
/* Injecting a simple short string via a format */
-snprintf(input, sizeof(input), "Simple Test");
+msnprintf(input, sizeof(input), "Simple Test");
Curl_infof(data, "%s", input);
fail_unless(strcmp(result, input) == 0, "Simple string test");