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
|
$NetBSD: patch-aq,v 1.1.1.1 2000/12/15 00:36:39 wiz Exp $
diff -x *.orig -urN ./tcl/tclGlob.c /usr/pkgsrc/net/icb/work.i386.unpatched/icb-5.0.9/tcl/tclGlob.c
--- ./tcl/tclGlob.c Fri Feb 24 22:19:55 1995
+++ /usr/pkgsrc/net/icb/work.i386.unpatched/icb-5.0.9/tcl/tclGlob.c Fri Nov 26 22:56:30 1999
@@ -28,6 +28,12 @@
#include <sys/stat.h>
#include <tcl.h>
+#ifdef __linux__
+#define DIRNAMLEN(d) strlen((d)->d_name)
+#else
+#define DIRNAMLEN(d) ((d)->d_namlen)
+#endif
+
/*
* The structure below is used to keep track of a globbing result
* being built up (i.e. a partial list of file names). The list
@@ -298,12 +304,12 @@
if (Tcl_StringMatch(entryPtr->d_name, pattern)) {
if (*p == 0) {
AppendResult(dir, entryPtr->d_name,
- (int) entryPtr->d_namlen, resPtr);
+ (int) DIRNAMLEN(entryPtr), resPtr);
} else {
- if ((l1+entryPtr->d_namlen+2) <= STATIC_SIZE) {
+ if ((l1+DIRNAMLEN(entryPtr)+2) <= STATIC_SIZE) {
newDir = static1;
} else {
- newDir = malloc((unsigned) (l1+entryPtr->d_namlen+2));
+ newDir = malloc((unsigned) (l1+DIRNAMLEN(entryPtr)+2));
}
sprintf(newDir, "%s%s/", dir, entryPtr->d_name);
result = DoGlob(interp, newDir, p+1, resPtr);
|