#ifdef __hpux
# define uint hide_HPs_uint
#endif
-#ifdef __unix
+#ifdef STDC_HEADERS
# include <unistd.h>
# ifdef __hpux
# undef uint
# include <netdb.h>
# include <sys/time.h>
# include <sys/ioctl.h>
-# if !defined(__hpux) && !defined(__linux__) && !defined(_WIN32)
+# ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
# endif
# include <netinet/in.h>
#include "hsys.h"
#include "devices.h"
-#include "endian.h"
+#include "angel_endian.h"
#include "buffers.h"
#include "hostchan.h"
#include "params.h"
#include "ethernet.h"
-#ifndef COMPILING_ON_WINDOWS
-/* these two might not work for windows */
- extern int sys_nerr;
- extern char *sys_errlist[];
+#if !defined(COMPILING_ON_WINDOWS) && !defined(STDC_HEADERS)
+/* These two might not work for windows. */
+extern int sys_nerr;
+extern char * sys_errlist[];
#endif
#ifndef UNUSED
static void fetch_ports(void)
{
int i;
- const char ctrlpacket[] = CTRL_MAGIC;
- CtrlResponse response;
+ char ctrlpacket[10];
+ CtrlResponse response;
+ memset (ctrlpacket, 0, 10);
+ strcpy (ctrlpacket, CTRL_MAGIC);
+ memset (response, 0, sizeof(CtrlResponse));
/*
* we will try 3 times to elicit a response from the target
*/
* port on the remote target
*/
ia->sin_port = htons(CTRL_PORT);
+#ifdef DEBUG
+ printf("CTLR_PORT=0x%04x sin_port=0x%04x\n");
+#endif
+
if (sendto(sock, ctrlpacket, sizeof(ctrlpacket), 0,
(struct sockaddr *)ia, sizeof(*ia)) < 0)
{
#ifdef DEBUG
perror("sendto");
#endif
+
#ifdef COMPILING_ON_WINDOWS
panic("ethernet send failure\n");
#else
/* might not work for Windows */
panic("ethernet send failure [%s]\n",
+#ifdef STDC_HEADERS
+ strerror(errno));
+#else
errno < sys_nerr ? sys_errlist[errno] : "unknown errno");
+#endif /* STDC_HEADERS */
#endif
}
#ifdef DEBUG