X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/c55a77db55ebf46a399f136eeb3a928b1e862772..2130e492c2cda886d74abbb77df4493f151e0a44:/test/src/mtpscript.c diff --git a/test/src/mtpscript.c b/test/src/mtpscript.c index 6a0b28160..a59519433 100644 --- a/test/src/mtpscript.c +++ b/test/src/mtpscript.c @@ -1,5 +1,3 @@ -/* $Cambridge: exim/test/src/mtpscript.c,v 1.1 2006/02/06 16:24:05 ph10 Exp $ */ - /* A little hacked up program that allows a script to play the part of a remote SMTP/LMTP server on stdin/stdout for testing purposes. Hacked from the more complicated version that does it over a socket. */ @@ -21,6 +19,10 @@ complicated version that does it over a socket. */ #include #include +#ifndef CS +# define CS (char *) +#endif + static FILE *log; @@ -88,9 +90,9 @@ signal(SIGALRM, sigalrm_handler); /* Read the script, and do what it says. */ -while (fgets(sbuffer, sizeof(sbuffer), script) != NULL) +while (fgets(CS sbuffer, sizeof(sbuffer), script) != NULL) { - int n = (int)strlen(sbuffer); + int n = (int)strlen(CS sbuffer); while (n > 0 && isspace(sbuffer[n-1])) n--; sbuffer[n] = 0; @@ -109,9 +111,9 @@ while (fgets(sbuffer, sizeof(sbuffer), script) != NULL) before continuing. Do not write this to the log, as it may not get written at the right place in a log that's being shared. */ - else if (strncmp(sbuffer, "*sleep ", 7) == 0) + else if (strncmp(CS sbuffer, "*sleep ", 7) == 0) { - sleep(atoi(sbuffer+7)); + sleep(atoi(CS sbuffer+7)); } /* Otherwise the script line is the start of an input line we are expecting @@ -121,7 +123,7 @@ while (fgets(sbuffer, sizeof(sbuffer), script) != NULL) else { - int data = strcmp(sbuffer, ".") == 0; + int data = strcmp(CS sbuffer, ".") == 0; fprintf(log, "%s\n", sbuffer); fflush(log); @@ -132,23 +134,23 @@ while (fgets(sbuffer, sizeof(sbuffer), script) != NULL) { int n; alarm(5); - if (fgets(ibuffer, sizeof(ibuffer), stdin) == NULL) + if (fgets(CS ibuffer, sizeof(ibuffer), stdin) == NULL) { fprintf(log, "%sxpected EOF read from client\n", - (strncmp(sbuffer, "*eof", 4) == 0)? "E" : "Une"); + (strncmp(CS sbuffer, "*eof", 4) == 0)? "E" : "Une"); goto END_OFF; } alarm(0); - n = (int)strlen(ibuffer); + n = (int)strlen(CS ibuffer); while (n > 0 && isspace(ibuffer[n-1])) n--; ibuffer[n] = 0; fprintf(log, "<<< %s\n", ibuffer); - if (!data || strcmp(ibuffer, ".") == 0) break; + if (!data || strcmp(CS ibuffer, ".") == 0) break; } /* Check received what was expected */ - if (strncmp(sbuffer, ibuffer, (int)strlen(sbuffer)) != 0) + if (strncmp(CS sbuffer, CS ibuffer, (int)strlen(CS sbuffer)) != 0) { fprintf(log, "Comparison failed - bailing out\n"); goto END_OFF;