Attachment "1034337-HEAD.diff" to
ticket [1034337fff]
added by
das
2004-11-11 08:26:54.
0000: 49 6e 64 65 78 3a 20 74 65 73 74 73 2f 66 43 6d Index: tests/fCm
0010: 64 2e 74 65 73 74 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d d.test.=========
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 ==========.RCS f
0060: 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 ile: /cvsroot/tc
0070: 6c 2f 74 63 6c 2f 74 65 73 74 73 2f 66 43 6d 64 l/tcl/tests/fCmd
0080: 2e 74 65 73 74 2c 76 0a 72 65 74 72 69 65 76 69 .test,v.retrievi
0090: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 34 33 ng revision 1.43
00a0: 0a 64 69 66 66 20 2d 75 20 2d 70 20 2d 72 31 2e .diff -u -p -r1.
00b0: 34 33 20 66 43 6d 64 2e 74 65 73 74 0a 2d 2d 2d 43 fCmd.test.---
00c0: 20 74 65 73 74 73 2f 66 43 6d 64 2e 74 65 73 74 tests/fCmd.test
00d0: 09 33 31 20 4f 63 74 20 32 30 30 34 20 31 39 3a .31 Oct 2004 19:
00e0: 31 32 3a 33 34 20 2d 30 30 30 30 09 31 2e 34 33 12:34 -0000.1.43
00f0: 0a 2b 2b 2b 20 74 65 73 74 73 2f 66 43 6d 64 2e .+++ tests/fCmd.
0100: 74 65 73 74 09 39 20 4e 6f 76 20 32 30 30 34 20 test.9 Nov 2004
0110: 31 38 3a 35 35 3a 31 30 20 2d 30 30 30 30 0a 40 18:55:10 -0000.@
0120: 40 20 2d 31 37 36 32 2c 36 20 2b 31 37 36 32 2c @ -1762,6 +1762,
0130: 31 36 20 40 40 20 74 65 73 74 20 66 43 6d 64 2d 16 @@ test fCmd-
0140: 32 30 2e 31 20 7b 54 72 61 76 65 72 73 65 55 6e 20.1 {TraverseUn
0150: 69 78 54 72 65 65 20 3a 20 66 61 69 6c 75 0a 20 ixTree : failu.
0160: 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 0a 20 set result.
0170: 7d 20 7b 31 7d 0a 20 0a 2b 74 65 73 74 20 66 43 } {1}. .+test fC
0180: 6d 64 2d 32 30 2e 32 20 7b 54 72 61 76 65 72 73 md-20.2 {Travers
0190: 65 55 6e 69 78 54 72 65 65 20 3a 20 72 65 63 75 eUnixTree : recu
01a0: 72 73 69 76 65 20 64 65 6c 65 74 65 20 6f 66 20 rsive delete of
01b0: 6c 61 72 67 65 20 64 69 72 65 63 74 6f 72 79 3a large directory:
01c0: 20 42 75 67 20 31 30 33 34 33 33 37 7d 20 5c 0a Bug 1034337} \.
01d0: 2b 09 7b 75 6e 69 78 20 6e 6f 74 52 6f 6f 74 7d +.{unix notRoot}
01e0: 20 7b 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 66 {.+ catch {f
01f0: 69 6c 65 20 64 65 6c 65 74 65 20 2d 66 6f 72 63 ile delete -forc
0200: 65 20 2d 2d 20 74 66 61 7d 0a 2b 20 20 20 20 66 e -- tfa}.+ f
0210: 69 6c 65 20 6d 6b 64 69 72 20 74 66 61 0a 2b 20 ile mkdir tfa.+
0220: 20 20 20 66 6f 72 20 7b 73 65 74 20 69 20 31 7d for {set i 1}
0230: 20 7b 24 69 20 3c 3d 20 32 30 30 7d 20 7b 69 6e {$i <= 200} {in
0240: 63 72 20 69 7d 20 7b 63 72 65 61 74 65 66 69 6c cr i} {createfil
0250: 65 20 74 66 61 2f 74 65 73 74 66 69 6c 65 5f 24 e tfa/testfile_$
0260: 69 7d 0a 2b 20 20 20 20 73 65 74 20 72 65 73 75 i}.+ set resu
0270: 6c 74 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 lt [catch {file
0280: 64 65 6c 65 74 65 20 2d 66 6f 72 63 65 20 74 66 delete -force tf
0290: 61 7d 20 6d 73 67 5d 0a 2b 20 20 20 20 77 68 69 a} msg].+ whi
02a0: 6c 65 20 7b 5b 63 61 74 63 68 20 7b 66 69 6c 65 le {[catch {file
02b0: 20 64 65 6c 65 74 65 20 2d 66 6f 72 63 65 20 74 delete -force t
02c0: 66 61 7d 5d 7d 20 7b 7d 0a 2b 20 20 20 20 6c 69 fa}]} {}.+ li
02d0: 73 74 20 24 72 65 73 75 6c 74 20 24 6d 73 67 0a st $result $msg.
02e0: 2b 7d 20 7b 30 20 7b 7d 7d 0a 2b 0a 20 23 0a 20 +} {0 {}}.+. #.
02f0: 23 20 46 65 61 74 75 72 65 20 74 65 73 74 69 6e # Feature testin
0300: 67 20 66 6f 72 20 54 63 6c 43 6f 70 79 46 69 6c g for TclCopyFil
0310: 65 73 43 6d 64 0a 20 23 20 0a 49 6e 64 65 78 3a esCmd. # .Index:
0320: 20 75 6e 69 78 2f 74 63 6c 55 6e 69 78 46 43 6d unix/tclUnixFCm
0330: 64 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d d.c.============
0340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0370: 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 =======.RCS file
0380: 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 : /cvsroot/tcl/t
0390: 63 6c 2f 75 6e 69 78 2f 74 63 6c 55 6e 69 78 46 cl/unix/tclUnixF
03a0: 43 6d 64 2e 63 2c 76 0a 72 65 74 72 69 65 76 69 Cmd.c,v.retrievi
03b0: 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 33 39 ng revision 1.39
03c0: 0a 64 69 66 66 20 2d 75 20 2d 70 20 2d 72 31 2e .diff -u -p -r1.
03d0: 33 39 20 74 63 6c 55 6e 69 78 46 43 6d 64 2e 63 39 tclUnixFCmd.c
03e0: 0a 2d 2d 2d 20 75 6e 69 78 2f 74 63 6c 55 6e 69 .--- unix/tclUni
03f0: 78 46 43 6d 64 2e 63 09 36 20 4f 63 74 20 32 30 xFCmd.c.6 Oct 20
0400: 30 34 20 31 36 3a 30 38 3a 35 37 20 2d 30 30 30 04 16:08:57 -000
0410: 30 09 31 2e 33 39 0a 2b 2b 2b 20 75 6e 69 78 2f 0.1.39.+++ unix/
0420: 74 63 6c 55 6e 69 78 46 43 6d 64 2e 63 09 39 20 tclUnixFCmd.c.9
0430: 4e 6f 76 20 32 30 30 34 20 31 38 3a 35 35 3a 31 Nov 2004 18:55:1
0440: 30 20 2d 30 30 30 30 0a 40 40 20 2d 31 39 30 2c 0 -0000.@@ -190,
0450: 37 20 2b 31 39 30 2c 37 20 40 40 20 73 74 61 74 7 +190,7 @@ stat
0460: 69 63 20 69 6e 74 09 09 54 72 61 76 65 72 73 61 ic int..Traversa
0470: 6c 44 65 6c 65 74 65 20 5f 41 4e 53 49 5f 41 52 lDelete _ANSI_AR
0480: 47 53 5f 28 0a 20 73 74 61 74 69 63 20 69 6e 74 GS_(. static int
0490: 09 09 54 72 61 76 65 72 73 65 55 6e 69 78 54 72 ..TraverseUnixTr
04a0: 65 65 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 ee _ANSI_ARGS_((
04b0: 0a 20 09 09 09 20 20 20 20 54 72 61 76 65 72 73 . ... Travers
04c0: 61 6c 50 72 6f 63 20 2a 74 72 61 76 65 72 73 61 alProc *traversa
04d0: 6c 50 72 6f 63 2c 0a 20 09 09 09 20 20 20 20 54 lProc,. ... T
04e0: 63 6c 5f 44 53 74 72 69 6e 67 20 2a 73 6f 75 72 cl_DString *sour
04f0: 63 65 50 74 72 2c 20 54 63 6c 5f 44 53 74 72 69 cePtr, Tcl_DStri
0500: 6e 67 20 2a 64 65 73 74 50 74 72 2c 0a 2d 09 09 ng *destPtr,.-..
0510: 09 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 . Tcl_DString
0520: 20 2a 65 72 72 6f 72 50 74 72 29 29 3b 0a 2b 09 *errorPtr));.+.
0530: 09 09 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e .. Tcl_DStrin
0540: 67 20 2a 65 72 72 6f 72 50 74 72 2c 20 69 6e 74 g *errorPtr, int
0550: 20 64 6f 52 65 77 69 6e 64 29 29 3b 0a 20 0a 20 doRewind));. .
0560: 23 69 66 64 65 66 20 50 55 52 49 46 59 0a 20 2f #ifdef PURIFY. /
0570: 2a 0a 40 40 20 2d 36 39 31 2c 37 20 2b 36 39 31 *.@@ -691,7 +691
0580: 2c 37 20 40 40 20 54 63 6c 70 4f 62 6a 43 6f 70 ,7 @@ TclpObjCop
0590: 79 44 69 72 65 63 74 6f 72 79 28 73 72 63 50 61 yDirectory(srcPa
05a0: 74 68 50 74 72 2c 20 64 65 73 74 50 61 74 0a 20 thPtr, destPat.
05b0: 09 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e .Tcl_DecrRefCoun
05c0: 74 28 74 72 61 6e 73 50 74 72 29 3b 0a 20 20 20 t(transPtr);.
05d0: 20 20 7d 0a 20 0a 2d 20 20 20 20 72 65 74 20 3d }. .- ret =
05e0: 20 54 72 61 76 65 72 73 65 55 6e 69 78 54 72 65 TraverseUnixTre
05f0: 65 28 54 72 61 76 65 72 73 61 6c 43 6f 70 79 2c e(TraversalCopy,
0600: 20 26 73 72 63 53 74 72 69 6e 67 2c 20 26 64 73 &srcString, &ds
0610: 74 53 74 72 69 6e 67 2c 20 26 64 73 29 3b 0a 2b tString, &ds);.+
0620: 20 20 20 20 72 65 74 20 3d 20 54 72 61 76 65 72 ret = Traver
0630: 73 65 55 6e 69 78 54 72 65 65 28 54 72 61 76 65 seUnixTree(Trave
0640: 72 73 61 6c 43 6f 70 79 2c 20 26 73 72 63 53 74 rsalCopy, &srcSt
0650: 72 69 6e 67 2c 20 26 64 73 74 53 74 72 69 6e 67 ring, &dstString
0660: 2c 20 26 64 73 2c 20 30 29 3b 0a 20 0a 20 20 20 , &ds, 0);. .
0670: 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 46 72 65 Tcl_DStringFre
0680: 65 28 26 73 72 63 53 74 72 69 6e 67 29 3b 0a 20 e(&srcString);.
0690: 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 46 Tcl_DStringF
06a0: 72 65 65 28 26 64 73 74 53 74 72 69 6e 67 29 3b ree(&dstString);
06b0: 0a 40 40 20 2d 38 31 30 2c 37 20 2b 38 31 30 2c .@@ -810,7 +810,
06c0: 37 20 40 40 20 44 6f 52 65 6d 6f 76 65 44 69 72 7 @@ DoRemoveDir
06d0: 65 63 74 6f 72 79 28 70 61 74 68 50 74 72 2c 20 ectory(pathPtr,
06e0: 72 65 63 75 72 73 69 76 65 2c 20 65 72 0a 20 20 recursive, er.
06f0: 20 20 20 20 2a 2f 0a 20 0a 20 20 20 20 20 69 66 */. . if
0700: 20 28 72 65 73 75 6c 74 20 3d 3d 20 54 43 4c 5f (result == TCL_
0710: 4f 4b 29 20 7b 0a 2d 09 72 65 73 75 6c 74 20 3d OK) {.-.result =
0720: 20 54 72 61 76 65 72 73 65 55 6e 69 78 54 72 65 TraverseUnixTre
0730: 65 28 54 72 61 76 65 72 73 61 6c 44 65 6c 65 74 e(TraversalDelet
0740: 65 2c 20 70 61 74 68 50 74 72 2c 20 4e 55 4c 4c e, pathPtr, NULL
0750: 2c 20 65 72 72 6f 72 50 74 72 29 3b 0a 2b 09 72 , errorPtr);.+.r
0760: 65 73 75 6c 74 20 3d 20 54 72 61 76 65 72 73 65 esult = Traverse
0770: 55 6e 69 78 54 72 65 65 28 54 72 61 76 65 72 73 UnixTree(Travers
0780: 61 6c 44 65 6c 65 74 65 2c 20 70 61 74 68 50 74 alDelete, pathPt
0790: 72 2c 20 4e 55 4c 4c 2c 20 65 72 72 6f 72 50 74 r, NULL, errorPt
07a0: 72 2c 20 31 29 3b 0a 20 20 20 20 20 7d 0a 20 20 r, 1);. }.
07b0: 20 20 20 0a 20 20 20 20 20 69 66 20 28 28 72 65 . if ((re
07c0: 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 sult != TCL_OK)
07d0: 26 26 20 28 72 65 63 75 72 73 69 76 65 20 21 3d && (recursive !=
07e0: 20 30 29 29 20 7b 0a 40 40 20 2d 38 34 33 2c 37 0)) {.@@ -843,7
07f0: 20 2b 38 34 33 2c 37 20 40 40 20 44 6f 52 65 6d +843,7 @@ DoRem
0800: 6f 76 65 44 69 72 65 63 74 6f 72 79 28 70 61 74 oveDirectory(pat
0810: 68 50 74 72 2c 20 72 65 63 75 72 73 69 76 65 2c hPtr, recursive,
0820: 20 65 72 0a 20 20 2a 2f 0a 20 0a 20 73 74 61 74 er. */. . stat
0830: 69 63 20 69 6e 74 20 0a 2d 54 72 61 76 65 72 73 ic int .-Travers
0840: 65 55 6e 69 78 54 72 65 65 28 74 72 61 76 65 72 eUnixTree(traver
0850: 73 65 50 72 6f 63 2c 20 73 6f 75 72 63 65 50 74 seProc, sourcePt
0860: 72 2c 20 74 61 72 67 65 74 50 74 72 2c 20 65 72 r, targetPtr, er
0870: 72 6f 72 50 74 72 29 0a 2b 54 72 61 76 65 72 73 rorPtr).+Travers
0880: 65 55 6e 69 78 54 72 65 65 28 74 72 61 76 65 72 eUnixTree(traver
0890: 73 65 50 72 6f 63 2c 20 73 6f 75 72 63 65 50 74 seProc, sourcePt
08a0: 72 2c 20 74 61 72 67 65 74 50 74 72 2c 20 65 72 r, targetPtr, er
08b0: 72 6f 72 50 74 72 2c 20 64 6f 52 65 77 69 6e 64 rorPtr, doRewind
08c0: 29 0a 20 20 20 20 20 54 72 61 76 65 72 73 61 6c ). Traversal
08d0: 50 72 6f 63 20 2a 74 72 61 76 65 72 73 65 50 72 Proc *traversePr
08e0: 6f 63 3b 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 oc;/* Function t
08f0: 6f 20 63 61 6c 6c 20 66 6f 72 20 65 76 65 72 79 o call for every
0900: 20 66 69 6c 65 20 61 6e 64 0a 20 09 09 09 09 20 file and. ....
0910: 2a 20 64 69 72 65 63 74 6f 72 79 20 69 6e 20 73 * directory in s
0920: 6f 75 72 63 65 20 68 69 65 72 61 72 63 68 79 2e ource hierarchy.
0930: 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 44 53 74 */. Tcl_DSt
0940: 72 69 6e 67 20 2a 73 6f 75 72 63 65 50 74 72 3b ring *sourcePtr;
0950: 09 2f 2a 20 50 61 74 68 6e 61 6d 65 20 6f 66 20 ./* Pathname of
0960: 73 6f 75 72 63 65 20 64 69 72 65 63 74 6f 72 79 source directory
0970: 20 74 6f 20 62 65 0a 40 40 20 2d 38 35 33 2c 31 to be.@@ -853,1
0980: 31 20 2b 38 35 33 2c 31 38 20 40 40 20 54 72 61 1 +853,18 @@ Tra
0990: 76 65 72 73 65 55 6e 69 78 54 72 65 65 28 74 72 verseUnixTree(tr
09a0: 61 76 65 72 73 65 50 72 6f 63 2c 20 73 6f 75 72 averseProc, sour
09b0: 63 65 50 74 72 0a 20 20 20 20 20 54 63 6c 5f 44 cePtr. Tcl_D
09c0: 53 74 72 69 6e 67 20 2a 65 72 72 6f 72 50 74 72 String *errorPtr
09d0: 3b 09 2f 2a 20 49 66 20 6e 6f 6e 2d 4e 55 4c 4c ;./* If non-NULL
09e0: 2c 20 75 6e 69 6e 69 74 69 61 6c 69 7a 65 64 20 , uninitialized
09f0: 6f 72 20 66 72 65 65 0a 20 09 09 09 09 20 2a 20 or free. .... *
0a00: 44 53 74 72 69 6e 67 20 66 69 6c 6c 65 64 20 77 DString filled w
0a10: 69 74 68 20 55 54 46 2d 38 20 6e 61 6d 65 20 6f ith UTF-8 name o
0a20: 66 20 66 69 6c 65 0a 20 09 09 09 09 20 2a 20 63 f file. .... * c
0a30: 61 75 73 69 6e 67 20 65 72 72 6f 72 2e 20 2a 2f ausing error. */
0a40: 0a 2b 20 20 20 20 69 6e 74 20 64 6f 52 65 77 69 .+ int doRewi
0a50: 6e 64 3b 09 09 2f 2a 20 46 6c 61 67 20 69 6e 64 nd;../* Flag ind
0a60: 69 63 61 74 69 6e 67 20 74 68 61 74 20 74 6f 20 icating that to
0a70: 65 6e 73 75 72 65 20 63 6f 6d 70 6c 65 74 65 0a ensure complete.
0a80: 2b 20 20 20 20 09 09 09 09 20 2a 20 74 72 61 76 + .... * trav
0a90: 65 72 73 61 6c 20 6f 66 20 73 6f 75 72 63 65 20 ersal of source
0aa0: 68 69 65 72 61 72 63 68 79 2c 20 74 68 65 20 72 hierarchy, the r
0ab0: 65 61 64 64 69 72 0a 2b 20 20 20 20 09 09 09 09 eaddir.+ ....
0ac0: 20 2a 20 6c 6f 6f 70 20 73 68 6f 75 6c 64 20 62 * loop should b
0ad0: 65 20 72 65 77 6f 75 6e 64 20 77 68 65 6e 65 76 e rewound whenev
0ae0: 65 72 0a 2b 20 20 20 20 09 09 09 09 20 2a 20 74 er.+ .... * t
0af0: 72 61 76 65 72 73 65 50 72 6f 63 20 68 61 73 20 raverseProc has
0b00: 72 65 74 75 72 6e 65 64 20 54 43 4c 5f 4f 4b 3b returned TCL_OK;
0b10: 20 74 68 69 73 20 69 73 0a 2b 20 20 20 20 09 09 this is.+ ..
0b20: 09 09 20 2a 20 72 65 71 75 69 72 65 64 20 77 68 .. * required wh
0b30: 65 6e 20 74 72 61 76 65 72 73 65 50 72 6f 63 20 en traverseProc
0b40: 6d 6f 64 69 66 69 65 73 20 74 68 65 0a 2b 20 20 modifies the.+
0b50: 20 20 09 09 09 09 20 2a 20 73 6f 75 72 63 65 20 .... * source
0b60: 68 69 65 72 61 72 63 68 79 2c 20 65 2e 67 2e 20 hierarchy, e.g.
0b70: 62 79 20 64 65 6c 65 74 69 6e 67 20 66 69 6c 65 by deleting file
0b80: 73 2e 20 2a 2f 20 0a 20 7b 0a 20 20 20 20 20 54 s. */ . {. T
0b90: 63 6c 5f 53 74 61 74 42 75 66 20 73 74 61 74 42 cl_StatBuf statB
0ba0: 75 66 3b 0a 20 20 20 20 20 43 4f 4e 53 54 20 63 uf;. CONST c
0bb0: 68 61 72 20 2a 73 6f 75 72 63 65 2c 20 2a 65 72 har *source, *er
0bc0: 72 66 69 6c 65 3b 0a 20 20 20 20 20 69 6e 74 20 rfile;. int
0bd0: 72 65 73 75 6c 74 2c 20 73 6f 75 72 63 65 4c 65 result, sourceLe
0be0: 6e 3b 0a 20 20 20 20 20 69 6e 74 20 74 61 72 67 n;. int targ
0bf0: 65 74 4c 65 6e 3b 0a 2b 20 20 20 20 69 6e 74 20 etLen;.+ int
0c00: 6e 65 65 64 52 65 77 69 6e 64 3b 0a 20 20 20 20 needRewind;.
0c10: 20 54 63 6c 5f 44 69 72 45 6e 74 72 79 20 2a 64 Tcl_DirEntry *d
0c20: 69 72 45 6e 74 50 74 72 3b 0a 20 20 20 20 20 44 irEntPtr;. D
0c30: 49 52 20 2a 64 69 72 50 74 72 3b 0a 20 0a 40 40 IR *dirPtr;. .@@
0c40: 20 2d 39 30 32 2c 33 36 20 2b 39 30 39 2c 34 35 -902,36 +909,45
0c50: 20 40 40 20 54 72 61 76 65 72 73 65 55 6e 69 78 @@ TraverseUnix
0c60: 54 72 65 65 28 74 72 61 76 65 72 73 65 50 72 6f Tree(traversePro
0c70: 63 2c 20 73 6f 75 72 63 65 50 74 72 0a 20 09 74 c, sourcePtr. .t
0c80: 61 72 67 65 74 4c 65 6e 20 3d 20 54 63 6c 5f 44 argetLen = Tcl_D
0c90: 53 74 72 69 6e 67 4c 65 6e 67 74 68 28 74 61 72 StringLength(tar
0ca0: 67 65 74 50 74 72 29 3b 0a 20 20 20 20 20 7d 0a getPtr);. }.
0cb0: 20 0a 2d 20 20 20 20 77 68 69 6c 65 20 28 28 64 .- while ((d
0cc0: 69 72 45 6e 74 50 74 72 20 3d 20 54 63 6c 4f 53 irEntPtr = TclOS
0cd0: 72 65 61 64 64 69 72 28 64 69 72 50 74 72 29 29 readdir(dirPtr))
0ce0: 20 21 3d 20 4e 55 4c 4c 29 20 7b 20 2f 2a 20 49 != NULL) { /* I
0cf0: 4e 54 4c 3a 20 4e 61 74 69 76 65 2e 20 2a 2f 0a NTL: Native. */.
0d00: 2d 09 69 66 20 28 28 64 69 72 45 6e 74 50 74 72 -.if ((dirEntPtr
0d10: 2d 3e 64 5f 6e 61 6d 65 5b 30 5d 20 3d 3d 20 27 ->d_name[0] == '
0d20: 2e 27 29 0a 2d 09 09 26 26 20 28 28 64 69 72 45 .').-..&& ((dirE
0d30: 6e 74 50 74 72 2d 3e 64 5f 6e 61 6d 65 5b 31 5d ntPtr->d_name[1]
0d40: 20 3d 3d 20 27 5c 30 27 29 0a 2d 09 09 09 7c 7c == '\0').-...||
0d50: 20 28 73 74 72 63 6d 70 28 64 69 72 45 6e 74 50 (strcmp(dirEntP
0d60: 74 72 2d 3e 64 5f 6e 61 6d 65 2c 20 22 2e 2e 22 tr->d_name, ".."
0d70: 29 20 3d 3d 20 30 29 29 29 20 7b 0a 2d 09 20 20 ) == 0))) {.-.
0d80: 20 20 63 6f 6e 74 69 6e 75 65 3b 0a 2d 09 7d 0a continue;.-.}.
0d90: 2d 0a 2d 09 2f 2a 20 0a 2d 09 20 2a 20 41 70 70 -.-./* .-. * App
0da0: 65 6e 64 20 6e 61 6d 65 20 61 66 74 65 72 20 73 end name after s
0db0: 6c 61 73 68 2c 20 61 6e 64 20 72 65 63 75 72 73 lash, and recurs
0dc0: 65 20 6f 6e 20 74 68 65 20 66 69 6c 65 2e 0a 2d e on the file..-
0dd0: 09 20 2a 2f 0a 2d 0a 2d 09 54 63 6c 5f 44 53 74 . */.-.-.Tcl_DSt
0de0: 72 69 6e 67 41 70 70 65 6e 64 28 73 6f 75 72 63 ringAppend(sourc
0df0: 65 50 74 72 2c 20 64 69 72 45 6e 74 50 74 72 2d ePtr, dirEntPtr-
0e00: 3e 64 5f 6e 61 6d 65 2c 20 2d 31 29 3b 0a 2d 09 >d_name, -1);.-.
0e10: 69 66 20 28 74 61 72 67 65 74 50 74 72 20 21 3d if (targetPtr !=
0e20: 20 4e 55 4c 4c 29 20 7b 0a 2d 09 20 20 20 20 54 NULL) {.-. T
0e30: 63 6c 5f 44 53 74 72 69 6e 67 41 70 70 65 6e 64 cl_DStringAppend
0e40: 28 74 61 72 67 65 74 50 74 72 2c 20 64 69 72 45 (targetPtr, dirE
0e50: 6e 74 50 74 72 2d 3e 64 5f 6e 61 6d 65 2c 20 2d ntPtr->d_name, -
0e60: 31 29 3b 0a 2d 09 7d 0a 2d 09 72 65 73 75 6c 74 1);.-.}.-.result
0e70: 20 3d 20 54 72 61 76 65 72 73 65 55 6e 69 78 54 = TraverseUnixT
0e80: 72 65 65 28 74 72 61 76 65 72 73 65 50 72 6f 63 ree(traverseProc
0e90: 2c 20 73 6f 75 72 63 65 50 74 72 2c 20 74 61 72 , sourcePtr, tar
0ea0: 67 65 74 50 74 72 2c 0a 2d 09 09 65 72 72 6f 72 getPtr,.-..error
0eb0: 50 74 72 29 3b 0a 2d 09 69 66 20 28 72 65 73 75 Ptr);.-.if (resu
0ec0: 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a lt != TCL_OK) {.
0ed0: 2d 09 20 20 20 20 62 72 65 61 6b 3b 0a 2b 20 20 -. break;.+
0ee0: 20 20 64 6f 20 7b 0a 2b 09 6e 65 65 64 52 65 77 do {.+.needRew
0ef0: 69 6e 64 20 3d 20 30 3b 0a 2b 09 77 68 69 6c 65 ind = 0;.+.while
0f00: 20 28 28 64 69 72 45 6e 74 50 74 72 20 3d 20 54 ((dirEntPtr = T
0f10: 63 6c 4f 53 72 65 61 64 64 69 72 28 64 69 72 50 clOSreaddir(dirP
0f20: 74 72 29 29 20 21 3d 20 4e 55 4c 4c 29 20 7b 20 tr)) != NULL) {
0f30: 2f 2a 20 49 4e 54 4c 3a 20 4e 61 74 69 76 65 2e /* INTL: Native.
0f40: 20 2a 2f 0a 2b 09 20 20 20 20 69 66 20 28 28 64 */.+. if ((d
0f50: 69 72 45 6e 74 50 74 72 2d 3e 64 5f 6e 61 6d 65 irEntPtr->d_name
0f60: 5b 30 5d 20 3d 3d 20 27 2e 27 29 0a 2b 09 09 20 [0] == '.').+..
0f70: 20 20 20 26 26 20 28 28 64 69 72 45 6e 74 50 74 && ((dirEntPt
0f80: 72 2d 3e 64 5f 6e 61 6d 65 5b 31 5d 20 3d 3d 20 r->d_name[1] ==
0f90: 27 5c 30 27 29 0a 2b 09 09 09 20 20 20 20 7c 7c '\0').+... ||
0fa0: 20 28 73 74 72 63 6d 70 28 64 69 72 45 6e 74 50 (strcmp(dirEntP
0fb0: 74 72 2d 3e 64 5f 6e 61 6d 65 2c 20 22 2e 2e 22 tr->d_name, ".."
0fc0: 29 20 3d 3d 20 30 29 29 29 20 7b 0a 2b 09 09 63 ) == 0))) {.+..c
0fd0: 6f 6e 74 69 6e 75 65 3b 0a 2b 09 20 20 20 20 7d ontinue;.+. }
0fe0: 0a 2b 09 20 20 20 20 0a 2b 09 20 20 20 20 2f 2a .+. .+. /*
0ff0: 20 0a 2b 09 20 20 20 20 20 2a 20 41 70 70 65 6e .+. * Appen
1000: 64 20 6e 61 6d 65 20 61 66 74 65 72 20 73 6c 61 d name after sla
1010: 73 68 2c 20 61 6e 64 20 72 65 63 75 72 73 65 20 sh, and recurse
1020: 6f 6e 20 74 68 65 20 66 69 6c 65 2e 0a 2b 09 20 on the file..+.
1030: 20 20 20 20 2a 2f 0a 2b 09 20 20 20 20 0a 2b 09 */.+. .+.
1040: 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 41 Tcl_DStringA
1050: 70 70 65 6e 64 28 73 6f 75 72 63 65 50 74 72 2c ppend(sourcePtr,
1060: 20 64 69 72 45 6e 74 50 74 72 2d 3e 64 5f 6e 61 dirEntPtr->d_na
1070: 6d 65 2c 20 2d 31 29 3b 0a 2b 09 20 20 20 20 69 me, -1);.+. i
1080: 66 20 28 74 61 72 67 65 74 50 74 72 20 21 3d 20 f (targetPtr !=
1090: 4e 55 4c 4c 29 20 7b 0a 2b 09 09 54 63 6c 5f 44 NULL) {.+..Tcl_D
10a0: 53 74 72 69 6e 67 41 70 70 65 6e 64 28 74 61 72 StringAppend(tar
10b0: 67 65 74 50 74 72 2c 20 64 69 72 45 6e 74 50 74 getPtr, dirEntPt
10c0: 72 2d 3e 64 5f 6e 61 6d 65 2c 20 2d 31 29 3b 0a r->d_name, -1);.
10d0: 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 72 65 +. }.+. re
10e0: 73 75 6c 74 20 3d 20 54 72 61 76 65 72 73 65 55 sult = TraverseU
10f0: 6e 69 78 54 72 65 65 28 74 72 61 76 65 72 73 65 nixTree(traverse
1100: 50 72 6f 63 2c 20 73 6f 75 72 63 65 50 74 72 2c Proc, sourcePtr,
1110: 20 74 61 72 67 65 74 50 74 72 2c 0a 2b 09 09 20 targetPtr,.+..
1120: 20 20 20 65 72 72 6f 72 50 74 72 2c 20 64 6f 52 errorPtr, doR
1130: 65 77 69 6e 64 29 3b 0a 2b 09 20 20 20 20 69 66 ewind);.+. if
1140: 20 28 72 65 73 75 6c 74 20 21 3d 20 54 43 4c 5f (result != TCL_
1150: 4f 4b 29 20 7b 0a 2b 09 20 20 20 20 09 6e 65 65 OK) {.+. .nee
1160: 64 52 65 77 69 6e 64 20 3d 20 30 3b 0a 2b 09 09 dRewind = 0;.+..
1170: 62 72 65 61 6b 3b 0a 2b 09 20 20 20 20 7d 20 65 break;.+. } e
1180: 6c 73 65 20 7b 0a 2b 09 09 6e 65 65 64 52 65 77 lse {.+..needRew
1190: 69 6e 64 20 3d 20 64 6f 52 65 77 69 6e 64 3b 0a ind = doRewind;.
11a0: 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 0a 2b +. }.+. .+
11b0: 09 20 20 20 20 2f 2a 0a 2b 09 20 20 20 20 20 2a . /*.+. *
11c0: 20 52 65 6d 6f 76 65 20 6e 61 6d 65 20 61 66 74 Remove name aft
11d0: 65 72 20 73 6c 61 73 68 2e 0a 2b 09 20 20 20 20 er slash..+.
11e0: 20 2a 2f 0a 2b 09 20 20 20 20 0a 2b 09 20 20 20 */.+. .+.
11f0: 20 54 63 6c 5f 44 53 74 72 69 6e 67 53 65 74 4c Tcl_DStringSetL
1200: 65 6e 67 74 68 28 73 6f 75 72 63 65 50 74 72 2c ength(sourcePtr,
1210: 20 73 6f 75 72 63 65 4c 65 6e 29 3b 0a 2b 09 20 sourceLen);.+.
1220: 20 20 20 69 66 20 28 74 61 72 67 65 74 50 74 72 if (targetPtr
1230: 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 09 54 != NULL) {.+..T
1240: 63 6c 5f 44 53 74 72 69 6e 67 53 65 74 4c 65 6e cl_DStringSetLen
1250: 67 74 68 28 74 61 72 67 65 74 50 74 72 2c 20 74 gth(targetPtr, t
1260: 61 72 67 65 74 4c 65 6e 29 3b 0a 2b 09 20 20 20 argetLen);.+.
1270: 20 7d 0a 20 09 7d 0a 2d 09 0a 2d 09 2f 2a 0a 2d }. .}.-..-./*.-
1280: 09 20 2a 20 52 65 6d 6f 76 65 20 6e 61 6d 65 20 . * Remove name
1290: 61 66 74 65 72 20 73 6c 61 73 68 2e 0a 2d 09 20 after slash..-.
12a0: 2a 2f 0a 2d 0a 2d 09 54 63 6c 5f 44 53 74 72 69 */.-.-.Tcl_DStri
12b0: 6e 67 53 65 74 4c 65 6e 67 74 68 28 73 6f 75 72 ngSetLength(sour
12c0: 63 65 50 74 72 2c 20 73 6f 75 72 63 65 4c 65 6e cePtr, sourceLen
12d0: 29 3b 0a 2d 09 69 66 20 28 74 61 72 67 65 74 50 );.-.if (targetP
12e0: 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2d 09 tr != NULL) {.-.
12f0: 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 53 Tcl_DStringS
1300: 65 74 4c 65 6e 67 74 68 28 74 61 72 67 65 74 50 etLength(targetP
1310: 74 72 2c 20 74 61 72 67 65 74 4c 65 6e 29 3b 0a tr, targetLen);.
1320: 2b 09 69 66 20 28 6e 65 65 64 52 65 77 69 6e 64 +.if (needRewind
1330: 29 20 7b 0a 2b 09 20 20 20 20 72 65 77 69 6e 64 ) {.+. rewind
1340: 64 69 72 28 64 69 72 50 74 72 29 3b 0a 20 09 7d dir(dirPtr);. .}
1350: 0a 2d 20 20 20 20 7d 0a 2b 20 20 20 20 7d 20 77 .- }.+ } w
1360: 68 69 6c 65 20 28 6e 65 65 64 52 65 77 69 6e 64 hile (needRewind
1370: 29 3b 0a 20 20 20 20 20 63 6c 6f 73 65 64 69 72 );. closedir
1380: 28 64 69 72 50 74 72 29 3b 0a 20 20 20 20 20 0a (dirPtr);. .
1390: 20 20 20 20 20 2f 2a 0a /*.