Tcl Source Code

Hex Artifact Content
Login

Artifact acf501a2376952d5e54283aecfd8b2142f75b646ca3945000aed23de882ed14b:

Attachment "filestat.diff" to ticket [560c5e438c] added by emiliano 2021-01-14 14:45:55. (unpublished)
0000: 49 6e 64 65 78 3a 20 64 6f 63 2f 66 69 6c 65 2e  Index: doc/file.
0010: 6e 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  n.==============
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0050: 3d 3d 3d 3d 0a 2d 2d 2d 20 64 6f 63 2f 66 69 6c  ====.--- doc/fil
0060: 65 2e 6e 0a 2b 2b 2b 20 64 6f 63 2f 66 69 6c 65  e.n.+++ doc/file
0070: 2e 6e 0a 40 40 20 2d 32 34 36 2c 31 38 20 2b 32  .n.@@ -246,18 +2
0080: 34 36 2c 31 38 20 40 40 0a 20 65 72 72 6f 72 20  46,18 @@. error 
0090: 6d 65 73 73 61 67 65 20 77 69 6c 6c 20 62 65 20  message will be 
00a0: 72 65 74 75 72 6e 65 64 2e 20 20 4d 6f 73 74 20  returned.  Most 
00b0: 55 6e 69 78 20 70 6c 61 74 66 6f 72 6d 73 20 73  Unix platforms s
00c0: 75 70 70 6f 72 74 20 62 6f 74 68 0a 20 73 79 6d  upport both. sym
00d0: 62 6f 6c 69 63 20 61 6e 64 20 68 61 72 64 20 6c  bolic and hard l
00e0: 69 6e 6b 73 20 28 74 68 65 20 6c 61 74 74 65 72  inks (the latter
00f0: 20 66 6f 72 20 66 69 6c 65 73 20 6f 6e 6c 79 29   for files only)
0100: 2e 20 57 69 6e 64 6f 77 73 0a 20 73 75 70 70 6f  . Windows. suppo
0110: 72 74 73 20 73 79 6d 62 6f 6c 69 63 20 64 69 72  rts symbolic dir
0120: 65 63 74 6f 72 79 20 6c 69 6e 6b 73 20 61 6e 64  ectory links and
0130: 20 68 61 72 64 20 66 69 6c 65 20 6c 69 6e 6b 73   hard file links
0140: 20 6f 6e 20 4e 54 46 53 20 64 72 69 76 65 73 2e   on NTFS drives.
0150: 0a 20 2e 52 45 0a 20 2e 54 50 0a 2d 5c 66 42 66  . .RE. .TP.-\fBf
0160: 69 6c 65 20 6c 73 74 61 74 20 5c 66 49 6e 61 6d  ile lstat \fInam
0170: 65 20 76 61 72 4e 61 6d 65 5c 66 52 0a 2b 5c 66  e varName\fR.+\f
0180: 42 66 69 6c 65 20 6c 73 74 61 74 20 5c 66 49 6e  Bfile lstat \fIn
0190: 61 6d 65 20 3f 76 61 72 4e 61 6d 65 3f 5c 66 52  ame ?varName?\fR
01a0: 0a 20 2e 0a 20 53 61 6d 65 20 61 73 20 5c 66 42  . .. Same as \fB
01b0: 73 74 61 74 5c 66 52 20 6f 70 74 69 6f 6e 20 28  stat\fR option (
01c0: 73 65 65 20 62 65 6c 6f 77 29 20 65 78 63 65 70  see below) excep
01d0: 74 20 75 73 65 73 20 74 68 65 20 5c 66 49 6c 73  t uses the \fIls
01e0: 74 61 74 5c 66 52 0a 20 6b 65 72 6e 65 6c 20 63  tat\fR. kernel c
01f0: 61 6c 6c 20 69 6e 73 74 65 61 64 20 6f 66 20 5c  all instead of \
0200: 66 49 73 74 61 74 5c 66 52 2e 20 20 54 68 69 73  fIstat\fR.  This
0210: 20 6d 65 61 6e 73 20 74 68 61 74 20 69 66 20 5c   means that if \
0220: 66 49 6e 61 6d 65 5c 66 52 0a 2d 72 65 66 65 72  fIname\fR.-refer
0230: 73 20 74 6f 20 61 20 73 79 6d 62 6f 6c 69 63 20  s to a symbolic 
0240: 6c 69 6e 6b 20 74 68 65 20 69 6e 66 6f 72 6d 61  link the informa
0250: 74 69 6f 6e 20 72 65 74 75 72 6e 65 64 20 69 6e  tion returned in
0260: 20 5c 66 49 76 61 72 4e 61 6d 65 5c 66 52 0a 2d   \fIvarName\fR.-
0270: 69 73 20 66 6f 72 20 74 68 65 20 6c 69 6e 6b 20  is for the link 
0280: 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20  rather than the 
0290: 66 69 6c 65 20 69 74 20 72 65 66 65 72 73 20 74  file it refers t
02a0: 6f 2e 20 20 4f 6e 20 73 79 73 74 65 6d 73 20 74  o.  On systems t
02b0: 68 61 74 0a 2d 64 6f 20 6e 6f 74 20 73 75 70 70  hat.-do not supp
02c0: 6f 72 74 20 73 79 6d 62 6f 6c 69 63 20 6c 69 6e  ort symbolic lin
02d0: 6b 73 20 74 68 69 73 20 6f 70 74 69 6f 6e 20 62  ks this option b
02e0: 65 68 61 76 65 73 20 65 78 61 63 74 6c 79 20 74  ehaves exactly t
02f0: 68 65 20 73 61 6d 65 0a 2d 61 73 20 74 68 65 20  he same.-as the 
0300: 5c 66 42 73 74 61 74 5c 66 52 20 6f 70 74 69 6f  \fBstat\fR optio
0310: 6e 2e 0a 2b 72 65 66 65 72 73 20 74 6f 20 61 20  n..+refers to a 
0320: 73 79 6d 62 6f 6c 69 63 20 6c 69 6e 6b 20 74 68  symbolic link th
0330: 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 72 65  e information re
0340: 74 75 72 6e 65 64 20 69 73 20 66 6f 72 20 74 68  turned is for th
0350: 65 20 6c 69 6e 6b 0a 2b 72 61 74 68 65 72 20 74  e link.+rather t
0360: 68 61 6e 20 74 68 65 20 66 69 6c 65 20 69 74 20  han the file it 
0370: 72 65 66 65 72 73 20 74 6f 2e 20 20 4f 6e 20 73  refers to.  On s
0380: 79 73 74 65 6d 73 20 74 68 61 74 20 64 6f 20 6e  ystems that do n
0390: 6f 74 20 73 75 70 70 6f 72 74 0a 2b 73 79 6d 62  ot support.+symb
03a0: 6f 6c 69 63 20 6c 69 6e 6b 73 20 74 68 69 73 20  olic links this 
03b0: 6f 70 74 69 6f 6e 20 62 65 68 61 76 65 73 20 65  option behaves e
03c0: 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20  xactly the same 
03d0: 61 73 20 74 68 65 0a 2b 5c 66 42 73 74 61 74 5c  as the.+\fBstat\
03e0: 66 52 20 6f 70 74 69 6f 6e 2e 0a 20 2e 54 50 0a  fR option.. .TP.
03f0: 20 5c 66 42 66 69 6c 65 20 6d 6b 64 69 72 5c 66   \fBfile mkdir\f
0400: 52 20 3f 5c 66 49 64 69 72 5c 66 52 20 2e 2e 2e  R ?\fIdir\fR ...
0410: 3f 0a 20 2e 0a 20 43 72 65 61 74 65 73 20 65 61  ?. .. Creates ea
0420: 63 68 20 64 69 72 65 63 74 6f 72 79 20 73 70 65  ch directory spe
0430: 63 69 66 69 65 64 2e 20 20 46 6f 72 20 65 61 63  cified.  For eac
0440: 68 20 70 61 74 68 6e 61 6d 65 20 5c 66 49 64 69  h pathname \fIdi
0450: 72 5c 66 52 20 73 70 65 63 69 66 69 65 64 2c 0a  r\fR specified,.
0460: 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 20 77 69   this command wi
0470: 6c 6c 20 63 72 65 61 74 65 20 61 6c 6c 20 6e 6f  ll create all no
0480: 6e 2d 65 78 69 73 74 69 6e 67 20 70 61 72 65 6e  n-existing paren
0490: 74 20 64 69 72 65 63 74 6f 72 69 65 73 20 61 73  t directories as
04a0: 0a 40 40 20 2d 33 38 38 2c 32 33 20 2b 33 38 38  .@@ -388,23 +388
04b0: 2c 32 34 20 40 40 0a 20 74 6f 20 65 6e 73 75 72  ,24 @@. to ensur
04c0: 65 20 74 68 61 74 20 6c 61 74 65 72 20 63 6f 6d  e that later com
04d0: 6d 61 6e 64 73 0a 20 74 68 61 74 20 75 73 65 20  mands. that use 
04e0: 74 68 65 20 74 68 69 72 64 20 63 6f 6d 70 6f 6e  the third compon
04f0: 65 6e 74 20 64 6f 20 6e 6f 74 20 61 74 74 65 6d  ent do not attem
0500: 70 74 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 69  pt to perform ti
0510: 6c 64 65 0a 20 73 75 62 73 74 69 74 75 74 69 6f  lde. substitutio
0520: 6e 2e 0a 20 2e 52 45 0a 20 2e 54 50 0a 2d 5c 66  n.. .RE. .TP.-\f
0530: 42 66 69 6c 65 20 73 74 61 74 20 5c 66 49 6e 61  Bfile stat \fIna
0540: 6d 65 20 76 61 72 4e 61 6d 65 5c 66 52 0a 2b 5c  me varName\fR.+\
0550: 66 42 66 69 6c 65 20 73 74 61 74 20 5c 66 49 6e  fBfile stat \fIn
0560: 61 6d 65 20 3f 76 61 72 4e 61 6d 65 3f 5c 66 52  ame ?varName?\fR
0570: 0a 20 2e 0a 2d 49 6e 76 6f 6b 65 73 20 74 68 65  . ..-Invokes the
0580: 20 5c 66 42 73 74 61 74 5c 66 52 20 6b 65 72 6e   \fBstat\fR kern
0590: 65 6c 20 63 61 6c 6c 20 6f 6e 20 5c 66 49 6e 61  el call on \fIna
05a0: 6d 65 5c 66 52 2c 20 61 6e 64 20 75 73 65 73 20  me\fR, and uses 
05b0: 74 68 65 20 76 61 72 69 61 62 6c 65 0a 2d 67 69  the variable.-gi
05c0: 76 65 6e 20 62 79 20 5c 66 49 76 61 72 4e 61 6d  ven by \fIvarNam
05d0: 65 5c 66 52 20 74 6f 20 68 6f 6c 64 20 69 6e 66  e\fR to hold inf
05e0: 6f 72 6d 61 74 69 6f 6e 20 72 65 74 75 72 6e 65  ormation returne
05f0: 64 20 66 72 6f 6d 20 74 68 65 20 6b 65 72 6e 65  d from the kerne
0600: 6c 20 63 61 6c 6c 2e 0a 2d 5c 66 49 56 61 72 4e  l call..-\fIVarN
0610: 61 6d 65 5c 66 52 20 69 73 20 74 72 65 61 74 65  ame\fR is treate
0620: 64 20 61 73 20 61 6e 20 61 72 72 61 79 20 76 61  d as an array va
0630: 72 69 61 62 6c 65 2c 20 61 6e 64 20 74 68 65 20  riable, and the 
0640: 66 6f 6c 6c 6f 77 69 6e 67 20 65 6c 65 6d 65 6e  following elemen
0650: 74 73 0a 2d 6f 66 20 74 68 61 74 20 76 61 72 69  ts.-of that vari
0660: 61 62 6c 65 20 61 72 65 20 73 65 74 3a 20 5c 66  able are set: \f
0670: 42 61 74 69 6d 65 5c 66 52 2c 20 5c 66 42 63 74  Batime\fR, \fBct
0680: 69 6d 65 5c 66 52 2c 20 5c 66 42 64 65 76 5c 66  ime\fR, \fBdev\f
0690: 52 2c 20 5c 66 42 67 69 64 5c 66 52 2c 0a 2d 5c  R, \fBgid\fR,.-\
06a0: 66 42 69 6e 6f 5c 66 52 2c 20 5c 66 42 6d 6f 64  fBino\fR, \fBmod
06b0: 65 5c 66 52 2c 20 5c 66 42 6d 74 69 6d 65 5c 66  e\fR, \fBmtime\f
06c0: 52 2c 20 5c 66 42 6e 6c 69 6e 6b 5c 66 52 2c 20  R, \fBnlink\fR, 
06d0: 5c 66 42 73 69 7a 65 5c 66 52 2c 20 5c 66 42 74  \fBsize\fR, \fBt
06e0: 79 70 65 5c 66 52 2c 0a 2d 5c 66 42 75 69 64 5c  ype\fR,.-\fBuid\
06f0: 66 52 2e 20 20 45 61 63 68 20 65 6c 65 6d 65 6e  fR.  Each elemen
0700: 74 20 65 78 63 65 70 74 20 5c 66 42 74 79 70 65  t except \fBtype
0710: 5c 66 52 20 69 73 20 61 20 64 65 63 69 6d 61 6c  \fR is a decimal
0720: 20 73 74 72 69 6e 67 20 77 69 74 68 20 74 68 65   string with the
0730: 0a 2d 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63  .-value of the c
0740: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 66 69 65  orresponding fie
0750: 6c 64 20 66 72 6f 6d 20 74 68 65 20 5c 66 42 73  ld from the \fBs
0760: 74 61 74 5c 66 52 20 72 65 74 75 72 6e 20 73 74  tat\fR return st
0770: 72 75 63 74 75 72 65 3b 0a 2d 73 65 65 20 74 68  ructure;.-see th
0780: 65 20 6d 61 6e 75 61 6c 20 65 6e 74 72 79 20 66  e manual entry f
0790: 6f 72 20 5c 66 42 73 74 61 74 5c 66 52 20 66 6f  or \fBstat\fR fo
07a0: 72 20 64 65 74 61 69 6c 73 20 6f 6e 20 74 68 65  r details on the
07b0: 20 6d 65 61 6e 69 6e 67 73 20 6f 66 20 74 68 65   meanings of the
07c0: 0a 2d 76 61 6c 75 65 73 2e 20 20 54 68 65 20 5c  .-values.  The \
07d0: 66 42 74 79 70 65 5c 66 52 20 65 6c 65 6d 65 6e  fBtype\fR elemen
07e0: 74 20 67 69 76 65 73 20 74 68 65 20 74 79 70 65  t gives the type
07f0: 20 6f 66 20 74 68 65 20 66 69 6c 65 20 69 6e 20   of the file in 
0800: 74 68 65 20 73 61 6d 65 0a 2d 66 6f 72 6d 20 72  the same.-form r
0810: 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 20 63  eturned by the c
0820: 6f 6d 6d 61 6e 64 20 5c 66 42 66 69 6c 65 20 74  ommand \fBfile t
0830: 79 70 65 5c 66 52 2e 20 20 54 68 69 73 20 63 6f  ype\fR.  This co
0840: 6d 6d 61 6e 64 20 72 65 74 75 72 6e 73 20 61 6e  mmand returns an
0850: 0a 2d 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0a  .-empty string..
0860: 2b 49 6e 76 6f 6b 65 73 20 74 68 65 20 5c 66 42  +Invokes the \fB
0870: 73 74 61 74 5c 66 52 20 6b 65 72 6e 65 6c 20 63  stat\fR kernel c
0880: 61 6c 6c 20 6f 6e 20 5c 66 49 6e 61 6d 65 5c 66  all on \fIname\f
0890: 52 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61  R, and returns a
08a0: 0a 2b 64 69 63 74 69 6f 6e 61 72 79 20 77 69 74  .+dictionary wit
08b0: 68 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f  h the informatio
08c0: 6e 20 72 65 74 75 72 6e 65 64 20 66 72 6f 6d 20  n returned from 
08d0: 74 68 65 20 6b 65 72 6e 65 6c 20 63 61 6c 6c 2e  the kernel call.
08e0: 20 49 66 0a 2b 5c 66 49 76 61 72 4e 61 6d 65 5c   If.+\fIvarName\
08f0: 66 52 20 69 73 20 67 69 76 65 6e 2c 20 69 74 20  fR is given, it 
0900: 75 73 65 73 20 74 68 65 20 76 61 72 69 61 62 6c  uses the variabl
0910: 65 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 69 6e  e to hold the in
0920: 66 6f 72 6d 61 74 69 6f 6e 2e 0a 2b 5c 66 49 56  formation..+\fIV
0930: 61 72 4e 61 6d 65 5c 66 52 20 69 73 20 74 72 65  arName\fR is tre
0940: 61 74 65 64 20 61 73 20 61 6e 20 61 72 72 61 79  ated as an array
0950: 20 76 61 72 69 61 62 6c 65 2c 20 61 6e 64 20 69   variable, and i
0960: 6e 20 73 75 63 68 20 63 61 73 65 20 74 68 65 0a  n such case the.
0970: 2b 63 6f 6d 6d 61 6e 64 20 72 65 74 75 72 6e 73  +command returns
0980: 20 74 68 65 20 65 6d 70 74 79 20 73 74 72 69 6e   the empty strin
0990: 67 2e 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67  g. The following
09a0: 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 73 65   elements are se
09b0: 74 3a 0a 2b 5c 66 42 61 74 69 6d 65 5c 66 52 2c  t:.+\fBatime\fR,
09c0: 20 5c 66 42 63 74 69 6d 65 5c 66 52 2c 20 5c 66   \fBctime\fR, \f
09d0: 42 64 65 76 5c 66 52 2c 20 5c 66 42 67 69 64 5c  Bdev\fR, \fBgid\
09e0: 66 52 2c 20 5c 66 42 69 6e 6f 5c 66 52 2c 20 5c  fR, \fBino\fR, \
09f0: 66 42 6d 6f 64 65 5c 66 52 2c 0a 2b 5c 66 42 6d  fBmode\fR,.+\fBm
0a00: 74 69 6d 65 5c 66 52 2c 20 5c 66 42 6e 6c 69 6e  time\fR, \fBnlin
0a10: 6b 5c 66 52 2c 20 5c 66 42 73 69 7a 65 5c 66 52  k\fR, \fBsize\fR
0a20: 2c 20 5c 66 42 74 79 70 65 5c 66 52 2c 20 5c 66  , \fBtype\fR, \f
0a30: 42 75 69 64 5c 66 52 2e 20 20 45 61 63 68 20 65  Buid\fR.  Each e
0a40: 6c 65 6d 65 6e 74 0a 2b 65 78 63 65 70 74 20 5c  lement.+except \
0a50: 66 42 74 79 70 65 5c 66 52 20 69 73 20 61 20 64  fBtype\fR is a d
0a60: 65 63 69 6d 61 6c 20 73 74 72 69 6e 67 20 77 69  ecimal string wi
0a70: 74 68 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20  th the value of 
0a80: 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e  the correspondin
0a90: 67 0a 2b 66 69 65 6c 64 20 66 72 6f 6d 20 74 68  g.+field from th
0aa0: 65 20 5c 66 42 73 74 61 74 5c 66 52 20 72 65 74  e \fBstat\fR ret
0ab0: 75 72 6e 20 73 74 72 75 63 74 75 72 65 3b 20 73  urn structure; s
0ac0: 65 65 20 74 68 65 20 6d 61 6e 75 61 6c 20 65 6e  ee the manual en
0ad0: 74 72 79 20 66 6f 72 0a 2b 5c 66 42 73 74 61 74  try for.+\fBstat
0ae0: 5c 66 52 20 66 6f 72 20 64 65 74 61 69 6c 73 20  \fR for details 
0af0: 6f 6e 20 74 68 65 20 6d 65 61 6e 69 6e 67 73 20  on the meanings 
0b00: 6f 66 20 74 68 65 20 76 61 6c 75 65 73 2e 20 20  of the values.  
0b10: 54 68 65 20 5c 66 42 74 79 70 65 5c 66 52 0a 2b  The \fBtype\fR.+
0b20: 65 6c 65 6d 65 6e 74 20 67 69 76 65 73 20 74 68  element gives th
0b30: 65 20 74 79 70 65 20 6f 66 20 74 68 65 20 66 69  e type of the fi
0b40: 6c 65 20 69 6e 20 74 68 65 20 73 61 6d 65 20 66  le in the same f
0b50: 6f 72 6d 20 72 65 74 75 72 6e 65 64 20 62 79 20  orm returned by 
0b60: 74 68 65 0a 2b 63 6f 6d 6d 61 6e 64 20 5c 66 42  the.+command \fB
0b70: 66 69 6c 65 20 74 79 70 65 5c 66 52 2e 0a 20 2e  file type\fR.. .
0b80: 54 50 0a 20 5c 66 42 66 69 6c 65 20 73 79 73 74  TP. \fBfile syst
0b90: 65 6d 20 5c 66 49 6e 61 6d 65 5c 66 52 0a 20 2e  em \fIname\fR. .
0ba0: 0a 20 52 65 74 75 72 6e 73 20 61 20 6c 69 73 74  . Returns a list
0bb0: 20 6f 66 20 6f 6e 65 20 6f 72 20 74 77 6f 20 65   of one or two e
0bc0: 6c 65 6d 65 6e 74 73 2c 20 74 68 65 20 66 69 72  lements, the fir
0bd0: 73 74 20 6f 66 20 77 68 69 63 68 20 69 73 20 74  st of which is t
0be0: 68 65 20 6e 61 6d 65 20 6f 66 0a 20 74 68 65 20  he name of. the 
0bf0: 66 69 6c 65 73 79 73 74 65 6d 20 74 6f 20 75 73  filesystem to us
0c00: 65 20 66 6f 72 20 74 68 65 20 66 69 6c 65 2c 20  e for the file, 
0c10: 61 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 2c 20  and the second, 
0c20: 69 66 20 67 69 76 65 6e 2c 20 61 6e 0a 0a 49 6e  if given, an..In
0c30: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c  dex: generic/tcl
0c40: 43 6d 64 41 48 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d  CmdAH.c.========
0c50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0c60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 2d 2d 2d 20 67  ==========.--- g
0c90: 65 6e 65 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e  eneric/tclCmdAH.
0ca0: 63 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63  c.+++ generic/tc
0cb0: 6c 43 6d 64 41 48 2e 63 0a 40 40 20 2d 31 32 36  lCmdAH.c.@@ -126
0cc0: 38 2c 31 38 20 2b 31 32 36 38 2c 32 32 20 40 40  8,18 +1268,22 @@
0cd0: 0a 20 20 20 20 20 69 6e 74 20 6f 62 6a 63 2c 0a  .     int objc,.
0ce0: 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f       Tcl_Obj *co
0cf0: 6e 73 74 20 6f 62 6a 76 5b 5d 29 0a 20 7b 0a 20  nst objv[]). {. 
0d00: 20 20 20 20 54 63 6c 5f 53 74 61 74 42 75 66 20      Tcl_StatBuf 
0d10: 62 75 66 3b 0a 20 0a 2d 20 20 20 20 69 66 20 28  buf;. .-    if (
0d20: 6f 62 6a 63 20 21 3d 20 33 29 20 7b 0a 2d 09 54  objc != 3) {.-.T
0d30: 63 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 73 28  cl_WrongNumArgs(
0d40: 69 6e 74 65 72 70 2c 20 31 2c 20 6f 62 6a 76 2c  interp, 1, objv,
0d50: 20 22 6e 61 6d 65 20 76 61 72 4e 61 6d 65 22 29   "name varName")
0d60: 3b 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 63 20  ;.+    if (objc 
0d70: 3c 20 32 20 7c 7c 20 6f 62 6a 63 20 3e 20 33 29  < 2 || objc > 3)
0d80: 20 7b 0a 2b 09 54 63 6c 5f 57 72 6f 6e 67 4e 75   {.+.Tcl_WrongNu
0d90: 6d 41 72 67 73 28 69 6e 74 65 72 70 2c 20 31 2c  mArgs(interp, 1,
0da0: 20 6f 62 6a 76 2c 20 22 6e 61 6d 65 20 3f 76 61   objv, "name ?va
0db0: 72 4e 61 6d 65 3f 22 29 3b 0a 20 09 72 65 74 75  rName?");. .retu
0dc0: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20  rn TCL_ERROR;.  
0dd0: 20 20 20 7d 0a 20 20 20 20 20 69 66 20 28 47 65     }.     if (Ge
0de0: 74 53 74 61 74 42 75 66 28 69 6e 74 65 72 70 2c  tStatBuf(interp,
0df0: 20 6f 62 6a 76 5b 31 5d 2c 20 54 63 6c 5f 46 53   objv[1], Tcl_FS
0e00: 4c 73 74 61 74 2c 20 26 62 75 66 29 20 21 3d 20  Lstat, &buf) != 
0e10: 54 43 4c 5f 4f 4b 29 20 7b 0a 20 09 72 65 74 75  TCL_OK) {. .retu
0e20: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20  rn TCL_ERROR;.  
0e30: 20 20 20 7d 0a 2d 20 20 20 20 72 65 74 75 72 6e     }.-    return
0e40: 20 53 74 6f 72 65 53 74 61 74 44 61 74 61 28 69   StoreStatData(i
0e50: 6e 74 65 72 70 2c 20 6f 62 6a 76 5b 32 5d 2c 20  nterp, objv[2], 
0e60: 26 62 75 66 29 3b 0a 2b 20 20 20 20 69 66 20 28  &buf);.+    if (
0e70: 6f 62 6a 63 20 3d 3d 20 32 29 20 7b 0a 2b 09 72  objc == 2) {.+.r
0e80: 65 74 75 72 6e 20 53 74 6f 72 65 53 74 61 74 44  eturn StoreStatD
0e90: 61 74 61 28 69 6e 74 65 72 70 2c 20 4e 55 4c 4c  ata(interp, NULL
0ea0: 2c 20 26 62 75 66 29 3b 0a 2b 20 20 20 20 7d 20  , &buf);.+    } 
0eb0: 65 6c 73 65 20 7b 0a 2b 09 72 65 74 75 72 6e 20  else {.+.return 
0ec0: 53 74 6f 72 65 53 74 61 74 44 61 74 61 28 69 6e  StoreStatData(in
0ed0: 74 65 72 70 2c 20 6f 62 6a 76 5b 32 5d 2c 20 26  terp, objv[2], &
0ee0: 62 75 66 29 3b 0a 2b 20 20 20 20 7d 0a 20 7d 0a  buf);.+    }. }.
0ef0: 20 0c 0a 20 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d   .. /*.  *------
0f00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0f10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0f20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0f40: 0a 20 20 2a 0a 40 40 20 2d 31 33 30 34 2c 31 38  .  *.@@ -1304,18
0f50: 20 2b 31 33 30 38 2c 32 32 20 40 40 0a 20 20 20   +1308,22 @@.   
0f60: 20 20 69 6e 74 20 6f 62 6a 63 2c 0a 20 20 20 20    int objc,.    
0f70: 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20   Tcl_Obj *const 
0f80: 6f 62 6a 76 5b 5d 29 0a 20 7b 0a 20 20 20 20 20  objv[]). {.     
0f90: 54 63 6c 5f 53 74 61 74 42 75 66 20 62 75 66 3b  Tcl_StatBuf buf;
0fa0: 0a 20 0a 2d 20 20 20 20 69 66 20 28 6f 62 6a 63  . .-    if (objc
0fb0: 20 21 3d 20 33 29 20 7b 0a 2d 09 54 63 6c 5f 57   != 3) {.-.Tcl_W
0fc0: 72 6f 6e 67 4e 75 6d 41 72 67 73 28 69 6e 74 65  rongNumArgs(inte
0fd0: 72 70 2c 20 31 2c 20 6f 62 6a 76 2c 20 22 6e 61  rp, 1, objv, "na
0fe0: 6d 65 20 76 61 72 4e 61 6d 65 22 29 3b 0a 2b 20  me varName");.+ 
0ff0: 20 20 20 69 66 20 28 6f 62 6a 63 20 3c 20 32 20     if (objc < 2 
1000: 7c 7c 20 6f 62 6a 63 20 3e 20 33 29 20 7b 0a 2b  || objc > 3) {.+
1010: 09 54 63 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67  .Tcl_WrongNumArg
1020: 73 28 69 6e 74 65 72 70 2c 20 31 2c 20 6f 62 6a  s(interp, 1, obj
1030: 76 2c 20 22 6e 61 6d 65 20 3f 76 61 72 4e 61 6d  v, "name ?varNam
1040: 65 3f 22 29 3b 0a 20 09 72 65 74 75 72 6e 20 54  e?");. .return T
1050: 43 4c 5f 45 52 52 4f 52 3b 0a 20 20 20 20 20 7d  CL_ERROR;.     }
1060: 0a 20 20 20 20 20 69 66 20 28 47 65 74 53 74 61  .     if (GetSta
1070: 74 42 75 66 28 69 6e 74 65 72 70 2c 20 6f 62 6a  tBuf(interp, obj
1080: 76 5b 31 5d 2c 20 54 63 6c 5f 46 53 53 74 61 74  v[1], Tcl_FSStat
1090: 2c 20 26 62 75 66 29 20 21 3d 20 54 43 4c 5f 4f  , &buf) != TCL_O
10a0: 4b 29 20 7b 0a 20 09 72 65 74 75 72 6e 20 54 43  K) {. .return TC
10b0: 4c 5f 45 52 52 4f 52 3b 0a 20 20 20 20 20 7d 0a  L_ERROR;.     }.
10c0: 2d 20 20 20 20 72 65 74 75 72 6e 20 53 74 6f 72  -    return Stor
10d0: 65 53 74 61 74 44 61 74 61 28 69 6e 74 65 72 70  eStatData(interp
10e0: 2c 20 6f 62 6a 76 5b 32 5d 2c 20 26 62 75 66 29  , objv[2], &buf)
10f0: 3b 0a 2b 20 20 20 20 69 66 20 28 6f 62 6a 63 20  ;.+    if (objc 
1100: 3d 3d 20 32 29 20 7b 0a 2b 09 72 65 74 75 72 6e  == 2) {.+.return
1110: 20 53 74 6f 72 65 53 74 61 74 44 61 74 61 28 69   StoreStatData(i
1120: 6e 74 65 72 70 2c 20 4e 55 4c 4c 2c 20 26 62 75  nterp, NULL, &bu
1130: 66 29 3b 0a 2b 20 20 20 20 7d 20 65 6c 73 65 20  f);.+    } else 
1140: 7b 0a 2b 09 72 65 74 75 72 6e 20 53 74 6f 72 65  {.+.return Store
1150: 53 74 61 74 44 61 74 61 28 69 6e 74 65 72 70 2c  StatData(interp,
1160: 20 6f 62 6a 76 5b 32 5d 2c 20 26 62 75 66 29 3b   objv[2], &buf);
1170: 0a 2b 20 20 20 20 7d 0a 20 7d 0a 20 0c 0a 20 2f  .+    }. }. .. /
1180: 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *.  *-----------
1190: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
11a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
11b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
11c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 0a  -----------.  *.
11d0: 40 40 20 2d 32 32 31 31 2c 31 31 20 2b 32 32 31  @@ -2211,11 +221
11e0: 39 2c 31 31 20 40 40 0a 20 20 2a 0a 20 20 2a 20  9,11 @@.  *.  * 
11f0: 53 74 6f 72 65 53 74 61 74 44 61 74 61 20 2d 2d  StoreStatData --
1200: 0a 20 20 2a 0a 20 20 2a 09 54 68 69 73 20 69 73  .  *.  *.This is
1210: 20 61 20 75 74 69 6c 69 74 79 20 70 72 6f 63 65   a utility proce
1220: 64 75 72 65 20 74 68 61 74 20 62 72 65 61 6b 73  dure that breaks
1230: 20 6f 75 74 20 74 68 65 20 66 69 65 6c 64 73 20   out the fields 
1240: 6f 66 20 61 20 22 73 74 61 74 22 0a 20 20 2a 09  of a "stat".  *.
1250: 73 74 72 75 63 74 75 72 65 20 61 6e 64 20 73 74  structure and st
1260: 6f 72 65 73 20 74 68 65 6d 20 69 6e 20 74 65 78  ores them in tex
1270: 74 75 61 6c 20 66 6f 72 6d 20 69 6e 74 6f 20 74  tual form into t
1280: 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 61  he elements of a
1290: 6e 0a 2d 20 2a 09 61 73 73 6f 63 69 61 74 69 76  n.- *.associativ
12a0: 65 20 61 72 72 61 79 2e 0a 2b 20 2a 09 61 73 73  e array..+ *.ass
12b0: 6f 63 69 61 74 69 76 65 20 61 72 72 61 79 20 28  ociative array (
12c0: 69 66 20 67 69 76 65 6e 29 20 6f 72 20 72 65 74  if given) or ret
12d0: 75 72 6e 73 20 61 20 64 69 63 74 69 6f 6e 61 72  urns a dictionar
12e0: 79 2e 0a 20 20 2a 0a 20 20 2a 20 52 65 73 75 6c  y..  *.  * Resul
12f0: 74 73 3a 0a 20 20 2a 09 52 65 74 75 72 6e 73 20  ts:.  *.Returns 
1300: 61 20 73 74 61 6e 64 61 72 64 20 54 63 6c 20 72  a standard Tcl r
1310: 65 74 75 72 6e 20 76 61 6c 75 65 2e 20 49 66 20  eturn value. If 
1320: 61 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 73 20  an error occurs 
1330: 74 68 65 6e 20 61 20 6d 65 73 73 61 67 65 0a 20  then a message. 
1340: 20 2a 09 69 73 20 6c 65 66 74 20 69 6e 20 69 6e   *.is left in in
1350: 74 65 72 70 27 73 20 72 65 73 75 6c 74 2e 0a 20  terp's result.. 
1360: 20 2a 0a 40 40 20 2d 32 32 33 31 2c 31 32 20 2b   *.@@ -2231,12 +
1370: 32 32 33 39 2c 34 33 20 40 40 0a 20 20 20 20 20  2239,43 @@.     
1380: 54 63 6c 5f 4f 62 6a 20 2a 76 61 72 4e 61 6d 65  Tcl_Obj *varName
1390: 2c 09 09 2f 2a 20 4e 61 6d 65 20 6f 66 20 61 73  ,../* Name of as
13a0: 73 6f 63 69 61 74 69 76 65 20 61 72 72 61 79 20  sociative array 
13b0: 76 61 72 69 61 62 6c 65 20 69 6e 20 77 68 69 63  variable in whic
13c0: 68 0a 20 09 09 09 09 20 2a 20 74 6f 20 73 74 6f  h. .... * to sto
13d0: 72 65 20 73 74 61 74 20 72 65 73 75 6c 74 73 2e  re stat results.
13e0: 20 2a 2f 0a 20 20 20 20 20 54 63 6c 5f 53 74 61   */.     Tcl_Sta
13f0: 74 42 75 66 20 2a 73 74 61 74 50 74 72 29 09 2f  tBuf *statPtr)./
1400: 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 62 75 66  * Pointer to buf
1410: 66 65 72 20 63 6f 6e 74 61 69 6e 69 6e 67 20 73  fer containing s
1420: 74 61 74 20 64 61 74 61 20 74 6f 0a 20 09 09 09  tat data to. ...
1430: 09 20 2a 20 73 74 6f 72 65 20 69 6e 20 76 61 72  . * store in var
1440: 4e 61 6d 65 2e 20 2a 2f 0a 20 7b 0a 2d 20 20 20  Name. */. {.-   
1450: 20 54 63 6c 5f 4f 62 6a 20 2a 66 69 65 6c 64 2c   Tcl_Obj *field,
1460: 20 2a 76 61 6c 75 65 3b 0a 2b 20 20 20 20 54 63   *value;.+    Tc
1470: 6c 5f 4f 62 6a 20 2a 66 69 65 6c 64 2c 20 2a 76  l_Obj *field, *v
1480: 61 6c 75 65 2c 20 2a 72 65 73 75 6c 74 3b 0a 20  alue, *result;. 
1490: 20 20 20 20 75 6e 73 69 67 6e 65 64 20 73 68 6f      unsigned sho
14a0: 72 74 20 6d 6f 64 65 3b 0a 2b 0a 2b 20 20 20 20  rt mode;.+.+    
14b0: 69 66 20 28 76 61 72 4e 61 6d 65 20 3d 3d 20 4e  if (varName == N
14c0: 55 4c 4c 29 20 7b 0a 2b 20 20 20 20 20 20 20 20  ULL) {.+        
14d0: 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4e 65 77  result = Tcl_New
14e0: 4f 62 6a 28 29 3b 0a 2b 20 20 20 20 20 20 20 20  Obj();.+        
14f0: 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74  Tcl_IncrRefCount
1500: 28 72 65 73 75 6c 74 29 3b 0a 2b 23 64 65 66 69  (result);.+#defi
1510: 6e 65 20 44 4f 42 4a 50 55 54 28 6b 65 79 2c 20  ne DOBJPUT(key, 
1520: 6f 62 6a 56 61 6c 75 65 29 20 20 20 20 20 20 20  objValue)       
1530: 20 20 20 20 20 20 20 20 20 20 20 5c 0a 2b 20 20             \.+  
1540: 20 20 20 20 20 20 54 63 6c 5f 44 69 63 74 4f 62        Tcl_DictOb
1550: 6a 50 75 74 28 4e 55 4c 4c 2c 20 72 65 73 75 6c  jPut(NULL, resul
1560: 74 2c 20 20 20 20 20 20 20 20 20 20 20 20 5c 0a  t,            \.
1570: 2b 20 20 20 20 20 20 20 20 20 20 20 20 54 63 6c  +            Tcl
1580: 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 28 6b  _NewStringObj((k
1590: 65 79 29 2c 20 2d 31 29 2c 20 20 20 20 20 20 20  ey), -1),       
15a0: 20 5c 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20   \.+            
15b0: 28 6f 62 6a 56 61 6c 75 65 29 29 3b 0a 2b 20 20  (objValue));.+  
15c0: 20 20 20 20 20 20 44 4f 42 4a 50 55 54 28 22 64        DOBJPUT("d
15d0: 65 76 22 2c 09 54 63 6c 5f 4e 65 77 57 69 64 65  ev",.Tcl_NewWide
15e0: 49 6e 74 4f 62 6a 28 28 6c 6f 6e 67 29 73 74 61  IntObj((long)sta
15f0: 74 50 74 72 2d 3e 73 74 5f 64 65 76 29 29 3b 0a  tPtr->st_dev));.
1600: 2b 20 20 20 20 20 20 20 20 44 4f 42 4a 50 55 54  +        DOBJPUT
1610: 28 22 69 6e 6f 22 2c 09 54 63 6c 5f 4e 65 77 57  ("ino",.Tcl_NewW
1620: 69 64 65 49 6e 74 4f 62 6a 28 28 54 63 6c 5f 57  ideIntObj((Tcl_W
1630: 69 64 65 49 6e 74 29 73 74 61 74 50 74 72 2d 3e  ideInt)statPtr->
1640: 73 74 5f 69 6e 6f 29 29 3b 0a 2b 20 20 20 20 20  st_ino));.+     
1650: 20 20 20 44 4f 42 4a 50 55 54 28 22 6e 6c 69 6e     DOBJPUT("nlin
1660: 6b 22 2c 09 54 63 6c 5f 4e 65 77 57 69 64 65 49  k",.Tcl_NewWideI
1670: 6e 74 4f 62 6a 28 28 6c 6f 6e 67 29 73 74 61 74  ntObj((long)stat
1680: 50 74 72 2d 3e 73 74 5f 6e 6c 69 6e 6b 29 29 3b  Ptr->st_nlink));
1690: 0a 2b 20 20 20 20 20 20 20 20 44 4f 42 4a 50 55  .+        DOBJPU
16a0: 54 28 22 75 69 64 22 2c 09 54 63 6c 5f 4e 65 77  T("uid",.Tcl_New
16b0: 57 69 64 65 49 6e 74 4f 62 6a 28 28 6c 6f 6e 67  WideIntObj((long
16c0: 29 73 74 61 74 50 74 72 2d 3e 73 74 5f 75 69 64  )statPtr->st_uid
16d0: 29 29 3b 0a 2b 20 20 20 20 20 20 20 20 44 4f 42  ));.+        DOB
16e0: 4a 50 55 54 28 22 67 69 64 22 2c 09 54 63 6c 5f  JPUT("gid",.Tcl_
16f0: 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 28 6c  NewWideIntObj((l
1700: 6f 6e 67 29 73 74 61 74 50 74 72 2d 3e 73 74 5f  ong)statPtr->st_
1710: 67 69 64 29 29 3b 0a 2b 20 20 20 20 20 20 20 20  gid));.+        
1720: 44 4f 42 4a 50 55 54 28 22 73 69 7a 65 22 2c 09  DOBJPUT("size",.
1730: 54 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62  Tcl_NewWideIntOb
1740: 6a 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 29 73  j((Tcl_WideInt)s
1750: 74 61 74 50 74 72 2d 3e 73 74 5f 73 69 7a 65 29  tatPtr->st_size)
1760: 29 3b 0a 2b 23 69 66 64 65 66 20 48 41 56 45 5f  );.+#ifdef HAVE_
1770: 53 54 52 55 43 54 5f 53 54 41 54 5f 53 54 5f 42  STRUCT_STAT_ST_B
1780: 4c 4f 43 4b 53 0a 2b 20 20 20 20 20 20 20 20 44  LOCKS.+        D
1790: 4f 42 4a 50 55 54 28 22 62 6c 6f 63 6b 73 22 2c  OBJPUT("blocks",
17a0: 09 54 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f  .Tcl_NewWideIntO
17b0: 62 6a 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 29  bj((Tcl_WideInt)
17c0: 73 74 61 74 50 74 72 2d 3e 73 74 5f 62 6c 6f 63  statPtr->st_bloc
17d0: 6b 73 29 29 3b 0a 2b 23 65 6e 64 69 66 0a 2b 23  ks));.+#endif.+#
17e0: 69 66 64 65 66 20 48 41 56 45 5f 53 54 52 55 43  ifdef HAVE_STRUC
17f0: 54 5f 53 54 41 54 5f 53 54 5f 42 4c 4b 53 49 5a  T_STAT_ST_BLKSIZ
1800: 45 0a 2b 20 20 20 20 20 20 20 20 44 4f 42 4a 50  E.+        DOBJP
1810: 55 54 28 22 62 6c 6b 73 69 7a 65 22 2c 20 54 63  UT("blksize", Tc
1820: 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28  l_NewWideIntObj(
1830: 28 6c 6f 6e 67 29 73 74 61 74 50 74 72 2d 3e 73  (long)statPtr->s
1840: 74 5f 62 6c 6b 73 69 7a 65 29 29 3b 0a 2b 23 65  t_blksize));.+#e
1850: 6e 64 69 66 0a 2b 20 20 20 20 20 20 20 20 44 4f  ndif.+        DO
1860: 42 4a 50 55 54 28 22 61 74 69 6d 65 22 2c 09 54  BJPUT("atime",.T
1870: 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a  cl_NewWideIntObj
1880: 28 54 63 6c 5f 47 65 74 41 63 63 65 73 73 54 69  (Tcl_GetAccessTi
1890: 6d 65 46 72 6f 6d 53 74 61 74 28 73 74 61 74 50  meFromStat(statP
18a0: 74 72 29 29 29 3b 0a 2b 20 20 20 20 20 20 20 20  tr)));.+        
18b0: 44 4f 42 4a 50 55 54 28 22 6d 74 69 6d 65 22 2c  DOBJPUT("mtime",
18c0: 09 54 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 4f  .Tcl_NewWideIntO
18d0: 62 6a 28 54 63 6c 5f 47 65 74 4d 6f 64 69 66 69  bj(Tcl_GetModifi
18e0: 63 61 74 69 6f 6e 54 69 6d 65 46 72 6f 6d 53 74  cationTimeFromSt
18f0: 61 74 28 73 74 61 74 50 74 72 29 29 29 3b 0a 2b  at(statPtr)));.+
1900: 20 20 20 20 20 20 20 20 44 4f 42 4a 50 55 54 28          DOBJPUT(
1910: 22 63 74 69 6d 65 22 2c 09 54 63 6c 5f 4e 65 77  "ctime",.Tcl_New
1920: 57 69 64 65 49 6e 74 4f 62 6a 28 54 63 6c 5f 47  WideIntObj(Tcl_G
1930: 65 74 43 68 61 6e 67 65 54 69 6d 65 46 72 6f 6d  etChangeTimeFrom
1940: 53 74 61 74 28 73 74 61 74 50 74 72 29 29 29 3b  Stat(statPtr)));
1950: 0a 2b 20 20 20 20 20 20 20 20 6d 6f 64 65 20 3d  .+        mode =
1960: 20 28 75 6e 73 69 67 6e 65 64 20 73 68 6f 72 74   (unsigned short
1970: 29 20 73 74 61 74 50 74 72 2d 3e 73 74 5f 6d 6f  ) statPtr->st_mo
1980: 64 65 3b 0a 2b 20 20 20 20 20 20 20 20 44 4f 42  de;.+        DOB
1990: 4a 50 55 54 28 22 6d 6f 64 65 22 2c 09 54 63 6c  JPUT("mode",.Tcl
19a0: 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 6d  _NewWideIntObj(m
19b0: 6f 64 65 29 29 3b 0a 2b 20 20 20 20 20 20 20 20  ode));.+        
19c0: 44 4f 42 4a 50 55 54 28 22 74 79 70 65 22 2c 09  DOBJPUT("type",.
19d0: 54 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a  Tcl_NewStringObj
19e0: 28 47 65 74 54 79 70 65 46 72 6f 6d 4d 6f 64 65  (GetTypeFromMode
19f0: 28 6d 6f 64 65 29 2c 20 2d 31 29 29 3b 0a 2b 23  (mode), -1));.+#
1a00: 75 6e 64 65 66 20 44 4f 42 4a 50 55 54 0a 2b 20  undef DOBJPUT.+ 
1a10: 20 20 20 20 20 20 20 54 63 6c 5f 53 65 74 4f 62         Tcl_SetOb
1a20: 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20  jResult(interp, 
1a30: 72 65 73 75 6c 74 29 3b 0a 2b 20 20 20 20 20 20  result);.+      
1a40: 20 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75    Tcl_DecrRefCou
1a50: 6e 74 28 72 65 73 75 6c 74 29 3b 0a 2b 20 20 20  nt(result);.+   
1a60: 20 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f       return TCL_
1a70: 4f 4b 3b 0a 2b 20 20 20 20 7d 0a 20 0a 20 20 20  OK;.+    }. .   
1a80: 20 20 2f 2a 0a 20 20 20 20 20 20 2a 20 41 73 73    /*.      * Ass
1a90: 75 6d 65 20 54 63 6c 5f 4f 62 6a 53 65 74 56 61  ume Tcl_ObjSetVa
1aa0: 72 32 28 29 20 64 6f 65 73 20 6e 6f 74 20 6b 65  r2() does not ke
1ab0: 65 70 20 61 20 63 6f 70 79 20 6f 66 20 74 68 65  ep a copy of the
1ac0: 20 66 69 65 6c 64 20 6e 61 6d 65 21 0a 20 20 20   field name!.   
1ad0: 20 20 20 2a 0a 20 20 20 20 20 20 2a 20 4d 69 67     *.      * Mig
1ae0: 68 74 20 62 65 20 61 20 62 65 74 74 65 72 20 69  ht be a better i
1af0: 64 65 61 20 74 6f 20 63 61 6c 6c 20 54 63 6c 5f  dea to call Tcl_
1b00: 53 65 74 56 61 72 32 45 78 28 29 20 69 6e 73 74  SetVar2Ex() inst
1b10: 65 61 64 2c 20 65 78 63 65 70 74 20 77 65 20 77  ead, except we w
1b20: 61 6e 74 0a 0a 49 6e 64 65 78 3a 20 74 65 73 74  ant..Index: test
1b30: 73 2f 63 6d 64 41 48 2e 74 65 73 74 0a 3d 3d 3d  s/cmdAH.test.===
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
1b80: 2d 2d 2d 20 74 65 73 74 73 2f 63 6d 64 41 48 2e  --- tests/cmdAH.
1b90: 74 65 73 74 0a 2b 2b 2b 20 74 65 73 74 73 2f 63  test.+++ tests/c
1ba0: 6d 64 41 48 2e 74 65 73 74 0a 40 40 20 2d 31 34  mdAH.test.@@ -14
1bb0: 31 30 2c 31 38 20 2b 31 34 31 30 2c 31 38 20 40  10,18 +1410,18 @
1bc0: 40 0a 20 73 65 74 20 67 6f 72 70 66 69 6c 65 20  @. set gorpfile 
1bd0: 5b 6d 61 6b 65 46 69 6c 65 20 22 54 65 73 74 20  [makeFile "Test 
1be0: 73 74 72 69 6e 67 22 20 67 6f 72 70 2e 66 69 6c  string" gorp.fil
1bf0: 65 5d 0a 20 63 61 74 63 68 20 7b 66 69 6c 65 20  e]. catch {file 
1c00: 61 74 74 72 69 62 75 74 65 73 20 24 67 6f 72 70  attributes $gorp
1c10: 66 69 6c 65 20 2d 70 65 72 6d 69 73 73 69 6f 6e  file -permission
1c20: 73 20 30 6f 37 36 35 7d 0a 20 0a 20 23 20 73 74  s 0o765}. . # st
1c30: 61 74 0a 20 74 65 73 74 20 63 6d 64 41 48 2d 32  at. test cmdAH-2
1c40: 38 2e 31 20 7b 54 63 6c 5f 46 69 6c 65 4f 62 6a  8.1 {Tcl_FileObj
1c50: 43 6d 64 3a 20 73 74 61 74 7d 20 2d 72 65 74 75  Cmd: stat} -retu
1c60: 72 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 62  rnCodes error -b
1c70: 6f 64 79 20 7b 0a 2d 20 20 20 20 66 69 6c 65 20  ody {.-    file 
1c80: 73 74 61 74 20 5f 62 6f 67 75 73 5f 0a 2d 7d 20  stat _bogus_.-} 
1c90: 2d 72 65 73 75 6c 74 20 7b 77 72 6f 6e 67 20 23  -result {wrong #
1ca0: 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 20 62 65   args: should be
1cb0: 20 22 66 69 6c 65 20 73 74 61 74 20 6e 61 6d 65   "file stat name
1cc0: 20 76 61 72 4e 61 6d 65 22 7d 0a 2b 20 20 20 20   varName"}.+    
1cd0: 66 69 6c 65 20 73 74 61 74 0a 2b 7d 20 2d 72 65  file stat.+} -re
1ce0: 73 75 6c 74 20 7b 77 72 6f 6e 67 20 23 20 61 72  sult {wrong # ar
1cf0: 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20 22 66  gs: should be "f
1d00: 69 6c 65 20 73 74 61 74 20 6e 61 6d 65 20 3f 76  ile stat name ?v
1d10: 61 72 4e 61 6d 65 3f 22 7d 0a 20 74 65 73 74 20  arName?"}. test 
1d20: 63 6d 64 41 48 2d 32 38 2e 32 20 7b 54 63 6c 5f  cmdAH-28.2 {Tcl_
1d30: 46 69 6c 65 4f 62 6a 43 6d 64 3a 20 73 74 61 74  FileObjCmd: stat
1d40: 7d 20 2d 72 65 74 75 72 6e 43 6f 64 65 73 20 65  } -returnCodes e
1d50: 72 72 6f 72 20 2d 62 6f 64 79 20 7b 0a 20 20 20  rror -body {.   
1d60: 20 20 66 69 6c 65 20 73 74 61 74 20 5f 62 6f 67    file stat _bog
1d70: 75 73 5f 20 61 20 62 0a 2d 7d 20 2d 72 65 73 75  us_ a b.-} -resu
1d80: 6c 74 20 7b 77 72 6f 6e 67 20 23 20 61 72 67 73  lt {wrong # args
1d90: 3a 20 73 68 6f 75 6c 64 20 62 65 20 22 66 69 6c  : should be "fil
1da0: 65 20 73 74 61 74 20 6e 61 6d 65 20 76 61 72 4e  e stat name varN
1db0: 61 6d 65 22 7d 0a 2b 7d 20 2d 72 65 73 75 6c 74  ame"}.+} -result
1dc0: 20 7b 77 72 6f 6e 67 20 23 20 61 72 67 73 3a 20   {wrong # args: 
1dd0: 73 68 6f 75 6c 64 20 62 65 20 22 66 69 6c 65 20  should be "file 
1de0: 73 74 61 74 20 6e 61 6d 65 20 3f 76 61 72 4e 61  stat name ?varNa
1df0: 6d 65 3f 22 7d 0a 20 74 65 73 74 20 63 6d 64 41  me?"}. test cmdA
1e00: 48 2d 32 38 2e 33 20 7b 54 63 6c 5f 46 69 6c 65  H-28.3 {Tcl_File
1e10: 4f 62 6a 43 6d 64 3a 20 73 74 61 74 7d 20 2d 73  ObjCmd: stat} -s
1e20: 65 74 75 70 20 7b 0a 20 20 20 20 20 75 6e 73 65  etup {.     unse
1e30: 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 73 74  t -nocomplain st
1e40: 61 74 0a 2d 20 20 20 20 73 65 74 20 73 74 61 74  at.-    set stat
1e50: 28 62 6c 6f 63 6b 73 29 20 5b 73 65 74 20 73 74  (blocks) [set st
1e60: 61 74 28 62 6c 6b 73 69 7a 65 29 20 7b 7d 5d 0a  at(blksize) {}].
1e70: 2b 20 20 20 20 61 72 72 61 79 20 73 65 74 20 73  +    array set s
1e80: 74 61 74 20 7b 62 6c 6f 63 6b 73 20 7b 7d 20 62  tat {blocks {} b
1e90: 6c 6b 73 69 7a 65 20 7b 7d 7d 0a 20 7d 20 2d 62  lksize {}}. } -b
1ea0: 6f 64 79 20 7b 0a 20 20 20 20 20 66 69 6c 65 20  ody {.     file 
1eb0: 73 74 61 74 20 24 67 6f 72 70 66 69 6c 65 20 73  stat $gorpfile s
1ec0: 74 61 74 0a 20 20 20 20 20 75 6e 73 65 74 20 73  tat.     unset s
1ed0: 74 61 74 28 62 6c 6f 63 6b 73 29 20 73 74 61 74  tat(blocks) stat
1ee0: 28 62 6c 6b 73 69 7a 65 29 3b 20 23 20 49 67 6e  (blksize); # Ign
1ef0: 6f 72 65 20 74 68 65 73 65 20 66 69 65 6c 64 73  ore these fields
1f00: 3b 20 6e 6f 74 20 61 6c 77 61 79 73 20 73 65 74  ; not always set
1f10: 0a 20 20 20 20 20 6c 73 6f 72 74 20 5b 61 72 72  .     lsort [arr
1f20: 61 79 20 6e 61 6d 65 73 20 73 74 61 74 5d 0a 20  ay names stat]. 
1f30: 7d 20 2d 72 65 73 75 6c 74 20 7b 61 74 69 6d 65  } -result {atime
1f40: 20 63 74 69 6d 65 20 64 65 76 20 67 69 64 20 69   ctime dev gid i
1f50: 6e 6f 20 6d 6f 64 65 20 6d 74 69 6d 65 20 6e 6c  no mode mtime nl
1f60: 69 6e 6b 20 73 69 7a 65 20 74 79 70 65 20 75 69  ink size type ui
1f70: 64 7d 0a 40 40 20 2d 31 35 31 30 2c 31 30 20 2b  d}.@@ -1510,10 +
1f80: 31 35 31 30 2c 32 30 20 40 40 0a 20 20 20 20 20  1510,20 @@.     
1f90: 7d 20 74 72 61 70 20 7b 50 4f 53 49 58 20 45 4e  } trap {POSIX EN
1fa0: 4f 45 4e 54 7d 20 7b 7d 20 7b 0a 20 09 73 65 74  OENT} {} {. .set
1fb0: 20 72 65 73 20 7b 30 20 30 20 2d 31 20 30 20 30   res {0 0 -1 0 0
1fc0: 20 38 36 33 30 20 30 20 30 20 30 20 63 68 61 72   8630 0 0 0 char
1fd0: 61 63 74 65 72 53 70 65 63 69 61 6c 20 30 7d 0a  acterSpecial 0}.
1fe0: 20 20 20 20 20 7d 0a 20 20 20 20 20 73 65 74 20       }.     set 
1ff0: 72 65 73 0a 20 7d 20 2d 72 65 73 75 6c 74 20 7b  res. } -result {
2000: 30 20 30 20 2d 31 20 30 20 30 20 38 36 33 30 20  0 0 -1 0 0 8630 
2010: 30 20 30 20 30 20 63 68 61 72 61 63 74 65 72 53  0 0 0 characterS
2020: 70 65 63 69 61 6c 20 30 7d 0a 2b 74 65 73 74 20  pecial 0}.+test 
2030: 63 6d 64 41 48 2d 32 38 2e 31 34 20 7b 54 63 6c  cmdAH-28.14 {Tcl
2040: 5f 46 69 6c 65 4f 62 6a 43 6d 64 3a 20 73 74 61  _FileObjCmd: sta
2050: 74 7d 20 2d 73 65 74 75 70 20 7b 0a 2b 20 20 20  t} -setup {.+   
2060: 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61   unset -nocompla
2070: 69 6e 20 73 74 61 74 0a 2b 7d 20 2d 62 6f 64 79  in stat.+} -body
2080: 20 7b 0a 2b 20 20 20 20 66 69 6c 65 20 73 74 61   {.+    file sta
2090: 74 20 24 67 6f 72 70 66 69 6c 65 20 73 74 61 74  t $gorpfile stat
20a0: 0a 2b 20 20 20 20 65 78 70 72 20 7b 0a 2b 09 09  .+    expr {.+..
20b0: 5b 6c 73 6f 72 74 20 2d 73 74 72 69 64 65 20 32  [lsort -stride 2
20c0: 20 5b 61 72 72 61 79 20 67 65 74 20 73 74 61 74   [array get stat
20d0: 5d 5d 20 0a 2b 09 09 65 71 20 0a 2b 09 09 5b 6c  ]] .+..eq .+..[l
20e0: 73 6f 72 74 20 2d 73 74 72 69 64 65 20 32 20 5b  sort -stride 2 [
20f0: 66 69 6c 65 20 73 74 61 74 20 24 67 6f 72 70 66  file stat $gorpf
2100: 69 6c 65 5d 5d 0a 2b 09 7d 0a 2b 7d 20 2d 72 65  ile]].+.}.+} -re
2110: 73 75 6c 74 20 7b 31 7d 0a 20 75 6e 73 65 74 20  sult {1}. unset 
2120: 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 73 74 61 74  -nocomplain stat
2130: 0a 20 0a 20 23 20 74 79 70 65 0a 20 74 65 73 74  . . # type. test
2140: 20 63 6d 64 41 48 2d 32 39 2e 31 20 7b 54 63 6c   cmdAH-29.1 {Tcl
2150: 5f 46 69 6c 65 4f 62 6a 43 6d 64 3a 20 74 79 70  _FileObjCmd: typ
2160: 65 7d 20 2d 72 65 74 75 72 6e 43 6f 64 65 73 20  e} -returnCodes 
2170: 65 72 72 6f 72 20 2d 62 6f 64 79 20 7b 0a 20 20  error -body {.  
2180: 20 20 20 66 69 6c 65 20 74 79 70 65 20 61 20 62     file type a b
2190: 0a 0a                                            ..