From 7d043f46d56d07062da64c6eb32f8b1c0c301c26 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 22 Feb 2002 10:40:05 +0000 Subject: hide debug output from screen, use log/ for logfiles --- tests/server/getpart.c | 16 +++++++++++----- tests/server/sws.c | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'tests/server') diff --git a/tests/server/getpart.c b/tests/server/getpart.c index e044f5b5d..108d536af 100644 --- a/tests/server/getpart.c +++ b/tests/server/getpart.c @@ -7,6 +7,12 @@ #define EAT_SPACE(ptr) while( ptr && *ptr && isspace(*ptr) ) ptr++ #define EAT_WORD(ptr) while( ptr && *ptr && !isspace(*ptr) && ('>' != *ptr)) ptr++ +#ifdef DEBUG +#define show(x) printf x +#else +#define show(x) +#endif + char *appendstring(char *string, /* original string */ char *buffer, /* to append */ int *stringlen, int *stralloc) @@ -60,9 +66,9 @@ char *spitout(FILE *stream, char *main, char *sub, int *size) if('<' != *ptr) { if(display) { - printf("=> %s", buffer); + show(("=> %s", buffer)); string = appendstring(string, buffer, &stringlen, &stralloc); - printf("* %s\n", buffer); + show(("* %s\n", buffer)); } continue; } @@ -113,17 +119,17 @@ char *spitout(FILE *stream, char *main, char *sub, int *size) } if(display) { string = appendstring(string, buffer, &stringlen, &stralloc); - printf("* %s\n", buffer); + show(("* %s\n", buffer)); } if((STATE_INSUB == state) && !strcmp(cmain, main) && !strcmp(csub, sub)) { - printf("* (%d bytes) %s\n", stringlen, buffer); + show(("* (%d bytes) %s\n", stringlen, buffer)); display = 1; /* start displaying */ } else { - printf("%d (%s/%s): %s\n", state, cmain, csub, buffer); + show(("%d (%s/%s): %s\n", state, cmain, csub, buffer)); display = 0; /* no display */ } } diff --git a/tests/server/sws.c b/tests/server/sws.c index 183a5b935..d23368f56 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -17,7 +17,7 @@ #define DEFAULT_PORT 8999 #ifndef DEFAULT_LOGFILE -#define DEFAULT_LOGFILE "/dev/null" +#define DEFAULT_LOGFILE "log/sws.log" #endif #define DOCBUFSIZE 4 @@ -25,7 +25,7 @@ #define VERSION "cURL test suite HTTP server/0.1" -#define REQUEST_DUMP "http-request.dump" +#define REQUEST_DUMP "log/http-request.dump" #define TEST_DATA_PATH "data/test%d" @@ -56,7 +56,9 @@ static void logmsg(const char *msg) strcpy(loctime, asctime(curr_time)); loctime[strlen(loctime) - 1] = '\0'; fprintf(logfp, "%s: pid %d: %s\n", loctime, getpid(), msg); +#ifdef DEBUG fprintf(stderr, "%s: pid %d: %s\n", loctime, getpid(), msg); +#endif fflush(logfp); } @@ -266,8 +268,6 @@ int main(int argc, char *argv[]) if(argc>1) port = atoi(argv[1]); - logfile = "logfile"; - /* FIX: write our pid to a file name */ logfp = fopen(logfile, "a"); -- cgit v1.2.3