Tcl Source Code

Hex Artifact Content
Login

Artifact e3ba5d2a92e0697009ebb765351650fecfb92cf2:

Attachment "tip99.patch" to ticket [562970ffff] added by vincentdarley 2002-06-18 17:32:37.
0000: 3f 20 74 65 73 74 73 2f 6f 75 74 64 61 74 61 0a  ? tests/outdata.
0010: 3f 20 74 65 73 74 73 2f 74 65 73 74 31 0a 3f 20  ? tests/test1.? 
0020: 74 65 73 74 73 2f 74 65 73 74 33 0a 3f 20 74 65  tests/test3.? te
0030: 73 74 73 2f 5f 74 63 6c 5f 74 65 73 74 5f 72 65  sts/_tcl_test_re
0040: 6d 6f 76 65 5f 6d 65 2e 74 78 74 0a 3f 20 77 69  move_me.txt.? wi
0050: 6e 2f 6f 75 74 64 61 74 61 0a 49 6e 64 65 78 3a  n/outdata.Index:
0060: 20 64 6f 63 2f 46 69 6c 65 53 79 73 74 65 6d 2e   doc/FileSystem.
0070: 33 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  3.==============
0080: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0090: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
00a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
00b0: 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20  =====.RCS file: 
00c0: 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c  /cvsroot/tcl/tcl
00d0: 2f 64 6f 63 2f 46 69 6c 65 53 79 73 74 65 6d 2e  /doc/FileSystem.
00e0: 33 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72  3,v.retrieving r
00f0: 65 76 69 73 69 6f 6e 20 31 2e 32 35 0a 64 69 66  evision 1.25.dif
0100: 66 20 2d 62 20 2d 75 20 2d 72 31 2e 32 35 20 46  f -b -u -r1.25 F
0110: 69 6c 65 53 79 73 74 65 6d 2e 33 0a 2d 2d 2d 20  ileSystem.3.--- 
0120: 64 6f 63 2f 46 69 6c 65 53 79 73 74 65 6d 2e 33  doc/FileSystem.3
0130: 09 31 33 20 4a 75 6e 20 32 30 30 32 20 30 39 3a  .13 Jun 2002 09:
0140: 33 39 3a 35 39 20 2d 30 30 30 30 09 31 2e 32 35  39:59 -0000.1.25
0150: 0a 2b 2b 2b 20 64 6f 63 2f 46 69 6c 65 53 79 73  .+++ doc/FileSys
0160: 74 65 6d 2e 33 09 31 38 20 4a 75 6e 20 32 30 30  tem.3.18 Jun 200
0170: 32 20 31 30 3a 32 33 3a 31 39 20 2d 30 30 30 30  2 10:23:19 -0000
0180: 0a 40 40 20 2d 36 34 2c 37 20 2b 36 34 2c 37 20  .@@ -64,7 +64,7 
0190: 40 40 0a 20 5c 66 42 54 63 6c 5f 46 53 4d 61 74  @@. \fBTcl_FSMat
01a0: 63 68 49 6e 44 69 72 65 63 74 6f 72 79 5c 66 52  chInDirectory\fR
01b0: 28 5c 66 49 69 6e 74 65 72 70 2c 20 72 65 73 75  (\fIinterp, resu
01c0: 6c 74 2c 20 70 61 74 68 50 74 72 2c 20 70 61 74  lt, pathPtr, pat
01d0: 74 65 72 6e 2c 20 74 79 70 65 73 5c 66 52 29 0a  tern, types\fR).
01e0: 20 2e 73 70 0a 20 54 63 6c 5f 4f 62 6a 2a 0a 2d   .sp. Tcl_Obj*.-
01f0: 5c 66 42 54 63 6c 5f 46 53 4c 69 6e 6b 5c 66 52  \fBTcl_FSLink\fR
0200: 28 5c 66 49 70 61 74 68 50 74 72 2c 20 74 6f 50  (\fIpathPtr, toP
0210: 74 72 2c 20 6c 69 6e 6b 54 79 70 65 5c 66 52 29  tr, linkType\fR)
0220: 0a 2b 5c 66 42 54 63 6c 5f 46 53 4c 69 6e 6b 5c  .+\fBTcl_FSLink\
0230: 66 52 28 5c 66 49 70 61 74 68 50 74 72 2c 20 74  fR(\fIpathPtr, t
0240: 6f 50 74 72 2c 20 6c 69 6e 6b 41 63 74 69 6f 6e  oPtr, linkAction
0250: 5c 66 52 29 0a 20 2e 73 70 0a 20 69 6e 74 0a 20  \fR). .sp. int. 
0260: 5c 66 42 54 63 6c 5f 46 53 4c 73 74 61 74 5c 66  \fBTcl_FSLstat\f
0270: 52 28 5c 66 49 70 61 74 68 50 74 72 2c 20 73 74  R(\fIpathPtr, st
0280: 61 74 50 74 72 5c 66 52 29 0a 40 40 20 2d 33 34  atPtr\fR).@@ -34
0290: 33 2c 31 38 20 2b 33 34 33 2c 32 32 20 40 40 0a  3,18 +343,22 @@.
02a0: 20 77 69 6c 6c 20 63 61 6c 6c 20 74 68 69 73 20   will call this 
02b0: 66 75 6e 63 74 69 6f 6e 20 66 72 65 71 75 65 6e  function frequen
02c0: 74 6c 79 20 61 73 6b 69 6e 67 20 6f 6e 6c 79 20  tly asking only 
02d0: 66 6f 72 20 64 69 72 65 63 74 6f 72 69 65 73 20  for directories 
02e0: 74 6f 20 62 65 0a 20 72 65 74 75 72 6e 65 64 2e  to be. returned.
02f0: 0a 20 2e 50 50 0a 2d 5c 66 42 54 63 6c 5f 46 53  . .PP.-\fBTcl_FS
0300: 4c 69 6e 6b 5c 66 52 20 72 65 70 6c 61 63 65 73  Link\fR replaces
0310: 20 74 68 65 20 6c 69 62 72 61 72 79 20 76 65 72   the library ver
0320: 73 69 6f 6e 20 6f 66 20 72 65 61 64 6c 69 6e 6b  sion of readlink
0330: 28 29 2c 20 61 6e 64 20 6d 61 79 0a 2d 61 6c 73  (), and may.-als
0340: 6f 20 62 65 20 75 73 65 64 20 69 6e 20 74 68 65  o be used in the
0350: 20 66 75 74 75 72 65 20 74 6f 20 61 6c 6c 6f 77   future to allow
0360: 20 6c 69 6e 6b 20 63 72 65 61 74 69 6f 6e 2e 0a   link creation..
0370: 2d 54 68 65 20 61 70 70 72 6f 70 72 69 61 74 65  -The appropriate
0380: 20 66 75 6e 63 74 69 6f 6e 20 66 6f 72 20 74 68   function for th
0390: 65 20 66 69 6c 65 73 79 73 74 65 6d 20 74 6f 20  e filesystem to 
03a0: 77 68 69 63 68 20 70 61 74 68 50 74 72 0a 2d 62  which pathPtr.-b
03b0: 65 6c 6f 6e 67 73 20 77 69 6c 6c 20 62 65 20 63  elongs will be c
03c0: 61 6c 6c 65 64 2e 0a 2d 2e 50 50 0a 2d 49 66 20  alled..-.PP.-If 
03d0: 74 68 65 20 5c 66 49 74 6f 50 74 72 5c 66 52 20  the \fItoPtr\fR 
03e0: 69 73 20 4e 55 4c 4c 2c 20 61 20 72 65 61 64 6c  is NULL, a readl
03f0: 69 6e 6b 20 61 63 74 69 6f 6e 20 69 73 20 70 65  ink action is pe
0400: 72 66 6f 72 6d 65 64 2e 0a 2d 54 68 65 20 72 65  rformed..-The re
0410: 73 75 6c 74 20 69 73 20 61 20 54 63 6c 5f 4f 62  sult is a Tcl_Ob
0420: 6a 20 73 70 65 63 69 66 79 69 6e 67 20 74 68 65  j specifying the
0430: 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65   contents of the
0440: 20 73 79 6d 62 6f 6c 69 63 20 6c 69 6e 6b 0a 2d   symbolic link.-
0450: 67 69 76 65 6e 20 62 79 20 5c 66 49 70 61 74 68  given by \fIpath
0460: 5c 66 52 2c 20 6f 72 20 4e 55 4c 4c 20 69 66 20  \fR, or NULL if 
0470: 74 68 65 20 73 79 6d 62 6f 6c 69 63 20 6c 69 6e  the symbolic lin
0480: 6b 20 63 6f 75 6c 64 20 6e 6f 74 20 62 65 20 72  k could not be r
0490: 65 61 64 2e 20 20 54 68 65 0a 2d 72 65 73 75 6c  ead.  The.-resul
04a0: 74 20 69 73 20 6f 77 6e 65 64 20 62 79 20 74 68  t is owned by th
04b0: 65 20 63 61 6c 6c 65 72 2c 20 77 68 69 63 68 20  e caller, which 
04c0: 73 68 6f 75 6c 64 20 63 61 6c 6c 20 54 63 6c 5f  should call Tcl_
04d0: 44 65 63 72 52 65 66 43 6f 75 6e 74 20 77 68 65  DecrRefCount whe
04e0: 6e 0a 2d 74 68 65 20 72 65 73 75 6c 74 20 69 73  n.-the result is
04f0: 20 6e 6f 20 6c 6f 6e 67 65 72 20 6e 65 65 64 65   no longer neede
0500: 64 2e 20 20 49 66 20 74 68 65 20 5c 66 49 74 6f  d.  If the \fIto
0510: 50 74 72 5c 66 52 20 69 73 20 6e 6f 74 20 4e 55  Ptr\fR is not NU
0520: 4c 4c 2c 20 54 63 6c 0a 2d 73 68 6f 75 6c 64 20  LL, Tcl.-should 
0530: 63 72 65 61 74 65 20 61 20 6c 69 6e 6b 2c 20 62  create a link, b
0540: 75 74 20 74 68 69 73 20 6f 70 74 69 6f 6e 20 69  ut this option i
0550: 73 20 6e 6f 74 20 63 75 72 72 65 6e 74 6c 79 20  s not currently 
0560: 73 75 70 70 6f 72 74 65 64 20 28 69 74 0a 2d 61  supported (it.-a
0570: 6e 64 20 74 68 65 20 5c 66 49 6c 69 6e 6b 54 79  nd the \fIlinkTy
0580: 70 65 5c 66 52 20 66 69 65 6c 64 20 61 72 65 20  pe\fR field are 
0590: 6c 65 66 74 20 61 76 61 69 6c 61 62 6c 65 20 66  left available f
05a0: 6f 72 20 66 75 74 75 72 65 20 65 78 70 61 6e 73  or future expans
05b0: 69 6f 6e 29 2e 0a 2b 5c 66 42 54 63 6c 5f 46 53  ion)..+\fBTcl_FS
05c0: 4c 69 6e 6b 5c 66 52 20 72 65 70 6c 61 63 65 73  Link\fR replaces
05d0: 20 74 68 65 20 6c 69 62 72 61 72 79 20 76 65 72   the library ver
05e0: 73 69 6f 6e 20 6f 66 20 72 65 61 64 6c 69 6e 6b  sion of readlink
05f0: 28 29 2c 20 61 6e 64 20 73 75 70 70 6f 72 74 73  (), and supports
0600: 0a 2b 74 68 65 20 63 72 65 61 74 69 6f 6e 20 6f  .+the creation o
0610: 66 20 6c 69 6e 6b 73 2e 20 20 54 68 65 20 61 70  f links.  The ap
0620: 70 72 6f 70 72 69 61 74 65 20 66 75 6e 63 74 69  propriate functi
0630: 6f 6e 20 66 6f 72 20 74 68 65 20 66 69 6c 65 73  on for the files
0640: 79 73 74 65 6d 20 74 6f 0a 2b 77 68 69 63 68 20  ystem to.+which 
0650: 70 61 74 68 50 74 72 20 62 65 6c 6f 6e 67 73 20  pathPtr belongs 
0660: 77 69 6c 6c 20 62 65 20 63 61 6c 6c 65 64 2e 0a  will be called..
0670: 2b 2e 50 50 0a 2b 49 66 20 74 68 65 20 5c 66 49  +.PP.+If the \fI
0680: 74 6f 50 74 72 5c 66 52 20 69 73 20 4e 55 4c 4c  toPtr\fR is NULL
0690: 2c 20 61 20 72 65 61 64 6c 69 6e 6b 20 61 63 74  , a readlink act
06a0: 69 6f 6e 20 69 73 20 70 65 72 66 6f 72 6d 65 64  ion is performed
06b0: 2e 20 20 54 68 65 20 72 65 73 75 6c 74 0a 2b 69  .  The result.+i
06c0: 73 20 61 20 54 63 6c 5f 4f 62 6a 20 73 70 65 63  s a Tcl_Obj spec
06d0: 69 66 79 69 6e 67 20 74 68 65 20 63 6f 6e 74 65  ifying the conte
06e0: 6e 74 73 20 6f 66 20 74 68 65 20 73 79 6d 62 6f  nts of the symbo
06f0: 6c 69 63 20 6c 69 6e 6b 20 67 69 76 65 6e 20 62  lic link given b
0700: 79 0a 2b 5c 66 49 70 61 74 68 5c 66 52 2c 20 6f  y.+\fIpath\fR, o
0710: 72 20 4e 55 4c 4c 20 69 66 20 74 68 65 20 6c 69  r NULL if the li
0720: 6e 6b 20 63 6f 75 6c 64 20 6e 6f 74 20 62 65 20  nk could not be 
0730: 72 65 61 64 2e 20 20 54 68 65 20 72 65 73 75 6c  read.  The resul
0740: 74 20 69 73 20 6f 77 6e 65 64 0a 2b 62 79 20 74  t is owned.+by t
0750: 68 65 20 63 61 6c 6c 65 72 2c 20 77 68 69 63 68  he caller, which
0760: 20 73 68 6f 75 6c 64 20 63 61 6c 6c 20 54 63 6c   should call Tcl
0770: 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 20 77 68  _DecrRefCount wh
0780: 65 6e 20 74 68 65 20 72 65 73 75 6c 74 20 69 73  en the result is
0790: 20 6e 6f 0a 2b 6c 6f 6e 67 65 72 20 6e 65 65 64   no.+longer need
07a0: 65 64 2e 20 20 49 66 20 74 68 65 20 5c 66 49 74  ed.  If the \fIt
07b0: 6f 50 74 72 5c 66 52 20 69 73 20 6e 6f 74 20 4e  oPtr\fR is not N
07c0: 55 4c 4c 2c 20 54 63 6c 20 73 68 6f 75 6c 64 20  ULL, Tcl should 
07d0: 63 72 65 61 74 65 20 61 20 6c 69 6e 6b 0a 2b 6f  create a link.+o
07e0: 66 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 79 70  f one of the typ
07f0: 65 73 20 70 61 73 73 65 64 20 69 6e 20 69 6e 20  es passed in in 
0800: 74 68 65 20 5c 66 49 6c 69 6e 6b 41 63 74 69 6f  the \fIlinkActio
0810: 6e 5c 66 52 20 66 6c 61 67 2e 20 20 54 68 69 73  n\fR flag.  This
0820: 20 66 6c 61 67 20 69 73 0a 2b 61 6e 20 6f 72 27   flag is.+an or'
0830: 64 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66  d combination of
0840: 20 54 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42   TCL_CREATE_SYMB
0850: 4f 4c 49 43 5f 4c 49 4e 4b 20 61 6e 64 20 54 43  OLIC_LINK and TC
0860: 4c 5f 43 52 45 41 54 45 5f 48 41 52 44 5f 4c 49  L_CREATE_HARD_LI
0870: 4e 4b 2e 0a 2b 57 68 65 72 65 20 61 20 63 68 6f  NK..+Where a cho
0880: 69 63 65 20 65 78 69 73 74 73 20 28 69 2e 65 2e  ice exists (i.e.
0890: 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 66   more than one f
08a0: 6c 61 67 20 69 73 20 70 61 73 73 65 64 20 69 6e  lag is passed in
08b0: 29 2c 20 74 68 65 20 54 63 6c 0a 2b 63 6f 6e 76  ), the Tcl.+conv
08c0: 65 6e 74 69 6f 6e 20 69 73 20 74 6f 20 70 72 65  ention is to pre
08d0: 66 65 72 20 73 79 6d 62 6f 6c 69 63 20 6c 69 6e  fer symbolic lin
08e0: 6b 73 2e 20 20 57 68 65 6e 20 61 20 6c 69 6e 6b  ks.  When a link
08f0: 20 69 73 20 73 75 63 63 65 73 73 66 75 6c 6c 79   is successfully
0900: 0a 2b 63 72 65 61 74 65 64 2c 20 74 68 65 20 72  .+created, the r
0910: 65 74 75 72 6e 20 76 61 6c 75 65 20 73 68 6f 75  eturn value shou
0920: 6c 64 20 62 65 20 5c 66 49 74 6f 50 74 72 5c 66  ld be \fItoPtr\f
0930: 52 20 28 77 68 69 63 68 20 69 73 20 74 68 65 72  R (which is ther
0940: 65 66 6f 72 65 0a 2b 61 6c 72 65 61 64 79 20 6f  efore.+already o
0950: 77 6e 65 64 20 62 79 20 74 68 65 20 63 61 6c 6c  wned by the call
0960: 65 72 29 2e 20 20 49 66 20 75 6e 73 75 63 63 65  er).  If unsucce
0970: 73 73 66 75 6c 2c 20 4e 55 4c 4c 20 73 68 6f 75  ssful, NULL shou
0980: 6c 64 20 62 65 0a 2b 72 65 74 75 72 6e 65 64 2e  ld be.+returned.
0990: 0a 20 2e 50 50 0a 20 5c 66 42 54 63 6c 5f 46 53  . .PP. \fBTcl_FS
09a0: 4c 73 74 61 74 5c 66 52 20 66 69 6c 6c 73 20 74  Lstat\fR fills t
09b0: 68 65 20 73 74 61 74 20 73 74 72 75 63 74 75 72  he stat structur
09c0: 65 20 5c 66 49 73 74 61 74 50 74 72 5c 66 52 20  e \fIstatPtr\fR 
09d0: 77 69 74 68 20 69 6e 66 6f 72 6d 61 74 69 6f 6e  with information
09e0: 0a 20 61 62 6f 75 74 20 74 68 65 20 73 70 65 63  . about the spec
09f0: 69 66 69 65 64 20 66 69 6c 65 2e 20 20 59 6f 75  ified file.  You
0a00: 20 64 6f 20 6e 6f 74 20 6e 65 65 64 20 61 6e 79   do not need any
0a10: 20 61 63 63 65 73 73 20 72 69 67 68 74 73 20 74   access rights t
0a20: 6f 20 74 68 65 0a 40 40 20 2d 31 30 33 32 2c 37  o the.@@ -1032,7
0a30: 20 2b 31 30 33 36 2c 37 20 40 40 0a 20 74 79 70   +1036,7 @@. typ
0a40: 65 64 65 66 20 54 63 6c 5f 4f 62 6a 2a 20 54 63  edef Tcl_Obj* Tc
0a50: 6c 5f 46 53 4c 69 6e 6b 50 72 6f 63 28 0a 20 09  l_FSLinkProc(. .
0a60: 54 63 6c 5f 4f 62 6a 20 2a 5c 66 49 70 61 74 68  Tcl_Obj *\fIpath
0a70: 50 74 72 5c 66 52 2c 0a 20 09 54 63 6c 5f 4f 62  Ptr\fR,. .Tcl_Ob
0a80: 6a 20 2a 5c 66 49 74 6f 50 74 72 5c 66 52 2c 0a  j *\fItoPtr\fR,.
0a90: 2d 09 69 6e 74 20 5c 66 49 6c 69 6e 6b 54 79 70  -.int \fIlinkTyp
0aa0: 65 5c 66 52 29 3b 0a 2b 09 69 6e 74 20 5c 66 49  e\fR);.+.int \fI
0ab0: 6c 69 6e 6b 41 63 74 69 6f 6e 5c 66 52 29 3b 0a  linkAction\fR);.
0ac0: 20 2e 43 45 0a 20 2e 50 50 0a 20 49 66 20 5c 66   .CE. .PP. If \f
0ad0: 49 74 6f 50 74 72 5c 66 52 20 69 73 20 4e 55 4c  ItoPtr\fR is NUL
0ae0: 4c 2c 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20  L, the function 
0af0: 69 73 20 62 65 69 6e 67 20 61 73 6b 65 64 20 74  is being asked t
0b00: 6f 20 72 65 61 64 20 74 68 65 0a 49 6e 64 65 78  o read the.Index
0b10: 3a 20 64 6f 63 2f 66 69 6c 65 2e 6e 0a 3d 3d 3d  : doc/file.n.===
0b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0b60: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72  .RCS file: /cvsr
0b70: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 64 6f 63 2f  oot/tcl/tcl/doc/
0b80: 66 69 6c 65 2e 6e 2c 76 0a 72 65 74 72 69 65 76  file.n,v.retriev
0b90: 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 31  ing revision 1.1
0ba0: 38 0a 64 69 66 66 20 2d 62 20 2d 75 20 2d 72 31  8.diff -b -u -r1
0bb0: 2e 31 38 20 66 69 6c 65 2e 6e 0a 2d 2d 2d 20 64  .18 file.n.--- d
0bc0: 6f 63 2f 66 69 6c 65 2e 6e 09 38 20 4d 61 79 20  oc/file.n.8 May 
0bd0: 32 30 30 32 20 32 33 3a 34 38 3a 32 33 20 2d 30  2002 23:48:23 -0
0be0: 30 30 30 09 31 2e 31 38 0a 2b 2b 2b 20 64 6f 63  000.1.18.+++ doc
0bf0: 2f 66 69 6c 65 2e 6e 09 31 38 20 4a 75 6e 20 32  /file.n.18 Jun 2
0c00: 30 30 32 20 31 30 3a 32 33 3a 31 39 20 2d 30 30  002 10:23:19 -00
0c10: 30 30 0a 40 40 20 2d 31 39 31 2c 36 20 2b 31 39  00.@@ -191,6 +19
0c20: 31 2c 33 37 20 40 40 0a 20 57 69 6e 64 6f 77 73  1,37 @@. Windows
0c30: 2c 20 61 6e 64 20 5c 66 42 3a 5c 66 52 20 66 6f  , and \fB:\fR fo
0c40: 72 20 4d 61 63 69 6e 74 6f 73 68 2e 0a 20 2e 52  r Macintosh.. .R
0c50: 45 0a 20 2e 54 50 0a 2b 5c 66 42 66 69 6c 65 20  E. .TP.+\fBfile 
0c60: 6c 69 6e 6b 20 3f 5c 66 49 2d 6c 69 6e 6b 74 79  link ?\fI-linkty
0c70: 70 65 5c 66 52 3f 20 5c 66 49 6c 69 6e 6b 4e 61  pe\fR? \fIlinkNa
0c80: 6d 65 5c 66 52 20 3f 5c 66 49 74 61 72 67 65 74  me\fR ?\fItarget
0c90: 5c 66 52 3f 0a 2b 2e 0a 2b 49 66 20 6f 6e 6c 79  \fR?.+..+If only
0ca0: 20 6f 6e 65 20 61 72 67 75 6d 65 6e 74 20 69 73   one argument is
0cb0: 20 67 69 76 65 6e 2c 20 74 68 61 74 20 61 72 67   given, that arg
0cc0: 75 6d 65 6e 74 20 69 73 20 61 73 73 75 6d 65 64  ument is assumed
0cd0: 20 74 6f 20 62 65 0a 2b 5c 66 49 6c 69 6e 6b 4e   to be.+\fIlinkN
0ce0: 61 6d 65 5c 66 52 2c 20 61 6e 64 20 74 68 69 73  ame\fR, and this
0cf0: 20 63 6f 6d 6d 61 6e 64 20 72 65 74 75 72 6e 73   command returns
0d00: 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68   the value of th
0d10: 65 20 6c 69 6e 6b 20 67 69 76 65 6e 20 62 79 0a  e link given by.
0d20: 2b 5c 66 49 6c 69 6e 6b 4e 61 6d 65 5c 66 52 20  +\fIlinkName\fR 
0d30: 28 69 2e 65 2e 20 74 68 65 20 6e 61 6d 65 20 6f  (i.e. the name o
0d40: 66 20 74 68 65 20 66 69 6c 65 20 69 74 20 70 6f  f the file it po
0d50: 69 6e 74 73 20 74 6f 29 2e 20 20 49 66 0a 2b 5c  ints to).  If.+\
0d60: 66 49 6c 69 6e 6b 4e 61 6d 65 5c 66 52 20 69 73  fIlinkName\fR is
0d70: 6e 27 74 20 61 20 6c 69 6e 6b 20 6f 72 20 69 74  n't a link or it
0d80: 73 20 76 61 6c 75 65 20 63 61 6e 6e 6f 74 20 62  s value cannot b
0d90: 65 20 72 65 61 64 20 28 61 73 2c 20 66 6f 72 20  e read (as, for 
0da0: 65 78 61 6d 70 6c 65 2c 0a 2b 73 65 65 6d 73 20  example,.+seems 
0db0: 74 6f 20 62 65 20 74 68 65 20 63 61 73 65 20 77  to be the case w
0dc0: 69 74 68 20 68 61 72 64 20 6c 69 6e 6b 73 2c 20  ith hard links, 
0dd0: 77 68 69 63 68 20 6c 6f 6f 6b 20 6a 75 73 74 20  which look just 
0de0: 6c 69 6b 65 20 6f 72 64 69 6e 61 72 79 0a 2b 66  like ordinary.+f
0df0: 69 6c 65 73 29 2c 20 74 68 65 6e 20 61 6e 20 65  iles), then an e
0e00: 72 72 6f 72 20 69 73 20 72 65 74 75 72 6e 65 64  rror is returned
0e10: 2e 0a 2b 2e 0a 2b 49 66 20 32 20 61 72 67 75 6d  ..+..+If 2 argum
0e20: 65 6e 74 73 20 61 72 65 20 67 69 76 65 6e 2c 20  ents are given, 
0e30: 74 68 65 6e 20 74 68 65 73 65 20 61 72 65 20 61  then these are a
0e40: 73 73 75 6d 65 64 20 74 6f 20 62 65 20 5c 66 49  ssumed to be \fI
0e50: 6c 69 6e 6b 4e 61 6d 65 5c 66 52 20 61 6e 64 0a  linkName\fR and.
0e60: 2b 5c 66 49 74 61 72 67 65 74 5c 66 52 2e 20 49  +\fItarget\fR. I
0e70: 66 20 5c 66 49 6c 69 6e 6b 4e 61 6d 65 5c 66 52  f \fIlinkName\fR
0e80: 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 73 2c   already exists,
0e90: 20 6f 72 20 69 66 20 5c 66 49 74 61 72 67 65 74   or if \fItarget
0ea0: 5c 66 52 0a 2b 64 6f 65 73 6e 27 74 20 65 78 69  \fR.+doesn't exi
0eb0: 73 74 2c 20 61 6e 20 65 72 72 6f 72 20 77 69 6c  st, an error wil
0ec0: 6c 20 62 65 20 72 65 74 75 72 6e 65 64 2e 20 20  l be returned.  
0ed0: 4f 74 68 65 72 77 69 73 65 2c 20 54 63 6c 20 63  Otherwise, Tcl c
0ee0: 72 65 61 74 65 73 20 61 20 6e 65 77 0a 2b 6c 69  reates a new.+li
0ef0: 6e 6b 20 63 61 6c 6c 65 64 20 5c 66 49 6c 69 6e  nk called \fIlin
0f00: 6b 4e 61 6d 65 5c 66 52 20 77 68 69 63 68 20 70  kName\fR which p
0f10: 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 65 78 69  oints to the exi
0f20: 73 74 69 6e 67 20 66 69 6c 65 73 79 73 74 65 6d  sting filesystem
0f30: 20 6f 62 6a 65 63 74 0a 2b 61 74 20 5c 66 49 74   object.+at \fIt
0f40: 61 72 67 65 74 5c 66 52 2c 20 77 68 65 72 65 20  arget\fR, where 
0f50: 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 20  the type of the 
0f60: 6c 69 6e 6b 20 69 73 20 70 6c 61 74 66 6f 72 6d  link is platform
0f70: 2d 73 70 65 63 69 66 69 63 20 28 6f 6e 20 55 6e  -specific (on Un
0f80: 69 78 0a 2b 61 20 73 79 6d 62 6f 6c 69 63 20 6c  ix.+a symbolic l
0f90: 69 6e 6b 20 77 69 6c 6c 20 62 65 20 74 68 65 20  ink will be the 
0fa0: 64 65 66 61 75 6c 74 29 2e 20 20 54 68 69 73 20  default).  This 
0fb0: 69 73 20 75 73 65 66 75 6c 20 66 6f 72 20 74 68  is useful for th
0fc0: 65 20 63 61 73 65 20 77 68 65 72 65 0a 2b 74 68  e case where.+th
0fd0: 65 20 75 73 65 72 20 77 69 73 68 65 73 20 74 6f  e user wishes to
0fe0: 20 63 72 65 61 74 65 20 61 20 6c 69 6e 6b 20 69   create a link i
0ff0: 6e 20 61 20 63 72 6f 73 73 2d 70 6c 61 74 66 6f  n a cross-platfo
1000: 72 6d 20 77 61 79 2c 20 61 6e 64 20 64 6f 65 73  rm way, and does
1010: 6e 27 74 0a 2b 63 61 72 65 20 77 68 61 74 20 74  n't.+care what t
1020: 79 70 65 20 6f 66 20 6c 69 6e 6b 20 69 73 20 63  ype of link is c
1030: 72 65 61 74 65 64 2e 0a 2b 2e 0a 2b 49 66 20 74  reated..+..+If t
1040: 68 65 20 75 73 65 72 20 77 69 73 68 65 73 20 74  he user wishes t
1050: 6f 20 6d 61 6b 65 20 61 20 6c 69 6e 6b 20 6f 66  o make a link of
1060: 20 61 20 73 70 65 63 69 66 69 63 20 74 79 70 65   a specific type
1070: 20 6f 6e 6c 79 2c 20 28 61 6e 64 20 73 69 67 6e   only, (and sign
1080: 61 6c 20 61 6e 0a 2b 65 72 72 6f 72 20 69 66 20  al an.+error if 
1090: 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20  for some reason 
10a0: 74 68 61 74 20 69 73 20 6e 6f 74 20 70 6f 73 73  that is not poss
10b0: 69 62 6c 65 29 2c 20 74 68 65 6e 20 74 68 65 20  ible), then the 
10c0: 6f 70 74 69 6f 6e 61 6c 0a 2b 5c 66 49 2d 6c 69  optional.+\fI-li
10d0: 6e 6b 74 79 70 65 5c 66 52 20 61 72 67 75 6d 65  nktype\fR argume
10e0: 6e 74 20 73 68 6f 75 6c 64 20 62 65 20 67 69 76  nt should be giv
10f0: 65 6e 2e 20 20 41 63 63 65 70 74 65 64 20 76 61  en.  Accepted va
1100: 6c 75 65 73 20 66 6f 72 0a 2b 5c 66 49 2d 6c 69  lues for.+\fI-li
1110: 6e 6b 74 79 70 65 5c 66 52 20 61 72 65 20 22 2d  nktype\fR are "-
1120: 73 79 6d 62 6f 6c 69 63 22 20 61 6e 64 20 22 2d  symbolic" and "-
1130: 68 61 72 64 22 2e 0a 2b 2e 0a 2b 57 68 65 6e 20  hard"..+..+When 
1140: 63 72 65 61 74 69 6e 67 20 6c 69 6e 6b 73 20 6f  creating links o
1150: 6e 20 66 69 6c 65 73 79 73 74 65 6d 73 20 74 68  n filesystems th
1160: 61 74 20 65 69 74 68 65 72 20 64 6f 20 6e 6f 74  at either do not
1170: 20 73 75 70 70 6f 72 74 20 61 6e 79 20 6c 69 6e   support any lin
1180: 6b 73 2c 0a 2b 6f 72 20 64 6f 20 6e 6f 74 20 73  ks,.+or do not s
1190: 75 70 70 6f 72 74 20 74 68 65 20 73 70 65 63 69  upport the speci
11a0: 66 69 63 20 74 79 70 65 20 72 65 71 75 65 73 74  fic type request
11b0: 65 64 2c 20 61 6e 20 65 72 72 6f 72 20 6d 65 73  ed, an error mes
11c0: 73 61 67 65 20 77 69 6c 6c 20 62 65 0a 2b 72 65  sage will be.+re
11d0: 74 75 72 6e 65 64 2e 20 20 49 6e 20 70 61 72 74  turned.  In part
11e0: 69 63 75 6c 61 72 20 57 69 6e 64 6f 77 73 20 39  icular Windows 9
11f0: 35 2c 20 39 38 20 61 6e 64 20 4d 45 20 64 6f 20  5, 98 and ME do 
1200: 6e 6f 74 20 73 75 70 70 6f 72 74 20 61 6e 79 20  not support any 
1210: 6c 69 6e 6b 73 0a 2b 61 74 20 70 72 65 73 65 6e  links.+at presen
1220: 74 2c 20 62 75 74 20 6d 6f 73 74 20 55 6e 69 78  t, but most Unix
1230: 20 70 6c 61 74 66 6f 72 6d 73 20 73 75 70 70 6f   platforms suppo
1240: 72 74 20 62 6f 74 68 20 73 79 6d 62 6f 6c 69 63  rt both symbolic
1250: 20 61 6e 64 20 68 61 72 64 20 6c 69 6e 6b 73 0a   and hard links.
1260: 2b 28 74 68 65 20 6c 61 74 74 65 72 20 66 6f 72  +(the latter for
1270: 20 66 69 6c 65 73 20 6f 6e 6c 79 29 2c 20 4d 61   files only), Ma
1280: 63 4f 53 20 73 75 70 70 6f 72 74 73 20 73 79 6d  cOS supports sym
1290: 62 6f 6c 69 63 20 6c 69 6e 6b 73 20 61 6e 64 20  bolic links and 
12a0: 57 69 6e 64 6f 77 73 0a 2b 4e 54 2f 32 30 30 30  Windows.+NT/2000
12b0: 2f 58 50 20 28 6f 6e 20 4e 54 46 53 20 64 72 69  /XP (on NTFS dri
12c0: 76 65 73 29 20 73 75 70 70 6f 72 74 20 73 79 6d  ves) support sym
12d0: 62 6f 6c 69 63 20 64 69 72 65 63 74 6f 72 79 20  bolic directory 
12e0: 6c 69 6e 6b 73 20 61 6e 64 20 68 61 72 64 0a 2b  links and hard.+
12f0: 66 69 6c 65 20 6c 69 6e 6b 73 2e 0a 2b 2e 54 50  file links..+.TP
1300: 0a 20 5c 66 42 66 69 6c 65 20 6c 73 74 61 74 20  . \fBfile lstat 
1310: 5c 66 49 6e 61 6d 65 20 76 61 72 4e 61 6d 65 5c  \fIname varName\
1320: 66 52 0a 20 2e 0a 20 53 61 6d 65 20 61 73 20 5c  fR. .. Same as \
1330: 66 42 73 74 61 74 5c 66 52 20 6f 70 74 69 6f 6e  fBstat\fR option
1340: 20 28 73 65 65 20 62 65 6c 6f 77 29 20 65 78 63   (see below) exc
1350: 65 70 74 20 75 73 65 73 20 74 68 65 20 5c 66 49  ept uses the \fI
1360: 6c 73 74 61 74 5c 66 52 0a 49 6e 64 65 78 3a 20  lstat\fR.Index: 
1370: 67 65 6e 65 72 69 63 2f 74 63 6c 2e 64 65 63 6c  generic/tcl.decl
1380: 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  s.==============
1390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
13a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
13b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
13c0: 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20  =====.RCS file: 
13d0: 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c  /cvsroot/tcl/tcl
13e0: 2f 67 65 6e 65 72 69 63 2f 74 63 6c 2e 64 65 63  /generic/tcl.dec
13f0: 6c 73 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20  ls,v.retrieving 
1400: 72 65 76 69 73 69 6f 6e 20 31 2e 38 39 0a 64 69  revision 1.89.di
1410: 66 66 20 2d 62 20 2d 75 20 2d 72 31 2e 38 39 20  ff -b -u -r1.89 
1420: 74 63 6c 2e 64 65 63 6c 73 0a 2d 2d 2d 20 67 65  tcl.decls.--- ge
1430: 6e 65 72 69 63 2f 74 63 6c 2e 64 65 63 6c 73 09  neric/tcl.decls.
1440: 31 33 20 4a 75 6e 20 32 30 30 32 20 30 39 3a 33  13 Jun 2002 09:3
1450: 39 3a 35 39 20 2d 30 30 30 30 09 31 2e 38 39 0a  9:59 -0000.1.89.
1460: 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 2e  +++ generic/tcl.
1470: 64 65 63 6c 73 09 31 38 20 4a 75 6e 20 32 30 30  decls.18 Jun 200
1480: 32 20 31 30 3a 32 33 3a 32 32 20 2d 30 30 30 30  2 10:23:22 -0000
1490: 0a 40 40 20 2d 31 35 37 37 2c 37 20 2b 31 35 37  .@@ -1577,7 +157
14a0: 37 2c 37 20 40 40 0a 20 09 20 20 20 20 54 63 6c  7,7 @@. .    Tcl
14b0: 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 43  _Obj *pathPtr, C
14c0: 4f 4e 53 54 20 63 68 61 72 20 2a 70 61 74 74 65  ONST char *patte
14d0: 72 6e 2c 20 54 63 6c 5f 47 6c 6f 62 54 79 70 65  rn, Tcl_GlobType
14e0: 44 61 74 61 20 2a 74 79 70 65 73 29 0a 20 7d 0a  Data *types). }.
14f0: 20 64 65 63 6c 61 72 65 20 34 34 36 20 67 65 6e   declare 446 gen
1500: 65 72 69 63 20 7b 0a 2d 20 20 20 20 54 63 6c 5f  eric {.-    Tcl_
1510: 4f 62 6a 20 2a 20 54 63 6c 5f 46 53 4c 69 6e 6b  Obj * Tcl_FSLink
1520: 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74  (Tcl_Obj *pathPt
1530: 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 74 6f 50 74  r, Tcl_Obj *toPt
1540: 72 2c 20 69 6e 74 20 6c 69 6e 6b 54 79 70 65 29  r, int linkType)
1550: 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 20  .+    Tcl_Obj * 
1560: 54 63 6c 5f 46 53 4c 69 6e 6b 28 54 63 6c 5f 4f  Tcl_FSLink(Tcl_O
1570: 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54 63 6c  bj *pathPtr, Tcl
1580: 5f 4f 62 6a 20 2a 74 6f 50 74 72 2c 20 69 6e 74  _Obj *toPtr, int
1590: 20 6c 69 6e 6b 41 63 74 69 6f 6e 29 0a 20 7d 0a   linkAction). }.
15a0: 20 64 65 63 6c 61 72 65 20 34 34 37 20 67 65 6e   declare 447 gen
15b0: 65 72 69 63 20 7b 0a 20 20 20 20 20 69 6e 74 20  eric {.     int 
15c0: 54 63 6c 5f 46 53 52 65 6d 6f 76 65 44 69 72 65  Tcl_FSRemoveDire
15d0: 63 74 6f 72 79 28 54 63 6c 5f 4f 62 6a 20 2a 70  ctory(Tcl_Obj *p
15e0: 61 74 68 50 74 72 2c 0a 49 6e 64 65 78 3a 20 67  athPtr,.Index: g
15f0: 65 6e 65 72 69 63 2f 74 63 6c 2e 68 0a 3d 3d 3d  eneric/tcl.h.===
1600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1640: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72  .RCS file: /cvsr
1650: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 65 6e 65  oot/tcl/tcl/gene
1660: 72 69 63 2f 74 63 6c 2e 68 2c 76 0a 72 65 74 72  ric/tcl.h,v.retr
1670: 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20  ieving revision 
1680: 31 2e 31 32 38 0a 64 69 66 66 20 2d 62 20 2d 75  1.128.diff -b -u
1690: 20 2d 72 31 2e 31 32 38 20 74 63 6c 2e 68 0a 2d   -r1.128 tcl.h.-
16a0: 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 2e 68  -- generic/tcl.h
16b0: 09 31 38 20 4a 75 6e 20 32 30 30 32 20 30 30 3a  .18 Jun 2002 00:
16c0: 31 32 3a 34 34 20 2d 30 30 30 30 09 31 2e 31 32  12:44 -0000.1.12
16d0: 38 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63  8.+++ generic/tc
16e0: 6c 2e 68 09 31 38 20 4a 75 6e 20 32 30 30 32 20  l.h.18 Jun 2002 
16f0: 31 30 3a 32 33 3a 32 33 20 2d 30 30 30 30 0a 40  10:23:23 -0000.@
1700: 40 20 2d 31 38 34 30 2c 36 20 2b 31 38 34 30 2c  @ -1840,6 +1840,
1710: 31 37 20 40 40 0a 20 09 09 09 20 20 20 20 20 2a  17 @@. ...     *
1720: 2f 0a 20 7d 20 54 63 6c 5f 46 69 6c 65 73 79 73  /. } Tcl_Filesys
1730: 74 65 6d 3b 0a 20 0a 2b 2f 2a 0a 2b 20 2a 20 54  tem;. .+/*.+ * T
1740: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66  he following def
1750: 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75 73 65  initions are use
1760: 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f 72 20  d as values for 
1770: 74 68 65 20 27 6c 69 6e 6b 41 63 74 69 6f 6e 27  the 'linkAction'
1780: 20 66 6c 61 67 0a 2b 20 2a 20 74 6f 20 54 63 6c   flag.+ * to Tcl
1790: 5f 46 53 4c 69 6e 6b 2c 20 6f 72 20 74 68 65 20  _FSLink, or the 
17a0: 6c 69 6e 6b 50 72 6f 63 20 6f 66 20 61 6e 79 20  linkProc of any 
17b0: 66 69 6c 65 73 79 73 74 65 6d 2e 20 20 41 6e 79  filesystem.  Any
17c0: 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 0a 2b 20 2a   combination.+ *
17d0: 20 6f 66 20 66 6c 61 67 73 20 63 61 6e 20 62 65   of flags can be
17e0: 20 67 69 76 65 6e 2e 20 20 46 6f 72 20 6c 69 6e   given.  For lin
17f0: 6b 20 63 72 65 61 74 69 6f 6e 2c 20 74 68 65 20  k creation, the 
1800: 6c 69 6e 6b 50 72 6f 63 20 73 68 6f 75 6c 64 20  linkProc should 
1810: 63 72 65 61 74 65 0a 2b 20 2a 20 61 20 6c 69 6e  create.+ * a lin
1820: 6b 20 77 68 69 63 68 20 6d 61 74 63 68 65 73 20  k which matches 
1830: 61 6e 79 20 6f 66 20 74 68 65 20 74 79 70 65 73  any of the types
1840: 20 67 69 76 65 6e 2e 0a 2b 20 2a 20 0a 2b 20 2a   given..+ * .+ *
1850: 20 54 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42   TCL_CREATE_SYMB
1860: 4f 4c 49 43 5f 4c 49 4e 4b 3a 20 20 43 72 65 61  OLIC_LINK:  Crea
1870: 74 65 20 61 20 73 79 6d 62 6f 6c 69 63 20 6f 72  te a symbolic or
1880: 20 73 6f 66 74 20 6c 69 6e 6b 2e 0a 2b 20 2a 20   soft link..+ * 
1890: 54 43 4c 5f 43 52 45 41 54 45 5f 48 41 52 44 5f  TCL_CREATE_HARD_
18a0: 4c 49 4e 4b 3a 20 20 20 20 20 20 43 72 65 61 74  LINK:      Creat
18b0: 65 20 61 20 68 61 72 64 20 6c 69 6e 6b 2e 0a 2b  e a hard link..+
18c0: 20 2a 2f 0a 2b 23 64 65 66 69 6e 65 20 54 43 4c   */.+#define TCL
18d0: 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f 4c 49 43  _CREATE_SYMBOLIC
18e0: 5f 4c 49 4e 4b 20 20 20 30 78 30 31 0a 2b 23 64  _LINK   0x01.+#d
18f0: 65 66 69 6e 65 20 54 43 4c 5f 43 52 45 41 54 45  efine TCL_CREATE
1900: 5f 48 41 52 44 5f 4c 49 4e 4b 20 20 20 20 20 20  _HARD_LINK      
1910: 20 30 78 30 32 0a 20 0a 20 2f 2a 0a 20 20 2a 20   0x02. . /*.  * 
1920: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74  The following st
1930: 72 75 63 74 75 72 65 20 72 65 70 72 65 73 65 6e  ructure represen
1940: 74 73 20 74 68 65 20 4e 6f 74 69 66 69 65 72 20  ts the Notifier 
1950: 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 0a 49  functions that.I
1960: 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63  ndex: generic/tc
1970: 6c 43 6d 64 41 48 2e 63 0a 3d 3d 3d 3d 3d 3d 3d  lCmdAH.c.=======
1980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
19a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
19b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53  ============.RCS
19c0: 20 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f   file: /cvsroot/
19d0: 74 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f  tcl/tcl/generic/
19e0: 74 63 6c 43 6d 64 41 48 2e 63 2c 76 0a 72 65 74  tclCmdAH.c,v.ret
19f0: 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e  rieving revision
1a00: 20 31 2e 32 35 0a 64 69 66 66 20 2d 62 20 2d 75   1.25.diff -b -u
1a10: 20 2d 72 31 2e 32 35 20 74 63 6c 43 6d 64 41 48   -r1.25 tclCmdAH
1a20: 2e 63 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74  .c.--- generic/t
1a30: 63 6c 43 6d 64 41 48 2e 63 09 31 33 20 4a 75 6e  clCmdAH.c.13 Jun
1a40: 20 32 30 30 32 20 30 39 3a 34 30 3a 30 30 20 2d   2002 09:40:00 -
1a50: 30 30 30 30 09 31 2e 32 35 0a 2b 2b 2b 20 67 65  0000.1.25.+++ ge
1a60: 6e 65 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e 63  neric/tclCmdAH.c
1a70: 09 31 38 20 4a 75 6e 20 32 30 30 32 20 31 30 3a  .18 Jun 2002 10:
1a80: 32 33 3a 32 34 20 2d 30 30 30 30 0a 40 40 20 2d  23:24 -0000.@@ -
1a90: 37 39 31 2c 38 20 2b 37 39 31 2c 38 20 40 40 0a  791,8 +791,8 @@.
1aa0: 20 09 22 61 74 69 6d 65 22 2c 09 22 61 74 74 72   ."atime",."attr
1ab0: 69 62 75 74 65 73 22 2c 09 22 63 68 61 6e 6e 65  ibutes",."channe
1ac0: 6c 73 22 2c 09 22 63 6f 70 79 22 2c 0a 20 09 22  ls",."copy",. ."
1ad0: 64 65 6c 65 74 65 22 2c 0a 20 09 22 64 69 72 6e  delete",. ."dirn
1ae0: 61 6d 65 22 2c 09 22 65 78 65 63 75 74 61 62 6c  ame",."executabl
1af0: 65 22 2c 09 22 65 78 69 73 74 73 22 2c 09 22 65  e",."exists",."e
1b00: 78 74 65 6e 73 69 6f 6e 22 2c 0a 2d 09 22 69 73  xtension",.-."is
1b10: 64 69 72 65 63 74 6f 72 79 22 2c 09 22 69 73 66  directory",."isf
1b20: 69 6c 65 22 2c 09 22 6a 6f 69 6e 22 2c 09 09 22  ile",."join",.."
1b30: 6c 73 74 61 74 22 2c 0a 2d 09 22 6d 74 69 6d 65  lstat",.-."mtime
1b40: 22 2c 09 22 6d 6b 64 69 72 22 2c 09 22 6e 61 74  ",."mkdir",."nat
1b50: 69 76 65 6e 61 6d 65 22 2c 09 0a 2b 09 22 69 73  ivename",..+."is
1b60: 64 69 72 65 63 74 6f 72 79 22 2c 09 22 69 73 66  directory",."isf
1b70: 69 6c 65 22 2c 09 22 6a 6f 69 6e 22 2c 09 09 22  ile",."join",.."
1b80: 6c 69 6e 6b 22 2c 0a 2b 09 22 6c 73 74 61 74 22  link",.+."lstat"
1b90: 2c 20 20 20 20 20 20 20 20 22 6d 74 69 6d 65 22  ,        "mtime"
1ba0: 2c 09 22 6d 6b 64 69 72 22 2c 09 22 6e 61 74 69  ,."mkdir",."nati
1bb0: 76 65 6e 61 6d 65 22 2c 09 0a 20 09 22 6e 6f 72  vename",.. ."nor
1bc0: 6d 61 6c 69 7a 65 22 2c 20 20 20 20 22 6f 77 6e  malize",    "own
1bd0: 65 64 22 2c 0a 20 09 22 70 61 74 68 74 79 70 65  ed",. ."pathtype
1be0: 22 2c 09 22 72 65 61 64 61 62 6c 65 22 2c 09 22  ",."readable",."
1bf0: 72 65 61 64 6c 69 6e 6b 22 2c 09 22 72 65 6e 61  readlink",."rena
1c00: 6d 65 22 2c 0a 20 09 22 72 6f 6f 74 6e 61 6d 65  me",. ."rootname
1c10: 22 2c 09 22 73 65 70 61 72 61 74 6f 72 22 2c 20  ",."separator", 
1c20: 20 20 20 22 73 69 7a 65 22 2c 09 09 22 73 70 6c     "size",.."spl
1c30: 69 74 22 2c 09 0a 40 40 20 2d 38 30 34 2c 38 20  it",..@@ -804,8 
1c40: 2b 38 30 34 2c 38 20 40 40 0a 20 09 46 49 4c 45  +804,8 @@. .FILE
1c50: 5f 41 54 49 4d 45 2c 09 46 49 4c 45 5f 41 54 54  _ATIME,.FILE_ATT
1c60: 52 49 42 55 54 45 53 2c 20 46 49 4c 45 5f 43 48  RIBUTES, FILE_CH
1c70: 41 4e 4e 45 4c 53 2c 09 46 49 4c 45 5f 43 4f 50  ANNELS,.FILE_COP
1c80: 59 2c 0a 20 09 46 49 4c 45 5f 44 45 4c 45 54 45  Y,. .FILE_DELETE
1c90: 2c 0a 20 09 46 49 4c 45 5f 44 49 52 4e 41 4d 45  ,. .FILE_DIRNAME
1ca0: 2c 09 46 49 4c 45 5f 45 58 45 43 55 54 41 42 4c  ,.FILE_EXECUTABL
1cb0: 45 2c 20 46 49 4c 45 5f 45 58 49 53 54 53 2c 09  E, FILE_EXISTS,.
1cc0: 46 49 4c 45 5f 45 58 54 45 4e 53 49 4f 4e 2c 0a  FILE_EXTENSION,.
1cd0: 2d 09 46 49 4c 45 5f 49 53 44 49 52 45 43 54 4f  -.FILE_ISDIRECTO
1ce0: 52 59 2c 20 46 49 4c 45 5f 49 53 46 49 4c 45 2c  RY, FILE_ISFILE,
1cf0: 09 46 49 4c 45 5f 4a 4f 49 4e 2c 09 46 49 4c 45  .FILE_JOIN,.FILE
1d00: 5f 4c 53 54 41 54 2c 0a 2d 09 46 49 4c 45 5f 4d  _LSTAT,.-.FILE_M
1d10: 54 49 4d 45 2c 09 46 49 4c 45 5f 4d 4b 44 49 52  TIME,.FILE_MKDIR
1d20: 2c 09 46 49 4c 45 5f 4e 41 54 49 56 45 4e 41 4d  ,.FILE_NATIVENAM
1d30: 45 2c 20 0a 2b 09 46 49 4c 45 5f 49 53 44 49 52  E, .+.FILE_ISDIR
1d40: 45 43 54 4f 52 59 2c 20 46 49 4c 45 5f 49 53 46  ECTORY, FILE_ISF
1d50: 49 4c 45 2c 09 46 49 4c 45 5f 4a 4f 49 4e 2c 09  ILE,.FILE_JOIN,.
1d60: 46 49 4c 45 5f 4c 49 4e 4b 2c 20 0a 2b 09 46 49  FILE_LINK, .+.FI
1d70: 4c 45 5f 4c 53 54 41 54 2c 20 20 20 20 20 46 49  LE_LSTAT,     FI
1d80: 4c 45 5f 4d 54 49 4d 45 2c 09 46 49 4c 45 5f 4d  LE_MTIME,.FILE_M
1d90: 4b 44 49 52 2c 09 46 49 4c 45 5f 4e 41 54 49 56  KDIR,.FILE_NATIV
1da0: 45 4e 41 4d 45 2c 20 0a 20 09 46 49 4c 45 5f 4e  ENAME, . .FILE_N
1db0: 4f 52 4d 41 4c 49 5a 45 2c 20 46 49 4c 45 5f 4f  ORMALIZE, FILE_O
1dc0: 57 4e 45 44 2c 0a 20 09 46 49 4c 45 5f 50 41 54  WNED,. .FILE_PAT
1dd0: 48 54 59 50 45 2c 09 46 49 4c 45 5f 52 45 41 44  HTYPE,.FILE_READ
1de0: 41 42 4c 45 2c 09 46 49 4c 45 5f 52 45 41 44 4c  ABLE,.FILE_READL
1df0: 49 4e 4b 2c 09 46 49 4c 45 5f 52 45 4e 41 4d 45  INK,.FILE_RENAME
1e00: 2c 0a 20 09 46 49 4c 45 5f 52 4f 4f 54 4e 41 4d  ,. .FILE_ROOTNAM
1e10: 45 2c 09 46 49 4c 45 5f 53 45 50 41 52 41 54 4f  E,.FILE_SEPARATO
1e20: 52 2c 20 46 49 4c 45 5f 53 49 5a 45 2c 09 46 49  R, FILE_SIZE,.FI
1e30: 4c 45 5f 53 50 4c 49 54 2c 09 0a 40 40 20 2d 39  LE_SPLIT,..@@ -9
1e40: 35 33 2c 36 20 2b 39 35 33 2c 37 36 20 40 40 0a  53,6 +953,76 @@.
1e50: 20 09 20 20 20 20 7d 0a 20 09 20 20 20 20 72 65   .    }. .    re
1e60: 73 4f 62 6a 20 3d 20 54 63 6c 5f 46 53 4a 6f 69  sObj = Tcl_FSJoi
1e70: 6e 54 6f 50 61 74 68 28 4e 55 4c 4c 2c 20 6f 62  nToPath(NULL, ob
1e80: 6a 63 20 2d 20 32 2c 20 6f 62 6a 76 20 2b 20 32  jc - 2, objv + 2
1e90: 29 3b 0a 20 09 20 20 20 20 54 63 6c 5f 53 65 74  );. .    Tcl_Set
1ea0: 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70  ObjResult(interp
1eb0: 2c 20 72 65 73 4f 62 6a 29 3b 0a 2b 09 20 20 20  , resObj);.+.   
1ec0: 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a   return TCL_OK;.
1ed0: 2b 09 7d 0a 2b 09 63 61 73 65 20 46 49 4c 45 5f  +.}.+.case FILE_
1ee0: 4c 49 4e 4b 3a 20 7b 0a 2b 09 20 20 20 20 54 63  LINK: {.+.    Tc
1ef0: 6c 5f 4f 62 6a 20 2a 63 6f 6e 74 65 6e 74 73 3b  l_Obj *contents;
1f00: 0a 2b 09 20 20 20 20 69 6e 74 20 69 6e 64 65 78  .+.    int index
1f10: 3b 0a 2b 09 20 20 20 20 0a 2b 09 20 20 20 20 69  ;.+.    .+.    i
1f20: 66 20 28 6f 62 6a 63 20 3c 20 33 20 7c 7c 20 6f  f (objc < 3 || o
1f30: 62 6a 63 20 3e 20 35 29 20 7b 0a 2b 09 09 54 63  bjc > 5) {.+..Tc
1f40: 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 73 28 69  l_WrongNumArgs(i
1f50: 6e 74 65 72 70 2c 20 32 2c 20 6f 62 6a 76 2c 20  nterp, 2, objv, 
1f60: 0a 2b 09 09 09 09 20 22 3f 2d 6c 69 6e 6b 74 79  .+.... "?-linkty
1f70: 70 65 3f 20 73 6f 75 72 63 65 20 3f 74 61 72 67  pe? source ?targ
1f80: 65 74 3f 22 29 3b 0a 2b 09 09 72 65 74 75 72 6e  et?");.+..return
1f90: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 09 20 20   TCL_ERROR;.+.  
1fa0: 20 20 7d 0a 2b 09 20 20 20 20 0a 2b 09 20 20 20    }.+.    .+.   
1fb0: 20 2f 2a 20 49 6e 64 65 78 20 6f 66 20 74 68 65   /* Index of the
1fc0: 20 27 73 6f 75 72 63 65 27 20 61 72 67 75 6d 65   'source' argume
1fd0: 6e 74 20 2a 2f 0a 2b 09 20 20 20 20 69 66 20 28  nt */.+.    if (
1fe0: 6f 62 6a 63 20 3d 3d 20 35 29 20 7b 0a 2b 09 09  objc == 5) {.+..
1ff0: 69 6e 64 65 78 20 3d 20 33 3b 0a 2b 09 20 20 20  index = 3;.+.   
2000: 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 69 6e 64   } else {.+..ind
2010: 65 78 20 3d 20 32 3b 0a 2b 09 20 20 20 20 7d 0a  ex = 2;.+.    }.
2020: 2b 09 20 20 20 20 0a 2b 09 20 20 20 20 69 66 20  +.    .+.    if 
2030: 28 54 63 6c 5f 46 53 43 6f 6e 76 65 72 74 54 6f  (Tcl_FSConvertTo
2040: 50 61 74 68 54 79 70 65 28 69 6e 74 65 72 70 2c  PathType(interp,
2050: 20 6f 62 6a 76 5b 69 6e 64 65 78 5d 29 20 21 3d   objv[index]) !=
2060: 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 09 72 65   TCL_OK) {.+..re
2070: 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a  turn TCL_ERROR;.
2080: 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20 20 0a 2b  +.    }.+.    .+
2090: 09 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3e 20  .    if (objc > 
20a0: 33 29 20 7b 0a 2b 09 09 69 6e 74 20 6c 69 6e 6b  3) {.+..int link
20b0: 41 63 74 69 6f 6e 3b 0a 2b 09 09 69 66 20 28 6f  Action;.+..if (o
20c0: 62 6a 63 20 3d 3d 20 35 29 20 7b 0a 2b 09 09 20  bjc == 5) {.+.. 
20d0: 20 20 20 2f 2a 20 57 65 20 68 61 76 65 20 61 20     /* We have a 
20e0: 27 2d 6c 69 6e 6b 74 79 70 65 27 20 61 72 67 75  '-linktype' argu
20f0: 6d 65 6e 74 20 2a 2f 0a 2b 09 09 20 20 20 20 73  ment */.+..    s
2100: 74 61 74 69 63 20 43 4f 4e 53 54 20 63 68 61 72  tatic CONST char
2110: 20 2a 6c 69 6e 6b 54 79 70 65 73 5b 5d 20 3d 20   *linkTypes[] = 
2120: 7b 0a 2b 09 09 09 22 2d 73 79 6d 62 6f 6c 69 63  {.+..."-symbolic
2130: 22 2c 20 22 2d 68 61 72 64 22 2c 20 4e 55 4c 4c  ", "-hard", NULL
2140: 0a 2b 09 09 20 20 20 20 7d 3b 0a 2b 09 09 20 20  .+..    };.+..  
2150: 20 20 69 66 20 28 54 63 6c 5f 47 65 74 49 6e 64    if (Tcl_GetInd
2160: 65 78 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70  exFromObj(interp
2170: 2c 20 6f 62 6a 76 5b 32 5d 2c 20 6c 69 6e 6b 54  , objv[2], linkT
2180: 79 70 65 73 2c 20 0a 2b 09 09 09 09 20 20 20 20  ypes, .+....    
2190: 20 22 73 77 69 74 63 68 22 2c 20 30 2c 20 26 6c   "switch", 0, &l
21a0: 69 6e 6b 41 63 74 69 6f 6e 29 20 21 3d 20 54 43  inkAction) != TC
21b0: 4c 5f 4f 4b 29 20 7b 0a 2b 09 09 09 72 65 74 75  L_OK) {.+...retu
21c0: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 09  rn TCL_ERROR;.+.
21d0: 09 20 20 20 20 7d 0a 2b 09 09 20 20 20 20 69 66  .    }.+..    if
21e0: 20 28 6c 69 6e 6b 41 63 74 69 6f 6e 20 3d 3d 20   (linkAction == 
21f0: 30 29 20 7b 0a 2b 09 09 20 20 20 20 20 20 20 20  0) {.+..        
2200: 6c 69 6e 6b 41 63 74 69 6f 6e 20 3d 20 54 43 4c  linkAction = TCL
2210: 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f 4c 49 43  _CREATE_SYMBOLIC
2220: 5f 4c 49 4e 4b 3b 0a 2b 09 09 20 20 20 20 7d 20  _LINK;.+..    } 
2230: 65 6c 73 65 20 7b 0a 2b 09 09 09 6c 69 6e 6b 41  else {.+...linkA
2240: 63 74 69 6f 6e 20 3d 20 54 43 4c 5f 43 52 45 41  ction = TCL_CREA
2250: 54 45 5f 48 41 52 44 5f 4c 49 4e 4b 3b 0a 2b 09  TE_HARD_LINK;.+.
2260: 09 20 20 20 20 7d 0a 2b 09 09 7d 20 65 6c 73 65  .    }.+..} else
2270: 20 7b 0a 2b 09 09 20 20 20 20 6c 69 6e 6b 41 63   {.+..    linkAc
2280: 74 69 6f 6e 20 3d 20 54 43 4c 5f 43 52 45 41 54  tion = TCL_CREAT
2290: 45 5f 53 59 4d 42 4f 4c 49 43 5f 4c 49 4e 4b 7c  E_SYMBOLIC_LINK|
22a0: 54 43 4c 5f 43 52 45 41 54 45 5f 48 41 52 44 5f  TCL_CREATE_HARD_
22b0: 4c 49 4e 4b 3b 0a 2b 09 09 7d 0a 2b 09 09 2f 2a  LINK;.+..}.+../*
22c0: 20 43 72 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f   Create link fro
22d0: 6d 20 73 6f 75 72 63 65 20 74 6f 20 74 61 72 67  m source to targ
22e0: 65 74 20 2a 2f 0a 2b 09 09 63 6f 6e 74 65 6e 74  et */.+..content
22f0: 73 20 3d 20 54 63 6c 5f 46 53 4c 69 6e 6b 28 6f  s = Tcl_FSLink(o
2300: 62 6a 76 5b 69 6e 64 65 78 5d 2c 20 6f 62 6a 76  bjv[index], objv
2310: 5b 69 6e 64 65 78 2b 31 5d 2c 20 6c 69 6e 6b 41  [index+1], linkA
2320: 63 74 69 6f 6e 29 3b 0a 2b 09 09 69 66 20 28 63  ction);.+..if (c
2330: 6f 6e 74 65 6e 74 73 20 3d 3d 20 4e 55 4c 4c 29  ontents == NULL)
2340: 20 7b 0a 2b 09 09 20 20 20 20 54 63 6c 5f 41 70   {.+..    Tcl_Ap
2350: 70 65 6e 64 52 65 73 75 6c 74 28 69 6e 74 65 72  pendResult(inter
2360: 70 2c 20 22 63 6f 75 6c 64 20 6e 6f 74 20 63 72  p, "could not cr
2370: 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f 6d 20 5c  eate link from \
2380: 22 22 2c 20 0a 2b 09 09 09 20 20 20 20 54 63 6c  "", .+...    Tcl
2390: 5f 47 65 74 53 74 72 69 6e 67 28 6f 62 6a 76 5b  _GetString(objv[
23a0: 69 6e 64 65 78 5d 29 2c 20 22 5c 22 20 74 6f 20  index]), "\" to 
23b0: 5c 22 22 2c 20 0a 2b 09 09 09 20 20 20 20 54 63  \"", .+...    Tc
23c0: 6c 5f 47 65 74 53 74 72 69 6e 67 28 6f 62 6a 76  l_GetString(objv
23d0: 5b 69 6e 64 65 78 2b 31 5d 29 2c 20 22 5c 22 3a  [index+1]), "\":
23e0: 20 22 2c 20 0a 2b 09 09 09 20 20 20 20 54 63 6c   ", .+...    Tcl
23f0: 5f 50 6f 73 69 78 45 72 72 6f 72 28 69 6e 74 65  _PosixError(inte
2400: 72 70 29 2c 20 28 63 68 61 72 20 2a 29 20 4e 55  rp), (char *) NU
2410: 4c 4c 29 3b 0a 2b 09 09 20 20 20 20 72 65 74 75  LL);.+..    retu
2420: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 09  rn TCL_ERROR;.+.
2430: 09 7d 0a 2b 09 20 20 20 20 7d 20 65 6c 73 65 20  .}.+.    } else 
2440: 7b 0a 2b 09 09 2f 2a 20 52 65 61 64 20 6c 69 6e  {.+../* Read lin
2450: 6b 20 2a 2f 0a 2b 09 09 63 6f 6e 74 65 6e 74 73  k */.+..contents
2460: 20 3d 20 54 63 6c 5f 46 53 4c 69 6e 6b 28 6f 62   = Tcl_FSLink(ob
2470: 6a 76 5b 69 6e 64 65 78 5d 2c 20 4e 55 4c 4c 2c  jv[index], NULL,
2480: 20 30 29 3b 0a 2b 09 09 69 66 20 28 63 6f 6e 74   0);.+..if (cont
2490: 65 6e 74 73 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a  ents == NULL) {.
24a0: 2b 09 09 20 20 20 20 54 63 6c 5f 41 70 70 65 6e  +..    Tcl_Appen
24b0: 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20  dResult(interp, 
24c0: 22 63 6f 75 6c 64 20 6e 6f 74 20 72 65 61 64 20  "could not read 
24d0: 6c 69 6e 6b 20 5c 22 22 2c 20 0a 2b 09 09 09 20  link \"", .+... 
24e0: 20 20 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67     Tcl_GetString
24f0: 28 6f 62 6a 76 5b 69 6e 64 65 78 5d 29 2c 20 22  (objv[index]), "
2500: 5c 22 3a 20 22 2c 20 0a 2b 09 09 09 20 20 20 20  \": ", .+...    
2510: 54 63 6c 5f 50 6f 73 69 78 45 72 72 6f 72 28 69  Tcl_PosixError(i
2520: 6e 74 65 72 70 29 2c 20 28 63 68 61 72 20 2a 29  nterp), (char *)
2530: 20 4e 55 4c 4c 29 3b 0a 2b 09 09 20 20 20 20 72   NULL);.+..    r
2540: 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b  eturn TCL_ERROR;
2550: 0a 2b 09 09 7d 0a 2b 09 20 20 20 20 7d 0a 2b 09  .+..}.+.    }.+.
2560: 20 20 20 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65      Tcl_SetObjRe
2570: 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 63 6f 6e  sult(interp, con
2580: 74 65 6e 74 73 29 3b 0a 2b 09 20 20 20 20 69 66  tents);.+.    if
2590: 20 28 6f 62 6a 63 20 3d 3d 20 33 29 20 7b 0a 2b   (objc == 3) {.+
25a0: 09 09 2f 2a 20 0a 2b 09 09 20 2a 20 49 66 20 77  ../* .+.. * If w
25b0: 65 20 61 72 65 20 72 65 61 64 69 6e 67 20 61 20  e are reading a 
25c0: 6c 69 6e 6b 2c 20 77 65 20 6e 65 65 64 20 74 6f  link, we need to
25d0: 20 66 72 65 65 20 74 68 69 73 0a 2b 09 09 20 2a   free this.+.. *
25e0: 20 72 65 73 75 6c 74 20 72 65 66 43 6f 75 6e 74   result refCount
25f0: 2e 20 20 49 66 20 77 65 20 61 72 65 20 63 72 65  .  If we are cre
2600: 61 74 69 6e 67 20 61 20 6c 69 6e 6b 2c 20 74 68  ating a link, th
2610: 69 73 0a 2b 09 09 20 2a 20 77 69 6c 6c 20 6a 75  is.+.. * will ju
2620: 73 74 20 62 65 20 6f 62 6a 76 5b 69 6e 64 65 78  st be objv[index
2630: 2b 31 5d 2c 20 61 6e 64 20 73 6f 20 77 65 20 64  +1], and so we d
2640: 6f 6e 27 74 20 6f 77 6e 20 69 74 2e 0a 2b 09 09  on't own it..+..
2650: 20 2a 2f 0a 2b 09 09 54 63 6c 5f 44 65 63 72 52   */.+..Tcl_DecrR
2660: 65 66 43 6f 75 6e 74 28 63 6f 6e 74 65 6e 74 73  efCount(contents
2670: 29 3b 0a 2b 09 20 20 20 20 7d 0a 20 09 20 20 20  );.+.    }. .   
2680: 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a   return TCL_OK;.
2690: 20 09 7d 0a 20 20 20 20 20 09 63 61 73 65 20 46   .}.     .case F
26a0: 49 4c 45 5f 4c 53 54 41 54 3a 20 7b 0a 49 6e 64  ILE_LSTAT: {.Ind
26b0: 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 49  ex: generic/tclI
26c0: 4f 55 74 69 6c 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d  OUtil.c.========
26d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
26e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
26f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20  ===========.RCS 
2710: 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74  file: /cvsroot/t
2720: 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74  cl/tcl/generic/t
2730: 63 6c 49 4f 55 74 69 6c 2e 63 2c 76 0a 72 65 74  clIOUtil.c,v.ret
2740: 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e  rieving revision
2750: 20 31 2e 34 39 0a 64 69 66 66 20 2d 62 20 2d 75   1.49.diff -b -u
2760: 20 2d 72 31 2e 34 39 20 74 63 6c 49 4f 55 74 69   -r1.49 tclIOUti
2770: 6c 2e 63 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f  l.c.--- generic/
2780: 74 63 6c 49 4f 55 74 69 6c 2e 63 09 31 33 20 4a  tclIOUtil.c.13 J
2790: 75 6e 20 32 30 30 32 20 30 39 3a 34 30 3a 30 30  un 2002 09:40:00
27a0: 20 2d 30 30 30 30 09 31 2e 34 39 0a 2b 2b 2b 20   -0000.1.49.+++ 
27b0: 67 65 6e 65 72 69 63 2f 74 63 6c 49 4f 55 74 69  generic/tclIOUti
27c0: 6c 2e 63 09 31 38 20 4a 75 6e 20 32 30 30 32 20  l.c.18 Jun 2002 
27d0: 31 30 3a 32 33 3a 33 31 20 2d 30 30 30 30 0a 40  10:23:31 -0000.@
27e0: 40 20 2d 32 36 39 30 2c 33 34 20 2b 32 36 39 30  @ -2690,34 +2690
27f0: 2c 33 37 20 40 40 0a 20 20 2a 20 20 20 20 20 20  ,37 @@.  *      
2800: 74 68 65 20 63 61 6c 6c 65 72 2c 20 77 68 69 63  the caller, whic
2810: 68 20 73 68 6f 75 6c 64 20 63 61 6c 6c 20 54 63  h should call Tc
2820: 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 20 77  l_DecrRefCount w
2830: 68 65 6e 20 74 68 65 20 72 65 73 75 6c 74 0a 20  hen the result. 
2840: 20 2a 20 20 20 20 20 20 69 73 20 6e 6f 20 6c 6f   *      is no lo
2850: 6e 67 65 72 20 6e 65 65 64 65 64 2e 0a 20 20 2a  nger needed..  *
2860: 20 20 20 20 20 20 0a 2d 20 2a 20 20 20 20 20 20        .- *      
2870: 49 66 20 74 6f 50 74 72 20 69 73 20 6e 6f 6e 2d  If toPtr is non-
2880: 4e 55 4c 4c 2c 20 74 68 65 6e 20 74 68 65 20 72  NULL, then the r
2890: 65 73 75 6c 74 20 69 73 20 74 6f 50 74 72 20 69  esult is toPtr i
28a0: 66 20 74 68 65 20 6c 69 6e 6b 0a 2b 20 2a 20 20  f the link.+ *  
28b0: 20 20 20 20 49 66 20 74 6f 50 74 72 20 69 73 20      If toPtr is 
28c0: 6e 6f 6e 2d 4e 55 4c 4c 2c 20 74 68 65 6e 20 74  non-NULL, then t
28d0: 68 65 20 72 65 73 75 6c 74 20 69 73 20 74 6f 50  he result is toP
28e0: 74 72 20 69 66 20 74 68 65 20 6c 69 6e 6b 20 61  tr if the link a
28f0: 63 74 69 6f 6e 0a 20 20 2a 20 20 20 20 20 20 77  ction.  *      w
2900: 61 73 20 73 75 63 63 65 73 73 66 75 6c 2c 20 6f  as successful, o
2910: 72 20 4e 55 4c 4c 20 69 66 20 6e 6f 74 2e 20 20  r NULL if not.  
2920: 49 6e 20 74 68 69 73 20 63 61 73 65 20 74 68 65  In this case the
2930: 20 72 65 73 75 6c 74 20 68 61 73 20 6e 6f 0a 2d   result has no.-
2940: 20 2a 20 20 20 20 20 20 61 64 64 69 74 69 6f 6e   *      addition
2950: 61 6c 20 72 65 66 65 72 65 6e 63 65 20 63 6f 75  al reference cou
2960: 6e 74 2c 20 61 6e 64 20 6e 65 65 64 20 6e 6f 74  nt, and need not
2970: 20 62 65 20 66 72 65 65 64 2e 0a 2b 20 2a 20 20   be freed..+ *  
2980: 20 20 20 20 61 64 64 69 74 69 6f 6e 61 6c 20 72      additional r
2990: 65 66 65 72 65 6e 63 65 20 63 6f 75 6e 74 2c 20  eference count, 
29a0: 61 6e 64 20 6e 65 65 64 20 6e 6f 74 20 62 65 20  and need not be 
29b0: 66 72 65 65 64 2e 20 20 54 68 65 20 61 63 74 75  freed.  The actu
29c0: 61 6c 0a 2b 20 2a 20 20 20 20 20 20 61 63 74 69  al.+ *      acti
29d0: 6f 6e 20 74 6f 20 70 65 72 66 6f 72 6d 20 69 73  on to perform is
29e0: 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 27 6c   given by the 'l
29f0: 69 6e 6b 41 63 74 69 6f 6e 27 20 66 6c 61 67 73  inkAction' flags
2a00: 2c 20 77 68 69 63 68 20 69 73 0a 2b 20 2a 20 20  , which is.+ *  
2a10: 20 20 20 20 61 6e 20 6f 72 27 64 20 63 6f 6d 62      an or'd comb
2a20: 69 6e 61 74 69 6f 6e 20 6f 66 3a 0a 2b 20 2a 20  ination of:.+ * 
2a30: 20 20 20 20 20 0a 2b 20 2a 20 20 20 20 20 20 20       .+ *       
2a40: 20 54 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42   TCL_CREATE_SYMB
2a50: 4f 4c 49 43 5f 4c 49 4e 4b 0a 2b 20 2a 20 20 20  OLIC_LINK.+ *   
2a60: 20 20 20 20 20 54 43 4c 5f 43 52 45 41 54 45 5f       TCL_CREATE_
2a70: 48 41 52 44 5f 4c 49 4e 4b 0a 20 20 2a 20 20 20  HARD_LINK.  *   
2a80: 20 20 20 0a 20 20 2a 20 20 20 20 20 20 4e 6f 74     .  *      Not
2a90: 65 20 74 68 61 74 20 6d 6f 73 74 20 66 69 6c 65  e that most file
2aa0: 73 79 73 74 65 6d 73 20 77 69 6c 6c 20 6e 6f 74  systems will not
2ab0: 20 73 75 70 70 6f 72 74 20 6c 69 6e 6b 69 6e 67   support linking
2ac0: 20 61 63 72 6f 73 73 0a 20 20 2a 20 20 20 20 20   across.  *     
2ad0: 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 66 69   to different fi
2ae0: 6c 65 73 79 73 74 65 6d 73 2c 20 73 6f 20 74 68  lesystems, so th
2af0: 69 73 20 66 75 6e 63 74 69 6f 6e 20 77 69 6c 6c  is function will
2b00: 20 75 73 75 61 6c 6c 79 0a 20 20 2a 20 20 20 20   usually.  *    
2b10: 20 20 66 61 69 6c 20 75 6e 6c 65 73 73 20 74 6f    fail unless to
2b20: 50 74 72 20 69 73 20 69 6e 20 74 68 65 20 73 61  Ptr is in the sa
2b30: 6d 65 20 46 53 20 61 73 20 70 61 74 68 50 74 72  me FS as pathPtr
2b40: 2e 0a 20 20 2a 20 20 20 20 20 20 0a 2d 20 2a 20  ..  *      .- * 
2b50: 20 20 20 20 20 4e 6f 74 65 3a 20 63 75 72 72 65       Note: curre
2b60: 6e 74 6c 79 20 6e 6f 20 54 63 6c 20 66 69 6c 65  ntly no Tcl file
2b70: 73 79 73 74 65 6d 73 20 73 75 70 70 6f 72 74 20  systems support 
2b80: 74 68 65 20 27 6c 69 6e 6b 27 20 61 63 74 69 6f  the 'link' actio
2b90: 6e 2c 0a 2d 20 2a 20 20 20 20 20 20 73 6f 20 77  n,.- *      so w
2ba0: 65 20 61 63 74 75 61 6c 6c 79 20 61 6c 77 61 79  e actually alway
2bb0: 73 20 72 65 74 75 72 6e 20 61 6e 20 65 72 72 6f  s return an erro
2bc0: 72 20 66 6f 72 20 74 68 61 74 20 63 61 6c 6c 2e  r for that call.
2bd0: 0a 2d 20 2a 0a 20 20 2a 20 53 69 64 65 20 65 66  .- *.  * Side ef
2be0: 66 65 63 74 73 3a 0a 2d 20 2a 09 53 65 65 20 72  fects:.- *.See r
2bf0: 65 61 64 6c 69 6e 6b 28 29 20 64 6f 63 75 6d 65  eadlink() docume
2c00: 6e 74 61 74 69 6f 6e 2e 0a 2b 20 2a 09 53 65 65  ntation..+ *.See
2c10: 20 72 65 61 64 6c 69 6e 6b 28 29 20 64 6f 63 75   readlink() docu
2c20: 6d 65 6e 74 61 74 69 6f 6e 2e 20 20 41 20 6e 65  mentation.  A ne
2c30: 77 20 66 69 6c 65 73 79 73 74 65 6d 20 6c 69 6e  w filesystem lin
2c40: 6b 20 0a 2b 20 2a 09 6f 62 6a 65 63 74 20 6d 61  k .+ *.object ma
2c50: 79 20 61 70 70 65 61 72 0a 20 20 2a 0a 20 20 2a  y appear.  *.  *
2c60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ca0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 2f  -----------.  */
2cb0: 0a 20 0a 20 54 63 6c 5f 4f 62 6a 20 2a 0a 2d 54  . . Tcl_Obj *.-T
2cc0: 63 6c 5f 46 53 4c 69 6e 6b 28 70 61 74 68 50 74  cl_FSLink(pathPt
2cd0: 72 2c 20 74 6f 50 74 72 2c 20 6c 69 6e 6b 54 79  r, toPtr, linkTy
2ce0: 70 65 29 0a 2b 54 63 6c 5f 46 53 4c 69 6e 6b 28  pe).+Tcl_FSLink(
2cf0: 70 61 74 68 50 74 72 2c 20 74 6f 50 74 72 2c 20  pathPtr, toPtr, 
2d00: 6c 69 6e 6b 41 63 74 69 6f 6e 29 0a 20 20 20 20  linkAction).    
2d10: 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74   Tcl_Obj *pathPt
2d20: 72 3b 09 09 2f 2a 20 50 61 74 68 20 6f 66 20 66  r;../* Path of f
2d30: 69 6c 65 20 74 6f 20 72 65 61 64 6c 69 6e 6b 20  ile to readlink 
2d40: 6f 72 20 6c 69 6e 6b 20 2a 2f 0a 20 20 20 20 20  or link */.     
2d50: 54 63 6c 5f 4f 62 6a 20 2a 74 6f 50 74 72 3b 09  Tcl_Obj *toPtr;.
2d60: 09 2f 2a 20 4e 55 4c 4c 20 6f 72 20 70 61 74 68  ./* NULL or path
2d70: 20 74 6f 20 62 65 20 6c 69 6e 6b 65 64 20 74 6f   to be linked to
2d80: 20 2a 2f 0a 2d 20 20 20 20 69 6e 74 20 6c 69 6e   */.-    int lin
2d90: 6b 54 79 70 65 3b 20 20 20 20 20 20 20 20 20 20  kType;          
2da0: 20 20 20 20 20 2f 2a 20 54 79 70 65 20 6f 66 20       /* Type of 
2db0: 6c 69 6e 6b 20 74 6f 20 63 72 65 61 74 65 20 2a  link to create *
2dc0: 2f 0a 2b 20 20 20 20 69 6e 74 20 6c 69 6e 6b 41  /.+    int linkA
2dd0: 63 74 69 6f 6e 3b 20 20 20 20 20 20 20 20 20 20  ction;          
2de0: 20 20 20 2f 2a 20 41 63 74 69 6f 6e 20 74 6f 20     /* Action to 
2df0: 70 65 72 66 6f 72 6d 20 2a 2f 0a 20 7b 0a 20 20  perform */. {.  
2e00: 20 20 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65     Tcl_Filesyste
2e10: 6d 20 2a 66 73 50 74 72 20 3d 20 54 63 6c 5f 46  m *fsPtr = Tcl_F
2e20: 53 47 65 74 46 69 6c 65 53 79 73 74 65 6d 46 6f  SGetFileSystemFo
2e30: 72 50 61 74 68 28 70 61 74 68 50 74 72 29 3b 0a  rPath(pathPtr);.
2e40: 20 20 20 20 20 69 66 20 28 66 73 50 74 72 20 21       if (fsPtr !
2e50: 3d 20 4e 55 4c 4c 29 20 7b 0a 20 09 54 63 6c 5f  = NULL) {. .Tcl_
2e60: 46 53 4c 69 6e 6b 50 72 6f 63 20 2a 70 72 6f 63  FSLinkProc *proc
2e70: 20 3d 20 66 73 50 74 72 2d 3e 6c 69 6e 6b 50 72   = fsPtr->linkPr
2e80: 6f 63 3b 0a 20 09 69 66 20 28 70 72 6f 63 20 21  oc;. .if (proc !
2e90: 3d 20 4e 55 4c 4c 29 20 7b 0a 2d 09 20 20 20 20  = NULL) {.-.    
2ea0: 72 65 74 75 72 6e 20 28 2a 70 72 6f 63 29 28 70  return (*proc)(p
2eb0: 61 74 68 50 74 72 2c 20 74 6f 50 74 72 2c 20 6c  athPtr, toPtr, l
2ec0: 69 6e 6b 54 79 70 65 29 3b 0a 2b 09 20 20 20 20  inkType);.+.    
2ed0: 72 65 74 75 72 6e 20 28 2a 70 72 6f 63 29 28 70  return (*proc)(p
2ee0: 61 74 68 50 74 72 2c 20 74 6f 50 74 72 2c 20 6c  athPtr, toPtr, l
2ef0: 69 6e 6b 41 63 74 69 6f 6e 29 3b 0a 20 09 7d 0a  inkAction);. .}.
2f00: 20 20 20 20 20 7d 0a 20 20 20 20 20 2f 2a 0a 49       }.     /*.I
2f10: 6e 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63  ndex: generic/tc
2f20: 6c 54 65 73 74 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d  lTest.c.========
2f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2f40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
2f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20  ===========.RCS 
2f70: 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74  file: /cvsroot/t
2f80: 63 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74  cl/tcl/generic/t
2f90: 63 6c 54 65 73 74 2e 63 2c 76 0a 72 65 74 72 69  clTest.c,v.retri
2fa0: 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31  eving revision 1
2fb0: 2e 35 30 0a 64 69 66 66 20 2d 62 20 2d 75 20 2d  .50.diff -b -u -
2fc0: 72 31 2e 35 30 20 74 63 6c 54 65 73 74 2e 63 0a  r1.50 tclTest.c.
2fd0: 2d 2d 2d 20 67 65 6e 65 72 69 63 2f 74 63 6c 54  --- generic/tclT
2fe0: 65 73 74 2e 63 09 31 33 20 4a 75 6e 20 32 30 30  est.c.13 Jun 200
2ff0: 32 20 30 39 3a 34 30 3a 30 30 20 2d 30 30 30 30  2 09:40:00 -0000
3000: 09 31 2e 35 30 0a 2b 2b 2b 20 67 65 6e 65 72 69  .1.50.+++ generi
3010: 63 2f 74 63 6c 54 65 73 74 2e 63 09 31 38 20 4a  c/tclTest.c.18 J
3020: 75 6e 20 32 30 30 32 20 31 30 3a 32 33 3a 33 35  un 2002 10:23:35
3030: 20 2d 30 30 30 30 0a 40 40 20 2d 32 30 30 37 2c   -0000.@@ -2007,
3040: 37 20 2b 32 30 30 37 2c 38 20 40 40 0a 20 20 20  7 +2007,8 @@.   
3050: 20 20 0a 20 20 20 20 20 69 66 20 28 6f 62 6a 63    .     if (objc
3060: 20 3d 3d 20 33 29 20 7b 0a 20 09 2f 2a 20 43 72   == 3) {. ./* Cr
3070: 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f 6d 20 73  eate link from s
3080: 6f 75 72 63 65 20 74 6f 20 74 61 72 67 65 74 20  ource to target 
3090: 2a 2f 0a 2d 09 63 6f 6e 74 65 6e 74 73 20 3d 20  */.-.contents = 
30a0: 54 63 6c 5f 46 53 4c 69 6e 6b 28 6f 62 6a 76 5b  Tcl_FSLink(objv[
30b0: 31 5d 2c 20 6f 62 6a 76 5b 32 5d 2c 20 30 29 3b  1], objv[2], 0);
30c0: 0a 2b 09 63 6f 6e 74 65 6e 74 73 20 3d 20 54 63  .+.contents = Tc
30d0: 6c 5f 46 53 4c 69 6e 6b 28 6f 62 6a 76 5b 31 5d  l_FSLink(objv[1]
30e0: 2c 20 6f 62 6a 76 5b 32 5d 2c 20 0a 2b 09 09 09  , objv[2], .+...
30f0: 54 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f  TCL_CREATE_SYMBO
3100: 4c 49 43 5f 4c 49 4e 4b 7c 54 43 4c 5f 43 52 45  LIC_LINK|TCL_CRE
3110: 41 54 45 5f 48 41 52 44 5f 4c 49 4e 4b 29 3b 0a  ATE_HARD_LINK);.
3120: 20 09 69 66 20 28 63 6f 6e 74 65 6e 74 73 20 3d   .if (contents =
3130: 3d 20 4e 55 4c 4c 29 20 7b 0a 20 09 20 20 20 20  = NULL) {. .    
3140: 54 63 6c 5f 41 70 70 65 6e 64 52 65 73 75 6c 74  Tcl_AppendResult
3150: 28 69 6e 74 65 72 70 2c 20 22 63 6f 75 6c 64 20  (interp, "could 
3160: 6e 6f 74 20 63 72 65 61 74 65 20 6c 69 6e 6b 20  not create link 
3170: 66 72 6f 6d 20 5c 22 22 2c 20 0a 20 09 09 20 20  from \"", . ..  
3180: 20 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 28    Tcl_GetString(
3190: 6f 62 6a 76 5b 31 5d 29 2c 20 22 5c 22 20 74 6f  objv[1]), "\" to
31a0: 20 5c 22 22 2c 20 0a 49 6e 64 65 78 3a 20 6d 61   \"", .Index: ma
31b0: 63 2f 74 63 6c 4d 61 63 46 69 6c 65 2e 63 0a 3d  c/tclMacFile.c.=
31c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
31d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
31e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
31f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3200: 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76  ==.RCS file: /cv
3210: 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 6d 61  sroot/tcl/tcl/ma
3220: 63 2f 74 63 6c 4d 61 63 46 69 6c 65 2e 63 2c 76  c/tclMacFile.c,v
3230: 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 76 69  .retrieving revi
3240: 73 69 6f 6e 20 31 2e 32 32 0a 64 69 66 66 20 2d  sion 1.22.diff -
3250: 62 20 2d 75 20 2d 72 31 2e 32 32 20 74 63 6c 4d  b -u -r1.22 tclM
3260: 61 63 46 69 6c 65 2e 63 0a 2d 2d 2d 20 6d 61 63  acFile.c.--- mac
3270: 2f 74 63 6c 4d 61 63 46 69 6c 65 2e 63 09 31 33  /tclMacFile.c.13
3280: 20 4a 75 6e 20 32 30 30 32 20 30 39 3a 34 30 3a   Jun 2002 09:40:
3290: 30 30 20 2d 30 30 30 30 09 31 2e 32 32 0a 2b 2b  00 -0000.1.22.++
32a0: 2b 20 6d 61 63 2f 74 63 6c 4d 61 63 46 69 6c 65  + mac/tclMacFile
32b0: 2e 63 09 31 38 20 4a 75 6e 20 32 30 30 32 20 31  .c.18 Jun 2002 1
32c0: 30 3a 32 33 3a 33 37 20 2d 30 30 30 30 0a 40 40  0:23:37 -0000.@@
32d0: 20 2d 31 31 34 35 2c 31 35 20 2b 31 31 34 35 2c   -1145,15 +1145,
32e0: 32 31 20 40 40 0a 20 23 69 66 64 65 66 20 53 5f  21 @@. #ifdef S_
32f0: 49 46 4c 4e 4b 0a 20 0a 20 54 63 6c 5f 4f 62 6a  IFLNK. . Tcl_Obj
3300: 2a 20 0a 2d 54 63 6c 70 4f 62 6a 4c 69 6e 6b 28  * .-TclpObjLink(
3310: 70 61 74 68 50 74 72 2c 20 74 6f 50 74 72 2c 20  pathPtr, toPtr, 
3320: 6c 69 6e 6b 54 79 70 65 29 0a 2b 54 63 6c 70 4f  linkType).+TclpO
3330: 62 6a 4c 69 6e 6b 28 70 61 74 68 50 74 72 2c 20  bjLink(pathPtr, 
3340: 74 6f 50 74 72 2c 20 6c 69 6e 6b 41 63 74 69 6f  toPtr, linkActio
3350: 6e 29 0a 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20  n).     Tcl_Obj 
3360: 2a 70 61 74 68 50 74 72 3b 0a 20 20 20 20 20 54  *pathPtr;.     T
3370: 63 6c 5f 4f 62 6a 20 2a 74 6f 50 74 72 3b 0a 2d  cl_Obj *toPtr;.-
3380: 20 20 20 20 69 6e 74 20 6c 69 6e 6b 54 79 70 65      int linkType
3390: 3b 0a 2b 20 20 20 20 69 6e 74 20 6c 69 6e 6b 41  ;.+    int linkA
33a0: 63 74 69 6f 6e 3b 0a 20 7b 0a 20 20 20 20 20 54  ction;. {.     T
33b0: 63 6c 5f 4f 62 6a 2a 20 6c 69 6e 6b 20 3d 20 4e  cl_Obj* link = N
33c0: 55 4c 4c 3b 0a 20 0a 20 20 20 20 20 69 66 20 28  ULL;. .     if (
33d0: 74 6f 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b  toPtr != NULL) {
33e0: 0a 2b 09 69 66 20 28 6c 69 6e 6b 41 63 74 69 6f  .+.if (linkActio
33f0: 6e 20 26 20 54 43 4c 5f 43 52 45 41 54 45 5f 53  n & TCL_CREATE_S
3400: 59 4d 42 4f 4c 49 43 5f 4c 49 4e 4b 29 20 7b 0a  YMBOLIC_LINK) {.
3410: 2b 09 20 20 20 20 2f 2a 20 4e 65 65 64 73 20 74  +.    /* Needs t
3420: 6f 20 63 72 65 61 74 65 20 61 20 6c 69 6e 6b 20  o create a link 
3430: 2a 2f 0a 20 09 72 65 74 75 72 6e 20 4e 55 4c 4c  */. .return NULL
3440: 3b 0a 2b 09 7d 20 65 6c 73 65 20 7b 0a 2b 09 20  ;.+.} else {.+. 
3450: 20 20 20 65 72 72 6e 6f 20 3d 20 45 4e 4f 44 45     errno = ENODE
3460: 56 3b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e 20  V;.+.    return 
3470: 4e 55 4c 4c 3b 0a 2b 09 7d 0a 20 20 20 20 20 7d  NULL;.+.}.     }
3480: 20 65 6c 73 65 20 7b 0a 20 09 54 63 6c 5f 44 53   else {. .Tcl_DS
3490: 74 72 69 6e 67 20 64 73 3b 0a 20 09 54 63 6c 5f  tring ds;. .Tcl_
34a0: 4f 62 6a 20 2a 74 72 61 6e 73 50 74 72 20 3d 20  Obj *transPtr = 
34b0: 54 63 6c 5f 46 53 47 65 74 54 72 61 6e 73 6c 61  Tcl_FSGetTransla
34c0: 74 65 64 50 61 74 68 28 4e 55 4c 4c 2c 20 70 61  tedPath(NULL, pa
34d0: 74 68 50 74 72 29 3b 0a 49 6e 64 65 78 3a 20 74  thPtr);.Index: t
34e0: 65 73 74 73 2f 63 6d 64 41 48 2e 74 65 73 74 0a  ests/cmdAH.test.
34f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
3530: 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63  ===.RCS file: /c
3540: 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 74  vsroot/tcl/tcl/t
3550: 65 73 74 73 2f 63 6d 64 41 48 2e 74 65 73 74 2c  ests/cmdAH.test,
3560: 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65 76  v.retrieving rev
3570: 69 73 69 6f 6e 20 31 2e 32 30 0a 64 69 66 66 20  ision 1.20.diff 
3580: 2d 62 20 2d 75 20 2d 72 31 2e 32 30 20 63 6d 64  -b -u -r1.20 cmd
3590: 41 48 2e 74 65 73 74 0a 2d 2d 2d 20 74 65 73 74  AH.test.--- test
35a0: 73 2f 63 6d 64 41 48 2e 74 65 73 74 09 37 20 4d  s/cmdAH.test.7 M
35b0: 61 79 20 32 30 30 32 20 31 38 3a 30 33 3a 30 34  ay 2002 18:03:04
35c0: 20 2d 30 30 30 30 09 31 2e 32 30 0a 2b 2b 2b 20   -0000.1.20.+++ 
35d0: 74 65 73 74 73 2f 63 6d 64 41 48 2e 74 65 73 74  tests/cmdAH.test
35e0: 09 31 38 20 4a 75 6e 20 32 30 30 32 20 31 30 3a  .18 Jun 2002 10:
35f0: 32 33 3a 34 35 20 2d 30 30 30 30 0a 40 40 20 2d  23:45 -0000.@@ -
3600: 31 36 38 2c 37 20 2b 31 36 38 2c 37 20 40 40 0a  168,7 +168,7 @@.
3610: 20 7d 20 7b 31 20 7b 77 72 6f 6e 67 20 23 20 61   } {1 {wrong # a
3620: 72 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20 22  rgs: should be "
3630: 66 69 6c 65 20 6f 70 74 69 6f 6e 20 3f 61 72 67  file option ?arg
3640: 20 2e 2e 2e 3f 22 7d 7d 0a 20 74 65 73 74 20 63   ...?"}}. test c
3650: 6d 64 41 48 2d 35 2e 32 20 7b 54 63 6c 5f 46 69  mdAH-5.2 {Tcl_Fi
3660: 6c 65 4f 62 6a 43 6d 64 7d 20 7b 0a 20 20 20 20  leObjCmd} {.    
3670: 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 66 69   list [catch {fi
3680: 6c 65 20 78 7d 20 6d 73 67 5d 20 24 6d 73 67 0a  le x} msg] $msg.
3690: 2d 7d 20 7b 31 20 7b 62 61 64 20 6f 70 74 69 6f  -} {1 {bad optio
36a0: 6e 20 22 78 22 3a 20 6d 75 73 74 20 62 65 20 61  n "x": must be a
36b0: 74 69 6d 65 2c 20 61 74 74 72 69 62 75 74 65 73  time, attributes
36c0: 2c 20 63 68 61 6e 6e 65 6c 73 2c 20 63 6f 70 79  , channels, copy
36d0: 2c 20 64 65 6c 65 74 65 2c 20 64 69 72 6e 61 6d  , delete, dirnam
36e0: 65 2c 20 65 78 65 63 75 74 61 62 6c 65 2c 20 65  e, executable, e
36f0: 78 69 73 74 73 2c 20 65 78 74 65 6e 73 69 6f 6e  xists, extension
3700: 2c 20 69 73 64 69 72 65 63 74 6f 72 79 2c 20 69  , isdirectory, i
3710: 73 66 69 6c 65 2c 20 6a 6f 69 6e 2c 20 6c 73 74  sfile, join, lst
3720: 61 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72  at, mtime, mkdir
3730: 2c 20 6e 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f  , nativename, no
3740: 72 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20  rmalize, owned, 
3750: 70 61 74 68 74 79 70 65 2c 20 72 65 61 64 61 62  pathtype, readab
3760: 6c 65 2c 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65  le, readlink, re
3770: 6e 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20  name, rootname, 
3780: 73 65 70 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c  separator, size,
3790: 20 73 70 6c 69 74 2c 20 73 74 61 74 2c 20 73 79   split, stat, sy
37a0: 73 74 65 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65  stem, tail, type
37b0: 2c 20 76 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72  , volumes, or wr
37c0: 69 74 61 62 6c 65 7d 7d 0a 2b 7d 20 7b 31 20 7b  itable}}.+} {1 {
37d0: 62 61 64 20 6f 70 74 69 6f 6e 20 22 78 22 3a 20  bad option "x": 
37e0: 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20 61  must be atime, a
37f0: 74 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e 6e  ttributes, chann
3800: 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65 74  els, copy, delet
3810: 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65 63  e, dirname, exec
3820: 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c 20  utable, exists, 
3830: 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69 72  extension, isdir
3840: 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c 20  ectory, isfile, 
3850: 6a 6f 69 6e 2c 20 6c 69 6e 6b 2c 20 6c 73 74 61  join, link, lsta
3860: 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72 2c  t, mtime, mkdir,
3870: 20 6e 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f 72   nativename, nor
3880: 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20 70  malize, owned, p
3890: 61 74 68 74 79 70 65 2c 20 72 65 61 64 61 62 6c  athtype, readabl
38a0: 65 2c 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65 6e  e, readlink, ren
38b0: 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20 73  ame, rootname, s
38c0: 65 70 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c 20  eparator, size, 
38d0: 73 70 6c 69 74 2c 20 73 74 61 74 2c 20 73 79 73  split, stat, sys
38e0: 74 65 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65 2c  tem, tail, type,
38f0: 20 76 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72 69   volumes, or wri
3900: 74 61 62 6c 65 7d 7d 0a 20 74 65 73 74 20 63 6d  table}}. test cm
3910: 64 41 48 2d 35 2e 33 20 7b 54 63 6c 5f 46 69 6c  dAH-5.3 {Tcl_Fil
3920: 65 4f 62 6a 43 6d 64 7d 20 7b 0a 20 20 20 20 20  eObjCmd} {.     
3930: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 66 69 6c  list [catch {fil
3940: 65 20 65 78 69 73 74 73 7d 20 6d 73 67 5d 20 24  e exists} msg] $
3950: 6d 73 67 0a 20 7d 20 7b 31 20 7b 77 72 6f 6e 67  msg. } {1 {wrong
3960: 20 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 20   # args: should 
3970: 62 65 20 22 66 69 6c 65 20 65 78 69 73 74 73 20  be "file exists 
3980: 6e 61 6d 65 22 7d 7d 0a 40 40 20 2d 31 32 32 30  name"}}.@@ -1220
3990: 2c 37 20 2b 31 32 32 30 2c 37 20 40 40 0a 20 23  ,7 +1220,7 @@. #
39a0: 20 6c 73 74 61 74 20 61 6e 64 20 72 65 61 64 6c   lstat and readl
39b0: 69 6e 6b 3a 20 20 64 6f 6e 27 74 20 72 75 6e 20  ink:  don't run 
39c0: 74 68 65 73 65 20 74 65 73 74 73 20 65 76 65 72  these tests ever
39d0: 79 77 68 65 72 65 2c 20 73 69 6e 63 65 20 6e 6f  ywhere, since no
39e0: 74 20 61 6c 6c 0a 20 23 20 73 69 74 65 73 20 77  t all. # sites w
39f0: 69 6c 6c 20 68 61 76 65 20 73 79 6d 62 6f 6c 69  ill have symboli
3a00: 63 20 6c 69 6e 6b 73 0a 20 0a 2d 63 61 74 63 68  c links. .-catch
3a10: 20 7b 65 78 65 63 20 6c 6e 20 2d 73 20 67 6f 72   {exec ln -s gor
3a20: 70 2e 66 69 6c 65 20 6c 69 6e 6b 2e 66 69 6c 65  p.file link.file
3a30: 7d 0a 2b 63 61 74 63 68 20 7b 66 69 6c 65 20 6c  }.+catch {file l
3a40: 69 6e 6b 20 2d 73 79 6d 62 6f 6c 69 63 20 6c 69  ink -symbolic li
3a50: 6e 6b 2e 66 69 6c 65 20 67 6f 72 70 2e 66 69 6c  nk.file gorp.fil
3a60: 65 7d 0a 20 74 65 73 74 20 63 6d 64 41 48 2d 32  e}. test cmdAH-2
3a70: 33 2e 31 20 7b 54 63 6c 5f 46 69 6c 65 4f 62 6a  3.1 {Tcl_FileObj
3a80: 43 6d 64 3a 20 6c 73 74 61 74 7d 20 7b 0a 20 20  Cmd: lstat} {.  
3a90: 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b     list [catch {
3aa0: 66 69 6c 65 20 6c 73 74 61 74 20 61 7d 20 6d 73  file lstat a} ms
3ab0: 67 5d 20 24 6d 73 67 0a 20 7d 20 7b 31 20 7b 77  g] $msg. } {1 {w
3ac0: 72 6f 6e 67 20 23 20 61 72 67 73 3a 20 73 68 6f  rong # args: sho
3ad0: 75 6c 64 20 62 65 20 22 66 69 6c 65 20 6c 73 74  uld be "file lst
3ae0: 61 74 20 6e 61 6d 65 20 76 61 72 4e 61 6d 65 22  at name varName"
3af0: 7d 7d 0a 40 40 20 2d 31 35 31 37 2c 36 20 2b 31  }}.@@ -1517,6 +1
3b00: 35 31 37 2c 31 34 20 40 40 0a 20 20 20 20 20 66  517,14 @@.     f
3b10: 69 6c 65 20 64 65 6c 65 74 65 20 6c 69 6e 6b 2e  ile delete link.
3b20: 66 69 6c 65 0a 20 20 20 20 20 73 65 74 20 72 65  file.     set re
3b30: 73 75 6c 74 0a 20 7d 20 6c 69 6e 6b 0a 2b 74 65  sult. } link.+te
3b40: 73 74 20 63 6d 64 41 48 2d 32 39 2e 34 2e 31 20  st cmdAH-29.4.1 
3b50: 7b 54 63 6c 5f 46 69 6c 65 4f 62 6a 43 6d 64 3a  {Tcl_FileObjCmd:
3b60: 20 74 79 70 65 7d 20 7b 0a 2b 20 20 20 20 66 69   type} {.+    fi
3b70: 6c 65 20 6d 6b 64 69 72 20 74 65 6d 70 0a 2b 20  le mkdir temp.+ 
3b80: 20 20 20 66 69 6c 65 20 6c 69 6e 6b 20 2d 73 79     file link -sy
3b90: 6d 62 6f 6c 69 63 20 6c 69 6e 6b 2e 64 69 72 20  mbolic link.dir 
3ba0: 74 65 6d 70 0a 2b 20 20 20 20 73 65 74 20 72 65  temp.+    set re
3bb0: 73 75 6c 74 20 5b 66 69 6c 65 20 74 79 70 65 20  sult [file type 
3bc0: 6c 69 6e 6b 2e 64 69 72 5d 0a 2b 20 20 20 20 66  link.dir].+    f
3bd0: 69 6c 65 20 64 65 6c 65 74 65 20 6c 69 6e 6b 2e  ile delete link.
3be0: 64 69 72 0a 2b 20 20 20 20 66 69 6c 65 20 64 65  dir.+    file de
3bf0: 6c 65 74 65 20 74 65 6d 70 0a 2b 20 20 20 20 73  lete temp.+    s
3c00: 65 74 20 72 65 73 75 6c 74 0a 2b 7d 20 6c 69 6e  et result.+} lin
3c10: 6b 0a 20 74 65 73 74 20 63 6d 64 41 48 2d 32 39  k. test cmdAH-29
3c20: 2e 35 20 7b 54 63 6c 5f 46 69 6c 65 4f 62 6a 43  .5 {Tcl_FileObjC
3c30: 6d 64 3a 20 74 79 70 65 7d 20 7b 0a 20 20 20 20  md: type} {.    
3c40: 20 73 74 72 69 6e 67 20 74 6f 6c 6f 77 65 72 20   string tolower 
3c50: 5b 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 66 69  [list [catch {fi
3c60: 6c 65 20 74 79 70 65 20 5f 62 6f 67 75 73 5f 7d  le type _bogus_}
3c70: 20 6d 73 67 5d 20 24 6d 73 67 20 24 65 72 72 6f   msg] $msg $erro
3c80: 72 43 6f 64 65 5d 0a 20 7d 20 7b 31 20 7b 63 6f  rCode]. } {1 {co
3c90: 75 6c 64 20 6e 6f 74 20 72 65 61 64 20 22 5f 62  uld not read "_b
3ca0: 6f 67 75 73 5f 22 3a 20 6e 6f 20 73 75 63 68 20  ogus_": no such 
3cb0: 66 69 6c 65 20 6f 72 20 64 69 72 65 63 74 6f 72  file or director
3cc0: 79 7d 20 7b 70 6f 73 69 78 20 65 6e 6f 65 6e 74  y} {posix enoent
3cd0: 20 7b 6e 6f 20 73 75 63 68 20 66 69 6c 65 20 6f   {no such file o
3ce0: 72 20 64 69 72 65 63 74 6f 72 79 7d 7d 7d 0a 40  r directory}}}.@
3cf0: 40 20 2d 31 35 32 35 2c 32 35 20 2b 31 35 33 33  @ -1525,25 +1533
3d00: 2c 32 35 20 40 40 0a 20 0a 20 74 65 73 74 20 63  ,25 @@. . test c
3d10: 6d 64 41 48 2d 33 30 2e 31 20 7b 54 63 6c 5f 46  mdAH-30.1 {Tcl_F
3d20: 69 6c 65 4f 62 6a 43 6d 64 3a 20 65 72 72 6f 72  ileObjCmd: error
3d30: 20 63 6f 6e 64 69 74 69 6f 6e 73 7d 20 7b 0a 20   conditions} {. 
3d40: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
3d50: 7b 66 69 6c 65 20 67 6f 72 70 20 78 7d 20 6d 73  {file gorp x} ms
3d60: 67 5d 20 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 62  g] $msg.-} {1 {b
3d70: 61 64 20 6f 70 74 69 6f 6e 20 22 67 6f 72 70 22  ad option "gorp"
3d80: 3a 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c  : must be atime,
3d90: 20 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61   attributes, cha
3da0: 6e 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c  nnels, copy, del
3db0: 65 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78  ete, dirname, ex
3dc0: 65 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73  ecutable, exists
3dd0: 2c 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64  , extension, isd
3de0: 69 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65  irectory, isfile
3df0: 2c 20 6a 6f 69 6e 2c 20 6c 73 74 61 74 2c 20 6d  , join, lstat, m
3e00: 74 69 6d 65 2c 20 6d 6b 64 69 72 2c 20 6e 61 74  time, mkdir, nat
3e10: 69 76 65 6e 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69  ivename, normali
3e20: 7a 65 2c 20 6f 77 6e 65 64 2c 20 70 61 74 68 74  ze, owned, patht
3e30: 79 70 65 2c 20 72 65 61 64 61 62 6c 65 2c 20 72  ype, readable, r
3e40: 65 61 64 6c 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c  eadlink, rename,
3e50: 20 72 6f 6f 74 6e 61 6d 65 2c 20 73 65 70 61 72   rootname, separ
3e60: 61 74 6f 72 2c 20 73 69 7a 65 2c 20 73 70 6c 69  ator, size, spli
3e70: 74 2c 20 73 74 61 74 2c 20 73 79 73 74 65 6d 2c  t, stat, system,
3e80: 20 74 61 69 6c 2c 20 74 79 70 65 2c 20 76 6f 6c   tail, type, vol
3e90: 75 6d 65 73 2c 20 6f 72 20 77 72 69 74 61 62 6c  umes, or writabl
3ea0: 65 7d 7d 0a 2b 7d 20 7b 31 20 7b 62 61 64 20 6f  e}}.+} {1 {bad o
3eb0: 70 74 69 6f 6e 20 22 67 6f 72 70 22 3a 20 6d 75  ption "gorp": mu
3ec0: 73 74 20 62 65 20 61 74 69 6d 65 2c 20 61 74 74  st be atime, att
3ed0: 72 69 62 75 74 65 73 2c 20 63 68 61 6e 6e 65 6c  ributes, channel
3ee0: 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65 74 65 2c  s, copy, delete,
3ef0: 20 64 69 72 6e 61 6d 65 2c 20 65 78 65 63 75 74   dirname, execut
3f00: 61 62 6c 65 2c 20 65 78 69 73 74 73 2c 20 65 78  able, exists, ex
3f10: 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69 72 65 63  tension, isdirec
3f20: 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c 20 6a 6f  tory, isfile, jo
3f30: 69 6e 2c 20 6c 69 6e 6b 2c 20 6c 73 74 61 74 2c  in, link, lstat,
3f40: 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72 2c 20 6e   mtime, mkdir, n
3f50: 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f 72 6d 61  ativename, norma
3f60: 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20 70 61 74  lize, owned, pat
3f70: 68 74 79 70 65 2c 20 72 65 61 64 61 62 6c 65 2c  htype, readable,
3f80: 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65 6e 61 6d   readlink, renam
3f90: 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20 73 65 70  e, rootname, sep
3fa0: 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c 20 73 70  arator, size, sp
3fb0: 6c 69 74 2c 20 73 74 61 74 2c 20 73 79 73 74 65  lit, stat, syste
3fc0: 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65 2c 20 76  m, tail, type, v
3fd0: 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72 69 74 61  olumes, or writa
3fe0: 62 6c 65 7d 7d 0a 20 74 65 73 74 20 63 6d 64 41  ble}}. test cmdA
3ff0: 48 2d 33 30 2e 32 20 7b 54 63 6c 5f 46 69 6c 65  H-30.2 {Tcl_File
4000: 4f 62 6a 43 6d 64 3a 20 65 72 72 6f 72 20 63 6f  ObjCmd: error co
4010: 6e 64 69 74 69 6f 6e 73 7d 20 7b 0a 20 20 20 20  nditions} {.    
4020: 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 66 69   list [catch {fi
4030: 6c 65 20 65 78 20 78 7d 20 6d 73 67 5d 20 24 6d  le ex x} msg] $m
4040: 73 67 0a 2d 7d 20 7b 31 20 7b 61 6d 62 69 67 75  sg.-} {1 {ambigu
4050: 6f 75 73 20 6f 70 74 69 6f 6e 20 22 65 78 22 3a  ous option "ex":
4060: 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20   must be atime, 
4070: 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e  attributes, chan
4080: 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65  nels, copy, dele
4090: 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65  te, dirname, exe
40a0: 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c  cutable, exists,
40b0: 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69   extension, isdi
40c0: 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c  rectory, isfile,
40d0: 20 6a 6f 69 6e 2c 20 6c 73 74 61 74 2c 20 6d 74   join, lstat, mt
40e0: 69 6d 65 2c 20 6d 6b 64 69 72 2c 20 6e 61 74 69  ime, mkdir, nati
40f0: 76 65 6e 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69 7a  vename, normaliz
4100: 65 2c 20 6f 77 6e 65 64 2c 20 70 61 74 68 74 79  e, owned, pathty
4110: 70 65 2c 20 72 65 61 64 61 62 6c 65 2c 20 72 65  pe, readable, re
4120: 61 64 6c 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c 20  adlink, rename, 
4130: 72 6f 6f 74 6e 61 6d 65 2c 20 73 65 70 61 72 61  rootname, separa
4140: 74 6f 72 2c 20 73 69 7a 65 2c 20 73 70 6c 69 74  tor, size, split
4150: 2c 20 73 74 61 74 2c 20 73 79 73 74 65 6d 2c 20  , stat, system, 
4160: 74 61 69 6c 2c 20 74 79 70 65 2c 20 76 6f 6c 75  tail, type, volu
4170: 6d 65 73 2c 20 6f 72 20 77 72 69 74 61 62 6c 65  mes, or writable
4180: 7d 7d 0a 2b 7d 20 7b 31 20 7b 61 6d 62 69 67 75  }}.+} {1 {ambigu
4190: 6f 75 73 20 6f 70 74 69 6f 6e 20 22 65 78 22 3a  ous option "ex":
41a0: 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20   must be atime, 
41b0: 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e  attributes, chan
41c0: 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65  nels, copy, dele
41d0: 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65  te, dirname, exe
41e0: 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c  cutable, exists,
41f0: 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69   extension, isdi
4200: 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c  rectory, isfile,
4210: 20 6a 6f 69 6e 2c 20 6c 69 6e 6b 2c 20 6c 73 74   join, link, lst
4220: 61 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72  at, mtime, mkdir
4230: 2c 20 6e 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f  , nativename, no
4240: 72 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20  rmalize, owned, 
4250: 70 61 74 68 74 79 70 65 2c 20 72 65 61 64 61 62  pathtype, readab
4260: 6c 65 2c 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65  le, readlink, re
4270: 6e 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20  name, rootname, 
4280: 73 65 70 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c  separator, size,
4290: 20 73 70 6c 69 74 2c 20 73 74 61 74 2c 20 73 79   split, stat, sy
42a0: 73 74 65 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65  stem, tail, type
42b0: 2c 20 76 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72  , volumes, or wr
42c0: 69 74 61 62 6c 65 7d 7d 0a 20 74 65 73 74 20 63  itable}}. test c
42d0: 6d 64 41 48 2d 33 30 2e 33 20 7b 54 63 6c 5f 46  mdAH-30.3 {Tcl_F
42e0: 69 6c 65 4f 62 6a 43 6d 64 3a 20 65 72 72 6f 72  ileObjCmd: error
42f0: 20 63 6f 6e 64 69 74 69 6f 6e 73 7d 20 7b 0a 20   conditions} {. 
4300: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
4310: 7b 66 69 6c 65 20 69 73 20 78 7d 20 6d 73 67 5d  {file is x} msg]
4320: 20 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 61 6d 62   $msg.-} {1 {amb
4330: 69 67 75 6f 75 73 20 6f 70 74 69 6f 6e 20 22 69  iguous option "i
4340: 73 22 3a 20 6d 75 73 74 20 62 65 20 61 74 69 6d  s": must be atim
4350: 65 2c 20 61 74 74 72 69 62 75 74 65 73 2c 20 63  e, attributes, c
4360: 68 61 6e 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64  hannels, copy, d
4370: 65 6c 65 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20  elete, dirname, 
4380: 65 78 65 63 75 74 61 62 6c 65 2c 20 65 78 69 73  executable, exis
4390: 74 73 2c 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69  ts, extension, i
43a0: 73 64 69 72 65 63 74 6f 72 79 2c 20 69 73 66 69  sdirectory, isfi
43b0: 6c 65 2c 20 6a 6f 69 6e 2c 20 6c 73 74 61 74 2c  le, join, lstat,
43c0: 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72 2c 20 6e   mtime, mkdir, n
43d0: 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f 72 6d 61  ativename, norma
43e0: 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20 70 61 74  lize, owned, pat
43f0: 68 74 79 70 65 2c 20 72 65 61 64 61 62 6c 65 2c  htype, readable,
4400: 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65 6e 61 6d   readlink, renam
4410: 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20 73 65 70  e, rootname, sep
4420: 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c 20 73 70  arator, size, sp
4430: 6c 69 74 2c 20 73 74 61 74 2c 20 73 79 73 74 65  lit, stat, syste
4440: 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65 2c 20 76  m, tail, type, v
4450: 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72 69 74 61  olumes, or writa
4460: 62 6c 65 7d 7d 0a 2b 7d 20 7b 31 20 7b 61 6d 62  ble}}.+} {1 {amb
4470: 69 67 75 6f 75 73 20 6f 70 74 69 6f 6e 20 22 69  iguous option "i
4480: 73 22 3a 20 6d 75 73 74 20 62 65 20 61 74 69 6d  s": must be atim
4490: 65 2c 20 61 74 74 72 69 62 75 74 65 73 2c 20 63  e, attributes, c
44a0: 68 61 6e 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64  hannels, copy, d
44b0: 65 6c 65 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20  elete, dirname, 
44c0: 65 78 65 63 75 74 61 62 6c 65 2c 20 65 78 69 73  executable, exis
44d0: 74 73 2c 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69  ts, extension, i
44e0: 73 64 69 72 65 63 74 6f 72 79 2c 20 69 73 66 69  sdirectory, isfi
44f0: 6c 65 2c 20 6a 6f 69 6e 2c 20 6c 69 6e 6b 2c 20  le, join, link, 
4500: 6c 73 74 61 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b  lstat, mtime, mk
4510: 64 69 72 2c 20 6e 61 74 69 76 65 6e 61 6d 65 2c  dir, nativename,
4520: 20 6e 6f 72 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65   normalize, owne
4530: 64 2c 20 70 61 74 68 74 79 70 65 2c 20 72 65 61  d, pathtype, rea
4540: 64 61 62 6c 65 2c 20 72 65 61 64 6c 69 6e 6b 2c  dable, readlink,
4550: 20 72 65 6e 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d   rename, rootnam
4560: 65 2c 20 73 65 70 61 72 61 74 6f 72 2c 20 73 69  e, separator, si
4570: 7a 65 2c 20 73 70 6c 69 74 2c 20 73 74 61 74 2c  ze, split, stat,
4580: 20 73 79 73 74 65 6d 2c 20 74 61 69 6c 2c 20 74   system, tail, t
4590: 79 70 65 2c 20 76 6f 6c 75 6d 65 73 2c 20 6f 72  ype, volumes, or
45a0: 20 77 72 69 74 61 62 6c 65 7d 7d 0a 20 74 65 73   writable}}. tes
45b0: 74 20 63 6d 64 41 48 2d 33 30 2e 34 20 7b 54 63  t cmdAH-30.4 {Tc
45c0: 6c 5f 46 69 6c 65 4f 62 6a 43 6d 64 3a 20 65 72  l_FileObjCmd: er
45d0: 72 6f 72 20 63 6f 6e 64 69 74 69 6f 6e 73 7d 20  ror conditions} 
45e0: 7b 0a 20 20 20 20 20 6c 69 73 74 20 5b 63 61 74  {.     list [cat
45f0: 63 68 20 7b 66 69 6c 65 20 7a 20 78 7d 20 6d 73  ch {file z x} ms
4600: 67 5d 20 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 62  g] $msg.-} {1 {b
4610: 61 64 20 6f 70 74 69 6f 6e 20 22 7a 22 3a 20 6d  ad option "z": m
4620: 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20 61 74  ust be atime, at
4630: 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e 6e 65  tributes, channe
4640: 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65 74 65  ls, copy, delete
4650: 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65 63 75  , dirname, execu
4660: 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c 20 65  table, exists, e
4670: 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69 72 65  xtension, isdire
4680: 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c 20 6a  ctory, isfile, j
4690: 6f 69 6e 2c 20 6c 73 74 61 74 2c 20 6d 74 69 6d  oin, lstat, mtim
46a0: 65 2c 20 6d 6b 64 69 72 2c 20 6e 61 74 69 76 65  e, mkdir, native
46b0: 6e 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69 7a 65 2c  name, normalize,
46c0: 20 6f 77 6e 65 64 2c 20 70 61 74 68 74 79 70 65   owned, pathtype
46d0: 2c 20 72 65 61 64 61 62 6c 65 2c 20 72 65 61 64  , readable, read
46e0: 6c 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c 20 72 6f  link, rename, ro
46f0: 6f 74 6e 61 6d 65 2c 20 73 65 70 61 72 61 74 6f  otname, separato
4700: 72 2c 20 73 69 7a 65 2c 20 73 70 6c 69 74 2c 20  r, size, split, 
4710: 73 74 61 74 2c 20 73 79 73 74 65 6d 2c 20 74 61  stat, system, ta
4720: 69 6c 2c 20 74 79 70 65 2c 20 76 6f 6c 75 6d 65  il, type, volume
4730: 73 2c 20 6f 72 20 77 72 69 74 61 62 6c 65 7d 7d  s, or writable}}
4740: 0a 2b 7d 20 7b 31 20 7b 62 61 64 20 6f 70 74 69  .+} {1 {bad opti
4750: 6f 6e 20 22 7a 22 3a 20 6d 75 73 74 20 62 65 20  on "z": must be 
4760: 61 74 69 6d 65 2c 20 61 74 74 72 69 62 75 74 65  atime, attribute
4770: 73 2c 20 63 68 61 6e 6e 65 6c 73 2c 20 63 6f 70  s, channels, cop
4780: 79 2c 20 64 65 6c 65 74 65 2c 20 64 69 72 6e 61  y, delete, dirna
4790: 6d 65 2c 20 65 78 65 63 75 74 61 62 6c 65 2c 20  me, executable, 
47a0: 65 78 69 73 74 73 2c 20 65 78 74 65 6e 73 69 6f  exists, extensio
47b0: 6e 2c 20 69 73 64 69 72 65 63 74 6f 72 79 2c 20  n, isdirectory, 
47c0: 69 73 66 69 6c 65 2c 20 6a 6f 69 6e 2c 20 6c 69  isfile, join, li
47d0: 6e 6b 2c 20 6c 73 74 61 74 2c 20 6d 74 69 6d 65  nk, lstat, mtime
47e0: 2c 20 6d 6b 64 69 72 2c 20 6e 61 74 69 76 65 6e  , mkdir, nativen
47f0: 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69 7a 65 2c 20  ame, normalize, 
4800: 6f 77 6e 65 64 2c 20 70 61 74 68 74 79 70 65 2c  owned, pathtype,
4810: 20 72 65 61 64 61 62 6c 65 2c 20 72 65 61 64 6c   readable, readl
4820: 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c 20 72 6f 6f  ink, rename, roo
4830: 74 6e 61 6d 65 2c 20 73 65 70 61 72 61 74 6f 72  tname, separator
4840: 2c 20 73 69 7a 65 2c 20 73 70 6c 69 74 2c 20 73  , size, split, s
4850: 74 61 74 2c 20 73 79 73 74 65 6d 2c 20 74 61 69  tat, system, tai
4860: 6c 2c 20 74 79 70 65 2c 20 76 6f 6c 75 6d 65 73  l, type, volumes
4870: 2c 20 6f 72 20 77 72 69 74 61 62 6c 65 7d 7d 0a  , or writable}}.
4880: 20 74 65 73 74 20 63 6d 64 41 48 2d 33 30 2e 35   test cmdAH-30.5
4890: 20 7b 54 63 6c 5f 46 69 6c 65 4f 62 6a 43 6d 64   {Tcl_FileObjCmd
48a0: 3a 20 65 72 72 6f 72 20 63 6f 6e 64 69 74 69 6f  : error conditio
48b0: 6e 73 7d 20 7b 0a 20 20 20 20 20 6c 69 73 74 20  ns} {.     list 
48c0: 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 72 65 61  [catch {file rea
48d0: 64 20 78 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 2d  d x} msg] $msg.-
48e0: 7d 20 7b 31 20 7b 61 6d 62 69 67 75 6f 75 73 20  } {1 {ambiguous 
48f0: 6f 70 74 69 6f 6e 20 22 72 65 61 64 22 3a 20 6d  option "read": m
4900: 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20 61 74  ust be atime, at
4910: 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e 6e 65  tributes, channe
4920: 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65 74 65  ls, copy, delete
4930: 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65 63 75  , dirname, execu
4940: 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c 20 65  table, exists, e
4950: 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69 72 65  xtension, isdire
4960: 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c 20 6a  ctory, isfile, j
4970: 6f 69 6e 2c 20 6c 73 74 61 74 2c 20 6d 74 69 6d  oin, lstat, mtim
4980: 65 2c 20 6d 6b 64 69 72 2c 20 6e 61 74 69 76 65  e, mkdir, native
4990: 6e 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69 7a 65 2c  name, normalize,
49a0: 20 6f 77 6e 65 64 2c 20 70 61 74 68 74 79 70 65   owned, pathtype
49b0: 2c 20 72 65 61 64 61 62 6c 65 2c 20 72 65 61 64  , readable, read
49c0: 6c 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c 20 72 6f  link, rename, ro
49d0: 6f 74 6e 61 6d 65 2c 20 73 65 70 61 72 61 74 6f  otname, separato
49e0: 72 2c 20 73 69 7a 65 2c 20 73 70 6c 69 74 2c 20  r, size, split, 
49f0: 73 74 61 74 2c 20 73 79 73 74 65 6d 2c 20 74 61  stat, system, ta
4a00: 69 6c 2c 20 74 79 70 65 2c 20 76 6f 6c 75 6d 65  il, type, volume
4a10: 73 2c 20 6f 72 20 77 72 69 74 61 62 6c 65 7d 7d  s, or writable}}
4a20: 0a 2b 7d 20 7b 31 20 7b 61 6d 62 69 67 75 6f 75  .+} {1 {ambiguou
4a30: 73 20 6f 70 74 69 6f 6e 20 22 72 65 61 64 22 3a  s option "read":
4a40: 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20   must be atime, 
4a50: 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e  attributes, chan
4a60: 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65  nels, copy, dele
4a70: 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65  te, dirname, exe
4a80: 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c  cutable, exists,
4a90: 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69   extension, isdi
4aa0: 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c  rectory, isfile,
4ab0: 20 6a 6f 69 6e 2c 20 6c 69 6e 6b 2c 20 6c 73 74   join, link, lst
4ac0: 61 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72  at, mtime, mkdir
4ad0: 2c 20 6e 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f  , nativename, no
4ae0: 72 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20  rmalize, owned, 
4af0: 70 61 74 68 74 79 70 65 2c 20 72 65 61 64 61 62  pathtype, readab
4b00: 6c 65 2c 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65  le, readlink, re
4b10: 6e 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20  name, rootname, 
4b20: 73 65 70 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c  separator, size,
4b30: 20 73 70 6c 69 74 2c 20 73 74 61 74 2c 20 73 79   split, stat, sy
4b40: 73 74 65 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65  stem, tail, type
4b50: 2c 20 76 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72  , volumes, or wr
4b60: 69 74 61 62 6c 65 7d 7d 0a 20 74 65 73 74 20 63  itable}}. test c
4b70: 6d 64 41 48 2d 33 30 2e 36 20 7b 54 63 6c 5f 46  mdAH-30.6 {Tcl_F
4b80: 69 6c 65 4f 62 6a 43 6d 64 3a 20 65 72 72 6f 72  ileObjCmd: error
4b90: 20 63 6f 6e 64 69 74 69 6f 6e 73 7d 20 7b 0a 20   conditions} {. 
4ba0: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
4bb0: 7b 66 69 6c 65 20 73 20 78 7d 20 6d 73 67 5d 20  {file s x} msg] 
4bc0: 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 61 6d 62 69  $msg.-} {1 {ambi
4bd0: 67 75 6f 75 73 20 6f 70 74 69 6f 6e 20 22 73 22  guous option "s"
4be0: 3a 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c  : must be atime,
4bf0: 20 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61   attributes, cha
4c00: 6e 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c  nnels, copy, del
4c10: 65 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78  ete, dirname, ex
4c20: 65 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73  ecutable, exists
4c30: 2c 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64  , extension, isd
4c40: 69 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65  irectory, isfile
4c50: 2c 20 6a 6f 69 6e 2c 20 6c 73 74 61 74 2c 20 6d  , join, lstat, m
4c60: 74 69 6d 65 2c 20 6d 6b 64 69 72 2c 20 6e 61 74  time, mkdir, nat
4c70: 69 76 65 6e 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69  ivename, normali
4c80: 7a 65 2c 20 6f 77 6e 65 64 2c 20 70 61 74 68 74  ze, owned, patht
4c90: 79 70 65 2c 20 72 65 61 64 61 62 6c 65 2c 20 72  ype, readable, r
4ca0: 65 61 64 6c 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c  eadlink, rename,
4cb0: 20 72 6f 6f 74 6e 61 6d 65 2c 20 73 65 70 61 72   rootname, separ
4cc0: 61 74 6f 72 2c 20 73 69 7a 65 2c 20 73 70 6c 69  ator, size, spli
4cd0: 74 2c 20 73 74 61 74 2c 20 73 79 73 74 65 6d 2c  t, stat, system,
4ce0: 20 74 61 69 6c 2c 20 74 79 70 65 2c 20 76 6f 6c   tail, type, vol
4cf0: 75 6d 65 73 2c 20 6f 72 20 77 72 69 74 61 62 6c  umes, or writabl
4d00: 65 7d 7d 0a 2b 7d 20 7b 31 20 7b 61 6d 62 69 67  e}}.+} {1 {ambig
4d10: 75 6f 75 73 20 6f 70 74 69 6f 6e 20 22 73 22 3a  uous option "s":
4d20: 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20   must be atime, 
4d30: 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e  attributes, chan
4d40: 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65  nels, copy, dele
4d50: 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65  te, dirname, exe
4d60: 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c  cutable, exists,
4d70: 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69   extension, isdi
4d80: 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c  rectory, isfile,
4d90: 20 6a 6f 69 6e 2c 20 6c 69 6e 6b 2c 20 6c 73 74   join, link, lst
4da0: 61 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72  at, mtime, mkdir
4db0: 2c 20 6e 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f  , nativename, no
4dc0: 72 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20  rmalize, owned, 
4dd0: 70 61 74 68 74 79 70 65 2c 20 72 65 61 64 61 62  pathtype, readab
4de0: 6c 65 2c 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65  le, readlink, re
4df0: 6e 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20  name, rootname, 
4e00: 73 65 70 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c  separator, size,
4e10: 20 73 70 6c 69 74 2c 20 73 74 61 74 2c 20 73 79   split, stat, sy
4e20: 73 74 65 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65  stem, tail, type
4e30: 2c 20 76 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72  , volumes, or wr
4e40: 69 74 61 62 6c 65 7d 7d 0a 20 74 65 73 74 20 63  itable}}. test c
4e50: 6d 64 41 48 2d 33 30 2e 37 20 7b 54 63 6c 5f 46  mdAH-30.7 {Tcl_F
4e60: 69 6c 65 4f 62 6a 43 6d 64 3a 20 65 72 72 6f 72  ileObjCmd: error
4e70: 20 63 6f 6e 64 69 74 69 6f 6e 73 7d 20 7b 0a 20   conditions} {. 
4e80: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
4e90: 7b 66 69 6c 65 20 74 20 78 7d 20 6d 73 67 5d 20  {file t x} msg] 
4ea0: 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 61 6d 62 69  $msg.-} {1 {ambi
4eb0: 67 75 6f 75 73 20 6f 70 74 69 6f 6e 20 22 74 22  guous option "t"
4ec0: 3a 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c  : must be atime,
4ed0: 20 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61   attributes, cha
4ee0: 6e 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c  nnels, copy, del
4ef0: 65 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78  ete, dirname, ex
4f00: 65 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73  ecutable, exists
4f10: 2c 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64  , extension, isd
4f20: 69 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65  irectory, isfile
4f30: 2c 20 6a 6f 69 6e 2c 20 6c 73 74 61 74 2c 20 6d  , join, lstat, m
4f40: 74 69 6d 65 2c 20 6d 6b 64 69 72 2c 20 6e 61 74  time, mkdir, nat
4f50: 69 76 65 6e 61 6d 65 2c 20 6e 6f 72 6d 61 6c 69  ivename, normali
4f60: 7a 65 2c 20 6f 77 6e 65 64 2c 20 70 61 74 68 74  ze, owned, patht
4f70: 79 70 65 2c 20 72 65 61 64 61 62 6c 65 2c 20 72  ype, readable, r
4f80: 65 61 64 6c 69 6e 6b 2c 20 72 65 6e 61 6d 65 2c  eadlink, rename,
4f90: 20 72 6f 6f 74 6e 61 6d 65 2c 20 73 65 70 61 72   rootname, separ
4fa0: 61 74 6f 72 2c 20 73 69 7a 65 2c 20 73 70 6c 69  ator, size, spli
4fb0: 74 2c 20 73 74 61 74 2c 20 73 79 73 74 65 6d 2c  t, stat, system,
4fc0: 20 74 61 69 6c 2c 20 74 79 70 65 2c 20 76 6f 6c   tail, type, vol
4fd0: 75 6d 65 73 2c 20 6f 72 20 77 72 69 74 61 62 6c  umes, or writabl
4fe0: 65 7d 7d 0a 2b 7d 20 7b 31 20 7b 61 6d 62 69 67  e}}.+} {1 {ambig
4ff0: 75 6f 75 73 20 6f 70 74 69 6f 6e 20 22 74 22 3a  uous option "t":
5000: 20 6d 75 73 74 20 62 65 20 61 74 69 6d 65 2c 20   must be atime, 
5010: 61 74 74 72 69 62 75 74 65 73 2c 20 63 68 61 6e  attributes, chan
5020: 6e 65 6c 73 2c 20 63 6f 70 79 2c 20 64 65 6c 65  nels, copy, dele
5030: 74 65 2c 20 64 69 72 6e 61 6d 65 2c 20 65 78 65  te, dirname, exe
5040: 63 75 74 61 62 6c 65 2c 20 65 78 69 73 74 73 2c  cutable, exists,
5050: 20 65 78 74 65 6e 73 69 6f 6e 2c 20 69 73 64 69   extension, isdi
5060: 72 65 63 74 6f 72 79 2c 20 69 73 66 69 6c 65 2c  rectory, isfile,
5070: 20 6a 6f 69 6e 2c 20 6c 69 6e 6b 2c 20 6c 73 74   join, link, lst
5080: 61 74 2c 20 6d 74 69 6d 65 2c 20 6d 6b 64 69 72  at, mtime, mkdir
5090: 2c 20 6e 61 74 69 76 65 6e 61 6d 65 2c 20 6e 6f  , nativename, no
50a0: 72 6d 61 6c 69 7a 65 2c 20 6f 77 6e 65 64 2c 20  rmalize, owned, 
50b0: 70 61 74 68 74 79 70 65 2c 20 72 65 61 64 61 62  pathtype, readab
50c0: 6c 65 2c 20 72 65 61 64 6c 69 6e 6b 2c 20 72 65  le, readlink, re
50d0: 6e 61 6d 65 2c 20 72 6f 6f 74 6e 61 6d 65 2c 20  name, rootname, 
50e0: 73 65 70 61 72 61 74 6f 72 2c 20 73 69 7a 65 2c  separator, size,
50f0: 20 73 70 6c 69 74 2c 20 73 74 61 74 2c 20 73 79   split, stat, sy
5100: 73 74 65 6d 2c 20 74 61 69 6c 2c 20 74 79 70 65  stem, tail, type
5110: 2c 20 76 6f 6c 75 6d 65 73 2c 20 6f 72 20 77 72  , volumes, or wr
5120: 69 74 61 62 6c 65 7d 7d 0a 20 74 65 73 74 20 63  itable}}. test c
5130: 6d 64 41 48 2d 33 30 2e 38 20 7b 54 63 6c 5f 46  mdAH-30.8 {Tcl_F
5140: 69 6c 65 4f 62 6a 43 6d 64 3a 20 65 72 72 6f 72  ileObjCmd: error
5150: 20 63 6f 6e 64 69 74 69 6f 6e 73 7d 20 7b 0a 20   conditions} {. 
5160: 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20      list [catch 
5170: 7b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 7e 77  {file dirname ~w
5180: 6f 6f 68 67 79 7d 20 6d 73 67 5d 20 24 6d 73 67  oohgy} msg] $msg
5190: 0a 20 7d 20 7b 31 20 7b 75 73 65 72 20 22 77 6f  . } {1 {user "wo
51a0: 6f 68 67 79 22 20 64 6f 65 73 6e 27 74 20 65 78  ohgy" doesn't ex
51b0: 69 73 74 7d 7d 0a 49 6e 64 65 78 3a 20 74 65 73  ist}}.Index: tes
51c0: 74 73 2f 66 43 6d 64 2e 74 65 73 74 0a 3d 3d 3d  ts/fCmd.test.===
51d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
51e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
51f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
5210: 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73 72  .RCS file: /cvsr
5220: 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 74 65 73 74  oot/tcl/tcl/test
5230: 73 2f 66 43 6d 64 2e 74 65 73 74 2c 76 0a 72 65  s/fCmd.test,v.re
5240: 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 69 6f  trieving revisio
5250: 6e 20 31 2e 31 33 0a 64 69 66 66 20 2d 62 20 2d  n 1.13.diff -b -
5260: 75 20 2d 72 31 2e 31 33 20 66 43 6d 64 2e 74 65  u -r1.13 fCmd.te
5270: 73 74 0a 2d 2d 2d 20 74 65 73 74 73 2f 66 43 6d  st.--- tests/fCm
5280: 64 2e 74 65 73 74 09 31 33 20 4a 75 6e 20 32 30  d.test.13 Jun 20
5290: 30 32 20 31 33 3a 31 37 3a 30 36 20 2d 30 30 30  02 13:17:06 -000
52a0: 30 09 31 2e 31 33 0a 2b 2b 2b 20 74 65 73 74 73  0.1.13.+++ tests
52b0: 2f 66 43 6d 64 2e 74 65 73 74 09 31 38 20 4a 75  /fCmd.test.18 Ju
52c0: 6e 20 32 30 30 32 20 31 30 3a 32 33 3a 34 37 20  n 2002 10:23:47 
52d0: 2d 30 30 30 30 0a 40 40 20 2d 32 31 38 36 2c 31  -0000.@@ -2186,1
52e0: 33 20 2b 32 31 38 36 2c 32 31 20 40 40 0a 20 20  3 +2186,21 @@.  
52f0: 20 20 20 74 63 6c 74 65 73 74 3a 3a 74 65 73 74     tcltest::test
5300: 43 6f 6e 73 74 72 61 69 6e 74 20 6c 69 6e 6b 46  Constraint linkF
5310: 69 6c 65 20 30 0a 20 7d 0a 20 0a 2d 74 65 73 74  ile 0. }. .-test
5320: 20 66 43 6d 64 2d 32 38 2e 31 20 7b 74 65 73 74   fCmd-28.1 {test
5330: 66 69 6c 65 6c 69 6e 6b 7d 20 7b 74 65 73 74 66  filelink} {testf
5340: 69 6c 65 6c 69 6e 6b 7d 20 7b 0a 2d 20 20 20 20  ilelink} {.-    
5350: 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 74 65 73  list [catch {tes
5360: 74 66 69 6c 65 6c 69 6e 6b 7d 20 6d 73 67 5d 20  tfilelink} msg] 
5370: 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b 77 72 6f 6e  $msg.-} {1 {wron
5380: 67 20 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64  g # args: should
5390: 20 62 65 20 22 74 65 73 74 66 69 6c 65 6c 69 6e   be "testfilelin
53a0: 6b 20 73 6f 75 72 63 65 20 3f 74 61 72 67 65 74  k source ?target
53b0: 3f 22 7d 7d 0a 2d 0a 2d 74 65 73 74 20 66 43 6d  ?"}}.-.-test fCm
53c0: 64 2d 32 38 2e 32 20 7b 74 65 73 74 66 69 6c 65  d-28.2 {testfile
53d0: 6c 69 6e 6b 7d 20 7b 74 65 73 74 66 69 6c 65 6c  link} {testfilel
53e0: 69 6e 6b 7d 20 7b 0a 2d 20 20 20 20 6c 69 73 74  ink} {.-    list
53f0: 20 5b 63 61 74 63 68 20 7b 74 65 73 74 66 69 6c   [catch {testfil
5400: 65 6c 69 6e 6b 20 61 20 62 20 63 20 64 7d 20 6d  elink a b c d} m
5410: 73 67 5d 20 24 6d 73 67 0a 2d 7d 20 7b 31 20 7b  sg] $msg.-} {1 {
5420: 77 72 6f 6e 67 20 23 20 61 72 67 73 3a 20 73 68  wrong # args: sh
5430: 6f 75 6c 64 20 62 65 20 22 74 65 73 74 66 69 6c  ould be "testfil
5440: 65 6c 69 6e 6b 20 73 6f 75 72 63 65 20 3f 74 61  elink source ?ta
5450: 72 67 65 74 3f 22 7d 7d 0a 2b 74 65 73 74 20 66  rget?"}}.+test f
5460: 43 6d 64 2d 32 38 2e 31 20 7b 66 69 6c 65 20 6c  Cmd-28.1 {file l
5470: 69 6e 6b 7d 20 7b 74 65 73 74 66 69 6c 65 6c 69  ink} {testfileli
5480: 6e 6b 7d 20 7b 0a 2b 20 20 20 20 6c 69 73 74 20  nk} {.+    list 
5490: 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 6c 69 6e  [catch {file lin
54a0: 6b 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 2b 7d 20  k} msg] $msg.+} 
54b0: 7b 31 20 7b 77 72 6f 6e 67 20 23 20 61 72 67 73  {1 {wrong # args
54c0: 3a 20 73 68 6f 75 6c 64 20 62 65 20 22 66 69 6c  : should be "fil
54d0: 65 20 6c 69 6e 6b 20 3f 2d 6c 69 6e 6b 74 79 70  e link ?-linktyp
54e0: 65 3f 20 73 6f 75 72 63 65 20 3f 74 61 72 67 65  e? source ?targe
54f0: 74 3f 22 7d 7d 0a 2b 0a 2b 74 65 73 74 20 66 43  t?"}}.+.+test fC
5500: 6d 64 2d 32 38 2e 32 20 7b 66 69 6c 65 20 6c 69  md-28.2 {file li
5510: 6e 6b 7d 20 7b 74 65 73 74 66 69 6c 65 6c 69 6e  nk} {testfilelin
5520: 6b 7d 20 7b 0a 2b 20 20 20 20 6c 69 73 74 20 5b  k} {.+    list [
5530: 63 61 74 63 68 20 7b 66 69 6c 65 20 6c 69 6e 6b  catch {file link
5540: 20 61 20 62 20 63 20 64 7d 20 6d 73 67 5d 20 24   a b c d} msg] $
5550: 6d 73 67 0a 2b 7d 20 7b 31 20 7b 77 72 6f 6e 67  msg.+} {1 {wrong
5560: 20 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 20   # args: should 
5570: 62 65 20 22 66 69 6c 65 20 6c 69 6e 6b 20 3f 2d  be "file link ?-
5580: 6c 69 6e 6b 74 79 70 65 3f 20 73 6f 75 72 63 65  linktype? source
5590: 20 3f 74 61 72 67 65 74 3f 22 7d 7d 0a 2b 0a 2b   ?target?"}}.+.+
55a0: 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 33 20 7b  test fCmd-28.3 {
55b0: 66 69 6c 65 20 6c 69 6e 6b 7d 20 7b 74 65 73 74  file link} {test
55c0: 66 69 6c 65 6c 69 6e 6b 7d 20 7b 0a 2b 20 20 20  filelink} {.+   
55d0: 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 66 69   list [catch {fi
55e0: 6c 65 20 6c 69 6e 6b 20 61 62 63 20 62 20 63 7d  le link abc b c}
55f0: 20 6d 73 67 5d 20 24 6d 73 67 0a 2b 7d 20 7b 31   msg] $msg.+} {1
5600: 20 7b 62 61 64 20 73 77 69 74 63 68 20 22 61 62   {bad switch "ab
5610: 63 22 3a 20 6d 75 73 74 20 62 65 20 2d 73 79 6d  c": must be -sym
5620: 62 6f 6c 69 63 20 6f 72 20 2d 68 61 72 64 7d 7d  bolic or -hard}}
5630: 0a 2b 0a 2b 74 65 73 74 20 66 43 6d 64 2d 32 38  .+.+test fCmd-28
5640: 2e 34 20 7b 66 69 6c 65 20 6c 69 6e 6b 7d 20 7b  .4 {file link} {
5650: 74 65 73 74 66 69 6c 65 6c 69 6e 6b 7d 20 7b 0a  testfilelink} {.
5660: 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68  +    list [catch
5670: 20 7b 66 69 6c 65 20 6c 69 6e 6b 20 2d 61 62 63   {file link -abc
5680: 20 62 20 63 7d 20 6d 73 67 5d 20 24 6d 73 67 0a   b c} msg] $msg.
5690: 2b 7d 20 7b 31 20 7b 62 61 64 20 73 77 69 74 63  +} {1 {bad switc
56a0: 68 20 22 2d 61 62 63 22 3a 20 6d 75 73 74 20 62  h "-abc": must b
56b0: 65 20 2d 73 79 6d 62 6f 6c 69 63 20 6f 72 20 2d  e -symbolic or -
56c0: 68 61 72 64 7d 7d 0a 20 0a 20 63 61 74 63 68 20  hard}}. . catch 
56d0: 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 2d 66 6f  {file delete -fo
56e0: 72 63 65 20 61 62 63 2e 64 69 72 7d 0a 20 63 61  rce abc.dir}. ca
56f0: 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 65  tch {file delete
5700: 20 2d 66 6f 72 63 65 20 61 62 63 32 2e 64 69 72   -force abc2.dir
5710: 7d 0a 40 40 20 2d 32 32 30 31 2c 34 36 20 2b 32  }.@@ -2201,46 +2
5720: 32 30 39 2c 37 34 20 40 40 0a 20 6d 61 6b 65 46  209,74 @@. makeF
5730: 69 6c 65 20 63 6f 6e 74 65 6e 74 73 20 61 62 63  ile contents abc
5740: 2e 66 69 6c 65 0a 20 6d 61 6b 65 46 69 6c 65 20  .file. makeFile 
5750: 63 6f 6e 74 65 6e 74 73 20 61 62 63 32 2e 66 69  contents abc2.fi
5760: 6c 65 0a 20 0a 2d 74 65 73 74 20 66 43 6d 64 2d  le. .-test fCmd-
5770: 32 38 2e 33 20 7b 74 65 73 74 66 69 6c 65 6c 69  28.3 {testfileli
5780: 6e 6b 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74 6f  nk} {linkDirecto
5790: 72 79 20 77 69 6e 4f 6e 6c 79 7d 20 7b 0a 2d 20  ry winOnly} {.- 
57a0: 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b     list [catch {
57b0: 74 65 73 74 66 69 6c 65 6c 69 6e 6b 20 61 62 63  testfilelink abc
57c0: 2e 64 69 72 20 61 62 63 32 2e 64 69 72 7d 20 6d  .dir abc2.dir} m
57d0: 73 67 5d 20 24 6d 73 67 0a 2b 74 65 73 74 20 66  sg] $msg.+test f
57e0: 43 6d 64 2d 32 38 2e 35 20 7b 66 69 6c 65 20 6c  Cmd-28.5 {file l
57f0: 69 6e 6b 3a 20 73 6f 75 72 63 65 20 61 6c 72 65  ink: source alre
5800: 61 64 79 20 65 78 69 73 74 73 7d 20 7b 6c 69 6e  ady exists} {lin
5810: 6b 44 69 72 65 63 74 6f 72 79 7d 20 7b 0a 2b 20  kDirectory} {.+ 
5820: 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b     list [catch {
5830: 66 69 6c 65 20 6c 69 6e 6b 20 61 62 63 2e 64 69  file link abc.di
5840: 72 20 61 62 63 32 2e 64 69 72 7d 20 6d 73 67 5d  r abc2.dir} msg]
5850: 20 24 6d 73 67 0a 20 7d 20 7b 31 20 7b 63 6f 75   $msg. } {1 {cou
5860: 6c 64 20 6e 6f 74 20 63 72 65 61 74 65 20 6c 69  ld not create li
5870: 6e 6b 20 66 72 6f 6d 20 22 61 62 63 2e 64 69 72  nk from "abc.dir
5880: 22 20 74 6f 20 22 61 62 63 32 2e 64 69 72 22 3a  " to "abc2.dir":
5890: 20 66 69 6c 65 20 61 6c 72 65 61 64 79 20 65 78   file already ex
58a0: 69 73 74 73 7d 7d 0a 20 0a 2d 74 65 73 74 20 66  ists}}. .-test f
58b0: 43 6d 64 2d 32 38 2e 34 20 7b 74 65 73 74 66 69  Cmd-28.4 {testfi
58c0: 6c 65 6c 69 6e 6b 7d 20 7b 6c 69 6e 6b 46 69 6c  lelink} {linkFil
58d0: 65 20 77 69 6e 4f 6e 6c 79 7d 20 7b 0a 2d 20 20  e winOnly} {.-  
58e0: 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 74    list [catch {t
58f0: 65 73 74 66 69 6c 65 6c 69 6e 6b 20 61 62 63 2e  estfilelink abc.
5900: 66 69 6c 65 20 61 62 63 32 2e 66 69 6c 65 7d 20  file abc2.file} 
5910: 6d 73 67 5d 20 24 6d 73 67 0a 2b 74 65 73 74 20  msg] $msg.+test 
5920: 66 43 6d 64 2d 32 38 2e 36 20 7b 66 69 6c 65 20  fCmd-28.6 {file 
5930: 6c 69 6e 6b 3a 20 75 6e 73 75 70 70 6f 72 74 65  link: unsupporte
5940: 64 20 6f 70 65 72 61 74 69 6f 6e 7d 20 7b 6c 69  d operation} {li
5950: 6e 6b 44 69 72 65 63 74 6f 72 79 20 6d 61 63 4f  nkDirectory macO
5960: 72 57 69 6e 7d 20 7b 0a 2b 20 20 20 20 6c 69 73  rWin} {.+    lis
5970: 74 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 6c  t [catch {file l
5980: 69 6e 6b 20 2d 68 61 72 64 20 61 62 63 2e 6c 69  ink -hard abc.li
5990: 6e 6b 20 61 62 63 2e 64 69 72 7d 20 6d 73 67 5d  nk abc.dir} msg]
59a0: 20 24 6d 73 67 0a 2b 7d 20 7b 31 20 7b 63 6f 75   $msg.+} {1 {cou
59b0: 6c 64 20 6e 6f 74 20 63 72 65 61 74 65 20 6c 69  ld not create li
59c0: 6e 6b 20 66 72 6f 6d 20 22 61 62 63 2e 6c 69 6e  nk from "abc.lin
59d0: 6b 22 20 74 6f 20 22 61 62 63 2e 64 69 72 22 3a  k" to "abc.dir":
59e0: 20 69 6c 6c 65 67 61 6c 20 6f 70 65 72 61 74 69   illegal operati
59f0: 6f 6e 20 6f 6e 20 61 20 64 69 72 65 63 74 6f 72  on on a director
5a00: 79 7d 7d 0a 2b 0a 2b 74 65 73 74 20 66 43 6d 64  y}}.+.+test fCmd
5a10: 2d 32 38 2e 37 20 7b 66 69 6c 65 20 6c 69 6e 6b  -28.7 {file link
5a20: 3a 20 73 6f 75 72 63 65 20 61 6c 72 65 61 64 79  : source already
5a30: 20 65 78 69 73 74 73 7d 20 7b 6c 69 6e 6b 46 69   exists} {linkFi
5a40: 6c 65 7d 20 7b 0a 2b 20 20 20 20 6c 69 73 74 20  le} {.+    list 
5a50: 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 6c 69 6e  [catch {file lin
5a60: 6b 20 61 62 63 2e 66 69 6c 65 20 61 62 63 32 2e  k abc.file abc2.
5a70: 66 69 6c 65 7d 20 6d 73 67 5d 20 24 6d 73 67 0a  file} msg] $msg.
5a80: 20 7d 20 7b 31 20 7b 63 6f 75 6c 64 20 6e 6f 74   } {1 {could not
5a90: 20 63 72 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f   create link fro
5aa0: 6d 20 22 61 62 63 2e 66 69 6c 65 22 20 74 6f 20  m "abc.file" to 
5ab0: 22 61 62 63 32 2e 66 69 6c 65 22 3a 20 66 69 6c  "abc2.file": fil
5ac0: 65 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 73  e already exists
5ad0: 7d 7d 0a 20 0a 2d 74 65 73 74 20 66 43 6d 64 2d  }}. .-test fCmd-
5ae0: 32 38 2e 35 20 7b 74 65 73 74 66 69 6c 65 6c 69  28.5 {testfileli
5af0: 6e 6b 7d 20 7b 6c 69 6e 6b 46 69 6c 65 20 77 69  nk} {linkFile wi
5b00: 6e 4f 6e 6c 79 7d 20 7b 0a 2b 74 65 73 74 20 66  nOnly} {.+test f
5b10: 43 6d 64 2d 32 38 2e 38 20 7b 66 69 6c 65 20 6c  Cmd-28.8 {file l
5b20: 69 6e 6b 7d 20 7b 6c 69 6e 6b 46 69 6c 65 20 77  ink} {linkFile w
5b30: 69 6e 4f 6e 6c 79 7d 20 7b 0a 2b 20 20 20 20 6c  inOnly} {.+    l
5b40: 69 73 74 20 5b 63 61 74 63 68 20 7b 66 69 6c 65  ist [catch {file
5b50: 20 6c 69 6e 6b 20 2d 73 79 6d 62 6f 6c 69 63 20   link -symbolic 
5b60: 61 62 63 2e 6c 69 6e 6b 20 61 62 63 2e 66 69 6c  abc.link abc.fil
5b70: 65 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 2b 7d 20  e} msg] $msg.+} 
5b80: 7b 31 20 7b 63 6f 75 6c 64 20 6e 6f 74 20 63 72  {1 {could not cr
5b90: 65 61 74 65 20 6c 69 6e 6b 20 66 72 6f 6d 20 22  eate link from "
5ba0: 61 62 63 2e 6c 69 6e 6b 22 20 74 6f 20 22 61 62  abc.link" to "ab
5bb0: 63 2e 66 69 6c 65 22 3a 20 6e 6f 74 20 61 20 64  c.file": not a d
5bc0: 69 72 65 63 74 6f 72 79 7d 7d 0a 2b 0a 2b 74 65  irectory}}.+.+te
5bd0: 73 74 20 66 43 6d 64 2d 32 38 2e 39 20 7b 66 69  st fCmd-28.9 {fi
5be0: 6c 65 20 6c 69 6e 6b 3a 20 73 75 63 63 65 73 73  le link: success
5bf0: 20 77 69 74 68 20 66 69 6c 65 7d 20 7b 6c 69 6e   with file} {lin
5c00: 6b 46 69 6c 65 7d 20 7b 0a 20 20 20 20 20 66 69  kFile} {.     fi
5c10: 6c 65 20 64 65 6c 65 74 65 20 2d 66 6f 72 63 65  le delete -force
5c20: 20 61 62 63 2e 6c 69 6e 6b 0a 2d 20 20 20 20 6c   abc.link.-    l
5c30: 69 73 74 20 5b 63 61 74 63 68 20 7b 74 65 73 74  ist [catch {test
5c40: 66 69 6c 65 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e  filelink abc.lin
5c50: 6b 20 61 62 63 2e 66 69 6c 65 7d 20 6d 73 67 5d  k abc.file} msg]
5c60: 20 24 6d 73 67 0a 2b 20 20 20 20 6c 69 73 74 20   $msg.+    list 
5c70: 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 6c 69 6e  [catch {file lin
5c80: 6b 20 61 62 63 2e 6c 69 6e 6b 20 61 62 63 2e 66  k abc.link abc.f
5c90: 69 6c 65 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 20  ile} msg] $msg. 
5ca0: 7d 20 7b 30 20 61 62 63 2e 66 69 6c 65 7d 0a 20  } {0 abc.file}. 
5cb0: 0a 20 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65  . catch {file de
5cc0: 6c 65 74 65 20 2d 66 6f 72 63 65 20 61 62 63 2e  lete -force abc.
5cd0: 6c 69 6e 6b 7d 0a 20 0a 2d 74 65 73 74 20 66 43  link}. .-test fC
5ce0: 6d 64 2d 32 38 2e 36 20 7b 74 65 73 74 66 69 6c  md-28.6 {testfil
5cf0: 65 6c 69 6e 6b 7d 20 7b 6c 69 6e 6b 44 69 72 65  elink} {linkDire
5d00: 63 74 6f 72 79 20 77 69 6e 4f 6e 6c 79 7d 20 7b  ctory winOnly} {
5d10: 0a 2b 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 31  .+test fCmd-28.1
5d20: 30 20 7b 66 69 6c 65 20 6c 69 6e 6b 3a 20 6c 69  0 {file link: li
5d30: 6e 6b 69 6e 67 20 74 6f 20 6e 6f 6e 65 78 69 73  nking to nonexis
5d40: 74 65 6e 74 20 70 61 74 68 7d 20 7b 6c 69 6e 6b  tent path} {link
5d50: 44 69 72 65 63 74 6f 72 79 7d 20 7b 0a 20 20 20  Directory} {.   
5d60: 20 20 66 69 6c 65 20 64 65 6c 65 74 65 20 2d 66    file delete -f
5d70: 6f 72 63 65 20 61 62 63 2e 6c 69 6e 6b 0a 2d 20  orce abc.link.- 
5d80: 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b     list [catch {
5d90: 74 65 73 74 66 69 6c 65 6c 69 6e 6b 20 61 62 63  testfilelink abc
5da0: 2e 6c 69 6e 6b 20 61 62 63 32 2e 64 6f 65 73 6e  .link abc2.doesn
5db0: 74 7d 20 6d 73 67 5d 20 24 6d 73 67 0a 2b 20 20  t} msg] $msg.+  
5dc0: 20 20 6c 69 73 74 20 5b 63 61 74 63 68 20 7b 66    list [catch {f
5dd0: 69 6c 65 20 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e  ile link abc.lin
5de0: 6b 20 61 62 63 32 2e 64 6f 65 73 6e 74 7d 20 6d  k abc2.doesnt} m
5df0: 73 67 5d 20 24 6d 73 67 0a 20 7d 20 7b 31 20 7b  sg] $msg. } {1 {
5e00: 63 6f 75 6c 64 20 6e 6f 74 20 63 72 65 61 74 65  could not create
5e10: 20 6c 69 6e 6b 20 66 72 6f 6d 20 22 61 62 63 2e   link from "abc.
5e20: 6c 69 6e 6b 22 20 74 6f 20 22 61 62 63 32 2e 64  link" to "abc2.d
5e30: 6f 65 73 6e 74 22 3a 20 6e 6f 20 73 75 63 68 20  oesnt": no such 
5e40: 66 69 6c 65 20 6f 72 20 64 69 72 65 63 74 6f 72  file or director
5e50: 79 7d 7d 0a 20 0a 2d 74 65 73 74 20 66 43 6d 64  y}}. .-test fCmd
5e60: 2d 32 38 2e 37 20 7b 74 65 73 74 66 69 6c 65 6c  -28.7 {testfilel
5e70: 69 6e 6b 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74  ink} {linkDirect
5e80: 6f 72 79 20 77 69 6e 4f 6e 6c 79 7d 20 7b 0a 2b  ory winOnly} {.+
5e90: 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 31 31 20  test fCmd-28.11 
5ea0: 7b 66 69 6c 65 20 6c 69 6e 6b 3a 20 73 75 63 63  {file link: succ
5eb0: 65 73 73 20 77 69 74 68 20 64 69 72 65 63 74 6f  ess with directo
5ec0: 72 79 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74 6f  ry} {linkDirecto
5ed0: 72 79 7d 20 7b 0a 20 20 20 20 20 66 69 6c 65 20  ry} {.     file 
5ee0: 64 65 6c 65 74 65 20 2d 66 6f 72 63 65 20 61 62  delete -force ab
5ef0: 63 2e 6c 69 6e 6b 0a 2d 20 20 20 20 6c 69 73 74  c.link.-    list
5f00: 20 5b 63 61 74 63 68 20 7b 74 65 73 74 66 69 6c   [catch {testfil
5f10: 65 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20 61  elink abc.link a
5f20: 62 63 2e 64 69 72 7d 20 6d 73 67 5d 20 24 6d 73  bc.dir} msg] $ms
5f30: 67 0a 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74  g.+    list [cat
5f40: 63 68 20 7b 66 69 6c 65 20 6c 69 6e 6b 20 61 62  ch {file link ab
5f50: 63 2e 6c 69 6e 6b 20 61 62 63 2e 64 69 72 7d 20  c.link abc.dir} 
5f60: 6d 73 67 5d 20 24 6d 73 67 0a 20 7d 20 7b 30 20  msg] $msg. } {0 
5f70: 61 62 63 2e 64 69 72 7d 0a 20 0a 2d 74 65 73 74  abc.dir}. .-test
5f80: 20 66 43 6d 64 2d 32 38 2e 37 2e 31 20 7b 74 65   fCmd-28.7.1 {te
5f90: 73 74 66 69 6c 65 6c 69 6e 6b 7d 20 7b 6c 69 6e  stfilelink} {lin
5fa0: 6b 44 69 72 65 63 74 6f 72 79 20 77 69 6e 4f 6e  kDirectory winOn
5fb0: 6c 79 7d 20 7b 0a 2b 74 65 73 74 20 66 43 6d 64  ly} {.+test fCmd
5fc0: 2d 32 38 2e 31 32 20 7b 66 69 6c 65 20 6c 69 6e  -28.12 {file lin
5fd0: 6b 3a 20 63 64 20 69 6e 74 6f 20 61 20 6c 69 6e  k: cd into a lin
5fe0: 6b 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74 6f 72  k} {linkDirector
5ff0: 79 7d 20 7b 0a 2b 20 20 20 20 66 69 6c 65 20 64  y} {.+    file d
6000: 65 6c 65 74 65 20 2d 66 6f 72 63 65 20 61 62 63  elete -force abc
6010: 2e 6c 69 6e 6b 0a 2b 20 20 20 20 66 69 6c 65 20  .link.+    file 
6020: 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20 61 62  link abc.link ab
6030: 63 2e 64 69 72 0a 2b 20 20 20 20 73 65 74 20 6f  c.dir.+    set o
6040: 72 69 67 20 5b 70 77 64 5d 0a 2b 20 20 20 20 63  rig [pwd].+    c
6050: 64 20 61 62 63 2e 6c 69 6e 6b 0a 2b 20 20 20 20  d abc.link.+    
6060: 73 65 74 20 64 69 72 20 5b 70 77 64 5d 0a 2b 20  set dir [pwd].+ 
6070: 20 20 20 63 64 20 2e 2e 0a 2b 20 20 20 20 73 65     cd ...+    se
6080: 74 20 75 70 20 5b 70 77 64 5d 0a 2b 20 20 20 20  t up [pwd].+    
6090: 63 64 20 24 6f 72 69 67 0a 2b 20 20 20 20 23 20  cd $orig.+    # 
60a0: 6e 6f 77 20 27 24 75 70 27 20 73 68 6f 75 6c 64  now '$up' should
60b0: 20 62 65 20 65 69 74 68 65 72 20 24 6f 72 69 67   be either $orig
60c0: 20 6f 72 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d   or [file dirnam
60d0: 65 20 61 62 63 2e 64 69 72 5d 0a 2b 20 20 20 20  e abc.dir].+    
60e0: 23 20 28 6f 6e 20 77 69 6e 64 6f 77 73 20 74 68  # (on windows th
60f0: 65 20 66 6f 72 6d 65 72 2c 20 6f 6e 20 75 6e 69  e former, on uni
6100: 78 20 74 68 65 20 6c 61 74 74 65 72 2c 20 49 20  x the latter, I 
6110: 62 65 6c 69 65 76 65 29 0a 2b 20 20 20 20 69 66  believe).+    if
6120: 20 7b 28 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69   {([file normali
6130: 7a 65 20 24 75 70 5d 20 21 3d 20 5b 66 69 6c 65  ze $up] != [file
6140: 20 6e 6f 72 6d 61 6c 69 7a 65 20 24 6f 72 69 67   normalize $orig
6150: 5d 29 20 5c 0a 2b 20 20 20 20 20 20 26 26 20 28  ]) \.+      && (
6160: 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20  [file normalize 
6170: 24 75 70 5d 20 21 3d 20 5b 66 69 6c 65 20 6e 6f  $up] != [file no
6180: 72 6d 61 6c 69 7a 65 20 5b 66 69 6c 65 20 64 69  rmalize [file di
6190: 72 6e 61 6d 65 20 61 62 63 2e 64 69 72 5d 5d 29  rname abc.dir]])
61a0: 7d 20 7b 0a 2b 09 73 65 74 20 72 65 73 20 22 77  } {.+.set res "w
61b0: 72 6f 6e 67 20 64 69 72 65 63 74 6f 72 79 20 77  rong directory w
61c0: 69 74 68 20 27 63 64 20 24 6c 69 6e 6b 20 3b 20  ith 'cd $link ; 
61d0: 63 64 20 2e 2e 27 22 0a 2b 20 20 20 20 7d 20 65  cd ..'".+    } e
61e0: 6c 73 65 20 7b 0a 2b 09 73 65 74 20 72 65 73 20  lse {.+.set res 
61f0: 22 6f 6b 22 0a 2b 20 20 20 20 7d 0a 2b 20 20 20  "ok".+    }.+   
6200: 20 73 65 74 20 72 65 73 0a 2b 7d 20 7b 6f 6b 7d   set res.+} {ok}
6210: 0a 2b 0a 2b 74 65 73 74 20 66 43 6d 64 2d 32 38  .+.+test fCmd-28
6220: 2e 31 33 20 7b 66 69 6c 65 20 6c 69 6e 6b 7d 20  .13 {file link} 
6230: 7b 6c 69 6e 6b 44 69 72 65 63 74 6f 72 79 7d 20  {linkDirectory} 
6240: 7b 0a 20 20 20 20 20 23 20 64 75 70 6c 69 63 61  {.     # duplica
6250: 74 65 20 6c 69 6e 6b 20 74 68 72 6f 77 73 20 65  te link throws e
6260: 72 72 6f 72 0a 2d 20 20 20 20 6c 69 73 74 20 5b  rror.-    list [
6270: 63 61 74 63 68 20 7b 74 65 73 74 66 69 6c 65 6c  catch {testfilel
6280: 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20 61 62 63  ink abc.link abc
6290: 2e 64 69 72 7d 20 6d 73 67 5d 20 24 6d 73 67 0a  .dir} msg] $msg.
62a0: 2b 20 20 20 20 6c 69 73 74 20 5b 63 61 74 63 68  +    list [catch
62b0: 20 7b 66 69 6c 65 20 6c 69 6e 6b 20 61 62 63 2e   {file link abc.
62c0: 6c 69 6e 6b 20 61 62 63 2e 64 69 72 7d 20 6d 73  link abc.dir} ms
62d0: 67 5d 20 24 6d 73 67 0a 20 7d 20 7b 31 20 7b 63  g] $msg. } {1 {c
62e0: 6f 75 6c 64 20 6e 6f 74 20 63 72 65 61 74 65 20  ould not create 
62f0: 6c 69 6e 6b 20 66 72 6f 6d 20 22 61 62 63 2e 6c  link from "abc.l
6300: 69 6e 6b 22 20 74 6f 20 22 61 62 63 2e 64 69 72  ink" to "abc.dir
6310: 22 3a 20 66 69 6c 65 20 61 6c 72 65 61 64 79 20  ": file already 
6320: 65 78 69 73 74 73 7d 7d 0a 20 0a 2d 74 65 73 74  exists}}. .-test
6330: 20 66 43 6d 64 2d 32 38 2e 38 20 7b 74 65 73 74   fCmd-28.8 {test
6340: 66 69 6c 65 6c 69 6e 6b 3a 20 64 65 6c 65 74 65  filelink: delete
6350: 73 20 6c 69 6e 6b 20 6e 6f 74 20 64 69 72 7d 20  s link not dir} 
6360: 7b 6c 69 6e 6b 44 69 72 65 63 74 6f 72 79 20 77  {linkDirectory w
6370: 69 6e 4f 6e 6c 79 7d 20 7b 0a 2b 74 65 73 74 20  inOnly} {.+test 
6380: 66 43 6d 64 2d 32 38 2e 31 34 20 7b 66 69 6c 65  fCmd-28.14 {file
6390: 20 6c 69 6e 6b 3a 20 64 65 6c 65 74 65 73 20 6c   link: deletes l
63a0: 69 6e 6b 20 6e 6f 74 20 64 69 72 7d 20 7b 6c 69  ink not dir} {li
63b0: 6e 6b 44 69 72 65 63 74 6f 72 79 7d 20 7b 0a 20  nkDirectory} {. 
63c0: 20 20 20 20 66 69 6c 65 20 64 65 6c 65 74 65 20      file delete 
63d0: 2d 66 6f 72 63 65 20 61 62 63 2e 6c 69 6e 6b 0a  -force abc.link.
63e0: 20 20 20 20 20 6c 69 73 74 20 5b 66 69 6c 65 20       list [file 
63f0: 65 78 69 73 74 73 20 61 62 63 2e 6c 69 6e 6b 5d  exists abc.link]
6400: 20 5b 66 69 6c 65 20 65 78 69 73 74 73 20 61 62   [file exists ab
6410: 63 2e 64 69 72 5d 0a 20 7d 20 7b 30 20 31 7d 0a  c.dir]. } {0 1}.
6420: 20 0a 2d 74 65 73 74 20 66 43 6d 64 2d 32 38 2e   .-test fCmd-28.
6430: 39 20 7b 74 65 73 74 66 69 6c 65 6c 69 6e 6b 3a  9 {testfilelink:
6440: 20 63 6f 70 69 65 73 20 6c 69 6e 6b 20 6e 6f 74   copies link not
6450: 20 64 69 72 7d 20 7b 6c 69 6e 6b 44 69 72 65 63   dir} {linkDirec
6460: 74 6f 72 79 20 77 69 6e 4f 6e 6c 79 7d 20 7b 0a  tory winOnly} {.
6470: 2b 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 31 35  +test fCmd-28.15
6480: 20 7b 66 69 6c 65 20 6c 69 6e 6b 3a 20 63 6f 70   {file link: cop
6490: 69 65 73 20 6c 69 6e 6b 20 6e 6f 74 20 64 69 72  ies link not dir
64a0: 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74 6f 72 79  } {linkDirectory
64b0: 7d 20 7b 0a 20 20 20 20 20 66 69 6c 65 20 64 65  } {.     file de
64c0: 6c 65 74 65 20 2d 66 6f 72 63 65 20 61 62 63 2e  lete -force abc.
64d0: 6c 69 6e 6b 0a 2d 20 20 20 20 74 65 73 74 66 69  link.-    testfi
64e0: 6c 65 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20  lelink abc.link 
64f0: 61 62 63 2e 64 69 72 0a 2b 20 20 20 20 66 69 6c  abc.dir.+    fil
6500: 65 20 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20  e link abc.link 
6510: 61 62 63 2e 64 69 72 0a 20 20 20 20 20 66 69 6c  abc.dir.     fil
6520: 65 20 63 6f 70 79 20 61 62 63 2e 6c 69 6e 6b 20  e copy abc.link 
6530: 61 62 63 32 2e 6c 69 6e 6b 0a 2d 20 20 20 20 6c  abc2.link.-    l
6540: 69 73 74 20 5b 66 69 6c 65 20 74 79 70 65 20 61  ist [file type a
6550: 62 63 32 2e 6c 69 6e 6b 5d 20 5b 66 69 6c 65 20  bc2.link] [file 
6560: 74 61 69 6c 20 5b 74 65 73 74 66 69 6c 65 6c 69  tail [testfileli
6570: 6e 6b 20 61 62 63 32 2e 6c 69 6e 6b 5d 5d 0a 2b  nk abc2.link]].+
6580: 20 20 20 20 6c 69 73 74 20 5b 66 69 6c 65 20 74      list [file t
6590: 79 70 65 20 61 62 63 32 2e 6c 69 6e 6b 5d 20 5b  ype abc2.link] [
65a0: 66 69 6c 65 20 74 61 69 6c 20 5b 66 69 6c 65 20  file tail [file 
65b0: 6c 69 6e 6b 20 61 62 63 32 2e 6c 69 6e 6b 5d 5d  link abc2.link]]
65c0: 0a 20 7d 20 7b 6c 69 6e 6b 20 61 62 63 2e 64 69  . } {link abc.di
65d0: 72 7d 0a 20 0a 20 66 69 6c 65 20 64 65 6c 65 74  r}. . file delet
65e0: 65 20 2d 66 6f 72 63 65 20 61 62 63 2e 6c 69 6e  e -force abc.lin
65f0: 6b 0a 40 40 20 2d 32 32 34 39 2c 31 37 20 2b 32  k.@@ -2249,17 +2
6600: 32 38 35 2c 31 37 20 40 40 0a 20 66 69 6c 65 20  285,17 @@. file 
6610: 63 6f 70 79 20 61 62 63 2e 66 69 6c 65 20 61 62  copy abc.file ab
6620: 63 2e 64 69 72 0a 20 66 69 6c 65 20 63 6f 70 79  c.dir. file copy
6630: 20 61 62 63 32 2e 66 69 6c 65 20 61 62 63 2e 64   abc2.file abc.d
6640: 69 72 0a 20 0a 2d 74 65 73 74 20 66 43 6d 64 2d  ir. .-test fCmd-
6650: 32 38 2e 31 30 20 7b 74 65 73 74 66 69 6c 65 6c  28.10 {testfilel
6660: 69 6e 6b 3a 20 67 6c 6f 62 20 69 6e 73 69 64 65  ink: glob inside
6670: 20 6c 69 6e 6b 7d 20 7b 6c 69 6e 6b 44 69 72 65   link} {linkDire
6680: 63 74 6f 72 79 20 77 69 6e 4f 6e 6c 79 7d 20 7b  ctory winOnly} {
6690: 0a 2b 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 31  .+test fCmd-28.1
66a0: 36 20 7b 66 69 6c 65 20 6c 69 6e 6b 3a 20 67 6c  6 {file link: gl
66b0: 6f 62 20 69 6e 73 69 64 65 20 6c 69 6e 6b 7d 20  ob inside link} 
66c0: 7b 6c 69 6e 6b 44 69 72 65 63 74 6f 72 79 7d 20  {linkDirectory} 
66d0: 7b 0a 20 20 20 20 20 66 69 6c 65 20 64 65 6c 65  {.     file dele
66e0: 74 65 20 2d 66 6f 72 63 65 20 61 62 63 2e 6c 69  te -force abc.li
66f0: 6e 6b 0a 2d 20 20 20 20 74 65 73 74 66 69 6c 65  nk.-    testfile
6700: 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20 61 62  link abc.link ab
6710: 63 2e 64 69 72 0a 2b 20 20 20 20 66 69 6c 65 20  c.dir.+    file 
6720: 6c 69 6e 6b 20 61 62 63 2e 6c 69 6e 6b 20 61 62  link abc.link ab
6730: 63 2e 64 69 72 0a 20 20 20 20 20 67 6c 6f 62 20  c.dir.     glob 
6740: 2d 64 69 72 20 61 62 63 2e 6c 69 6e 6b 20 2d 74  -dir abc.link -t
6750: 61 69 6c 73 20 2a 0a 20 7d 20 7b 61 62 63 2e 66  ails *. } {abc.f
6760: 69 6c 65 20 61 62 63 32 2e 66 69 6c 65 7d 0a 20  ile abc2.file}. 
6770: 0a 2d 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 31  .-test fCmd-28.1
6780: 31 20 7b 74 65 73 74 66 69 6c 65 6c 69 6e 6b 3a  1 {testfilelink:
6790: 20 67 6c 6f 62 20 2d 74 79 70 65 20 6c 7d 20 7b   glob -type l} {
67a0: 6c 69 6e 6b 44 69 72 65 63 74 6f 72 79 20 77 69  linkDirectory wi
67b0: 6e 4f 6e 6c 79 7d 20 7b 0a 2b 74 65 73 74 20 66  nOnly} {.+test f
67c0: 43 6d 64 2d 32 38 2e 31 37 20 7b 66 69 6c 65 20  Cmd-28.17 {file 
67d0: 6c 69 6e 6b 3a 20 67 6c 6f 62 20 2d 74 79 70 65  link: glob -type
67e0: 20 6c 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74 6f   l} {linkDirecto
67f0: 72 79 7d 20 7b 0a 20 20 20 20 20 67 6c 6f 62 20  ry} {.     glob 
6800: 2d 64 69 72 20 5b 70 77 64 5d 20 2d 74 79 70 65  -dir [pwd] -type
6810: 20 6c 20 2d 74 61 69 6c 73 20 61 62 63 2a 0a 20   l -tails abc*. 
6820: 7d 20 7b 61 62 63 2e 6c 69 6e 6b 7d 0a 20 0a 2d  } {abc.link}. .-
6830: 74 65 73 74 20 66 43 6d 64 2d 32 38 2e 31 32 20  test fCmd-28.12 
6840: 7b 74 65 73 74 66 69 6c 65 6c 69 6e 6b 3a 20 67  {testfilelink: g
6850: 6c 6f 62 20 2d 74 79 70 65 20 64 7d 20 7b 6c 69  lob -type d} {li
6860: 6e 6b 44 69 72 65 63 74 6f 72 79 20 77 69 6e 4f  nkDirectory winO
6870: 6e 6c 79 7d 20 7b 0a 2b 74 65 73 74 20 66 43 6d  nly} {.+test fCm
6880: 64 2d 32 38 2e 31 38 20 7b 66 69 6c 65 20 6c 69  d-28.18 {file li
6890: 6e 6b 3a 20 67 6c 6f 62 20 2d 74 79 70 65 20 64  nk: glob -type d
68a0: 7d 20 7b 6c 69 6e 6b 44 69 72 65 63 74 6f 72 79  } {linkDirectory
68b0: 7d 20 7b 0a 20 20 20 20 20 6c 73 6f 72 74 20 5b  } {.     lsort [
68c0: 67 6c 6f 62 20 2d 64 69 72 20 5b 70 77 64 5d 20  glob -dir [pwd] 
68d0: 2d 74 79 70 65 20 64 20 2d 74 61 69 6c 73 20 61  -type d -tails a
68e0: 62 63 2a 5d 0a 20 7d 20 5b 6c 73 6f 72 74 20 5b  bc*]. } [lsort [
68f0: 6c 69 73 74 20 61 62 63 2e 6c 69 6e 6b 20 61 62  list abc.link ab
6900: 63 2e 64 69 72 20 61 62 63 32 2e 64 69 72 5d 5d  c.dir abc2.dir]]
6910: 0a 20 0a 49 6e 64 65 78 3a 20 74 65 73 74 73 2f  . .Index: tests/
6920: 66 69 6c 65 4e 61 6d 65 2e 74 65 73 74 0a 3d 3d  fileName.test.==
6930: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6940: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6950: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
6970: 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 76 73  =.RCS file: /cvs
6980: 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 74 65 73  root/tcl/tcl/tes
6990: 74 73 2f 66 69 6c 65 4e 61 6d 65 2e 74 65 73 74  ts/fileName.test
69a0: 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 65  ,v.retrieving re
69b0: 76 69 73 69 6f 6e 20 31 2e 32 32 0a 64 69 66 66  vision 1.22.diff
69c0: 20 2d 62 20 2d 75 20 2d 72 31 2e 32 32 20 66 69   -b -u -r1.22 fi
69d0: 6c 65 4e 61 6d 65 2e 74 65 73 74 0a 2d 2d 2d 20  leName.test.--- 
69e0: 74 65 73 74 73 2f 66 69 6c 65 4e 61 6d 65 2e 74  tests/fileName.t
69f0: 65 73 74 09 33 30 20 4d 61 79 20 32 30 30 32 20  est.30 May 2002 
6a00: 30 39 3a 32 37 3a 31 31 20 2d 30 30 30 30 09 31  09:27:11 -0000.1
6a10: 2e 32 32 0a 2b 2b 2b 20 74 65 73 74 73 2f 66 69  .22.+++ tests/fi
6a20: 6c 65 4e 61 6d 65 2e 74 65 73 74 09 31 38 20 4a  leName.test.18 J
6a30: 75 6e 20 32 30 30 32 20 31 30 3a 32 33 3a 34 38  un 2002 10:23:48
6a40: 20 2d 30 30 30 30 0a 40 40 20 2d 31 31 37 32 2c   -0000.@@ -1172,
6a50: 31 32 20 2b 31 31 37 32 2c 31 32 20 40 40 0a 20  12 +1172,12 @@. 
6a60: 09 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 67 6c 6f  .[file join $glo
6a70: 62 6e 61 6d 65 20 78 2c 7a 31 2e 63 5d 5c 0a 20  bname x,z1.c]\. 
6a80: 09 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 67 6c 6f  .[file join $glo
6a90: 62 6e 61 6d 65 20 78 31 2e 63 5d 5c 0a 20 09 5b  bname x1.c]\. .[
6aa0: 66 69 6c 65 20 6a 6f 69 6e 20 24 67 6c 6f 62 6e  file join $globn
6ab0: 61 6d 65 20 79 31 2e 63 5d 20 5b 66 69 6c 65 20  ame y1.c] [file 
6ac0: 6a 6f 69 6e 20 24 67 6c 6f 62 6e 61 6d 65 20 7a  join $globname z
6ad0: 31 2e 63 5d 5d 5d 5d 0a 2d 74 65 73 74 20 66 69  1.c]]]].-test fi
6ae0: 6c 65 6e 61 6d 65 2d 31 31 2e 31 37 2e 32 20 7b  lename-11.17.2 {
6af0: 54 63 6c 5f 47 6c 6f 62 43 6d 64 7d 20 7b 75 6e  Tcl_GlobCmd} {un
6b00: 69 78 4f 6e 6c 79 20 6e 6f 74 52 6f 6f 74 7d 20  ixOnly notRoot} 
6b10: 7b 0a 2b 74 65 73 74 20 66 69 6c 65 6e 61 6d 65  {.+test filename
6b20: 2d 31 31 2e 31 37 2e 32 20 7b 54 63 6c 5f 47 6c  -11.17.2 {Tcl_Gl
6b30: 6f 62 43 6d 64 7d 20 7b 6e 6f 74 52 6f 6f 74 7d  obCmd} {notRoot}
6b40: 20 7b 0a 20 20 20 20 20 73 65 74 20 64 69 72 20   {.     set dir 
6b50: 5b 70 77 64 5d 0a 20 20 20 20 20 73 65 74 20 72  [pwd].     set r
6b60: 65 74 20 22 65 72 72 6f 72 20 69 6e 20 74 65 73  et "error in tes
6b70: 74 22 0a 20 20 20 20 20 69 66 20 7b 5b 63 61 74  t".     if {[cat
6b80: 63 68 20 7b 0a 20 09 63 64 20 24 67 6c 6f 62 6e  ch {. .cd $globn
6b90: 61 6d 65 0a 2d 09 65 78 65 63 20 6c 6e 20 2d 73  ame.-.exec ln -s
6ba0: 20 61 31 20 6c 69 6e 6b 0a 2b 09 66 69 6c 65 20   a1 link.+.file 
6bb0: 6c 69 6e 6b 20 2d 73 79 6d 62 6f 6c 69 63 20 6c  link -symbolic l
6bc0: 69 6e 6b 20 61 31 0a 20 09 63 64 20 24 64 69 72  ink a1. .cd $dir
6bd0: 0a 20 09 73 65 74 20 72 65 74 20 5b 6c 69 73 74  . .set ret [list
6be0: 20 5b 63 61 74 63 68 20 7b 0a 20 09 20 20 20 20   [catch {. .    
6bf0: 6c 73 6f 72 74 20 5b 67 6c 6f 62 20 2d 64 69 72  lsort [glob -dir
6c00: 65 63 74 6f 72 79 20 24 67 6c 6f 62 6e 61 6d 65  ectory $globname
6c10: 20 2d 6a 6f 69 6e 20 2a 20 62 31 5d 0a 40 40 20   -join * b1].@@ 
6c20: 2d 31 31 39 30 2c 31 32 20 2b 31 31 39 30 2c 31  -1190,12 +1190,1
6c30: 32 20 40 40 0a 20 7d 20 5b 6c 69 73 74 20 30 20  2 @@. } [list 0 
6c40: 5b 6c 73 6f 72 74 20 5b 6c 69 73 74 20 5b 66 69  [lsort [list [fi
6c50: 6c 65 20 6a 6f 69 6e 20 24 67 6c 6f 62 6e 61 6d  le join $globnam
6c60: 65 20 61 31 20 62 31 5d 20 5c 0a 20 20 20 5b 66  e a1 b1] \.   [f
6c70: 69 6c 65 20 6a 6f 69 6e 20 24 67 6c 6f 62 6e 61  ile join $globna
6c80: 6d 65 20 6c 69 6e 6b 20 62 31 5d 5d 5d 5d 0a 20  me link b1]]]]. 
6c90: 23 20 53 69 6d 70 6c 65 72 20 76 65 72 73 69 6f  # Simpler versio
6ca0: 6e 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 74  n of the above t
6cb0: 65 73 74 20 74 6f 20 69 6c 6c 75 73 74 72 61 74  est to illustrat
6cc0: 65 20 61 20 67 69 76 65 6e 20 62 75 67 2e 0a 2d  e a given bug..-
6cd0: 74 65 73 74 20 66 69 6c 65 6e 61 6d 65 2d 31 31  test filename-11
6ce0: 2e 31 37 2e 33 20 7b 54 63 6c 5f 47 6c 6f 62 43  .17.3 {Tcl_GlobC
6cf0: 6d 64 7d 20 7b 75 6e 69 78 4f 6e 6c 79 20 6e 6f  md} {unixOnly no
6d00: 74 52 6f 6f 74 7d 20 7b 0a 2b 74 65 73 74 20 66  tRoot} {.+test f
6d10: 69 6c 65 6e 61 6d 65 2d 31 31 2e 31 37 2e 33 20  ilename-11.17.3 
6d20: 7b 54 63 6c 5f 47 6c 6f 62 43 6d 64 7d 20 7b 6e  {Tcl_GlobCmd} {n
6d30: 6f 74 52 6f 6f 74 7d 20 7b 0a 20 20 20 20 20 73  otRoot} {.     s
6d40: 65 74 20 64 69 72 20 5b 70 77 64 5d 0a 20 20 20  et dir [pwd].   
6d50: 20 20 73 65 74 20 72 65 74 20 22 65 72 72 6f 72    set ret "error
6d60: 20 69 6e 20 74 65 73 74 22 0a 20 20 20 20 20 69   in test".     i
6d70: 66 20 7b 5b 63 61 74 63 68 20 7b 0a 20 09 63 64  f {[catch {. .cd
6d80: 20 24 67 6c 6f 62 6e 61 6d 65 0a 2d 09 65 78 65   $globname.-.exe
6d90: 63 20 6c 6e 20 2d 73 20 61 31 20 6c 69 6e 6b 0a  c ln -s a1 link.
6da0: 2b 09 66 69 6c 65 20 6c 69 6e 6b 20 2d 73 79 6d  +.file link -sym
6db0: 62 6f 6c 69 63 20 6c 69 6e 6b 20 61 31 0a 20 09  bolic link a1. .
6dc0: 63 64 20 24 64 69 72 0a 20 09 73 65 74 20 72 65  cd $dir. .set re
6dd0: 74 20 5b 6c 69 73 74 20 5b 63 61 74 63 68 20 7b  t [list [catch {
6de0: 0a 20 09 20 20 20 20 6c 73 6f 72 74 20 5b 67 6c  . .    lsort [gl
6df0: 6f 62 20 2d 64 69 72 65 63 74 6f 72 79 20 24 67  ob -directory $g
6e00: 6c 6f 62 6e 61 6d 65 20 2d 74 79 70 65 20 64 20  lobname -type d 
6e10: 2a 5d 0a 40 40 20 2d 31 32 31 31 2c 31 32 20 2b  *].@@ -1211,12 +
6e20: 31 32 31 31 2c 31 32 20 40 40 0a 20 20 20 5b 66  1211,12 @@.   [f
6e30: 69 6c 65 20 6a 6f 69 6e 20 24 67 6c 6f 62 6e 61  ile join $globna
6e40: 6d 65 20 6c 69 6e 6b 5d 5d 5d 5d 0a 20 23 20 4d  me link]]]]. # M
6e50: 61 6b 65 20 73 75 72 65 20 74 68 65 20 62 75 67  ake sure the bug
6e60: 66 69 78 20 69 73 6e 27 74 20 74 6f 6f 20 73 69  fix isn't too si
6e70: 6d 70 6c 65 2e 20 20 57 65 20 64 6f 6e 27 74 20  mple.  We don't 
6e80: 77 61 6e 74 0a 20 23 20 74 6f 20 62 72 65 61 6b  want. # to break
6e90: 20 27 67 6c 6f 62 20 2d 74 79 70 65 20 6c 27 2e   'glob -type l'.
6ea0: 0a 2d 74 65 73 74 20 66 69 6c 65 6e 61 6d 65 2d  .-test filename-
6eb0: 31 31 2e 31 37 2e 34 20 7b 54 63 6c 5f 47 6c 6f  11.17.4 {Tcl_Glo
6ec0: 62 43 6d 64 7d 20 7b 75 6e 69 78 4f 6e 6c 79 20  bCmd} {unixOnly 
6ed0: 6e 6f 74 52 6f 6f 74 7d 20 7b 0a 2b 74 65 73 74  notRoot} {.+test
6ee0: 20 66 69 6c 65 6e 61 6d 65 2d 31 31 2e 31 37 2e   filename-11.17.
6ef0: 34 20 7b 54 63 6c 5f 47 6c 6f 62 43 6d 64 7d 20  4 {Tcl_GlobCmd} 
6f00: 7b 6e 6f 74 52 6f 6f 74 7d 20 7b 0a 20 20 20 20  {notRoot} {.    
6f10: 20 73 65 74 20 64 69 72 20 5b 70 77 64 5d 0a 20   set dir [pwd]. 
6f20: 20 20 20 20 73 65 74 20 72 65 74 20 22 65 72 72      set ret "err
6f30: 6f 72 20 69 6e 20 74 65 73 74 22 0a 20 20 20 20  or in test".    
6f40: 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0a 20 09   if {[catch {. .
6f50: 63 64 20 24 67 6c 6f 62 6e 61 6d 65 0a 2d 09 65  cd $globname.-.e
6f60: 78 65 63 20 6c 6e 20 2d 73 20 61 31 20 6c 69 6e  xec ln -s a1 lin
6f70: 6b 0a 2b 09 66 69 6c 65 20 6c 69 6e 6b 20 2d 73  k.+.file link -s
6f80: 79 6d 62 6f 6c 69 63 20 6c 69 6e 6b 20 61 31 0a  ymbolic link a1.
6f90: 20 09 63 64 20 24 64 69 72 0a 20 09 73 65 74 20   .cd $dir. .set 
6fa0: 72 65 74 20 5b 6c 69 73 74 20 5b 63 61 74 63 68  ret [list [catch
6fb0: 20 7b 0a 20 09 20 20 20 20 6c 73 6f 72 74 20 5b   {. .    lsort [
6fc0: 67 6c 6f 62 20 2d 64 69 72 65 63 74 6f 72 79 20  glob -directory 
6fd0: 24 67 6c 6f 62 6e 61 6d 65 20 2d 74 79 70 65 20  $globname -type 
6fe0: 6c 20 2a 5d 0a 49 6e 64 65 78 3a 20 74 65 73 74  l *].Index: test
6ff0: 73 2f 66 69 6c 65 53 79 73 74 65 6d 2e 74 65 73  s/fileSystem.tes
7000: 74 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  t.==============
7010: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7040: 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20  =====.RCS file: 
7050: 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c  /cvsroot/tcl/tcl
7060: 2f 74 65 73 74 73 2f 66 69 6c 65 53 79 73 74 65  /tests/fileSyste
7070: 6d 2e 74 65 73 74 2c 76 0a 72 65 74 72 69 65 76  m.test,v.retriev
7080: 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e 39  ing revision 1.9
7090: 0a 64 69 66 66 20 2d 62 20 2d 75 20 2d 72 31 2e  .diff -b -u -r1.
70a0: 39 20 66 69 6c 65 53 79 73 74 65 6d 2e 74 65 73  9 fileSystem.tes
70b0: 74 0a 2d 2d 2d 20 74 65 73 74 73 2f 66 69 6c 65  t.--- tests/file
70c0: 53 79 73 74 65 6d 2e 74 65 73 74 09 31 33 20 4a  System.test.13 J
70d0: 75 6e 20 32 30 30 32 20 30 39 3a 34 30 3a 30 30  un 2002 09:40:00
70e0: 20 2d 30 30 30 30 09 31 2e 39 0a 2b 2b 2b 20 74   -0000.1.9.+++ t
70f0: 65 73 74 73 2f 66 69 6c 65 53 79 73 74 65 6d 2e  ests/fileSystem.
7100: 74 65 73 74 09 31 38 20 4a 75 6e 20 32 30 30 32  test.18 Jun 2002
7110: 20 31 30 3a 32 33 3a 34 38 20 2d 30 30 30 30 0a   10:23:48 -0000.
7120: 40 40 20 2d 33 32 2c 31 31 20 2b 33 32 2c 31 31  @@ -32,11 +32,11
7130: 20 40 40 0a 20 6d 61 6b 65 46 69 6c 65 20 22 74   @@. makeFile "t
7140: 65 73 74 20 66 69 6c 65 20 69 6e 20 64 69 72 65  est file in dire
7150: 63 74 6f 72 79 22 20 5b 66 69 6c 65 20 6a 6f 69  ctory" [file joi
7160: 6e 20 64 69 72 2e 66 69 6c 65 20 69 6e 73 69 64  n dir.file insid
7170: 65 2e 66 69 6c 65 5d 0a 20 0a 20 69 66 20 7b 5b  e.file]. . if {[
7180: 63 61 74 63 68 20 7b 0a 2d 20 20 20 20 74 65 73  catch {.-    tes
7190: 74 66 69 6c 65 6c 69 6e 6b 20 6c 69 6e 6b 2e 66  tfilelink link.f
71a0: 69 6c 65 20 67 6f 72 70 2e 66 69 6c 65 20 0a 2d  ile gorp.file .-
71b0: 20 20 20 20 74 65 73 74 66 69 6c 65 6c 69 6e 6b      testfilelink
71c0: 20 5c 0a 2b 20 20 20 20 66 69 6c 65 20 6c 69 6e   \.+    file lin
71d0: 6b 20 6c 69 6e 6b 2e 66 69 6c 65 20 67 6f 72 70  k link.file gorp
71e0: 2e 66 69 6c 65 20 0a 2b 20 20 20 20 66 69 6c 65  .file .+    file
71f0: 20 6c 69 6e 6b 20 5c 0a 20 20 20 20 20 20 20 5b   link \.       [
7200: 66 69 6c 65 20 6a 6f 69 6e 20 64 69 72 2e 66 69  file join dir.fi
7210: 6c 65 20 6c 69 6e 6b 69 6e 73 69 64 65 2e 66 69  le linkinside.fi
7220: 6c 65 5d 20 5c 0a 20 20 20 20 20 20 20 5b 66 69  le] \.       [fi
7230: 6c 65 20 6a 6f 69 6e 20 64 69 72 2e 66 69 6c 65  le join dir.file
7240: 20 69 6e 73 69 64 65 2e 66 69 6c 65 5d 0a 2d 20   inside.file].- 
7250: 20 20 20 74 65 73 74 66 69 6c 65 6c 69 6e 6b 20     testfilelink 
7260: 64 69 72 2e 6c 69 6e 6b 20 64 69 72 2e 66 69 6c  dir.link dir.fil
7270: 65 0a 2b 20 20 20 20 66 69 6c 65 20 6c 69 6e 6b  e.+    file link
7280: 20 64 69 72 2e 6c 69 6e 6b 20 64 69 72 2e 66 69   dir.link dir.fi
7290: 6c 65 0a 20 7d 5d 7d 20 7b 0a 20 20 20 20 20 74  le. }]} {.     t
72a0: 63 6c 74 65 73 74 3a 3a 74 65 73 74 43 6f 6e 73  cltest::testCons
72b0: 74 72 61 69 6e 74 20 6c 69 6e 6b 73 20 30 0a 20  traint links 0. 
72c0: 7d 20 65 6c 73 65 20 7b 0a 40 40 20 2d 38 36 2c  } else {.@@ -86,
72d0: 36 20 2b 38 36 2c 34 39 20 40 40 0a 20 20 20 20  6 +86,49 @@.    
72e0: 20 20 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a    [file normaliz
72f0: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 64 69 72  e [file join dir
7300: 2e 6c 69 6e 6b 20 69 6e 73 69 64 65 2e 66 69 6c  .link inside.fil
7310: 65 66 6f 6f 5d 5d 0a 20 7d 20 7b 30 7d 0a 20 0a  efoo]]. } {0}. .
7320: 2b 74 65 73 74 20 66 69 6c 65 73 79 73 74 65 6d  +test filesystem
7330: 2d 31 2e 39 20 7b 6c 69 6e 6b 20 6e 6f 72 6d 61  -1.9 {link norma
7340: 6c 69 73 61 74 69 6f 6e 7d 20 7b 6c 69 6e 6b 73  lisation} {links
7350: 7d 20 7b 0a 2b 20 20 20 20 66 69 6c 65 20 64 65  } {.+    file de
7360: 6c 65 74 65 20 2d 66 6f 72 63 65 20 64 69 72 2e  lete -force dir.
7370: 6c 69 6e 6b 0a 2b 20 20 20 20 66 69 6c 65 20 6c  link.+    file l
7380: 69 6e 6b 20 64 69 72 2e 6c 69 6e 6b 20 5b 66 69  ink dir.link [fi
7390: 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 64 69  le nativename di
73a0: 72 2e 66 69 6c 65 5d 0a 2b 20 20 20 20 73 74 72  r.file].+    str
73b0: 69 6e 67 20 65 71 75 61 6c 20 5b 66 69 6c 65 20  ing equal [file 
73c0: 6e 6f 72 6d 61 6c 69 7a 65 20 5b 66 69 6c 65 20  normalize [file 
73d0: 6a 6f 69 6e 20 64 69 72 2e 66 69 6c 65 20 6c 69  join dir.file li
73e0: 6e 6b 69 6e 73 69 64 65 2e 66 69 6c 65 20 66 6f  nkinside.file fo
73f0: 6f 5d 5d 20 5c 0a 2b 20 20 20 20 20 20 5b 66 69  o]] \.+      [fi
7400: 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5b 66 69  le normalize [fi
7410: 6c 65 20 6a 6f 69 6e 20 64 69 72 2e 6c 69 6e 6b  le join dir.link
7420: 20 69 6e 73 69 64 65 2e 66 69 6c 65 20 66 6f 6f   inside.file foo
7430: 5d 5d 0a 2b 7d 20 7b 30 7d 0a 2b 0a 2b 74 65 73  ]].+} {0}.+.+tes
7440: 74 20 66 69 6c 65 73 79 73 74 65 6d 2d 31 2e 31  t filesystem-1.1
7450: 30 20 7b 6c 69 6e 6b 20 6e 6f 72 6d 61 6c 69 73  0 {link normalis
7460: 61 74 69 6f 6e 3a 20 64 6f 75 62 6c 65 20 6c 69  ation: double li
7470: 6e 6b 7d 20 7b 6c 69 6e 6b 73 7d 20 7b 0a 2b 20  nk} {links} {.+ 
7480: 20 20 20 66 69 6c 65 20 6c 69 6e 6b 20 64 69 72     file link dir
7490: 32 2e 6c 69 6e 6b 20 64 69 72 2e 6c 69 6e 6b 0a  2.link dir.link.
74a0: 2b 20 20 20 20 73 74 72 69 6e 67 20 65 71 75 61  +    string equa
74b0: 6c 20 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a  l [file normaliz
74c0: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 64 69 72  e [file join dir
74d0: 2e 66 69 6c 65 20 6c 69 6e 6b 69 6e 73 69 64 65  .file linkinside
74e0: 2e 66 69 6c 65 20 66 6f 6f 5d 5d 20 5c 0a 2b 20  .file foo]] \.+ 
74f0: 20 20 20 20 20 5b 66 69 6c 65 20 6e 6f 72 6d 61       [file norma
7500: 6c 69 7a 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20  lize [file join 
7510: 64 69 72 32 2e 6c 69 6e 6b 20 69 6e 73 69 64 65  dir2.link inside
7520: 2e 66 69 6c 65 20 66 6f 6f 5d 5d 0a 2b 7d 20 7b  .file foo]].+} {
7530: 30 7d 0a 2b 0a 2b 6d 61 6b 65 44 69 72 65 63 74  0}.+.+makeDirect
7540: 6f 72 79 20 64 69 72 32 2e 66 69 6c 65 0a 2b 0a  ory dir2.file.+.
7550: 2b 74 65 73 74 20 66 69 6c 65 73 79 73 74 65 6d  +test filesystem
7560: 2d 31 2e 31 31 20 7b 6c 69 6e 6b 20 6e 6f 72 6d  -1.11 {link norm
7570: 61 6c 69 73 61 74 69 6f 6e 3a 20 64 6f 75 62 6c  alisation: doubl
7580: 65 20 6c 69 6e 6b 2c 20 62 61 63 6b 20 69 6e 20  e link, back in 
7590: 74 72 65 65 7d 20 7b 6c 69 6e 6b 73 7d 20 7b 0a  tree} {links} {.
75a0: 2b 20 20 20 20 66 69 6c 65 20 6c 69 6e 6b 20 5b  +    file link [
75b0: 66 69 6c 65 20 6a 6f 69 6e 20 64 69 72 32 2e 66  file join dir2.f
75c0: 69 6c 65 20 64 69 72 32 2e 6c 69 6e 6b 5d 20 64  ile dir2.link] d
75d0: 69 72 32 2e 6c 69 6e 6b 0a 2b 20 20 20 20 73 74  ir2.link.+    st
75e0: 72 69 6e 67 20 65 71 75 61 6c 20 5b 66 69 6c 65  ring equal [file
75f0: 20 6e 6f 72 6d 61 6c 69 7a 65 20 5b 66 69 6c 65   normalize [file
7600: 20 6a 6f 69 6e 20 64 69 72 2e 66 69 6c 65 20 6c   join dir.file l
7610: 69 6e 6b 69 6e 73 69 64 65 2e 66 69 6c 65 20 66  inkinside.file f
7620: 6f 6f 5d 5d 20 5c 0a 2b 20 20 20 20 20 20 5b 66  oo]] \.+      [f
7630: 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5b 66  ile normalize [f
7640: 69 6c 65 20 6a 6f 69 6e 20 64 69 72 32 2e 66 69  ile join dir2.fi
7650: 6c 65 20 64 69 72 32 2e 6c 69 6e 6b 20 69 6e 73  le dir2.link ins
7660: 69 64 65 2e 66 69 6c 65 20 66 6f 6f 5d 5d 0a 2b  ide.file foo]].+
7670: 7d 20 7b 30 7d 0a 2b 0a 2b 74 65 73 74 20 66 69  } {0}.+.+test fi
7680: 6c 65 73 79 73 74 65 6d 2d 31 2e 31 32 20 7b 66  lesystem-1.12 {f
7690: 69 6c 65 20 6e 65 77 20 6e 61 74 69 76 65 20 70  ile new native p
76a0: 61 74 68 7d 20 7b 7d 20 7b 0a 2b 20 20 20 20 66  ath} {} {.+    f
76b0: 6f 72 20 7b 73 65 74 20 69 20 30 7d 20 7b 24 69  or {set i 0} {$i
76c0: 20 3c 20 31 30 7d 20 7b 69 6e 63 72 20 69 7d 20   < 10} {incr i} 
76d0: 7b 0a 2b 09 66 6f 72 65 61 63 68 20 66 20 5b 6c  {.+.foreach f [l
76e0: 73 6f 72 74 20 5b 67 6c 6f 62 20 2d 6e 6f 63 6f  sort [glob -noco
76f0: 6d 70 6c 61 69 6e 20 2d 74 79 70 65 20 6c 20 2a  mplain -type l *
7700: 5d 5d 20 7b 0a 2b 09 20 20 20 20 63 61 74 63 68  ]] {.+.    catch
7710: 20 7b 66 69 6c 65 20 72 65 61 64 6c 69 6e 6b 20   {file readlink 
7720: 24 66 7d 0a 2b 09 7d 0a 2b 20 20 20 20 7d 0a 2b  $f}.+.}.+    }.+
7730: 20 20 20 20 23 20 49 66 20 77 65 20 72 65 61 63      # If we reac
7740: 68 20 68 65 72 65 20 77 65 27 76 65 20 73 75 63  h here we've suc
7750: 63 65 65 64 65 64 2e 20 57 65 20 75 73 65 64 20  ceeded. We used 
7760: 74 6f 20 63 72 61 73 68 20 61 62 6f 76 65 2e 0a  to crash above..
7770: 2b 20 20 20 20 65 78 70 72 20 31 0a 2b 7d 20 7b  +    expr 1.+} {
7780: 31 7d 0a 2b 0a 2b 74 65 73 74 20 66 69 6c 65 73  1}.+.+test files
7790: 79 73 74 65 6d 2d 31 2e 31 33 20 7b 66 69 6c 65  ystem-1.13 {file
77a0: 20 6e 6f 72 6d 61 6c 69 73 61 74 69 6f 6e 7d 20   normalisation} 
77b0: 7b 77 69 6e 4f 6e 6c 79 7d 20 7b 0a 2b 20 20 20  {winOnly} {.+   
77c0: 20 23 20 54 68 69 73 20 75 73 65 64 20 74 6f 20   # This used to 
77d0: 62 65 20 62 72 6f 6b 65 6e 0a 2b 20 20 20 20 66  be broken.+    f
77e0: 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 43 3a  ile normalize C:
77f0: 2f 74 68 69 73 6c 6f 6e 67 6e 61 6d 65 64 6f 65  /thislongnamedoe
7800: 73 6e 74 65 78 69 73 74 0a 2b 7d 20 7b 43 3a 2f  sntexist.+} {C:/
7810: 74 68 69 73 6c 6f 6e 67 6e 61 6d 65 64 6f 65 73  thislongnamedoes
7820: 6e 74 65 78 69 73 74 7d 0a 2b 0a 2b 74 65 73 74  ntexist}.+.+test
7830: 20 66 69 6c 65 73 79 73 74 65 6d 2d 31 2e 31 34   filesystem-1.14
7840: 20 7b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 73 61   {file normalisa
7850: 74 69 6f 6e 7d 20 7b 77 69 6e 4f 6e 6c 79 7d 20  tion} {winOnly} 
7860: 7b 0a 2b 20 20 20 20 23 20 54 68 69 73 20 75 73  {.+    # This us
7870: 65 64 20 74 6f 20 62 65 20 62 72 6f 6b 65 6e 0a  ed to be broken.
7880: 2b 20 20 20 20 66 69 6c 65 20 6e 6f 72 6d 61 6c  +    file normal
7890: 69 7a 65 20 63 3a 2f 0a 2b 7d 20 7b 43 3a 2f 7d  ize c:/.+} {C:/}
78a0: 0a 2b 0a 2b 66 69 6c 65 20 64 65 6c 65 74 65 20  .+.+file delete 
78b0: 2d 66 6f 72 63 65 20 64 69 72 32 2e 66 69 6c 65  -force dir2.file
78c0: 0a 2b 66 69 6c 65 20 64 65 6c 65 74 65 20 2d 66  .+file delete -f
78d0: 6f 72 63 65 20 64 69 72 32 2e 6c 69 6e 6b 0a 20  orce dir2.link. 
78e0: 66 69 6c 65 20 64 65 6c 65 74 65 20 2d 66 6f 72  file delete -for
78f0: 63 65 20 6c 69 6e 6b 2e 66 69 6c 65 20 64 69 72  ce link.file dir
7900: 2e 6c 69 6e 6b 0a 20 72 65 6d 6f 76 65 46 69 6c  .link. removeFil
7910: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 64 69 72  e [file join dir
7920: 2e 66 69 6c 65 20 69 6e 73 69 64 65 2e 66 69 6c  .file inside.fil
7930: 65 5d 0a 20 72 65 6d 6f 76 65 44 69 72 65 63 74  e]. removeDirect
7940: 6f 72 79 20 64 69 72 2e 66 69 6c 65 0a 49 6e 64  ory dir.file.Ind
7950: 65 78 3a 20 75 6e 69 78 2f 74 63 6c 55 6e 69 78  ex: unix/tclUnix
7960: 46 69 6c 65 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d  File.c.=========
7970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
79a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66  ==========.RCS f
79b0: 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63  ile: /cvsroot/tc
79c0: 6c 2f 74 63 6c 2f 75 6e 69 78 2f 74 63 6c 55 6e  l/tcl/unix/tclUn
79d0: 69 78 46 69 6c 65 2e 63 2c 76 0a 72 65 74 72 69  ixFile.c,v.retri
79e0: 65 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31  eving revision 1
79f0: 2e 32 33 0a 64 69 66 66 20 2d 62 20 2d 75 20 2d  .23.diff -b -u -
7a00: 72 31 2e 32 33 20 74 63 6c 55 6e 69 78 46 69 6c  r1.23 tclUnixFil
7a10: 65 2e 63 0a 2d 2d 2d 20 75 6e 69 78 2f 74 63 6c  e.c.--- unix/tcl
7a20: 55 6e 69 78 46 69 6c 65 2e 63 09 31 33 20 4a 75  UnixFile.c.13 Ju
7a30: 6e 20 32 30 30 32 20 30 39 3a 34 30 3a 30 31 20  n 2002 09:40:01 
7a40: 2d 30 30 30 30 09 31 2e 32 33 0a 2b 2b 2b 20 75  -0000.1.23.+++ u
7a50: 6e 69 78 2f 74 63 6c 55 6e 69 78 46 69 6c 65 2e  nix/tclUnixFile.
7a60: 63 09 31 38 20 4a 75 6e 20 32 30 30 32 20 31 30  c.18 Jun 2002 10
7a70: 3a 32 33 3a 34 39 20 2d 30 30 30 30 0a 40 40 20  :23:49 -0000.@@ 
7a80: 2d 37 32 34 2c 31 30 20 2b 37 32 34 2c 31 30 20  -724,10 +724,10 
7a90: 40 40 0a 20 23 69 66 64 65 66 20 53 5f 49 46 4c  @@. #ifdef S_IFL
7aa0: 4e 4b 0a 20 0a 20 54 63 6c 5f 4f 62 6a 2a 20 0a  NK. . Tcl_Obj* .
7ab0: 2d 54 63 6c 70 4f 62 6a 4c 69 6e 6b 28 70 61 74  -TclpObjLink(pat
7ac0: 68 50 74 72 2c 20 74 6f 50 74 72 2c 20 6c 69 6e  hPtr, toPtr, lin
7ad0: 6b 54 79 70 65 29 0a 2b 54 63 6c 70 4f 62 6a 4c  kType).+TclpObjL
7ae0: 69 6e 6b 28 70 61 74 68 50 74 72 2c 20 74 6f 50  ink(pathPtr, toP
7af0: 74 72 2c 20 6c 69 6e 6b 41 63 74 69 6f 6e 29 0a  tr, linkAction).
7b00: 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 70 61       Tcl_Obj *pa
7b10: 74 68 50 74 72 3b 0a 20 20 20 20 20 54 63 6c 5f  thPtr;.     Tcl_
7b20: 4f 62 6a 20 2a 74 6f 50 74 72 3b 0a 2d 20 20 20  Obj *toPtr;.-   
7b30: 20 69 6e 74 20 6c 69 6e 6b 54 79 70 65 3b 0a 2b   int linkType;.+
7b40: 20 20 20 20 69 6e 74 20 6c 69 6e 6b 41 63 74 69      int linkActi
7b50: 6f 6e 3b 0a 20 7b 0a 20 20 20 20 20 65 78 74 65  on;. {.     exte
7b60: 72 6e 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65  rn Tcl_Filesyste
7b70: 6d 20 6e 61 74 69 76 65 46 69 6c 65 73 79 73 74  m nativeFilesyst
7b80: 65 6d 3b 0a 20 0a 40 40 20 2d 37 33 38 2c 31 32  em;. .@@ -738,12
7b90: 20 2b 37 33 38 2c 32 37 20 40 40 0a 20 09 69 66   +738,27 @@. .if
7ba0: 20 28 73 72 63 20 3d 3d 20 4e 55 4c 4c 20 7c 7c   (src == NULL ||
7bb0: 20 74 61 72 67 65 74 20 3d 3d 20 4e 55 4c 4c 29   target == NULL)
7bc0: 20 7b 0a 20 09 20 20 20 20 72 65 74 75 72 6e 20   {. .    return 
7bd0: 4e 55 4c 4c 3b 0a 20 09 7d 0a 2d 09 2f 2a 20 57  NULL;. .}.-./* W
7be0: 65 20 64 6f 6e 27 74 20 72 65 63 6f 67 6e 69 73  e don't recognis
7bf0: 65 20 74 68 65 73 65 20 63 6f 64 65 73 20 2a 2f  e these codes */
7c00: 0a 2d 09 69 66 20 28 6c 69 6e 6b 54 79 70 65 20  .-.if (linkType 
7c10: 3c 20 30 20 7c 7c 20 6c 69 6e 6b 54 79 70 65 20  < 0 || linkType 
7c20: 3e 20 32 29 20 72 65 74 75 72 6e 20 4e 55 4c 4c  > 2) return NULL
7c30: 3b 0a 2d 09 69 66 20 28 6c 69 6e 6b 54 79 70 65  ;.-.if (linkType
7c40: 20 3d 3d 20 32 29 20 7b 0a 2d 09 20 20 20 20 69   == 2) {.-.    i
7c50: 66 20 28 6c 69 6e 6b 28 73 72 63 2c 20 74 61 72  f (link(src, tar
7c60: 67 65 74 29 20 21 3d 20 30 29 20 72 65 74 75 72  get) != 0) retur
7c70: 6e 20 4e 55 4c 4c 3b 0a 2b 09 69 66 20 28 61 63  n NULL;.+.if (ac
7c80: 63 65 73 73 28 73 72 63 2c 20 46 5f 4f 4b 29 20  cess(src, F_OK) 
7c90: 21 3d 20 2d 31 29 20 7b 0a 2b 09 20 20 20 20 2f  != -1) {.+.    /
7ca0: 2a 20 73 72 63 20 65 78 69 73 74 73 20 2a 2f 0a  * src exists */.
7cb0: 2b 09 20 20 20 20 65 72 72 6e 6f 20 3d 20 45 45  +.    errno = EE
7cc0: 58 49 53 54 3b 0a 2b 09 20 20 20 20 72 65 74 75  XIST;.+.    retu
7cd0: 72 6e 20 4e 55 4c 4c 3b 0a 2b 09 7d 0a 2b 09 69  rn NULL;.+.}.+.i
7ce0: 66 20 28 61 63 63 65 73 73 28 74 61 72 67 65 74  f (access(target
7cf0: 2c 20 46 5f 4f 4b 29 20 3d 3d 20 2d 31 29 20 7b  , F_OK) == -1) {
7d00: 0a 2b 09 20 20 20 20 2f 2a 20 74 61 72 67 65 74  .+.    /* target
7d10: 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 20 2a   doesn't exist *
7d20: 2f 0a 2b 09 20 20 20 20 65 72 72 6e 6f 20 3d 20  /.+.    errno = 
7d30: 45 4e 4f 45 4e 54 3b 0a 2b 09 20 20 20 20 72 65  ENOENT;.+.    re
7d40: 74 75 72 6e 20 4e 55 4c 4c 3b 0a 2b 09 7d 0a 2b  turn NULL;.+.}.+
7d50: 09 2f 2a 20 0a 2b 09 20 2a 20 43 68 65 63 6b 20  ./* .+. * Check 
7d60: 73 79 6d 62 6f 6c 69 63 20 6c 69 6e 6b 20 66 6c  symbolic link fl
7d70: 61 67 20 66 69 72 73 74 2c 20 73 69 6e 63 65 20  ag first, since 
7d80: 77 65 20 70 72 65 66 65 72 20 74 6f 0a 2b 09 20  we prefer to.+. 
7d90: 2a 20 63 72 65 61 74 65 20 74 68 65 73 65 2e 0a  * create these..
7da0: 2b 09 20 2a 2f 0a 2b 09 69 66 20 28 6c 69 6e 6b  +. */.+.if (link
7db0: 41 63 74 69 6f 6e 20 26 20 54 43 4c 5f 43 52 45  Action & TCL_CRE
7dc0: 41 54 45 5f 53 59 4d 42 4f 4c 49 43 5f 4c 49 4e  ATE_SYMBOLIC_LIN
7dd0: 4b 29 20 7b 0a 2b 09 20 20 20 20 69 66 20 28 73  K) {.+.    if (s
7de0: 79 6d 6c 69 6e 6b 28 74 61 72 67 65 74 2c 20 73  ymlink(target, s
7df0: 72 63 29 20 21 3d 20 30 29 20 72 65 74 75 72 6e  rc) != 0) return
7e00: 20 4e 55 4c 4c 3b 0a 2b 09 7d 20 65 6c 73 65 20   NULL;.+.} else 
7e10: 69 66 20 28 6c 69 6e 6b 41 63 74 69 6f 6e 20 26  if (linkAction &
7e20: 20 54 43 4c 5f 43 52 45 41 54 45 5f 48 41 52 44   TCL_CREATE_HARD
7e30: 5f 4c 49 4e 4b 29 20 7b 0a 2b 09 20 20 20 20 69  _LINK) {.+.    i
7e40: 66 20 28 6c 69 6e 6b 28 74 61 72 67 65 74 2c 20  f (link(target, 
7e50: 73 72 63 29 20 21 3d 20 30 29 20 72 65 74 75 72  src) != 0) retur
7e60: 6e 20 4e 55 4c 4c 3b 0a 20 09 7d 20 65 6c 73 65  n NULL;. .} else
7e70: 20 7b 0a 2d 09 20 20 20 20 69 66 20 28 73 79 6d   {.-.    if (sym
7e80: 6c 69 6e 6b 28 73 72 63 2c 20 74 61 72 67 65 74  link(src, target
7e90: 29 20 21 3d 20 30 29 20 72 65 74 75 72 6e 20 4e  ) != 0) return N
7ea0: 55 4c 4c 3b 0a 2b 09 20 20 20 20 65 72 72 6e 6f  ULL;.+.    errno
7eb0: 20 3d 20 45 4e 4f 44 45 56 3b 0a 2b 09 20 20 20   = ENODEV;.+.   
7ec0: 20 72 65 74 75 72 6e 20 4e 55 4c 4c 3b 0a 20 09   return NULL;. .
7ed0: 7d 0a 20 09 72 65 74 75 72 6e 20 74 6f 50 74 72  }. .return toPtr
7ee0: 3b 0a 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a  ;.     } else {.
7ef0: 49 6e 64 65 78 3a 20 77 69 6e 2f 74 63 6c 57 69  Index: win/tclWi
7f00: 6e 46 69 6c 65 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d  nFile.c.========
7f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
7f40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20  ===========.RCS 
7f50: 66 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74  file: /cvsroot/t
7f60: 63 6c 2f 74 63 6c 2f 77 69 6e 2f 74 63 6c 57 69  cl/tcl/win/tclWi
7f70: 6e 46 69 6c 65 2e 63 2c 76 0a 72 65 74 72 69 65  nFile.c,v.retrie
7f80: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e  ving revision 1.
7f90: 33 32 0a 64 69 66 66 20 2d 62 20 2d 75 20 2d 72  32.diff -b -u -r
7fa0: 31 2e 33 32 20 74 63 6c 57 69 6e 46 69 6c 65 2e  1.32 tclWinFile.
7fb0: 63 0a 2d 2d 2d 20 77 69 6e 2f 74 63 6c 57 69 6e  c.--- win/tclWin
7fc0: 46 69 6c 65 2e 63 09 31 33 20 4a 75 6e 20 32 30  File.c.13 Jun 20
7fd0: 30 32 20 31 30 3a 34 33 3a 34 31 20 2d 30 30 30  02 10:43:41 -000
7fe0: 30 09 31 2e 33 32 0a 2b 2b 2b 20 77 69 6e 2f 74  0.1.32.+++ win/t
7ff0: 63 6c 57 69 6e 46 69 6c 65 2e 63 09 31 38 20 4a  clWinFile.c.18 J
8000: 75 6e 20 32 30 30 32 20 31 30 3a 32 33 3a 35 31  un 2002 10:23:51
8010: 20 2d 30 30 30 30 0a 40 40 20 2d 31 36 32 2c 37   -0000.@@ -162,7
8020: 20 2b 31 36 32 2c 37 20 40 40 0a 20 73 74 61 74   +162,7 @@. stat
8030: 69 63 20 54 63 6c 5f 4f 62 6a 2a 20 57 69 6e 52  ic Tcl_Obj* WinR
8040: 65 61 64 4c 69 6e 6b 28 43 4f 4e 53 54 20 54 43  eadLink(CONST TC
8050: 48 41 52 2a 20 4c 69 6e 6b 53 6f 75 72 63 65 29  HAR* LinkSource)
8060: 3b 0a 20 73 74 61 74 69 63 20 54 63 6c 5f 4f 62  ;. static Tcl_Ob
8070: 6a 2a 20 57 69 6e 52 65 61 64 4c 69 6e 6b 44 69  j* WinReadLinkDi
8080: 72 65 63 74 6f 72 79 28 43 4f 4e 53 54 20 54 43  rectory(CONST TC
8090: 48 41 52 2a 20 4c 69 6e 6b 44 69 72 65 63 74 6f  HAR* LinkDirecto
80a0: 72 79 29 3b 0a 20 73 74 61 74 69 63 20 69 6e 74  ry);. static int
80b0: 20 57 69 6e 4c 69 6e 6b 28 43 4f 4e 53 54 20 54   WinLink(CONST T
80c0: 43 48 41 52 2a 20 4c 69 6e 6b 53 6f 75 72 63 65  CHAR* LinkSource
80d0: 2c 20 43 4f 4e 53 54 20 54 43 48 41 52 2a 20 4c  , CONST TCHAR* L
80e0: 69 6e 6b 54 61 72 67 65 74 2c 20 0a 2d 09 09 20  inkTarget, .-.. 
80f0: 20 20 69 6e 74 20 6c 69 6e 6b 54 79 70 65 29 3b    int linkType);
8100: 0a 2b 09 09 20 20 20 69 6e 74 20 6c 69 6e 6b 41  .+..   int linkA
8110: 63 74 69 6f 6e 29 3b 0a 20 73 74 61 74 69 63 20  ction);. static 
8120: 69 6e 74 20 57 69 6e 53 79 6d 4c 69 6e 6b 44 69  int WinSymLinkDi
8130: 72 65 63 74 6f 72 79 28 43 4f 4e 53 54 20 54 43  rectory(CONST TC
8140: 48 41 52 2a 20 4c 69 6e 6b 44 69 72 65 63 74 6f  HAR* LinkDirecto
8150: 72 79 2c 20 0a 20 09 09 09 20 20 20 20 20 20 20  ry, . ...       
8160: 43 4f 4e 53 54 20 54 43 48 41 52 2a 20 4c 69 6e  CONST TCHAR* Lin
8170: 6b 54 61 72 67 65 74 29 3b 0a 20 65 78 74 65 72  kTarget);. exter
8180: 6e 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65 6d  n Tcl_Filesystem
8190: 20 6e 61 74 69 76 65 46 69 6c 65 73 79 73 74 65   nativeFilesyste
81a0: 6d 3b 0a 40 40 20 2d 31 37 37 2c 31 30 20 2b 31  m;.@@ -177,10 +1
81b0: 37 37 2c 31 30 20 40 40 0a 20 20 2a 2d 2d 2d 2d  77,10 @@.  *----
81c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
81d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
81e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
81f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8200: 0a 20 20 2a 2f 0a 20 73 74 61 74 69 63 20 69 6e  .  */. static in
8210: 74 20 0a 2d 57 69 6e 4c 69 6e 6b 28 4c 69 6e 6b  t .-WinLink(Link
8220: 53 6f 75 72 63 65 2c 20 4c 69 6e 6b 54 61 72 67  Source, LinkTarg
8230: 65 74 2c 20 6c 69 6e 6b 54 79 70 65 29 0a 2b 57  et, linkType).+W
8240: 69 6e 4c 69 6e 6b 28 4c 69 6e 6b 53 6f 75 72 63  inLink(LinkSourc
8250: 65 2c 20 4c 69 6e 6b 54 61 72 67 65 74 2c 20 6c  e, LinkTarget, l
8260: 69 6e 6b 41 63 74 69 6f 6e 29 0a 20 20 20 20 20  inkAction).     
8270: 43 4f 4e 53 54 20 54 43 48 41 52 2a 20 4c 69 6e  CONST TCHAR* Lin
8280: 6b 53 6f 75 72 63 65 3b 0a 20 20 20 20 20 43 4f  kSource;.     CO
8290: 4e 53 54 20 54 43 48 41 52 2a 20 4c 69 6e 6b 54  NST TCHAR* LinkT
82a0: 61 72 67 65 74 3b 0a 2d 20 20 20 20 69 6e 74 20  arget;.-    int 
82b0: 6c 69 6e 6b 54 79 70 65 3b 0a 2b 20 20 20 20 69  linkType;.+    i
82c0: 6e 74 20 6c 69 6e 6b 41 63 74 69 6f 6e 3b 0a 20  nt linkAction;. 
82d0: 7b 0a 20 20 20 20 20 57 43 48 41 52 09 74 65 6d  {.     WCHAR.tem
82e0: 70 46 69 6c 65 4e 61 6d 65 5b 4d 41 58 5f 50 41  pFileName[MAX_PA
82f0: 54 48 5d 3b 0a 20 20 20 20 20 54 43 48 41 52 2a  TH];.     TCHAR*
8300: 09 74 65 6d 70 46 69 6c 65 50 61 72 74 3b 0a 40  .tempFilePart;.@
8310: 40 20 2d 32 32 30 2c 32 31 20 2b 32 32 30 2c 33  @ -220,21 +220,3
8320: 31 20 40 40 0a 20 09 20 20 20 20 54 63 6c 5f 53  1 @@. .    Tcl_S
8330: 65 74 45 72 72 6e 6f 28 45 4e 4f 54 44 49 52 29  etErrno(ENOTDIR)
8340: 3b 0a 20 09 20 20 20 20 72 65 74 75 72 6e 20 2d  ;. .    return -
8350: 31 3b 0a 20 09 7d 0a 2d 09 69 66 20 28 6c 69 6e  1;. .}.-.if (lin
8360: 6b 54 79 70 65 20 3d 3d 20 31 29 20 7b 0a 2d 09  kType == 1) {.-.
8370: 20 20 20 20 2f 2a 20 43 61 6e 27 74 20 73 79 6d      /* Can't sym
8380: 6c 69 6e 6b 20 66 69 6c 65 73 20 2a 2f 0a 2d 09  link files */.-.
8390: 20 20 20 20 72 65 74 75 72 6e 20 2d 31 3b 0a 2d      return -1;.-
83a0: 09 7d 0a 2b 09 69 66 20 28 6c 69 6e 6b 41 63 74  .}.+.if (linkAct
83b0: 69 6f 6e 20 26 20 54 43 4c 5f 43 52 45 41 54 45  ion & TCL_CREATE
83c0: 5f 48 41 52 44 5f 4c 49 4e 4b 29 20 7b 0a 20 09  _HARD_LINK) {. .
83d0: 69 66 20 28 21 28 2a 74 63 6c 57 69 6e 50 72 6f  if (!(*tclWinPro
83e0: 63 73 2d 3e 63 72 65 61 74 65 48 61 72 64 4c 69  cs->createHardLi
83f0: 6e 6b 50 72 6f 63 29 28 4c 69 6e 6b 53 6f 75 72  nkProc)(LinkSour
8400: 63 65 2c 20 4c 69 6e 6b 54 61 72 67 65 74 2c 20  ce, LinkTarget, 
8410: 4e 55 4c 4c 29 29 20 7b 0a 20 09 20 20 20 20 54  NULL)) {. .    T
8420: 63 6c 57 69 6e 43 6f 6e 76 65 72 74 45 72 72 6f  clWinConvertErro
8430: 72 28 47 65 74 4c 61 73 74 45 72 72 6f 72 28 29  r(GetLastError()
8440: 29 3b 0a 20 09 20 20 20 20 72 65 74 75 72 6e 20  );. .    return 
8450: 2d 31 3b 0a 20 09 7d 0a 20 09 72 65 74 75 72 6e  -1;. .}. .return
8460: 20 30 3b 0a 2b 09 7d 20 65 6c 73 65 20 69 66 20   0;.+.} else if 
8470: 28 6c 69 6e 6b 41 63 74 69 6f 6e 20 26 20 54 43  (linkAction & TC
8480: 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f 4c 49  L_CREATE_SYMBOLI
8490: 43 5f 4c 49 4e 4b 29 20 7b 0a 2b 09 20 20 20 20  C_LINK) {.+.    
84a0: 2f 2a 20 43 61 6e 27 74 20 73 79 6d 6c 69 6e 6b  /* Can't symlink
84b0: 20 66 69 6c 65 73 20 2a 2f 0a 2b 09 20 20 20 20   files */.+.    
84c0: 54 63 6c 5f 53 65 74 45 72 72 6e 6f 28 45 4e 4f  Tcl_SetErrno(ENO
84d0: 54 44 49 52 29 3b 0a 2b 09 20 20 20 20 72 65 74  TDIR);.+.    ret
84e0: 75 72 6e 20 2d 31 3b 0a 20 20 20 20 20 7d 20 65  urn -1;.     } e
84f0: 6c 73 65 20 7b 0a 2d 09 69 66 20 28 6c 69 6e 6b  lse {.-.if (link
8500: 54 79 70 65 20 3d 3d 20 32 29 20 7b 0a 2d 09 20  Type == 2) {.-. 
8510: 20 20 20 2f 2a 20 43 61 6e 27 74 20 68 61 72 64     /* Can't hard
8520: 20 6c 69 6e 6b 20 64 69 72 65 63 74 6f 72 69 65   link directorie
8530: 73 20 2a 2f 0a 2b 09 20 20 20 20 54 63 6c 5f 53  s */.+.    Tcl_S
8540: 65 74 45 72 72 6e 6f 28 45 4e 4f 44 45 56 29 3b  etErrno(ENODEV);
8550: 0a 20 09 20 20 20 20 72 65 74 75 72 6e 20 2d 31  . .    return -1
8560: 3b 0a 20 09 7d 0a 2b 20 20 20 20 7d 20 65 6c 73  ;. .}.+    } els
8570: 65 20 7b 0a 2b 09 69 66 20 28 6c 69 6e 6b 41 63  e {.+.if (linkAc
8580: 74 69 6f 6e 20 26 20 54 43 4c 5f 43 52 45 41 54  tion & TCL_CREAT
8590: 45 5f 53 59 4d 42 4f 4c 49 43 5f 4c 49 4e 4b 29  E_SYMBOLIC_LINK)
85a0: 20 7b 0a 20 09 72 65 74 75 72 6e 20 57 69 6e 53   {. .return WinS
85b0: 79 6d 4c 69 6e 6b 44 69 72 65 63 74 6f 72 79 28  ymLinkDirectory(
85c0: 4c 69 6e 6b 53 6f 75 72 63 65 2c 20 4c 69 6e 6b  LinkSource, Link
85d0: 54 61 72 67 65 74 29 3b 0a 2b 09 7d 20 65 6c 73  Target);.+.} els
85e0: 65 20 69 66 20 28 6c 69 6e 6b 41 63 74 69 6f 6e  e if (linkAction
85f0: 20 26 20 54 43 4c 5f 43 52 45 41 54 45 5f 48 41   & TCL_CREATE_HA
8600: 52 44 5f 4c 49 4e 4b 29 20 7b 0a 2b 09 20 20 20  RD_LINK) {.+.   
8610: 20 2f 2a 20 43 61 6e 27 74 20 68 61 72 64 20 6c   /* Can't hard l
8620: 69 6e 6b 20 64 69 72 65 63 74 6f 72 69 65 73 20  ink directories 
8630: 2a 2f 0a 2b 09 20 20 20 20 54 63 6c 5f 53 65 74  */.+.    Tcl_Set
8640: 45 72 72 6e 6f 28 45 49 53 44 49 52 29 3b 0a 2b  Errno(EISDIR);.+
8650: 09 20 20 20 20 72 65 74 75 72 6e 20 2d 31 3b 0a  .    return -1;.
8660: 2b 09 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 20 20  +.} else {.+.   
8670: 20 54 63 6c 5f 53 65 74 45 72 72 6e 6f 28 45 4e   Tcl_SetErrno(EN
8680: 4f 44 45 56 29 3b 0a 2b 09 20 20 20 20 72 65 74  ODEV);.+.    ret
8690: 75 72 6e 20 2d 31 3b 0a 2b 09 7d 0a 20 20 20 20  urn -1;.+.}.    
86a0: 20 7d 0a 20 7d 0a 20 0c 0a 40 40 20 2d 31 38 35   }. }. ..@@ -185
86b0: 35 2c 31 30 20 2b 31 38 36 35 2c 31 30 20 40 40  5,10 +1865,10 @@
86c0: 0a 20 23 69 66 64 65 66 20 53 5f 49 46 4c 4e 4b  . #ifdef S_IFLNK
86d0: 0a 20 0a 20 54 63 6c 5f 4f 62 6a 2a 20 0a 2d 54  . . Tcl_Obj* .-T
86e0: 63 6c 70 4f 62 6a 4c 69 6e 6b 28 70 61 74 68 50  clpObjLink(pathP
86f0: 74 72 2c 20 74 6f 50 74 72 2c 20 6c 69 6e 6b 54  tr, toPtr, linkT
8700: 79 70 65 29 0a 2b 54 63 6c 70 4f 62 6a 4c 69 6e  ype).+TclpObjLin
8710: 6b 28 70 61 74 68 50 74 72 2c 20 74 6f 50 74 72  k(pathPtr, toPtr
8720: 2c 20 6c 69 6e 6b 41 63 74 69 6f 6e 29 0a 20 20  , linkAction).  
8730: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68     Tcl_Obj *path
8740: 50 74 72 3b 0a 20 20 20 20 20 54 63 6c 5f 4f 62  Ptr;.     Tcl_Ob
8750: 6a 20 2a 74 6f 50 74 72 3b 0a 2d 20 20 20 20 69  j *toPtr;.-    i
8760: 6e 74 20 6c 69 6e 6b 54 79 70 65 3b 0a 2b 20 20  nt linkType;.+  
8770: 20 20 69 6e 74 20 6c 69 6e 6b 41 63 74 69 6f 6e    int linkAction
8780: 3b 0a 20 7b 0a 20 20 20 20 20 69 66 20 28 74 6f  ;. {.     if (to
8790: 50 74 72 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 20  Ptr != NULL) {. 
87a0: 09 69 6e 74 20 72 65 73 3b 0a 40 40 20 2d 31 38  .int res;.@@ -18
87b0: 36 37 2c 39 20 2b 31 38 37 37 2c 37 20 40 40 0a  67,9 +1877,7 @@.
87c0: 20 09 69 66 20 28 4c 69 6e 6b 53 6f 75 72 63 65   .if (LinkSource
87d0: 20 3d 3d 20 4e 55 4c 4c 20 7c 7c 20 4c 69 6e 6b   == NULL || Link
87e0: 54 61 72 67 65 74 20 3d 3d 20 4e 55 4c 4c 29 20  Target == NULL) 
87f0: 7b 0a 20 09 20 20 20 20 72 65 74 75 72 6e 20 4e  {. .    return N
8800: 55 4c 4c 3b 0a 20 09 7d 0a 2d 09 2f 2a 20 57 65  ULL;. .}.-./* We
8810: 20 64 6f 6e 27 74 20 72 65 63 6f 67 6e 69 73 65   don't recognise
8820: 20 74 68 65 73 65 20 63 6f 64 65 73 20 2a 2f 0a   these codes */.
8830: 2d 09 69 66 20 28 6c 69 6e 6b 54 79 70 65 20 3c  -.if (linkType <
8840: 20 30 20 7c 7c 20 6c 69 6e 6b 54 79 70 65 20 3e   0 || linkType >
8850: 20 32 29 20 72 65 74 75 72 6e 20 4e 55 4c 4c 3b   2) return NULL;
8860: 0a 2d 09 72 65 73 20 3d 20 57 69 6e 4c 69 6e 6b  .-.res = WinLink
8870: 28 4c 69 6e 6b 53 6f 75 72 63 65 2c 20 4c 69 6e  (LinkSource, Lin
8880: 6b 54 61 72 67 65 74 2c 20 6c 69 6e 6b 54 79 70  kTarget, linkTyp
8890: 65 29 3b 0a 2b 09 72 65 73 20 3d 20 57 69 6e 4c  e);.+.res = WinL
88a0: 69 6e 6b 28 4c 69 6e 6b 53 6f 75 72 63 65 2c 20  ink(LinkSource, 
88b0: 4c 69 6e 6b 54 61 72 67 65 74 2c 20 6c 69 6e 6b  LinkTarget, link
88c0: 41 63 74 69 6f 6e 29 3b 0a 20 09 69 66 20 28 72  Action);. .if (r
88d0: 65 73 20 3d 3d 20 30 29 20 7b 0a 20 09 20 20 20  es == 0) {. .   
88e0: 20 72 65 74 75 72 6e 20 74 6f 50 74 72 3b 0a 20   return toPtr;. 
88f0: 09 7d 20 65 6c 73 65 20 7b 0a 40 40 20 2d 31 39  .} else {.@@ -19
8900: 34 38 2c 31 31 20 2b 31 39 35 36 2c 31 31 20 40  48,11 +1956,11 @
8910: 40 0a 20 7d 0a 20 0a 20 0c 0a 2b 23 69 66 20 30  @. }. . ..+#if 0
8920: 0a 20 2f 2a 20 0a 20 20 2a 20 54 68 69 73 20 66  . /* .  * This f
8930: 75 6e 63 74 69 6f 6e 20 63 6f 75 6c 64 20 62 65  unction could be
8940: 20 74 68 6f 72 6f 75 67 68 6c 79 20 74 65 73 74   thoroughly test
8950: 65 64 20 61 6e 64 20 74 68 65 6e 20 73 75 62 73  ed and then subs
8960: 74 69 74 75 74 65 64 20 69 6e 0a 20 20 2a 20 62  tituted in.  * b
8970: 65 6c 6f 77 20 74 6f 20 73 70 65 65 64 20 75 70  elow to speed up
8980: 20 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 61 74   file normalizat
8990: 69 6f 6e 20 6f 6e 20 57 69 6e 64 6f 77 73 20 4e  ion on Windows N
89a0: 54 2f 32 30 30 30 2f 58 50 0a 20 20 2a 2f 0a 2d  T/2000/XP.  */.-
89b0: 23 69 66 20 30 0a 20 0a 20 76 6f 69 64 20 57 69  #if 0. . void Wi
89c0: 6e 47 65 74 4c 6f 6e 67 50 61 74 68 4e 61 6d 65  nGetLongPathName
89d0: 28 43 4f 4e 53 54 20 54 43 48 41 52 2a 20 6f 72  (CONST TCHAR* or
89e0: 69 67 50 61 74 68 2c 20 54 63 6c 5f 44 53 74 72  igPath, Tcl_DStr
89f0: 69 6e 67 20 2a 64 73 50 74 72 29 3b 0a 20 0a 40  ing *dsPtr);. .@
8a00: 40 20 2d 32 30 32 33 2c 31 35 20 2b 32 30 33 31  @ -2023,15 +2031
8a10: 2c 32 34 20 40 40 0a 20 20 20 20 20 0a 20 23 65  ,24 @@.     . #e
8a20: 6e 64 69 66 0a 20 0a 2b 2f 2a 20 0a 2b 20 2a 20  ndif. .+/* .+ * 
8a30: 57 65 20 68 61 76 65 20 74 77 6f 20 64 69 66 66  We have two diff
8a40: 65 72 65 6e 74 20 69 6d 70 6c 65 6d 65 6e 74 61  erent implementa
8a50: 74 69 6f 6e 73 20 6f 66 20 66 69 6c 65 20 6e 6f  tions of file no
8a60: 72 6d 61 6c 69 7a 61 74 69 6f 6e 20 77 68 69 63  rmalization whic
8a70: 68 0a 2b 20 2a 20 63 61 6e 20 62 65 20 74 75 72  h.+ * can be tur
8a80: 6e 65 64 20 6f 6e 20 6f 72 20 6f 66 66 20 68 65  ned on or off he
8a90: 72 65 2e 20 20 54 68 65 79 20 73 68 6f 75 6c 64  re.  They should
8aa0: 20 62 6f 74 68 20 61 67 72 65 65 20 66 6f 72 20   both agree for 
8ab0: 61 6c 6c 20 66 69 6c 65 73 2c 0a 2b 20 2a 20 61  all files,.+ * a
8ac0: 6e 64 20 74 69 6d 69 6e 67 73 20 73 68 6f 77 20  nd timings show 
8ad0: 74 68 65 20 27 54 43 4c 57 49 4e 5f 4e 45 57 5f  the 'TCLWIN_NEW_
8ae0: 4e 4f 52 4d 27 20 76 65 72 73 69 6f 6e 20 69 73  NORM' version is
8af0: 20 61 62 6f 75 74 20 31 30 25 20 66 61 73 74 65   about 10% faste
8b00: 72 2e 0a 2b 20 2a 2f 0a 2b 23 64 65 66 69 6e 65  r..+ */.+#define
8b10: 20 54 43 4c 57 49 4e 5f 4e 45 57 5f 4e 4f 52 4d   TCLWIN_NEW_NORM
8b20: 0a 20 0c 0a 20 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d  . .. /*.  *-----
8b30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8b40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8b50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8b60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8b70: 2d 2d 2d 2d 2d 2d 0a 20 20 2a 0a 20 20 2a 20 54  ------.  *.  * T
8b80: 63 6c 70 4f 62 6a 4e 6f 72 6d 61 6c 69 7a 65 50  clpObjNormalizeP
8b90: 61 74 68 20 2d 2d 0a 20 20 2a 0a 2d 20 2a 09 54  ath --.  *.- *.T
8ba0: 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 73 63 61  his function sca
8bb0: 6e 73 20 74 68 72 6f 75 67 68 20 61 20 70 61 74  ns through a pat
8bc0: 68 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20  h specification 
8bd0: 61 6e 64 20 72 65 70 6c 61 63 65 73 0a 2d 20 2a  and replaces.- *
8be0: 09 69 74 2c 20 69 6e 20 70 6c 61 63 65 2c 20 77  .it, in place, w
8bf0: 69 74 68 20 61 20 6e 6f 72 6d 61 6c 69 7a 65 64  ith a normalized
8c00: 20 76 65 72 73 69 6f 6e 2e 20 20 4f 6e 20 77 69   version.  On wi
8c10: 6e 64 6f 77 73 20 74 68 69 73 0a 2d 20 2a 09 6d  ndows this.- *.m
8c20: 65 61 6e 73 20 75 73 69 6e 67 20 74 68 65 20 27  eans using the '
8c30: 6c 6f 6e 67 6e 61 6d 65 27 2e 0a 2b 20 2a 09 54  longname'..+ *.T
8c40: 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 73 63 61  his function sca
8c50: 6e 73 20 74 68 72 6f 75 67 68 20 61 20 70 61 74  ns through a pat
8c60: 68 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20  h specification 
8c70: 61 6e 64 20 72 65 70 6c 61 63 65 73 20 69 74 2c  and replaces it,
8c80: 0a 2b 20 2a 09 69 6e 20 70 6c 61 63 65 2c 20 77  .+ *.in place, w
8c90: 69 74 68 20 61 20 6e 6f 72 6d 61 6c 69 7a 65 64  ith a normalized
8ca0: 20 76 65 72 73 69 6f 6e 2e 20 20 4f 6e 20 57 69   version.  On Wi
8cb0: 6e 64 6f 77 73 20 4e 54 2f 32 30 30 30 2f 58 50  ndows NT/2000/XP
8cc0: 20 74 68 69 73 0a 2b 20 2a 09 6d 65 61 6e 73 20   this.+ *.means 
8cd0: 75 73 69 6e 67 20 74 68 65 20 27 6c 6f 6e 67 6e  using the 'longn
8ce0: 61 6d 65 27 2c 20 61 6e 64 20 65 78 70 61 6e 64  ame', and expand
8cf0: 69 6e 67 20 61 6e 79 20 73 79 6d 62 6f 6c 69 63  ing any symbolic
8d00: 20 6c 69 6e 6b 73 0a 2b 20 2a 09 63 6f 6e 74 61   links.+ *.conta
8d10: 69 6e 65 64 20 77 69 74 68 69 6e 20 74 68 65 20  ined within the 
8d20: 70 61 74 68 2e 20 20 4f 6e 20 57 69 6e 39 35 2f  path.  On Win95/
8d30: 39 38 2f 4d 45 20 69 74 20 6d 65 61 6e 73 20 75  98/ME it means u
8d40: 73 69 6e 67 20 74 68 65 0a 2b 20 2a 09 73 68 6f  sing the.+ *.sho
8d50: 72 74 20 66 6f 72 6d 20 6f 66 20 74 68 65 20 6e  rt form of the n
8d60: 61 6d 65 20 28 62 65 63 61 75 73 65 20 74 68 65  ame (because the
8d70: 20 41 50 49 73 20 74 6f 20 67 65 74 20 61 74 20   APIs to get at 
8d80: 74 68 65 20 6c 6f 6e 67 20 66 6f 72 6d 0a 2b 20  the long form.+ 
8d90: 2a 09 61 72 65 20 6d 75 63 68 20 74 6f 6f 20 73  *.are much too s
8da0: 6c 6f 77 29 2e 0a 20 20 2a 0a 20 20 2a 20 52 65  low)..  *.  * Re
8db0: 73 75 6c 74 73 3a 0a 20 20 2a 09 54 68 65 20 6e  sults:.  *.The n
8dc0: 65 77 20 27 6e 65 78 74 43 68 65 63 6b 70 6f 69  ew 'nextCheckpoi
8dd0: 6e 74 27 20 76 61 6c 75 65 2c 20 67 69 76 69 6e  nt' value, givin
8de0: 67 20 61 73 20 66 61 72 20 61 73 20 77 65 20 63  g as far as we c
8df0: 6f 75 6c 64 0a 40 40 20 2d 32 31 30 30 2c 39 20  ould.@@ -2100,9 
8e00: 2b 32 31 31 37 2c 31 30 20 40 40 0a 20 09 20 20  +2117,10 @@. .  
8e10: 20 20 2a 6c 61 73 74 56 61 6c 69 64 50 61 74 68    *lastValidPath
8e20: 45 6e 64 20 3d 20 27 5c 30 27 3b 0a 20 09 7d 0a  End = '\0';. .}.
8e30: 20 09 2f 2a 20 0a 2d 09 20 2a 20 49 66 20 77 65   ./* .-. * If we
8e40: 20 67 65 74 20 68 65 72 65 2c 20 77 65 20 66 6f   get here, we fo
8e50: 75 6e 64 20 61 20 76 61 6c 69 64 20 70 61 74 68  und a valid path
8e60: 2c 20 77 68 69 63 68 20 77 65 27 76 65 20 63 6f  , which we've co
8e70: 6e 76 65 72 74 65 64 20 74 6f 0a 2d 09 20 2a 20  nverted to.-. * 
8e80: 73 68 6f 72 74 20 66 6f 72 6d 2c 20 61 6e 64 20  short form, and 
8e90: 74 68 65 20 76 61 6c 69 64 20 73 74 72 69 6e 67  the valid string
8ea0: 20 65 6e 64 73 20 61 74 20 6f 72 20 62 65 66 6f   ends at or befo
8eb0: 72 65 20 27 6c 61 73 74 56 61 6c 69 64 50 61 74  re 'lastValidPat
8ec0: 68 45 6e 64 27 0a 2d 09 20 2a 20 61 6e 64 20 74  hEnd'.-. * and t
8ed0: 68 65 20 69 6e 76 61 6c 69 64 20 73 74 72 69 6e  he invalid strin
8ee0: 67 20 73 74 61 72 74 73 20 61 74 20 27 6c 61 73  g starts at 'las
8ef0: 74 56 61 6c 69 64 50 61 74 68 45 6e 64 27 2e 0a  tValidPathEnd'..
8f00: 2b 09 20 2a 20 49 66 20 77 65 20 67 65 74 20 68  +. * If we get h
8f10: 65 72 65 2c 20 77 65 20 66 6f 75 6e 64 20 61 20  ere, we found a 
8f20: 76 61 6c 69 64 20 70 61 74 68 2c 20 77 68 69 63  valid path, whic
8f30: 68 20 77 65 27 76 65 20 63 6f 6e 76 65 72 74 65  h we've converte
8f40: 64 0a 2b 09 20 2a 20 74 6f 20 73 68 6f 72 74 20  d.+. * to short 
8f50: 66 6f 72 6d 2c 20 61 6e 64 20 74 68 65 20 76 61  form, and the va
8f60: 6c 69 64 20 73 74 72 69 6e 67 20 65 6e 64 73 20  lid string ends 
8f70: 61 74 20 6f 72 20 62 65 66 6f 72 65 0a 2b 09 20  at or before.+. 
8f80: 2a 20 27 6c 61 73 74 56 61 6c 69 64 50 61 74 68  * 'lastValidPath
8f90: 45 6e 64 27 20 61 6e 64 20 74 68 65 20 69 6e 76  End' and the inv
8fa0: 61 6c 69 64 20 73 74 72 69 6e 67 20 73 74 61 72  alid string star
8fb0: 74 73 20 61 74 0a 2b 09 20 2a 20 27 6c 61 73 74  ts at.+. * 'last
8fc0: 56 61 6c 69 64 50 61 74 68 45 6e 64 27 2e 0a 20  ValidPathEnd'.. 
8fd0: 09 20 2a 2f 0a 20 0a 20 09 2f 2a 20 43 6f 70 79  . */. . ./* Copy
8fe0: 20 6f 76 65 72 20 74 68 65 20 76 61 6c 69 64 20   over the valid 
8ff0: 70 61 72 74 20 6f 66 20 74 68 65 20 70 61 74 68  part of the path
9000: 20 61 6e 64 20 66 69 6e 64 20 69 74 73 20 6c 65   and find its le
9010: 6e 67 74 68 20 2a 2f 0a 40 40 20 2d 32 31 32 39  ngth */.@@ -2129
9020: 2c 34 34 20 2b 32 31 34 37 2c 31 37 20 40 40 0a  ,44 +2147,17 @@.
9030: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 09       } else {. .
9040: 2f 2a 20 57 65 27 72 65 20 6f 6e 20 57 69 6e 4e  /* We're on WinN
9050: 54 20 6f 72 20 32 30 30 30 20 6f 72 20 58 50 20  T or 2000 or XP 
9060: 2a 2f 0a 20 09 43 4f 4e 53 54 20 63 68 61 72 20  */. .CONST char 
9070: 2a 6e 61 74 69 76 65 50 61 74 68 3b 0a 2d 23 69  *nativePath;.-#i
9080: 66 20 30 0a 2d 09 2f 2a 20 0a 2d 09 20 2a 20 57  f 0.-./* .-. * W
9090: 65 20 64 6f 6e 27 74 20 75 73 65 20 74 68 69 73  e don't use this
90a0: 20 73 69 6d 70 6c 65 72 20 76 65 72 73 69 6f 6e   simpler version
90b0: 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 73 70  , because the sp
90c0: 65 65 64 0a 2d 09 20 2a 20 69 6e 63 72 65 61 73  eed.-. * increas
90d0: 65 20 64 6f 65 73 20 6e 6f 74 20 73 65 65 6d 20  e does not seem 
90e0: 73 69 67 6e 69 66 69 63 61 6e 74 20 61 74 20 70  significant at p
90f0: 72 65 73 65 6e 74 20 61 6e 64 20 74 68 65 20 76  resent and the v
9100: 65 72 73 69 6f 6e 0a 2d 09 20 2a 20 62 65 6c 6f  ersion.-. * belo
9110: 77 20 69 73 20 74 68 6f 72 6f 75 67 68 6c 79 20  w is thoroughly 
9120: 64 65 62 75 67 67 65 64 2e 0a 2d 09 20 2a 2f 0a  debugged..-. */.
9130: 2d 09 69 6e 74 20 6e 61 74 69 76 65 4c 65 6e 3b  -.int nativeLen;
9140: 0a 2d 09 54 63 6c 5f 44 53 74 72 69 6e 67 20 65  .-.Tcl_DString e
9150: 44 73 3b 0a 2d 09 6e 61 74 69 76 65 50 61 74 68  Ds;.-.nativePath
9160: 20 3d 20 54 63 6c 5f 55 74 66 54 6f 45 78 74 65   = Tcl_UtfToExte
9170: 72 6e 61 6c 44 53 74 72 69 6e 67 28 4e 55 4c 4c  rnalDString(NULL
9180: 2c 20 70 61 74 68 2c 20 2d 31 2c 20 26 64 73 29  , path, -1, &ds)
9190: 3b 0a 2d 09 6e 61 74 69 76 65 4c 65 6e 20 3d 20  ;.-.nativeLen = 
91a0: 54 63 6c 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74  Tcl_DStringLengt
91b0: 68 28 26 64 73 29 3b 0a 2d 09 57 69 6e 47 65 74  h(&ds);.-.WinGet
91c0: 4c 6f 6e 67 50 61 74 68 4e 61 6d 65 28 6e 61 74  LongPathName(nat
91d0: 69 76 65 50 61 74 68 2c 20 26 65 44 73 29 3b 0a  ivePath, &eDs);.
91e0: 2d 09 2f 2a 20 0a 2d 09 20 2a 20 57 65 20 6e 65  -./* .-. * We ne
91f0: 65 64 20 74 6f 20 61 64 64 20 63 6f 64 65 20 68  ed to add code h
9200: 65 72 65 20 74 6f 20 63 61 6c 63 75 6c 61 74 65  ere to calculate
9210: 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 6f   the new value o
9220: 66 20 0a 2d 09 20 2a 20 27 6e 65 78 74 43 68 65  f .-. * 'nextChe
9230: 63 6b 70 6f 69 6e 74 27 20 2d 2d 20 69 2e 65 2e  ckpoint' -- i.e.
9240: 20 74 68 65 20 6c 6f 6e 67 65 73 74 20 70 61 72   the longest par
9250: 74 20 6f 66 20 74 68 65 20 70 61 74 68 0a 2d 09  t of the path.-.
9260: 20 2a 20 77 68 69 63 68 20 69 73 20 61 6e 20 65   * which is an e
9270: 78 69 73 74 69 6e 67 20 66 69 6c 65 2e 0a 2d 09  xisting file..-.
9280: 20 2a 2f 0a 2d 09 54 63 6c 5f 53 65 74 53 74 72   */.-.Tcl_SetStr
9290: 69 6e 67 4f 62 6a 28 70 61 74 68 50 74 72 2c 20  ingObj(pathPtr, 
92a0: 54 63 6c 5f 44 53 74 72 69 6e 67 56 61 6c 75 65  Tcl_DStringValue
92b0: 28 26 65 44 73 29 2c 20 54 63 6c 5f 44 53 74 72  (&eDs), Tcl_DStr
92c0: 69 6e 67 4c 65 6e 67 74 68 28 26 65 44 73 29 29  ingLength(&eDs))
92d0: 3b 0a 2d 09 54 63 6c 5f 44 53 74 72 69 6e 67 46  ;.-.Tcl_DStringF
92e0: 72 65 65 28 26 65 44 73 29 3b 0a 2d 09 54 63 6c  ree(&eDs);.-.Tcl
92f0: 5f 44 53 74 72 69 6e 67 46 72 65 65 28 26 64 73  _DStringFree(&ds
9300: 29 3b 0a 2d 23 65 6c 73 65 0a 20 09 63 68 61 72  );.-#else. .char
9310: 20 2a 63 75 72 72 65 6e 74 50 61 74 68 45 6e 64   *currentPathEnd
9320: 50 6f 73 69 74 69 6f 6e 3b 0a 20 09 54 63 6c 5f  Position;. .Tcl_
9330: 4f 62 6a 20 2a 74 65 6d 70 20 3d 20 4e 55 4c 4c  Obj *temp = NULL
9340: 3b 0a 20 09 57 49 4e 33 32 5f 46 49 4c 45 5f 41  ;. .WIN32_FILE_A
9350: 54 54 52 49 42 55 54 45 5f 44 41 54 41 20 64 61  TTRIBUTE_DATA da
9360: 74 61 3b 0a 2b 09 69 6e 74 20 69 73 44 72 69 76  ta;.+.int isDriv
9370: 65 20 3d 20 31 3b 0a 2b 23 69 66 64 65 66 20 54  e = 1;.+#ifdef T
9380: 43 4c 57 49 4e 5f 4e 45 57 5f 4e 4f 52 4d 0a 2b  CLWIN_NEW_NORM.+
9390: 09 2f 2a 20 54 68 69 73 20 77 69 6c 6c 20 68 6f  ./* This will ho
93a0: 6c 64 20 74 68 65 20 6e 6f 72 6d 61 6c 69 7a 65  ld the normalize
93b0: 64 20 73 74 72 69 6e 67 20 2a 2f 0a 2b 09 54 63  d string */.+.Tc
93c0: 6c 5f 44 53 74 72 69 6e 67 20 64 73 4e 6f 72 6d  l_DString dsNorm
93d0: 3b 0a 2b 09 54 63 6c 5f 44 53 74 72 69 6e 67 49  ;.+.Tcl_DStringI
93e0: 6e 69 74 28 26 64 73 4e 6f 72 6d 29 3b 0a 2b 23  nit(&dsNorm);.+#
93f0: 65 6e 64 69 66 0a 20 09 6e 61 74 69 76 65 50 61  endif. .nativePa
9400: 74 68 20 3d 20 54 63 6c 5f 57 69 6e 55 74 66 54  th = Tcl_WinUtfT
9410: 6f 54 43 68 61 72 28 70 61 74 68 2c 20 2d 31 2c  oTChar(path, -1,
9420: 20 26 64 73 29 3b 0a 20 0a 2d 09 2f 2a 20 0a 2d   &ds);. .-./* .-
9430: 09 20 2a 20 57 65 20 63 75 72 72 65 6e 74 6c 79  . * We currently
9440: 20 64 6f 6e 27 74 20 75 73 65 20 74 68 69 73 20   don't use this 
9450: 62 65 63 61 75 73 65 20 77 65 20 68 61 76 65 20  because we have 
9460: 74 6f 20 63 68 65 63 6b 0a 2d 09 20 2a 20 65 61  to check.-. * ea
9470: 63 68 20 70 61 74 68 20 63 6f 6d 70 6f 6e 65 6e  ch path componen
9480: 74 20 66 6f 72 20 72 65 70 61 72 73 65 20 70 6f  t for reparse po
9490: 69 6e 74 73 2e 0a 2d 09 20 2a 2f 0a 2d 09 69 66  ints..-. */.-.if
94a0: 20 28 30 20 26 26 20 28 2a 74 63 6c 57 69 6e 50   (0 && (*tclWinP
94b0: 72 6f 63 73 2d 3e 67 65 74 46 69 6c 65 41 74 74  rocs->getFileAtt
94c0: 72 69 62 75 74 65 73 45 78 50 72 6f 63 29 28 6e  ributesExProc)(n
94d0: 61 74 69 76 65 50 61 74 68 2c 20 0a 2d 09 09 09  ativePath, .-...
94e0: 09 09 09 20 20 20 20 47 65 74 46 69 6c 65 45 78  ...    GetFileEx
94f0: 49 6e 66 6f 53 74 61 6e 64 61 72 64 2c 20 0a 2d  InfoStandard, .-
9500: 09 09 09 09 09 09 20 20 20 20 26 64 61 74 61 29  ......    &data)
9510: 20 3d 3d 20 54 52 55 45 29 20 7b 0a 2d 09 20 20   == TRUE) {.-.  
9520: 20 20 63 75 72 72 65 6e 74 50 61 74 68 45 6e 64    currentPathEnd
9530: 50 6f 73 69 74 69 6f 6e 20 3d 20 70 61 74 68 20  Position = path 
9540: 2b 20 70 61 74 68 4c 65 6e 3b 0a 2d 09 20 20 20  + pathLen;.-.   
9550: 20 6e 65 78 74 43 68 65 63 6b 70 6f 69 6e 74 20   nextCheckpoint 
9560: 3d 20 70 61 74 68 4c 65 6e 3b 0a 2d 09 20 20 20  = pathLen;.-.   
9570: 20 6c 61 73 74 56 61 6c 69 64 50 61 74 68 45 6e   lastValidPathEn
9580: 64 20 3d 20 63 75 72 72 65 6e 74 50 61 74 68 45  d = currentPathE
9590: 6e 64 50 6f 73 69 74 69 6f 6e 3b 0a 2d 09 20 20  ndPosition;.-.  
95a0: 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 46 72 65    Tcl_DStringFre
95b0: 65 28 26 64 73 29 3b 0a 2d 09 7d 20 65 6c 73 65  e(&ds);.-.} else
95c0: 20 7b 0a 2d 09 20 20 20 20 69 6e 74 20 69 73 44   {.-.    int isD
95d0: 72 69 76 65 20 3d 20 31 3b 0a 20 09 20 20 20 20  rive = 1;. .    
95e0: 54 63 6c 5f 44 53 74 72 69 6e 67 46 72 65 65 28  Tcl_DStringFree(
95f0: 26 64 73 29 3b 0a 20 09 20 20 20 20 63 75 72 72  &ds);. .    curr
9600: 65 6e 74 50 61 74 68 45 6e 64 50 6f 73 69 74 69  entPathEndPositi
9610: 6f 6e 20 3d 20 70 61 74 68 20 2b 20 6e 65 78 74  on = path + next
9620: 43 68 65 63 6b 70 6f 69 6e 74 3b 0a 20 09 20 20  Checkpoint;. .  
9630: 20 20 77 68 69 6c 65 20 28 31 29 20 7b 0a 40 40    while (1) {.@@
9640: 20 2d 32 31 38 32 2c 31 31 20 2b 32 31 37 33 2c   -2182,11 +2173,
9650: 31 39 20 40 40 0a 20 09 09 09 62 72 65 61 6b 3b  19 @@. ...break;
9660: 0a 20 09 09 20 20 20 20 7d 0a 20 0a 2d 09 09 20  . ..    }. .-.. 
9670: 20 20 20 2f 2a 20 46 69 6c 65 20 64 6f 65 73 20     /* File does 
9680: 65 78 69 73 74 20 69 66 20 77 65 20 67 65 74 20  exist if we get 
9690: 68 65 72 65 20 2a 2f 0a 2b 09 09 2f 2a 20 0a 2b  here */.+../* .+
96a0: 09 09 20 2a 20 46 69 6c 65 20 27 6e 61 74 69 76  .. * File 'nativ
96b0: 65 50 61 74 68 27 20 64 6f 65 73 20 65 78 69 73  ePath' does exis
96c0: 74 20 69 66 20 77 65 20 67 65 74 20 68 65 72 65  t if we get here
96d0: 2e 20 20 57 65 0a 2b 09 09 20 2a 20 6e 6f 77 20  .  We.+.. * now 
96e0: 77 61 6e 74 20 74 6f 20 63 68 65 63 6b 20 69 66  want to check if
96f0: 20 69 74 20 69 73 20 61 20 73 79 6d 6c 69 6e 6b   it is a symlink
9700: 20 61 6e 64 20 6f 74 68 65 72 77 69 73 65 0a 2b   and otherwise.+
9710: 09 09 20 2a 20 63 6f 6e 74 69 6e 75 65 20 77 69  .. * continue wi
9720: 74 68 20 74 68 65 20 72 65 73 74 20 6f 66 20 74  th the rest of t
9730: 68 65 20 70 61 74 68 2e 0a 2b 09 09 20 2a 2f 0a  he path..+.. */.
9740: 20 09 09 20 20 20 20 0a 20 09 09 20 20 20 20 2f   ..    . ..    /
9750: 2a 20 0a 20 09 09 20 20 20 20 20 2a 20 43 68 65  * . ..     * Che
9760: 63 6b 20 66 6f 72 20 73 79 6d 6c 69 6e 6b 73 2c  ck for symlinks,
9770: 20 65 78 63 65 70 74 20 61 74 20 6c 61 73 74 20   except at last 
9780: 63 6f 6d 70 6f 6e 65 6e 74 0a 2d 09 09 20 20 20  component.-..   
9790: 20 20 2a 20 6f 66 20 70 61 74 68 20 28 77 65 20    * of path (we 
97a0: 64 6f 6e 27 74 20 66 6f 6c 6c 6f 77 20 66 69 6e  don't follow fin
97b0: 61 6c 20 73 79 6d 6c 69 6e 6b 73 29 20 0a 2b 09  al symlinks) .+.
97c0: 09 20 2a 20 6f 66 20 70 61 74 68 20 28 77 65 20  . * of path (we 
97d0: 64 6f 6e 27 74 20 66 6f 6c 6c 6f 77 20 66 69 6e  don't follow fin
97e0: 61 6c 20 73 79 6d 6c 69 6e 6b 73 29 2e 20 41 6c  al symlinks). Al
97f0: 73 6f 0a 2b 09 09 20 2a 20 61 20 64 72 69 76 65  so.+.. * a drive
9800: 20 28 43 3a 2f 29 20 66 6f 72 20 65 78 61 6d 70   (C:/) for examp
9810: 6c 65 2c 20 6d 61 79 20 73 6f 6d 65 74 69 6d 65  le, may sometime
9820: 73 20 68 61 76 65 0a 2b 09 09 20 2a 20 74 68 65  s have.+.. * the
9830: 20 72 65 70 61 72 73 65 20 66 6c 61 67 20 73 65   reparse flag se
9840: 74 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f  t for some reaso
9850: 6e 20 49 20 64 6f 6e 27 74 0a 2b 09 09 20 2a 20  n I don't.+.. * 
9860: 75 6e 64 65 72 73 74 61 6e 64 2e 20 20 57 65 20  understand.  We 
9870: 74 68 65 72 65 66 6f 72 65 20 64 6f 6e 27 74 20  therefore don't 
9880: 70 65 72 66 6f 72 6d 20 74 68 69 73 0a 2b 09 09  perform this.+..
9890: 20 2a 20 63 68 65 63 6b 20 66 6f 72 20 64 72 69   * check for dri
98a0: 76 65 73 2e 0a 20 09 09 20 20 20 20 20 2a 2f 0a  ves.. ..     */.
98b0: 20 09 09 20 20 20 20 69 66 20 28 63 75 72 20 21   ..    if (cur !
98c0: 3d 20 30 20 26 26 20 21 69 73 44 72 69 76 65 20  = 0 && !isDrive 
98d0: 26 26 20 28 64 61 74 61 2e 64 77 46 69 6c 65 41  && (data.dwFileA
98e0: 74 74 72 69 62 75 74 65 73 20 0a 20 09 09 09 09  ttributes . ....
98f0: 20 20 20 20 20 26 20 46 49 4c 45 5f 41 54 54 52       & FILE_ATTR
9900: 49 42 55 54 45 5f 52 45 50 41 52 53 45 5f 50 4f  IBUTE_REPARSE_PO
9910: 49 4e 54 29 29 20 7b 0a 40 40 20 2d 32 31 39 34  INT)) {.@@ -2194
9920: 2c 32 38 20 2b 32 31 39 33 2c 36 37 20 40 40 0a  ,28 +2193,67 @@.
9930: 20 09 09 09 69 66 20 28 74 6f 20 21 3d 20 4e 55   ...if (to != NU
9940: 4c 4c 29 20 7b 0a 20 09 09 09 20 20 20 20 2f 2a  LL) {. ...    /*
9950: 20 52 65 61 64 20 74 68 65 20 72 65 70 61 72 73   Read the repars
9960: 65 20 70 6f 69 6e 74 20 6f 6b 20 2a 2f 0a 20 09  e point ok */. .
9970: 09 09 20 20 20 20 54 63 6c 5f 47 65 74 53 74 72  ..    Tcl_GetStr
9980: 69 6e 67 46 72 6f 6d 4f 62 6a 28 74 6f 2c 20 26  ingFromObj(to, &
9990: 70 61 74 68 4c 65 6e 29 3b 0a 2d 09 09 09 20 20  pathLen);.-...  
99a0: 20 20 6e 65 78 74 43 68 65 63 6b 70 6f 69 6e 74    nextCheckpoint
99b0: 20 3d 20 70 61 74 68 4c 65 6e 3b 0a 2b 09 09 09   = pathLen;.+...
99c0: 6e 65 78 74 43 68 65 63 6b 70 6f 69 6e 74 20 3d  nextCheckpoint =
99d0: 20 30 3b 20 2f 2a 20 70 61 74 68 4c 65 6e 20 2a   0; /* pathLen *
99e0: 2f 0a 20 09 09 09 20 20 20 20 54 63 6c 5f 41 70  /. ...    Tcl_Ap
99f0: 70 65 6e 64 54 6f 4f 62 6a 28 74 6f 2c 20 63 75  pendToObj(to, cu
9a00: 72 72 65 6e 74 50 61 74 68 45 6e 64 50 6f 73 69  rrentPathEndPosi
9a10: 74 69 6f 6e 2c 20 2d 31 29 3b 0a 2b 09 09 09 2f  tion, -1);.+.../
9a20: 2a 20 43 6f 6e 76 65 72 74 20 6c 69 6e 6b 20 74  * Convert link t
9a30: 6f 20 66 6f 72 77 61 72 64 20 73 6c 61 73 68 65  o forward slashe
9a40: 73 20 2a 2f 0a 2b 09 09 09 66 6f 72 20 28 70 61  s */.+...for (pa
9a50: 74 68 20 3d 20 54 63 6c 5f 47 65 74 53 74 72 69  th = Tcl_GetStri
9a60: 6e 67 28 74 6f 29 3b 20 2a 70 61 74 68 20 21 3d  ng(to); *path !=
9a70: 20 30 3b 20 70 61 74 68 2b 2b 29 20 7b 0a 2b 09   0; path++) {.+.
9a80: 09 09 20 20 20 20 69 66 20 28 2a 70 61 74 68 20  ..    if (*path 
9a90: 3d 3d 20 27 5c 5c 27 29 20 2a 70 61 74 68 20 3d  == '\\') *path =
9aa0: 20 27 2f 27 3b 0a 2b 09 09 09 7d 0a 20 09 09 09   '/';.+...}. ...
9ab0: 20 20 20 20 70 61 74 68 20 3d 20 54 63 6c 5f 47      path = Tcl_G
9ac0: 65 74 53 74 72 69 6e 67 28 74 6f 29 3b 0a 20 09  etString(to);. .
9ad0: 09 09 20 20 20 20 63 75 72 72 65 6e 74 50 61 74  ..    currentPat
9ae0: 68 45 6e 64 50 6f 73 69 74 69 6f 6e 20 3d 20 70  hEndPosition = p
9af0: 61 74 68 20 2b 20 6e 65 78 74 43 68 65 63 6b 70  ath + nextCheckp
9b00: 6f 69 6e 74 3b 0a 20 09 09 09 20 20 20 20 69 66  oint;. ...    if
9b10: 20 28 74 65 6d 70 20 21 3d 20 4e 55 4c 4c 29 20   (temp != NULL) 
9b20: 7b 0a 20 09 09 09 20 20 20 20 20 20 20 20 54 63  {. ...        Tc
9b30: 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 74  l_DecrRefCount(t
9b40: 65 6d 70 29 3b 0a 20 09 09 09 20 20 20 20 7d 0a  emp);. ...    }.
9b50: 20 09 09 09 20 20 20 20 74 65 6d 70 20 3d 20 74   ...    temp = t
9b60: 6f 3b 0a 2b 09 09 09 2f 2a 20 52 65 73 65 74 20  o;.+.../* Reset 
9b70: 76 61 72 69 61 62 6c 65 73 20 73 6f 20 77 65 20  variables so we 
9b80: 63 61 6e 20 72 65 73 74 61 72 74 20 6e 6f 72 6d  can restart norm
9b90: 61 6c 69 7a 61 74 69 6f 6e 20 2a 2f 0a 2b 09 09  alization */.+..
9ba0: 09 69 73 44 72 69 76 65 20 3d 20 31 3b 0a 2b 23  .isDrive = 1;.+#
9bb0: 69 66 64 65 66 20 54 43 4c 57 49 4e 5f 4e 45 57  ifdef TCLWIN_NEW
9bc0: 5f 4e 4f 52 4d 0a 2b 09 09 09 54 63 6c 5f 44 53  _NORM.+...Tcl_DS
9bd0: 74 72 69 6e 67 46 72 65 65 28 26 64 73 4e 6f 72  tringFree(&dsNor
9be0: 6d 29 3b 0a 2b 09 09 09 54 63 6c 5f 44 53 74 72  m);.+...Tcl_DStr
9bf0: 69 6e 67 49 6e 69 74 28 26 64 73 4e 6f 72 6d 29  ingInit(&dsNorm)
9c00: 3b 0a 2b 23 65 6e 64 69 66 0a 2b 09 09 09 54 63  ;.+#endif.+...Tc
9c10: 6c 5f 44 53 74 72 69 6e 67 46 72 65 65 28 26 64  l_DStringFree(&d
9c20: 73 29 3b 0a 2b 09 09 09 63 6f 6e 74 69 6e 75 65  s);.+...continue
9c30: 3b 0a 2b 09 09 20 20 20 20 7d 0a 20 09 09 09 7d  ;.+..    }. ...}
9c40: 0a 2b 23 69 66 64 65 66 20 54 43 4c 57 49 4e 5f  .+#ifdef TCLWIN_
9c50: 4e 45 57 5f 4e 4f 52 4d 0a 2b 09 09 2f 2a 0a 2b  NEW_NORM.+../*.+
9c60: 09 09 20 2a 20 4e 6f 77 20 77 65 20 63 6f 6e 76  .. * Now we conv
9c70: 65 72 74 20 74 68 65 20 74 61 69 6c 20 6f 66 20  ert the tail of 
9c80: 74 68 65 20 63 75 72 72 65 6e 74 20 70 61 74 68  the current path
9c90: 20 74 6f 20 69 74 73 0a 2b 09 09 20 2a 20 27 6c   to its.+.. * 'l
9ca0: 6f 6e 67 20 66 6f 72 6d 27 2c 20 61 6e 64 20 61  ong form', and a
9cb0: 70 70 65 6e 64 20 69 74 20 74 6f 20 27 64 73 4e  ppend it to 'dsN
9cc0: 6f 72 6d 27 20 77 68 69 63 68 20 68 6f 6c 64 73  orm' which holds
9cd0: 0a 2b 09 09 20 2a 20 74 68 65 20 63 75 72 72 65  .+.. * the curre
9ce0: 6e 74 20 6e 6f 72 6d 61 6c 69 7a 65 64 20 70 61  nt normalized pa
9cf0: 74 68 0a 2b 09 09 20 2a 2f 0a 2b 09 09 69 66 20  th.+.. */.+..if 
9d00: 28 69 73 44 72 69 76 65 29 20 7b 0a 2b 09 09 20  (isDrive) {.+.. 
9d10: 20 20 20 57 43 48 41 52 20 64 72 69 76 65 20 3d     WCHAR drive =
9d20: 20 28 28 57 43 48 41 52 2a 29 6e 61 74 69 76 65   ((WCHAR*)native
9d30: 50 61 74 68 29 5b 30 5d 3b 0a 2b 09 09 20 20 20  Path)[0];.+..   
9d40: 20 69 66 20 28 64 72 69 76 65 20 3e 3d 20 4c 27   if (drive >= L'
9d50: 61 27 29 20 7b 0a 2b 09 09 20 20 20 20 20 20 20  a') {.+..       
9d60: 20 64 72 69 76 65 20 2d 3d 20 28 4c 27 61 27 20   drive -= (L'a' 
9d70: 2d 20 4c 27 41 27 29 3b 0a 2b 09 09 09 28 28 57  - L'A');.+...((W
9d80: 43 48 41 52 2a 29 6e 61 74 69 76 65 50 61 74 68  CHAR*)nativePath
9d90: 29 5b 30 5d 20 3d 20 64 72 69 76 65 3b 0a 20 09  )[0] = drive;. .
9da0: 09 20 20 20 20 7d 0a 2b 09 09 20 20 20 20 54 63  .    }.+..    Tc
9db0: 6c 5f 44 53 74 72 69 6e 67 41 70 70 65 6e 64 28  l_DStringAppend(
9dc0: 26 64 73 4e 6f 72 6d 2c 6e 61 74 69 76 65 50 61  &dsNorm,nativePa
9dd0: 74 68 2c 54 63 6c 5f 44 53 74 72 69 6e 67 4c 65  th,Tcl_DStringLe
9de0: 6e 67 74 68 28 26 64 73 29 29 3b 0a 2b 09 09 7d  ngth(&ds));.+..}
9df0: 20 65 6c 73 65 20 7b 0a 2b 09 09 20 20 20 20 57   else {.+..    W
9e00: 49 4e 33 32 5f 46 49 4e 44 5f 44 41 54 41 57 20  IN32_FIND_DATAW 
9e10: 66 44 61 74 61 3b 0a 2b 09 09 20 20 20 20 48 41  fData;.+..    HA
9e20: 4e 44 4c 45 20 68 61 6e 64 6c 65 3b 0a 20 0a 2d  NDLE handle;. .-
9e30: 09 09 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e  ..    Tcl_DStrin
9e40: 67 46 72 65 65 28 26 64 73 29 3b 0a 2d 09 09 20  gFree(&ds);.-.. 
9e50: 20 20 20 6c 61 73 74 56 61 6c 69 64 50 61 74 68     lastValidPath
9e60: 45 6e 64 20 3d 20 63 75 72 72 65 6e 74 50 61 74  End = currentPat
9e70: 68 45 6e 64 50 6f 73 69 74 69 6f 6e 3b 0a 2d 09  hEndPosition;.-.
9e80: 09 20 20 20 20 69 66 20 28 30 29 20 7b 0a 2d 09  .    if (0) {.-.
9e90: 09 09 57 49 4e 33 32 5f 46 49 4e 44 5f 44 41 54  ..WIN32_FIND_DAT
9ea0: 41 54 20 66 64 61 74 61 3b 0a 2d 09 09 09 43 4f  AT fdata;.-...CO
9eb0: 4e 53 54 20 54 43 48 41 52 20 2a 6e 61 74 69 76  NST TCHAR *nativ
9ec0: 65 4e 61 6d 65 3b 0a 2d 09 09 09 28 2a 74 63 6c  eName;.-...(*tcl
9ed0: 57 69 6e 50 72 6f 63 73 2d 3e 66 69 6e 64 46 69  WinProcs->findFi
9ee0: 72 73 74 46 69 6c 65 50 72 6f 63 29 28 6e 61 74  rstFileProc)(nat
9ef0: 69 76 65 50 61 74 68 2c 20 26 66 64 61 74 61 29  ivePath, &fdata)
9f00: 3b 0a 2d 09 09 09 6e 61 74 69 76 65 4e 61 6d 65  ;.-...nativeName
9f10: 20 3d 20 28 54 43 48 41 52 20 2a 29 20 66 64 61   = (TCHAR *) fda
9f20: 74 61 2e 77 2e 63 41 6c 74 65 72 6e 61 74 65 46  ta.w.cAlternateF
9f30: 69 6c 65 4e 61 6d 65 3b 0a 2d 09 09 09 69 66 20  ileName;.-...if 
9f40: 28 66 64 61 74 61 2e 77 2e 63 46 69 6c 65 4e 61  (fdata.w.cFileNa
9f50: 6d 65 5b 30 5d 20 21 3d 20 27 5c 30 27 29 20 7b  me[0] != '\0') {
9f60: 0a 2d 09 09 09 20 20 20 20 6e 61 74 69 76 65 4e  .-...    nativeN
9f70: 61 6d 65 20 3d 20 28 54 43 48 41 52 20 2a 29 20  ame = (TCHAR *) 
9f80: 66 64 61 74 61 2e 77 2e 63 46 69 6c 65 4e 61 6d  fdata.w.cFileNam
9f90: 65 3b 0a 2b 09 09 20 20 20 20 68 61 6e 64 6c 65  e;.+..    handle
9fa0: 20 3d 20 46 69 6e 64 46 69 72 73 74 46 69 6c 65   = FindFirstFile
9fb0: 57 28 28 57 43 48 41 52 2a 29 6e 61 74 69 76 65  W((WCHAR*)native
9fc0: 50 61 74 68 2c 20 26 66 44 61 74 61 29 3b 0a 2b  Path, &fData);.+
9fd0: 09 09 20 20 20 20 69 66 20 28 68 61 6e 64 6c 65  ..    if (handle
9fe0: 20 3d 3d 20 49 4e 56 41 4c 49 44 5f 48 41 4e 44   == INVALID_HAND
9ff0: 4c 45 5f 56 41 4c 55 45 29 20 7b 0a 2b 09 09 09  LE_VALUE) {.+...
a000: 2f 2a 20 54 68 69 73 20 69 73 20 75 73 75 61 6c  /* This is usual
a010: 6c 79 20 74 68 65 20 27 2f 27 20 69 6e 20 27 63  ly the '/' in 'c
a020: 3a 2f 27 20 61 74 20 65 6e 64 20 6f 66 20 73 74  :/' at end of st
a030: 72 69 6e 67 20 2a 2f 0a 2b 09 09 09 54 63 6c 5f  ring */.+...Tcl_
a040: 44 53 74 72 69 6e 67 41 70 70 65 6e 64 28 26 64  DStringAppend(&d
a050: 73 4e 6f 72 6d 2c 28 43 4f 4e 53 54 20 63 68 61  sNorm,(CONST cha
a060: 72 2a 29 4c 22 2f 22 2c 20 0a 2b 09 09 09 09 09  r*)L"/", .+.....
a070: 20 20 73 69 7a 65 6f 66 28 57 43 48 41 52 29 29    sizeof(WCHAR))
a080: 3b 0a 2b 09 09 20 20 20 20 7d 20 65 6c 73 65 20  ;.+..    } else 
a090: 7b 0a 2b 09 09 09 57 43 48 41 52 20 2a 6e 61 74  {.+...WCHAR *nat
a0a0: 69 76 65 4e 61 6d 65 3b 0a 2b 09 09 09 69 66 20  iveName;.+...if 
a0b0: 28 66 44 61 74 61 2e 63 46 69 6c 65 4e 61 6d 65  (fData.cFileName
a0c0: 5b 30 5d 20 21 3d 20 27 5c 30 27 29 20 7b 0a 2b  [0] != '\0') {.+
a0d0: 09 09 09 20 20 20 20 6e 61 74 69 76 65 4e 61 6d  ...    nativeNam
a0e0: 65 20 3d 20 66 44 61 74 61 2e 63 46 69 6c 65 4e  e = fData.cFileN
a0f0: 61 6d 65 3b 0a 2b 09 09 09 7d 20 65 6c 73 65 20  ame;.+...} else 
a100: 7b 0a 2b 09 09 09 20 20 20 20 6e 61 74 69 76 65  {.+...    native
a110: 4e 61 6d 65 20 3d 20 66 44 61 74 61 2e 63 41 6c  Name = fData.cAl
a120: 74 65 72 6e 61 74 65 46 69 6c 65 4e 61 6d 65 3b  ternateFileName;
a130: 0a 2b 09 09 09 7d 0a 2b 09 09 09 46 69 6e 64 43  .+...}.+...FindC
a140: 6c 6f 73 65 28 68 61 6e 64 6c 65 29 3b 0a 2b 09  lose(handle);.+.
a150: 09 09 54 63 6c 5f 44 53 74 72 69 6e 67 41 70 70  ..Tcl_DStringApp
a160: 65 6e 64 28 26 64 73 4e 6f 72 6d 2c 28 43 4f 4e  end(&dsNorm,(CON
a170: 53 54 20 63 68 61 72 2a 29 4c 22 2f 22 2c 20 0a  ST char*)L"/", .
a180: 2b 09 09 09 09 09 20 20 73 69 7a 65 6f 66 28 57  +.....  sizeof(W
a190: 43 48 41 52 29 29 3b 0a 2b 09 09 09 54 63 6c 5f  CHAR));.+...Tcl_
a1a0: 44 53 74 72 69 6e 67 41 70 70 65 6e 64 28 26 64  DStringAppend(&d
a1b0: 73 4e 6f 72 6d 2c 28 54 43 48 41 52 2a 29 6e 61  sNorm,(TCHAR*)na
a1c0: 74 69 76 65 4e 61 6d 65 2c 20 0a 2b 09 09 09 09  tiveName, .+....
a1d0: 09 20 20 77 63 73 6c 65 6e 28 6e 61 74 69 76 65  .  wcslen(native
a1e0: 4e 61 6d 65 29 2a 73 69 7a 65 6f 66 28 57 43 48  Name)*sizeof(WCH
a1f0: 41 52 29 29 3b 0a 20 09 09 09 7d 20 0a 20 09 09  AR));. ...} . ..
a200: 20 20 20 20 7d 0a 2b 23 65 6e 64 69 66 09 09 0a      }.+#endif...
a210: 2b 09 09 54 63 6c 5f 44 53 74 72 69 6e 67 46 72  +..Tcl_DStringFr
a220: 65 65 28 26 64 73 29 3b 0a 2b 09 09 6c 61 73 74  ee(&ds);.+..last
a230: 56 61 6c 69 64 50 61 74 68 45 6e 64 20 3d 20 63  ValidPathEnd = c
a240: 75 72 72 65 6e 74 50 61 74 68 45 6e 64 50 6f 73  urrentPathEndPos
a250: 69 74 69 6f 6e 3b 0a 20 09 09 20 20 20 20 69 66  ition;. ..    if
a260: 20 28 63 75 72 20 3d 3d 20 30 29 20 7b 0a 20 09   (cur == 0) {. .
a270: 09 09 62 72 65 61 6b 3b 0a 20 09 09 20 20 20 20  ..break;. ..    
a280: 7d 0a 40 40 20 2d 32 32 32 38 2c 31 36 20 2b 32  }.@@ -2228,16 +2
a290: 32 36 36 2c 34 36 20 40 40 0a 20 09 09 63 75 72  266,46 @@. ..cur
a2a0: 72 65 6e 74 50 61 74 68 45 6e 64 50 6f 73 69 74  rentPathEndPosit
a2b0: 69 6f 6e 2b 2b 3b 0a 20 09 20 20 20 20 7d 0a 20  ion++;. .    }. 
a2c0: 09 20 20 20 20 6e 65 78 74 43 68 65 63 6b 70 6f  .    nextCheckpo
a2d0: 69 6e 74 20 3d 20 63 75 72 72 65 6e 74 50 61 74  int = currentPat
a2e0: 68 45 6e 64 50 6f 73 69 74 69 6f 6e 20 2d 20 70  hEndPosition - p
a2f0: 61 74 68 3b 0a 2d 09 7d 0a 2b 09 0a 20 09 69 66  ath;.-.}.+.. .if
a300: 20 28 6c 61 73 74 56 61 6c 69 64 50 61 74 68 45   (lastValidPathE
a310: 6e 64 20 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 23  nd != NULL) {.+#
a320: 69 66 64 65 66 20 54 43 4c 57 49 4e 5f 4e 45 57  ifdef TCLWIN_NEW
a330: 5f 4e 4f 52 4d 0a 2b 09 20 20 20 20 2f 2a 20 0a  _NORM.+.    /* .
a340: 2b 09 20 20 20 20 20 2a 20 43 6f 6e 63 61 74 65  +.     * Concate
a350: 6e 61 74 65 20 74 68 65 20 6e 6f 72 6d 61 6c 69  nate the normali
a360: 7a 65 64 20 73 74 72 69 6e 67 20 69 6e 20 64 73  zed string in ds
a370: 4e 6f 72 6d 20 77 69 74 68 20 74 68 65 0a 2b 09  Norm with the.+.
a380: 20 20 20 20 20 2a 20 74 61 69 6c 20 6f 66 20 74       * tail of t
a390: 68 65 20 70 61 74 68 20 77 68 69 63 68 20 77 65  he path which we
a3a0: 20 64 69 64 6e 27 74 20 72 65 63 6f 67 6e 69 73   didn't recognis
a3b0: 65 2e 20 20 54 68 65 0a 2b 09 20 20 20 20 20 2a  e.  The.+.     *
a3c0: 20 73 74 72 69 6e 67 20 69 6e 20 64 73 4e 6f 72   string in dsNor
a3d0: 6d 20 69 73 20 69 6e 20 74 68 65 20 6e 61 74 69  m is in the nati
a3e0: 76 65 20 65 6e 63 6f 64 69 6e 67 2c 20 73 6f 20  ve encoding, so 
a3f0: 77 65 0a 2b 09 20 20 20 20 20 2a 20 68 61 76 65  we.+.     * have
a400: 20 74 6f 20 63 6f 6e 76 65 72 74 20 69 74 20 74   to convert it t
a410: 6f 20 55 74 66 2e 0a 2b 09 20 20 20 20 20 2a 2f  o Utf..+.     */
a420: 0a 2b 09 20 20 20 20 54 63 6c 5f 44 53 74 72 69  .+.    Tcl_DStri
a430: 6e 67 20 64 73 54 65 6d 70 3b 0a 2b 09 20 20 20  ng dsTemp;.+.   
a440: 20 54 63 6c 5f 57 69 6e 54 43 68 61 72 54 6f 55   Tcl_WinTCharToU
a450: 74 66 28 54 63 6c 5f 44 53 74 72 69 6e 67 56 61  tf(Tcl_DStringVa
a460: 6c 75 65 28 26 64 73 4e 6f 72 6d 29 2c 20 0a 2b  lue(&dsNorm), .+
a470: 09 09 09 20 20 20 20 20 20 54 63 6c 5f 44 53 74  ...      Tcl_DSt
a480: 72 69 6e 67 4c 65 6e 67 74 68 28 26 64 73 4e 6f  ringLength(&dsNo
a490: 72 6d 29 2c 20 26 64 73 54 65 6d 70 29 3b 0a 2b  rm), &dsTemp);.+
a4a0: 09 20 20 20 20 6e 65 78 74 43 68 65 63 6b 70 6f  .    nextCheckpo
a4b0: 69 6e 74 20 3d 20 54 63 6c 5f 44 53 74 72 69 6e  int = Tcl_DStrin
a4c0: 67 4c 65 6e 67 74 68 28 26 64 73 54 65 6d 70 29  gLength(&dsTemp)
a4d0: 3b 0a 2b 09 20 20 20 20 69 66 20 28 2a 6c 61 73  ;.+.    if (*las
a4e0: 74 56 61 6c 69 64 50 61 74 68 45 6e 64 20 21 3d  tValidPathEnd !=
a4f0: 20 30 29 20 7b 0a 2b 09 09 2f 2a 20 4e 6f 74 20   0) {.+../* Not 
a500: 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 73  the end of the s
a510: 74 72 69 6e 67 20 2a 2f 0a 2b 09 09 69 6e 74 20  tring */.+..int 
a520: 6c 65 6e 3b 0a 2b 09 09 63 68 61 72 20 2a 70 61  len;.+..char *pa
a530: 74 68 3b 0a 20 09 20 20 20 20 54 63 6c 5f 4f 62  th;. .    Tcl_Ob
a540: 6a 20 2a 74 6d 70 50 61 74 68 50 74 72 3b 0a 2b  j *tmpPathPtr;.+
a550: 09 09 74 6d 70 50 61 74 68 50 74 72 20 3d 20 54  ..tmpPathPtr = T
a560: 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28  cl_NewStringObj(
a570: 54 63 6c 5f 44 53 74 72 69 6e 67 56 61 6c 75 65  Tcl_DStringValue
a580: 28 26 64 73 54 65 6d 70 29 2c 20 0a 2b 09 09 09  (&dsTemp), .+...
a590: 09 09 20 20 20 20 20 20 6e 65 78 74 43 68 65 63  ..      nextChec
a5a0: 6b 70 6f 69 6e 74 29 3b 0a 2b 09 09 54 63 6c 5f  kpoint);.+..Tcl_
a5b0: 41 70 70 65 6e 64 54 6f 4f 62 6a 28 74 6d 70 50  AppendToObj(tmpP
a5c0: 61 74 68 50 74 72 2c 20 6c 61 73 74 56 61 6c 69  athPtr, lastVali
a5d0: 64 50 61 74 68 45 6e 64 2c 20 2d 31 29 3b 0a 2b  dPathEnd, -1);.+
a5e0: 09 09 70 61 74 68 20 3d 20 54 63 6c 5f 47 65 74  ..path = Tcl_Get
a5f0: 53 74 72 69 6e 67 46 72 6f 6d 4f 62 6a 28 74 6d  StringFromObj(tm
a600: 70 50 61 74 68 50 74 72 2c 20 26 6c 65 6e 29 3b  pPathPtr, &len);
a610: 0a 2b 09 09 54 63 6c 5f 53 65 74 53 74 72 69 6e  .+..Tcl_SetStrin
a620: 67 4f 62 6a 28 70 61 74 68 50 74 72 2c 20 70 61  gObj(pathPtr, pa
a630: 74 68 2c 20 6c 65 6e 29 3b 0a 2b 09 09 54 63 6c  th, len);.+..Tcl
a640: 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 74 6d  _DecrRefCount(tm
a650: 70 50 61 74 68 50 74 72 29 3b 0a 2b 09 20 20 20  pPathPtr);.+.   
a660: 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 09 2f 2a 20   } else {.+../* 
a670: 45 6e 64 20 6f 66 20 73 74 72 69 6e 67 20 77 61  End of string wa
a680: 73 20 72 65 61 63 68 65 64 20 61 62 6f 76 65 20  s reached above 
a690: 2a 2f 0a 2b 09 09 54 63 6c 5f 53 65 74 53 74 72  */.+..Tcl_SetStr
a6a0: 69 6e 67 4f 62 6a 28 70 61 74 68 50 74 72 2c 20  ingObj(pathPtr, 
a6b0: 54 63 6c 5f 44 53 74 72 69 6e 67 56 61 6c 75 65  Tcl_DStringValue
a6c0: 28 26 64 73 54 65 6d 70 29 2c 0a 2b 09 09 09 09  (&dsTemp),.+....
a6d0: 20 6e 65 78 74 43 68 65 63 6b 70 6f 69 6e 74 29   nextCheckpoint)
a6e0: 3b 0a 2b 09 20 20 20 20 7d 0a 2b 09 20 20 20 20  ;.+.    }.+.    
a6f0: 54 63 6c 5f 44 53 74 72 69 6e 67 46 72 65 65 28  Tcl_DStringFree(
a700: 26 64 73 54 65 6d 70 29 3b 0a 2b 23 65 6c 73 65  &dsTemp);.+#else
a710: 0a 20 09 20 20 20 20 2f 2a 20 0a 20 09 20 20 20  . .    /* . .   
a720: 20 20 2a 20 54 68 65 20 6c 65 61 64 69 6e 67 20    * The leading 
a730: 65 6e 64 20 6f 66 20 74 68 65 20 70 61 74 68 20  end of the path 
a740: 64 65 73 63 72 69 70 74 69 6f 6e 20 77 61 73 20  description was 
a750: 61 63 63 65 70 74 61 62 6c 65 20 74 6f 0a 2d 09  acceptable to.-.
a760: 20 20 20 20 20 2a 20 75 73 2e 20 20 57 65 20 74       * us.  We t
a770: 68 65 72 65 66 6f 72 65 20 63 6f 6e 76 65 72 74  herefore convert
a780: 20 69 74 20 74 6f 20 69 74 73 20 6c 6f 6e 67 20   it to its long 
a790: 66 6f 72 6d 2c 20 61 6e 64 20 72 65 74 75 72 6e  form, and return
a7a0: 0a 2b 09 20 20 20 20 20 2a 20 75 73 2e 20 20 57  .+.     * us.  W
a7b0: 65 20 74 68 65 72 65 66 6f 72 65 20 63 6f 6e 76  e therefore conv
a7c0: 65 72 74 20 69 74 20 74 6f 20 69 74 73 20 6c 6f  ert it to its lo
a7d0: 6e 67 20 66 6f 72 6d 20 28 77 68 69 63 68 20 69  ng form (which i
a7e0: 73 0a 2b 09 20 20 20 20 20 2a 20 75 73 65 64 20  s.+.     * used 
a7f0: 62 79 20 54 63 6c 20 61 73 20 61 20 75 6e 69 71  by Tcl as a uniq
a800: 75 65 20 6e 6f 72 6d 61 6c 69 7a 65 64 20 66 6f  ue normalized fo
a810: 72 6d 29 2c 20 61 6e 64 20 72 65 74 75 72 6e 0a  rm), and return.
a820: 20 09 20 20 20 20 20 2a 20 74 68 61 74 2e 0a 20   .     * that.. 
a830: 09 20 20 20 20 20 2a 2f 0a 2d 09 20 20 20 20 54  .     */.-.    T
a840: 63 6c 5f 4f 62 6a 2a 20 6f 62 6a 50 74 72 20 3d  cl_Obj* objPtr =
a850: 20 4e 55 4c 4c 3b 0a 20 09 20 20 20 20 69 6e 74   NULL;. .    int
a860: 20 65 6e 64 4f 66 53 74 72 69 6e 67 3b 0a 2b 09   endOfString;.+.
a870: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 74 6d 70      Tcl_Obj *tmp
a880: 50 61 74 68 50 74 72 3b 0a 2b 09 20 20 20 20 54  PathPtr;.+.    T
a890: 63 6c 5f 4f 62 6a 2a 20 6f 62 6a 50 74 72 20 3d  cl_Obj* objPtr =
a8a0: 20 4e 55 4c 4c 3b 0a 20 09 20 20 20 20 69 6e 74   NULL;. .    int
a8b0: 20 75 73 65 4c 65 6e 67 74 68 20 3d 20 6c 61 73   useLength = las
a8c0: 74 56 61 6c 69 64 50 61 74 68 45 6e 64 20 2d 20  tValidPathEnd - 
a8d0: 70 61 74 68 3b 0a 20 09 20 20 20 20 69 66 20 28  path;. .    if (
a8e0: 2a 6c 61 73 74 56 61 6c 69 64 50 61 74 68 45 6e  *lastValidPathEn
a8f0: 64 20 3d 3d 20 30 29 20 7b 0a 20 09 09 74 6d 70  d == 0) {. ..tmp
a900: 50 61 74 68 50 74 72 20 3d 20 54 63 6c 5f 4e 65  PathPtr = Tcl_Ne
a910: 77 53 74 72 69 6e 67 4f 62 6a 28 70 61 74 68 2c  wStringObj(path,
a920: 20 75 73 65 4c 65 6e 67 74 68 29 3b 0a 40 40 20   useLength);.@@ 
a930: 2d 32 32 36 39 2c 37 20 2b 32 33 33 37 2c 31 30  -2269,7 +2337,10
a940: 20 40 40 0a 20 09 09 54 63 6c 5f 44 65 63 72 52   @@. ..Tcl_DecrR
a950: 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 3b  efCount(objPtr);
a960: 0a 20 09 20 20 20 20 7d 0a 20 09 20 20 20 20 54  . .    }. .    T
a970: 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28  cl_DecrRefCount(
a980: 74 6d 70 50 61 74 68 50 74 72 29 3b 0a 2b 23 65  tmpPathPtr);.+#e
a990: 6e 64 69 66 0a 20 09 7d 0a 2b 23 69 66 64 65 66  ndif. .}.+#ifdef
a9a0: 20 54 43 4c 57 49 4e 5f 4e 45 57 5f 4e 4f 52 4d   TCLWIN_NEW_NORM
a9b0: 0a 2b 09 54 63 6c 5f 44 53 74 72 69 6e 67 46 72  .+.Tcl_DStringFr
a9c0: 65 65 28 26 64 73 4e 6f 72 6d 29 3b 0a 20 23 65  ee(&dsNorm);. #e
a9d0: 6e 64 69 66 0a 20 20 20 20 20 7d 0a 20 20 20 20  ndif.     }.    
a9e0: 20 72 65 74 75 72 6e 20 6e 65 78 74 43 68 65 63   return nextChec
a9f0: 6b 70 6f 69 6e 74 3b 0a                          kpoint;.