about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2000-12-22 20:27:57 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2000-12-22 20:27:57 -0500
commit244b955fa0312faea2e138d55330bd9a81fd92de (patch)
tree80e6d4330a5f7e04567967694daf88575574cfb8 /WWW
parent4bcb5704f4f3f96436217702000f32c859b621fb (diff)
downloadlynx-snapshots-244b955fa0312faea2e138d55330bd9a81fd92de.tar.gz
snapshot of project "lynx", label v2-8-4dev_15
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/HTAccess.c2
-rw-r--r--WWW/Library/Implementation/HTBTree.c3
-rw-r--r--WWW/Library/Implementation/HTFile.c57
-rw-r--r--WWW/Library/Implementation/HTFile.h7
-rw-r--r--WWW/Library/Implementation/HTUtils.h37
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.c2
-rw-r--r--WWW/Library/Implementation/HTVMSUtils.h4
7 files changed, 65 insertions, 47 deletions
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 786c9619..962407da 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -1057,7 +1057,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	fprintf(stderr,
  gettext("**** HTAccess: Internal software error.  Please mail lynx-dev@sig.net!\n"));
 	fprintf(stderr, gettext("**** HTAccess: Status returned was: %d\n"),status);
-	exit(-1);
+	exit(EXIT_FAILURE);
     }
 
     /* Failure in accessing a document */
diff --git a/WWW/Library/Implementation/HTBTree.c b/WWW/Library/Implementation/HTBTree.c
index c545eb0e..db3b50db 100644
--- a/WWW/Library/Implementation/HTBTree.c
+++ b/WWW/Library/Implementation/HTBTree.c
@@ -9,9 +9,6 @@
 
 #include <HTUtils.h>
 #include <HTBTree.h>
-#ifndef __STRICT_BSD__
-#include <stdlib.h>
-#endif
 
 #define MAXIMUM(a,b) ((a)>(b)?(a):(b))
 
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 41627cdb..3e990097 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -138,11 +138,6 @@ PRIVATE HTSuffix no_suffix = { "*", NULL, NULL, NULL, 1.0 };
 PRIVATE HTSuffix unknown_suffix = { "*.*", NULL, NULL, NULL, 1.0};
 
 
-#ifdef _WINDOWS
-#define exists(p)	(access(p,0)==0)
-#endif
-
-
 /*	To free up the suffixes at program exit.
 **	----------------------------------------
 */
@@ -233,13 +228,8 @@ PRIVATE void LYListFmtParse ARGS5(
 #define PTBIT(a, s)  PBIT(a, 0, 0)
 #endif
 
-#ifdef _WINDOWS
-	if (stat(file, &st) < 0)
-		fmtstr = "    %a";	/* can't stat so just do anchor */
-#else
 	if (lstat(file, &st) < 0)
 		fmtstr = "    %a";	/* can't stat so just do anchor */
-#endif
 
 	StrAllocCopy(str, fmtstr);
 	s = str;
@@ -1995,7 +1985,6 @@ PRIVATE int print_local_dir ARGS5(
 	    }
 	} /* end printing out the tree in order */
 
-	closedir(dp);
 	FREE(logical);
 	FREE(tmpfilename);
 	FREE(tail);
