summaryrefslogtreecommitdiff
path: root/net/icb/patches/patch-ad
blob: d83be14f40bfb11a5b89ab6184aa49b323c2d1c0 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
$NetBSD: patch-ad,v 1.2 1998/11/12 23:40:20 frueauf Exp $

*** icb/serverlist.c.orig	Fri Feb 24 16:20:29 1995
--- icb/serverlist.c	Thu Sep  3 10:37:50 1998
***************
*** 1,4 ****
--- 1,5 ----
  #include <stdio.h>
+ #include <pwd.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include "icb.h"
***************
*** 14,28 ****
  FILE *openserverfile()
  {
  	struct stat statbuf;
! 	char *personalsl;
! 	char command[256];
! 	char pwd[256];
  	FILE *ret;
  
  #ifdef sgi
  #undef SYSV
  #endif
! #ifndef SYSV
  	getwd(pwd);
  #else /* SYSV */
  	getcwd(pwd, MAXPATHLEN+1);
--- 15,28 ----
  FILE *openserverfile()
  {
  	struct stat statbuf;
! 	char *personalsl, *home;
! 	char pwd[MAXPATHLEN+1];
  	FILE *ret;
  
  #ifdef sgi
  #undef SYSV
  #endif
! #if !defined(SYSV) && !(defined(BSD) && BSD >= 199306)
  	getwd(pwd);
  #else /* SYSV */
  	getcwd(pwd, MAXPATHLEN+1);
***************
*** 30,40 ****
  #ifdef sgi
  #define SYSV
  #endif
! 	chdir(getenv("HOME"));
  	if (!stat(PERSONALSL,&statbuf))
  	{
! 		sprintf(command,"/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
  		ret= popen(command,"r");
  	}
  	else
  		ret= fopen(SERVERLIST,"r");
--- 30,49 ----
  #ifdef sgi
  #define SYSV
  #endif
! 	if ((home = getenv("HOME")) == NULL) {
! 		struct passwd *pw;
! 		if ((pw = getpwuid(getuid())) == NULL)
! 			home = ".";
! 		home = pw->pw_dir;
! 	}
! 	chdir(home);
  	if (!stat(PERSONALSL,&statbuf))
  	{
! 		char *command = malloc(strlen("/bin/cat  \n") +
! 			strlen(PERSONALSL) + strlen(SERVERLIST) + 1);
! 		sprintf(command, "/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
  		ret= popen(command,"r");
+ 		free(command);
  	}
  	else
  		ret= fopen(SERVERLIST,"r");