Merge from vendor branch TNF:
[pkgsrcv2.git] / chat / bitchx / patches / patch-ah
1 $NetBSD$
2
3 --- source/commands.c.orig      2003-06-11 09:00:41.000000000 +0200
4 +++ source/commands.c
5 @@ -2617,7 +2617,6 @@ BUILT_IN_COMMAND(e_hostname)
6  #if !defined(__linux__) && !defined(BSD) && !defined(__EMX__)
7                 bitchsay("Local Host Name is [%s]", (LocalHostName)? LocalHostName: hostname);
8  #elif defined(old_hostname)
9 -               char filename[81];
10                 char comm[200];
11                 FILE *fptr;
12                 char *p = NULL, *q;
13 @@ -2632,34 +2631,29 @@ BUILT_IN_COMMAND(e_hostname)
14  #endif
15  #endif
16  
17 -               tmpnam(filename);
18  #if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
19                 if (!(p = path_search("netstat", "/sbin:/usr/sbin:/bin:/usr/bin")))
20                 {
21                         yell("No Netstat to be found");
22                         return;
23                 }
24 -               sprintf(comm, "%s -in >%s", p, filename);
25 +               sprintf(comm, "%s -in", p);
26  #elif defined(__EMX__)
27 -               sprintf(comm, "netstat -a > %s", filename);
28 +               sprintf(comm, "netstat -a");
29  #else
30                 if (!(p = path_search("ifconfig", "/sbin:/usr/sbin:/bin:/usr/bin")))
31                 {
32                         yell("Can't find ifconfig");
33                         return;
34                 }
35 -                sprintf(comm, "%s -a >%s", p, filename);
36 +                sprintf(comm, "%s -a", p);
37  #endif
38 -               system(comm);
39  
40  #ifdef __EMXPM__
41                 pm_seticon(last_input_screen);
42  #endif
43 -               if ((fptr = fopen(filename, "r")) == NULL)
44 -               {
45 -                       unlink(filename);
46 +               if ((fptr = popen(comm, "r")) == NULL)
47                         return;
48 -               }
49  #if defined(_BSDI_VERSION) && _BSDI_VERSION < 199701
50                 fgets(comm, 200, fptr);
51                 fgets(comm, 200, fptr);
52 @@ -2777,7 +2771,6 @@ BUILT_IN_COMMAND(e_hostname)
53                         }
54                 }
55                 fclose(fptr);
56 -               unlink(filename);
57                 for (new = virtuals, i = 1; virtuals; i++)
58                 {
59                         new = virtuals;