openbsd-ports/net/bitchx/patches/patch-source_commands_c
2004-01-04 23:46:49 +00:00

75 lines
3.5 KiB
Plaintext

$OpenBSD: patch-source_commands_c,v 1.3 2004/01/04 23:46:49 espie Exp $
--- source/commands.c.orig 2001-01-08 07:24:22.000000000 +0100
+++ source/commands.c 2004-01-05 00:38:36.000000000 +0100
@@ -203,8 +203,8 @@ IrcCommand irc_command[] =
{ "ADDLAMENICK","AddLameNick", add_bad_nick, 0, "%Y<%Cnick%G|%Cnick%C nick nick%Y>%n\n - Adds %Y<%Cnick%Y>%n to your lame nicklist, bans nick!*@*"},
{ "ADDNOFLOOD", "AddNoFlood", add_no_flood, 0, "%Y<%Cnick%Y>%n\n - Adds %Cnick%n to your no flood list" },
#ifdef WANT_USERLIST
- { "ADDSHIT", "AddShit", add_shit, 0, "%Y<%Cnick%G|%Cnick%G!%nuser%Y@%n
- hostname%Y>%n %Y<%Bchannel%G|%Y*>%n %R[%nshitlevel%R]%n %R[%nreason%R]%n\n- Add %Y<%Cnick%G|%Cnick%G!%nuser%Y@%nhostname%Y>%n to your shitlist on %Y<%Bchannel%G|%Y*>%n with %R[%nshitlevel%R]%n and for %R[%nreason%R]%n" },
+ { "ADDSHIT", "AddShit", add_shit, 0, "%Y<%Cnick%G|%Cnick%G!%nuser%Y@%n\n"
+" hostname%Y>%n %Y<%Bchannel%G|%Y*>%n %R[%nshitlevel%R]%n %R[%nreason%R]%n\n- Add %Y<%Cnick%G|%Cnick%G!%nuser%Y@%nhostname%Y>%n to your shitlist on %Y<%Bchannel%G|%Y*>%n with %R[%nshitlevel%R]%n and for %R[%nreason%R]%n" },
{ "ADDUSER", "AddUser", add_user, 0, "%Y<%Cnick%G|%Cnick%G!%nuser%Y@%nhostname%Y>%n %Y<%Bchannel%G|%Y*>%n %R[%nuserlevel%R]%n %R[%nauto-op%R]%n %R[%nprotection%R]%n %R[%npassword%R]%n\n - Adds %Y<%Cnick%G|%Cnick%G!%nuser%Y@%nhostname%Y>%n on %Y<%Bchannel%G|%Y*>%n with %R[%nuserlevel%R]%n %R[%nauto-op%R]%n and %R[%nprotection%R]%n levels to your userlist" },
#endif
{ "ADDWORD", NULL, add_ban_word, 0, "%Y<%Bchannel%G|%Y*>%n %Y<%nword%y(%ns%y)%Y>%n\n- Adds %Y<%nword%y(%ns%y)%Y>%n to wordlist, anyone saying it in %Y<%Bchannel%G|%Y*>%n will be kicked" },
@@ -2604,13 +2604,13 @@ BUILT_IN_COMMAND(e_hostname)
int i;
char *newhost = NULL;
#if !defined(__linux__) && !defined(__EMX__)
-#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701 || defined(__OpenBSD__)
char device[80];
#endif
#endif
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");
@@ -2637,10 +2637,16 @@ BUILT_IN_COMMAND(e_hostname)
unlink(filename);
return;
}
-#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);
+#ifdef __OpenBSD__
+ while ((*p == 'l') && (*(p+1) == 'o')) {
+ fgets(comm, 200, fptr);
+ p = next_arg(comm, &q);
+ }
+#endif
strncpy(device, p, 79);
bitchsay("Looking for hostnames on device %s", device);
#else
@@ -2655,7 +2661,7 @@ BUILT_IN_COMMAND(e_hostname)
if (strstr(comm, "inet6 addr") || strstr(comm, "inet addr"))
#else
if (strstr(comm, "inet addr"))
-#endif
+#endif /* ifdef IPV6 */
{
/* inet addr:127.0.0.1 Mask:... */
/* inet6 addr: ::1/128 Scope:... */
@@ -2672,11 +2678,15 @@ BUILT_IN_COMMAND(e_hostname)
}
*q = 0;
-#elif defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
+#elif defined(_BSDI_VERSION) && _BSDI_VERSION < 199701 || defined(__OpenBSD__)
if (!strncmp(comm, device, strlen(device)))
{
p = comm;
+#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
p += 24;
+#elif defined(__OpenBSD__)
+ p += strlen("Name Mtu Network ")-1;
+#endif
while (*p && *p == ' ') p++;
q = strchr(p, ' ');
*q = 0;