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

--- ./main.c.orig	Sun Jul  3 10:49:25 1988
+++ ./main.c	Thu Mar 30 08:35:35 2000
@@ -20,6 +20,35 @@
 
 static VOID	edinit();
 
+// refling all the next few lines....
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+
+char *getrc(char *progname, char *tmpr)
+{
+char *p, *e;
+int gotit = 0;
+char tmp[1000];
+struct stat statb;
+if (NULL == strrchr(progname, '/')) {
+   p = (char *)strcat(getenv("PATH"), ":");
+   while (NULL != (e = (char *)strchr(p, ':')))
+     {*e = 0;
+     if (!stat(strcat(strcpy(tmp, p), "/mg.rc"), &statb)) return(strcpy(tmpr, tmp));
+     p = ++e;}}
+else {
+   strcpy(tmp, progname);
+   *(char *)strrchr(tmp, '/') = 0;
+   strcat(tmp, "/mg.rc");
+   if (!stat(tmp, &statb)) return(strcpy(tmpr, tmp));}
+return(NULL);
+}
+
+// refling end.........
+
+
 VOID
 main(argc, argv)
 int  argc;
@@ -27,6 +56,8 @@
 {
 #ifndef NO_STARTUP
 	char	*startupfile();
+	char	*getrc();   // refling
+	char	tmppp[200];  // refling
 #endif
 	char	*cp;
 	VOID	vtinit(), makename(), eerase();
@@ -47,7 +78,9 @@
 	 */
 	update();
 #ifndef NO_STARTUP				/* User startup file.	*/
-	if ((cp = startupfile((char *)NULL)) != NULL)
+//	if ((cp = startupfile((char *)NULL)) != NULL)
+//		(VOID) load(cp);
+	if ((cp = getrc(argv[0], tmppp)) != NULL)  // refling
 		(VOID) load(cp);
 #endif
 	while (--argc > 0) {