summaryrefslogtreecommitdiff
path: root/editors/uemacs/patches/patch-ac
blob: 1fa1258300ab455e68afba7349c8903a5dddaa1d (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
$NetBSD: patch-ac,v 1.3 2012/05/10 20:53:30 dholland Exp $

- use standard headers
- avoid implicit int
- look in $PREFIX/share/uemacs for data files
- const correctness required by existing const declarations
- suppress false initialization warning seen with gcc 4.1

--- src/bind.c.orig	1995-11-19 08:09:20.000000000 +0000
+++ src/bind.c
@@ -5,13 +5,14 @@
 								*/
 
 #include	<stdio.h>
+#include	<string.h>
 #include	"estruct.h"
 #include	"eproto.h"
 #include	"edef.h"
 #include	"elang.h"
 #include	"epath.h"
 
-PASCAL NEAR help(f, n)	/* give me some help!!!!
+PASCAL NEAR int help(f, n)	/* give me some help!!!!
 		   bring up a fake buffer and read the help file
 		   into it with view mode			*/
 
@@ -19,7 +20,10 @@ int f,n;	/* prefix flag and argument */
 
 {
 	register BUFFER *bp;	/* buffer pointer to help */
-	char *fname;		/* file name of help file */
+	CONST char *fname;		/* file name of help file */
+
+	/* required by gcc 4.1 */
+	fname = NULL;
 
 	/* first check if we are already here */
 	bp = bfind("emacs.hlp", FALSE, BFINVS);
@@ -51,7 +55,7 @@ int f,n;	/* prefix flag and argument */
 	return(TRUE);
 }
 
-PASCAL NEAR deskey(f, n)	/* describe the command for a certain key */
+PASCAL NEAR int deskey(f, n)	/* describe the command for a certain key */
 
 int f,n;	/* prefix flag and argument */
 
@@ -81,7 +85,7 @@ int f,n;	/* prefix flag and argument */
 
 /* bindtokey:	add a new key to the key binding table		*/
 
-PASCAL NEAR bindtokey(f, n)
+PASCAL NEAR int bindtokey(f, n)
 
 int f, n;	/* command arguments [IGNORED] */
 
@@ -180,7 +184,7 @@ int f, n;	/* command arguments [IGNORED]
 
 /* macrotokey:	Bind a key to a macro in the key binding table */
 
-PASCAL NEAR macrotokey(f, n)
+PASCAL NEAR int macrotokey(f, n)
 
 int f, n;	/* command arguments [IGNORED] */
 
@@ -258,7 +262,7 @@ int f, n;	/* command arguments [IGNORED]
 
 /* unbindkey:	delete a key from the key binding table */
 
-PASCAL NEAR unbindkey(f, n)
+PASCAL NEAR int unbindkey(f, n)
 
 int f, n;	/* command arguments [IGNORED] */
 
@@ -286,7 +290,7 @@ int f, n;	/* command arguments [IGNORED]
 	return(TRUE);
 }
 
-PASCAL NEAR unbindchar(c)
+PASCAL NEAR int unbindchar(c)
 
 int c;		/* command key to unbind */
 
@@ -359,7 +363,7 @@ BUFFER *bp;	/* buffer to unbind all keys
 	   into it with view mode
 */
 
-PASCAL NEAR desbind(f, n)
+PASCAL NEAR int desbind(f, n)
 
 int f,n;	/* prefix flag and argument */
 
@@ -367,7 +371,7 @@ int f,n;	/* prefix flag and argument */
 	return(buildlist(TRUE, ""));
 }
 
-PASCAL NEAR apro(f, n)	/* Apropos (List functions that match a substring) */
+PASCAL NEAR int apro(f, n)	/* Apropos (List functions that match a substring) */
 
 int f,n;	/* prefix flag and argument */
 
@@ -383,7 +387,7 @@ int f,n;	/* prefix flag and argument */
 	return(buildlist(FALSE, mstring));
 }
 
-PASCAL NEAR buildlist(type, mstring)  /* build a binding list (limited or full) */
+PASCAL NEAR int buildlist(type, mstring)  /* build a binding list (limited or full) */
 
 int type;	/* true = full list,   false = partial list */
 char *mstring;	/* match string if a partial list */
@@ -519,7 +523,7 @@ bfail:		/* and on to the next buffer */
 	return(TRUE);
 }
 