@@ -2015,6 +2004,40 @@ PRIVATE int print_local_dir ARGS5(
 #endif /* HAVE_READDIR */
 
 
+#ifndef VMS
+PUBLIC int HTStat ARGS2(
+	CONST char *,	filename,
+	struct stat *,	data)
+{
+    int result = -1;
+    char *temp_name = NULL;
+    size_t len = strlen(filename);
+
+    if (len != 0 && LYIsPathSep(filename[len-1])) {
+	HTSprintf0(&temp_name, "%s.", filename);
+    } else {
+	temp_name = (char *)filename;
+    }
+#ifdef _WINDOWS
+    /*
+     * Someone claims that stat() doesn't give the proper result for a
+     * directory on Windows.
+     */
+    if (access(temp_name, 0) == 0) {
+	if (stat(temp_name, data) == -1) data->st_mode = S_IFDIR;
+	return 0;
+    }
+    return -1;
+#else
+    return stat(temp_name, data);
+#endif
+
+    if (temp_name != filename) {
+	FREE(temp_name);
+    }
+    return result;
+}
+#endif
 
 /*	Load a document.
 **	----------------
@@ -2465,21 +2488,13 @@ PUBLIC int HTLoadFile ARGS4(
 	**  will hold the directory entry, and a type 'DIR' which is used
 	**  to point to the current directory being read.
 	*/
-#ifdef _WINDOWS
-	if (!exists(localname))
-#else
-	if (stat(localname,&dir_info) == -1)	   /* get file information */
-#endif
+	if (HTStat(localname,&dir_info) == -1)	   /* get file information */
 	{
 				/* if can't read file information */
 	    CTRACE((tfp, "HTLoadFile: can't stat %s\n", localname));
 
 	}  else {		/* Stat was OK */
 
-#ifdef _WINDOWS
-	    if (stat(localname,&dir_info) == -1) dir_info.st_mode = S_IFDIR;
-#endif
-
 	    if (S_ISDIR(dir_info.st_mode)) {
 		/*
 		**  If localname is a directory.
@@ -2500,7 +2515,6 @@ PUBLIC int HTLoadFile ARGS4(
 		    return HTLoadError(sink, 403, DISALLOWED_DIR_SCAN);
 		}
 
-
 		if (HTDirAccess == HT_DIR_SELECTIVE) {
 		    char * enable_file_name = NULL;
 
@@ -2527,6 +2541,7 @@ PUBLIC int HTLoadFile ARGS4(
 
 		status = print_local_dir(dp, localname,
 					anchor, format_out, sink);
+		closedir(dp);
 		FREE(localname);
 		FREE(nodename);
 		return status;	/* document loaded, maybe partial */
diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h
index f0a3178a..edee6ded 100644
--- a/WWW/Library/Implementation/HTFile.h
+++ b/WWW/Library/Implementation/HTFile.h
@@ -72,6 +72,13 @@ extern BOOL HTDirTitles PARAMS((
         HTAnchor *      anchor,
 	BOOL		tildeIsTop));
 
+/*
+**	Check existence.
+*/
+extern int HTStat PARAMS((
+	CONST char *	filename,
+	struct stat *	data));
+
 /*	Load a document.
 **	----------------
 */
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index aaef1923..036ed2fd 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -48,6 +48,10 @@
 #define HAVE_STDARG_H 1
 #endif
 
+#if defined(VMS) || defined(_WINDOWS)
+#define HAVE_STDLIB_H 1
+#endif
+
 /* Accommodate non-autoconf'd Makefile's (VMS, DJGPP, etc) */
 
 #ifndef NO_ARPA_INET_H
@@ -142,14 +146,6 @@ typedef unsigned short mode_t;
 
 #endif /* _WINDOWS */
 
-#ifdef __EMX__
-#include <unistd.h> /* should be re-include protected under EMX */
-#include <stdlib.h> /* should be re-include protected under EMX */
-#define getcwd _getcwd2
-#define chdir _chdir2
-
-#endif
-
 #ifndef USE_COLOR_STYLE
     /* it's useless for such setup */
 #  define NO_EMPTY_HREFLESS_A
@@ -186,9 +182,23 @@ typedef void * HTError;                 /* Unused at present -- best definition?
 Standard C library for malloc() etc
 
  */
-#ifdef DGUX
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif /* DGUX */
+#endif
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+#ifdef __EMX__
+#include <unistd.h> /* should be re-include protected under EMX */
+#define getcwd _getcwd2
+#define chdir _chdir2
+#endif
 
 #ifdef vax
 #ifdef unix
@@ -202,22 +212,15 @@ Standard C library for malloc() etc
 #ifdef NeXT
 #include <libc.h>       /* NeXT */
 #endif /* NeXT */
-#ifndef MACH /* Vincent.Cate@furmint.nectar.cs.cmu.edu */
-#ifndef __STRICT_BSD__
-#include <stdlib.h>
-#endif /* !__STRICT_BSD__ */
-#endif /* !MACH */
 
 #else /* ultrix: */
 
 #include <malloc.h>
 #include <memory.h>
-#include <stdlib.h>   /* ANSI */   /* BSN */
 
 #endif /* !ultrix */
 #else   /* VMS: */
 
-#include <stdlib.h>
 #include <unixlib.h>
 #if defined(VAXC) && !defined(__DECC)
 #define malloc	VAXC$MALLOC_OPT
diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c
index f4209ce2..a83bdce3 100644
--- a/WWW/Library/Implementation/HTVMSUtils.c
+++ b/WWW/Library/Implementation/HTVMSUtils.c
@@ -364,7 +364,7 @@ static char *Name;
       }
    }
 
-   /* try in case a file on toplevel directory or .DIR was alreadyt specified */
+   /* try in case a file on toplevel directory or .DIR was already specified */
    Result = stat(Name,info);
    if (Result == 0)
       return(Result);
diff --git a/WWW/Library/Implementation/HTVMSUtils.h b/WWW/Library/Implementation/HTVMSUtils.h
index 6eb55ca6..2720125e 100644
--- a/WWW/Library/Implementation/HTVMSUtils.h
+++ b/WWW/Library/Implementation/HTVMSUtils.h
@@ -89,10 +89,6 @@ PUBLIC BOOL HTVMS_checkAccess PARAMS((
 PUBLIC char * HTVMS_wwwName PARAMS((
 	CONST char *	vmsname));
 
-PUBLIC int HTStat PARAMS((
-	CONST char * filename,
-        struct stat * info));
-
 PUBLIC int HTVMSBrowseDir PARAMS((
 	CONST char * address,
 	HTParentAnchor * anchor,
='alt'>
44c1aeef ^

d009e158 ^

cd9bb850 ^



3e1349d2 ^
cd9bb850 ^
f344b250 ^

cd9bb850 ^

f344b250 ^
cd9bb850 ^
d009e158 ^




4690ce81 ^


d009e158 ^

4690ce81 ^
2f02189d ^
d009e158 ^




4690ce81 ^
d009e158 ^
4690ce81 ^
d009e158 ^



298f8065 ^



beea7ce2 ^


d009e158 ^

beea7ce2 ^
d009e158 ^






3e1349d2 ^
f344b250 ^
d009e158 ^
3e1349d2 ^
d009e158 ^



f344b250 ^

d009e158 ^


3e1349d2 ^


d009e158 ^
3e1349d2 ^
d009e158 ^



f344b250 ^

d009e158 ^



4690ce81 ^
d009e158 ^
4690ce81 ^
d059fe74 ^
4690ce81 ^
c02478c4 ^
4690ce81 ^
c02478c4 ^
4690ce81 ^

c02478c4 ^




d009e158 ^
c02478c4 ^





d009e158 ^



c02478c4 ^










3e1349d2 ^
0ca56ed8 ^
d009e158 ^

0ca56ed8 ^




4690ce81 ^
d059fe74 ^
44c1aeef ^
d009e158 ^
0ca56ed8 ^
d009e158 ^
44c1aeef ^
d009e158 ^
0ca56ed8 ^





d059fe74 ^
44c1aeef ^


298f8065 ^
44c1aeef ^
d009e158 ^


0ca56ed8 ^
























44c1aeef ^
0ca56ed8 ^
298f8065 ^







2f02189d ^
4690ce81 ^
44c1aeef ^



d009e158 ^




3e1349d2 ^
f344b250 ^
3e1349d2 ^

d009e158 ^
3e1349d2 ^
d009e158 ^



2f02189d ^
d009e158 ^


3e1349d2 ^

d009e158 ^
3e1349d2 ^
d009e158 ^



2f02189d ^
d009e158 ^
b2566a84 ^
4690ce81 ^


d009e158 ^

4690ce81 ^

d059fe74 ^
4690ce81 ^
d009e158 ^

d059fe74 ^
4690ce81 ^
d009e158 ^



2f02189d ^
298f8065 ^
3e1349d2 ^

f344b250 ^
3e1349d2 ^
298f8065 ^
3e1349d2 ^
298f8065 ^





2f02189d ^


3e1349d2 ^
2f02189d ^

3e1349d2 ^
2f02189d ^





2e4f0bbd ^
2f02189d ^






d059fe74 ^
2e4f0bbd ^




2f02189d ^

2e4f0bbd ^








d009e158 ^


a654e4ec ^
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406