X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/3634fc257bd0667daef14d72005cd87c735bbb24..e326959e5e455e1b46124b023e0b202e4892e501:/test/src/mtpscript.c?ds=sidebyside diff --git a/test/src/mtpscript.c b/test/src/mtpscript.c index 2acfa285f..a59519433 100644 --- a/test/src/mtpscript.c +++ b/test/src/mtpscript.c @@ -19,6 +19,10 @@ complicated version that does it over a socket. */ #include #include +#ifndef CS +# define CS (char *) +#endif + static FILE *log; @@ -86,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; @@ -107,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 @@ -119,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); @@ -130,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;