-PASCAL NEAR strinc(source, sub) /* does source include sub? */
+PASCAL NEAR int strinc(source, sub) /* does source include sub? */
 
 char *source;	/* string to search in */
 char *sub;	/* substring to look for */
@@ -579,12 +583,12 @@ int mflag;	/* going for a meta sequence?
 
 /* execute the startup file */
 
-PASCAL NEAR startup(sfname)
+PASCAL NEAR int startup(sfname)
 
 char *sfname;	/* name of startup file (null if default) */
 
 {
-	char *fname;	/* resulting file name to execute */
+	CONST char *fname;	/* resulting file name to execute */
 	char name[NSTRING];	/* name with extention */
 
 	/* look up the startup file */
@@ -623,29 +627,31 @@ char *sfname;	/* name of startup file (n
 			directories in table from EPATH.H
 */
 
-char *PASCAL NEAR flook(fname, hflag)
+CONST char *PASCAL NEAR flook(fname, hflag)
 
-char *fname;	/* base file name to search for */
+CONST char *fname;	/* base file name to search for */
 int hflag;	/* Look in the HOME environment variable first? */
 
 {
 	register char *home;	/* path to home directory */
 	register char *path;	/* environmental PATH variable */
-	register char *sp;	/* pointer into path spec */
+	register CONST char *sp1;	/* pointer into path spec */
+	register char *sp2;	/* pointer into path spec */
 	register int i; 	/* index */
 	static char fspec[NFILEN];	/* full path spec to search */
-
+        char patha[NFILEN];
+        
 	/* if we have an absolute path.. check only there! */
-	sp = fname;
-	while (*sp) {
-		if (*sp == ':' || *sp == '\\' || *sp == '/') {
+	sp1 = fname;
+	while (*sp1) {
+		if (*sp1 == ':' || *sp1 == '\\' || *sp1 == '/') {
 			if (ffropen(fname) == FIOSUC) {
 				ffclose();
 				return(fname);
 			} else
 				return(NULL);
 		}
-		++sp;
+		++sp1;
 	}
 
 #if	ENVFUNC
@@ -689,25 +695,27 @@ int hflag;	/* Look in the HOME environme
 #if OS2
 	path = getenv("DPATH");
 #else
-	path = getenv("PATH");
+	strncpy(patha, getenv("PATH"), NFILEN - 25);
+        strcat(patha, ":%%PREFIX%%/share/uemacs");
 #endif
 #endif
+        path = patha;
 	if (path != NULL)
 		while (*path) {
 
 			/* build next possible file spec */
-			sp = fspec;
+			sp2 = fspec;
 #if	TOS
 			while (*path && (*path != PATHCHR) && (*path != ','))
 #else
 			while (*path && (*path != PATHCHR))
 #endif
-				*sp++ = *path++;
+				*sp2++ = *path++;
 
 			/* add a terminating dir separator if we need it */
-			if ((sp != fspec) && (*(sp-1) != DIRSEPCHAR))
-				*sp++ = DIRSEPCHAR;
-			*sp = 0;
+			if ((sp2 != fspec) && (*(sp2-1) != DIRSEPCHAR))
+				*sp2++ = DIRSEPCHAR;
+			*sp2 = 0;
 			strcat(fspec, fname);
 
 			/* and try it out */
@@ -918,12 +926,13 @@ int index;	/* index of name to fetch out
 	the ^A form.
 */
 
-unsigned int PASCAL NEAR stock(keyname)
+unsigned int PASCAL NEAR stock(keyname_c)
 
-unsigned char *keyname;	/* name of key to translate to Command key form */
+char *keyname_c;	/* name of key to translate to Command key form */
 
 {
 	register unsigned int c;	/* key sequence to return */
+	unsigned char *keyname = (unsigned char *)keyname_c;
 
 	/* parse it up */
 	c = 0;
@@ -990,12 +999,12 @@ unsigned char *keyname;	/* name of key t
 	return(c);
 }
 
-char *PASCAL NEAR transbind(skey)	/* string key name to binding name.... */
+CONST char *PASCAL NEAR transbind(skey)	/* string key name to binding name.... */
 
 char *skey;	/* name of key to get binding for */
 
 {
-	char *bindname;
+	CONST char *bindname;
 
 	bindname = getfname(getbind(stock(skey)));
 	if (bindname == NULL)