openbsd-ports/net/bitchx/patches/patch-source_commands.c

63 lines
1.8 KiB
C
Raw Normal View History

2000-09-16 00:04:27 -04:00
--- source/commands.c.orig Fri Sep 15 22:45:24 2000
+++ source/commands.c Fri Sep 15 22:48:11 2000
@@ -2603,13 +2603,13 @@
int i;
char *newhost = NULL;
#if !defined(__linux__) && !defined(__EMX__)
-#if _BSDI_VERSION < 199701
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701 || defined(__OpenBSD__)
char device[80];
#endif
#endif
2000-09-16 00:04:27 -04:00
tmpnam(filename);
-#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701 || defined(__OpenBSD__)
if (!(p = path_search("netstat", "/sbin:/usr/sbin:/bin:/usr/bin")))
{
yell("No Netstat to be found");
@@ -2636,10 +2636,16 @@
unlink(filename);
return;
}
2000-09-16 00:04:27 -04:00
-#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701 || defined(__OpenBSD__)
fgets(comm, 200, fptr);
fgets(comm, 200, fptr);
p = next_arg(comm, &q);
2000-09-16 00:04:27 -04:00
+#ifdef __OpenBSD__
+ while ((*p == 'l') && (*(p+1) == 'o')) {
+ fgets(comm, 200, fptr);
+ p = next_arg(comm, &q);
+ }
2000-09-16 00:04:27 -04:00
+#endif
strncpy(device, p, 79);
bitchsay("Looking for hostnames on device %s", device);
#else
@@ -2654,7 +2660,7 @@
if (strstr(comm, "inet6 addr") || strstr(comm, "inet addr"))
#else
if (strstr(comm, "inet addr"))
-#endif
+#endif /* ifdef IPV6 */
2000-09-16 00:04:27 -04:00
{
/* inet addr:127.0.0.1 Mask:... */
/* inet6 addr: ::1/128 Scope:... */
@@ -2671,11 +2677,15 @@
}
*q = 0;
2000-09-16 00:04:27 -04:00
-#elif defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
+#elif defined(_BSDI_VERSION) && _BSDI_VERSION < 199701 || defined(__OpenBSD__)
if (!strncmp(comm, device, strlen(device)))
{
p = comm;
2000-09-16 00:04:27 -04:00
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
p += 24;
+#elif defined(__OpenBSD__)
+ p += strlen("Name Mtu Network ")-1;
2000-09-16 00:04:27 -04:00
+#endif
while (*p && *p == ' ') p++;
q = strchr(p, ' ');
*q = 0;