summaryrefslogtreecommitdiff
path: root/chat/bitchx/patches/patch-ah
blob: 0ccc33901ab25bb6f3fef5c03555ef2f200db128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
$NetBSD: patch-ah,v 1.3 2008/07/06 05:16:50 tonnerre Exp $

--- source/commands.c.orig	2003-06-11 09:00:41.000000000 +0200
+++ source/commands.c
@@ -2617,7 +2617,6 @@ BUILT_IN_COMMAND(e_hostname)
 #if !defined(__linux__) && !defined(BSD) && !defined(__EMX__)
 		bitchsay("Local Host Name is [%s]", (LocalHostName)? LocalHostName: hostname);
 #elif defined(old_hostname)
-		char filename[81];
 		char comm[200];
 		FILE *fptr;
 		char *p = NULL, *q;
@@ -2632,34 +2631,29 @@ BUILT_IN_COMMAND(e_hostname)
 #endif
 #endif
 
-		tmpnam(filename);
 #if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
 		if (!(p = path_search("netstat", "/sbin:/usr/sbin:/bin:/usr/bin")))
 		{
 			yell("No Netstat to be found");
 			return;
 		}
-		sprintf(comm, "%s -in >%s", p, filename);
+		sprintf(comm, "%s -in", p);
 #elif defined(__EMX__)
-		sprintf(comm, "netstat -a > %s", filename);
+		sprintf(comm, "netstat -a");
 #else
 		if (!(p = path_search("ifconfig", "/sbin:/usr/sbin:/bin:/usr/bin")))
 		{
 			yell("Can't find ifconfig");
 			return;
 		}
-                sprintf(comm, "%s -a >%s", p, filename);
+                sprintf(comm, "%s -a", p);
 #endif
-		system(comm);
 
 #ifdef __EMXPM__
 		pm_seticon(last_input_screen);
 #endif
-		if ((fptr = fopen(filename, "r")) == NULL)
-		{
-			unlink(filename);
+		if ((fptr = popen(comm, "r")) == NULL)
 			return;
-		}
 #if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
 		fgets(comm, 200, fptr);
 		fgets(comm, 200, fptr);
@@ -2777,7 +2771,6 @@ BUILT_IN_COMMAND(e_hostname)
 			}
 		}
 		fclose(fptr);
-		unlink(filename);
 		for (new = virtuals, i = 1; virtuals; i++)
 		{
 			new = virtuals;