moved test2file() to util.c

This commit is contained in:
Daniel Stenberg 2005-09-15 20:22:43 +00:00
parent 97a6d7b1a8
commit 9542dfdcdc
3 changed files with 20 additions and 14 deletions

View File

@ -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";

View File

@ -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;
}

View File

@ -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);