aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-09-15 20:22:43 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-09-15 20:22:43 +0000
commit9542dfdcdc37773d95b5a0c402fa04c6c9f7d2e7 (patch)
treeb14dffd8d55c223af456f50807a31e1b0c4fd5d9
parent97a6d7b1a8f1370d825d4b1fe9dbb52ee8dfe712 (diff)
moved test2file() to util.c
-rw-r--r--tests/server/sws.c16
-rw-r--r--tests/server/util.c10
-rw-r--r--tests/server/util.h8
3 files changed, 20 insertions, 14 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 1e341cf0d..5a2a15574 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -105,8 +105,6 @@ const char *serverlogfile = DEFAULT_LOGFILE;
#define REQUEST_DUMP "log/server.input"
#define RESPONSE_DUMP "log/server.response"
-#define TEST_DATA_PATH "%s/data/test%ld"
-
/* very-big-path support */
#define MAXDOCNAMELEN 140000
#define MAXDOCNAMELEN_TXT "139999"
@@ -117,9 +115,6 @@ const char *serverlogfile = DEFAULT_LOGFILE;
#define END_OF_HEADERS "\r\n\r\n"
-/* global variable, where to find the 'data' dir */
-const char *path=".";
-
enum {
DOCNUMBER_NOTHING = -7,
DOCNUMBER_QUIT = -6,
@@ -169,14 +164,6 @@ static void sigpipe_handler(int sig)
}
#endif
-static char *test2file(long testno)
-{
- static char filename[256];
- sprintf(filename, TEST_DATA_PATH, path, testno);
- return filename;
-}
-
-
int ProcessRequest(struct httprequest *req)
{
char *line=req->reqbuf;
@@ -642,7 +629,8 @@ int main(int argc, char *argv[])
#ifdef ENABLE_IPV6
struct sockaddr_in6 me6;
#endif /* ENABLE_IPV6 */
- int sock, msgsock, flag;
+ curl_socket_t sock, msgsock;
+ int flag;
unsigned short port = DEFAULT_PORT;
FILE *pidfile;
char *pidname= (char *)".http.pid";
diff --git a/tests/server/util.c b/tests/server/util.c
index 2b68971a1..93905c0ec 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -144,3 +144,13 @@ void win32_cleanup(void)
}
#endif
+/* set by the main code to point to where the test dir is */
+const char *path=".";
+
+char *test2file(long testno)
+{
+ static char filename[256];
+ snprintf(filename, sizeof(filename), TEST_DATA_PATH, path, testno);
+ return filename;
+}
+
diff --git a/tests/server/util.h b/tests/server/util.h
index c4521fbae..357b49cc9 100644
--- a/tests/server/util.h
+++ b/tests/server/util.h
@@ -33,6 +33,11 @@ void logmsg(const char *msg, ...);
#define TRUE 1
#endif
+#define TEST_DATA_PATH "%s/data/test%ld"
+
+/* global variable, where to find the 'data' dir */
+extern const char *path;
+
#if defined(WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#include <winsock2.h>
@@ -60,3 +65,6 @@ const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }};
void win32_init(void);
void win32_cleanup(void);
+
+/* returns the path name to the test case file */
+char *test2file(long testno);