summaryrefslogtreecommitdiff
path: root/editors/mg2a/patches/patch-ac
blob: f80aff356ff99e094fc3f2b0001037f6eb56fe1e (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
$NetBSD: patch-ac,v 1.1.1.1 2000/04/01 00:21:27 dmcmahill Exp $

--- ./sys/bsd/fileio.c.orig	Sun Jul  3 10:50:24 1988
+++ ./sys/bsd/fileio.c	Thu Mar 30 08:35:33 2000
@@ -2,6 +2,7 @@
  *		bsd (4.2, others?), Sun (3.2, ?) and Ultrix-32 (?) file I/O.
  */
 #include	"def.h"
+#include <unistd.h>    /* refling added this per compiler */
 
 static	FILE	*ffp;
 extern	char	*getenv(), *strncpy();
@@ -276,7 +277,7 @@
 	if ((file = getenv("HOME")) == NULL) goto notfound;
 	if (strlen(file)+7 >= NFILEN - 1) goto notfound;
 	(VOID) strcpy(home, file);
-	(VOID) strcat(home, "/.mg");
+	(VOID) strcat(home, "/.mgrc");
 	if (suffix != NULL) {
 		(VOID) strcat(home, "-");
 		(VOID) strcat(home, suffix);
@@ -295,6 +296,18 @@
 	if (access(file, F_OK ) == 0) return file;
 #endif
 
+
+/* refling - try to open a file name given by MGRC env var */
+	if ((file = getenv("MGRC")) == NULL) return NULL;
+	if (strlen(file)+7 >= NFILEN - 1) goto notfound;
+	(VOID) strcpy(home, file);
+	if (suffix != NULL) {
+		(VOID) strcat(home, "-");
+		(VOID) strcat(home, suffix);
+	}
+	if (access(home, F_OK ) == 0) return home;
+
+
 	return NULL;
 }
 #endif
@@ -318,7 +331,8 @@
 	execve("cp", eargv, (char **)NULL);
 	_exit(1);	/* shouldn't happen */
     }
-    while(wait(&status) != pid) {}
+/*    while(wait(&status) != pid) {}   refling, was this */
+    while(wait((int *)&status) != pid) {}
     return status.w_status == 0;
 }