}
#endif
-while (fgets(outbuffer, sizeof(outbuffer), stdin) != NULL)
+while (fgets(CS outbuffer, sizeof(outbuffer), stdin) != NULL)
{
- int n = (int)strlen(outbuffer);
+ int n = (int)strlen(CS outbuffer);
while (n > 0 && isspace(outbuffer[n-1])) n--;
outbuffer[n] = 0;
/* Expect incoming */
- if (strncmp(outbuffer, "??? ", 4) == 0)
+ if (strncmp(CS outbuffer, "??? ", 4) == 0)
{
unsigned char *lineptr;
printf("%s\n", outbuffer);
}
printf("<<< %s\n", lineptr);
- if (strncmp(lineptr, outbuffer + 4, (int)strlen(outbuffer) - 4) != 0)
+ if (strncmp(CS lineptr, CS outbuffer + 4, (int)strlen(CS outbuffer) - 4) != 0)
{
printf("\n******** Input mismatch ********\n");
exit(79);
/* Wait for a bit before proceeding */
- else if (strncmp(outbuffer, "+++ ", 4) == 0)
+ else if (strncmp(CS outbuffer, "+++ ", 4) == 0)
{
printf("%s\n", outbuffer);
- sleep(atoi(outbuffer + 4));
+ sleep(atoi(CS outbuffer + 4));
}
/* Send outgoing, but barf if unconsumed incoming */
#endif
printf(">>> %s\n", outbuffer);
- strcpy(outbuffer + n, "\r\n");
+ strcpy(CS outbuffer + n, "\r\n");
/* Turn "\n" and "\r" into the relevant characters. This is a hack. */
- while ((escape = strstr(outbuffer, "\\r")) != NULL)
+ while ((escape = US strstr(CS outbuffer, "\\r")) != NULL)
{
*escape = '\r';
memmove(escape + 1, escape + 2, (n + 2) - (escape - outbuffer) - 2);
#include <utime.h>
#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
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;
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");
{
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");
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);