X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/c55a77db55ebf46a399f136eeb3a928b1e862772..84547130ee72174d019f557dcbc3b0cf42c5ac80:/test/src/server.c diff --git a/test/src/server.c b/test/src/server.c index f35d80ba2..0d6e5fe90 100644 --- a/test/src/server.c +++ b/test/src/server.c @@ -1,5 +1,3 @@ -/* $Cambridge: exim/test/src/server.c,v 1.1 2006/02/06 16:24:05 ph10 Exp $ */ - /* A little hacked up program that listens on a given port and allows a script to play the part of a remote MTA for testing purposes. This scripted version is hacked from my original interactive version. A further hack allows it to listen @@ -45,11 +43,15 @@ on all interfaces, unless the option -noipv6 is given. */ #include #ifdef AF_INET6 -#define HAVE_IPV6 1 +# define HAVE_IPV6 1 #endif #ifndef S_ADDR_TYPE -#define S_ADDR_TYPE u_long +# define S_ADDR_TYPE u_long +#endif + +#ifndef CS +# define CS (char *) #endif @@ -381,16 +383,16 @@ because that would cause it to wait for this process, which it doesn't yet want to do. The driving script adds the "++++" automatically - it doesn't actually appear in the test script. */ -while (fgets(buffer, sizeof(buffer), stdin) != NULL) +while (fgets(CS buffer, sizeof(buffer), stdin) != NULL) { line *next; - int n = (int)strlen(buffer); + int n = (int)strlen(CS buffer); while (n > 0 && isspace(buffer[n-1])) n--; buffer[n] = 0; - if (strcmp(buffer, "++++") == 0) break; + if (strcmp(CS buffer, "++++") == 0) break; next = malloc(sizeof(line) + n); next->next = NULL; - strcpy(next->line, buffer); + strcpy(next->line, CS buffer); if (last == NULL) script = last = next; else last->next = next; last = next; @@ -466,7 +468,7 @@ for (count = 0; count < connection_count; count++) dup_accept_socket = dup(accept_socket); if (port > 0) - printf("\nConnection request from [%s]\n", host_ntoa(&accepted, buffer)); + printf("\nConnection request from [%s]\n", host_ntoa(&accepted, CS buffer)); else { printf("\nConnection request\n"); @@ -574,7 +576,7 @@ for (count = 0; count < connection_count; count++) { int n; alarm(timeout); - if (fgets(buffer+offset, sizeof(buffer)-offset, in) == NULL) + if (fgets(CS buffer+offset, sizeof(buffer)-offset, in) == NULL) { printf("%sxpected EOF read from client\n", (strncmp(ss, "*eof", 4) == 0)? "E" : "Une"); @@ -582,14 +584,14 @@ for (count = 0; count < connection_count; count++) goto END_OFF; } alarm(0); - n = (int)strlen(buffer); + n = (int)strlen(CS buffer); while (n > 0 && isspace(buffer[n-1])) n--; buffer[n] = 0; printf("%s\n", buffer); - if (!data || strcmp(buffer, ".") == 0) break; + if (!data || strcmp(CS buffer, ".") == 0) break; } - if (strncmp(ss, buffer, (int)strlen(ss)) != 0) + if (strncmp(ss, CS buffer, (int)strlen(ss)) != 0) { printf("Comparison failed - bailing out\n"); printf("Expected: %s\n", ss);