Attachment "tip287-revised-revised.patch" to
ticket [1586860fff]
added by
cleverly
2006-11-22 12:54:39.
0000: 2d 2d 2d 20 64 6f 63 2f 63 68 61 6e 2e 6e 2e 6f --- doc/chan.n.o
0010: 72 69 67 09 32 30 30 36 2d 31 30 2d 32 38 20 32 rig.2006-10-28 2
0020: 32 3a 33 37 3a 34 38 2e 30 30 30 30 30 30 30 30 2:37:48.00000000
0030: 30 20 2d 30 36 30 30 0a 2b 2b 2b 20 64 6f 63 2f 0 -0600.+++ doc/
0040: 63 68 61 6e 2e 6e 09 32 30 30 36 2d 31 31 2d 32 chan.n.2006-11-2
0050: 31 20 32 32 3a 34 37 3a 33 33 2e 30 30 30 30 30 1 22:47:33.00000
0060: 30 30 30 30 20 2d 30 37 30 30 0a 40 40 20 2d 34 0000 -0700.@@ -4
0070: 39 33 2c 36 20 2b 34 39 33 2c 31 36 20 40 40 0a 93,6 +493,16 @@.
0080: 20 6f 6e 6c 79 20 74 68 6f 73 65 20 63 68 61 6e only those chan
0090: 6e 65 6c 20 6e 61 6d 65 73 20 74 68 61 74 20 6d nel names that m
00a0: 61 74 63 68 20 69 74 20 28 61 63 63 6f 72 64 69 atch it (accordi
00b0: 6e 67 20 74 6f 20 74 68 65 20 72 75 6c 65 73 20 ng to the rules
00c0: 6f 66 0a 20 5c 66 42 73 74 72 69 6e 67 20 6d 61 of. \fBstring ma
00d0: 74 63 68 5c 66 52 29 20 77 69 6c 6c 20 62 65 20 tch\fR) will be
00e0: 72 65 74 75 72 6e 65 64 2e 0a 20 2e 54 50 0a 2b returned.. .TP.+
00f0: 5c 66 42 63 68 61 6e 20 70 65 6e 64 69 6e 67 20 \fBchan pending
0100: 5c 66 49 6d 6f 64 65 20 63 68 61 6e 6e 65 6c 49 \fImode channelI
0110: 64 5c 66 52 0a 2b 2e 0a 2b 44 65 70 65 6e 64 69 d\fR.+..+Dependi
0120: 6e 67 20 6f 6e 20 77 68 65 74 68 65 72 20 5c 66 ng on whether \f
0130: 49 6d 6f 64 65 5c 66 72 20 69 73 20 22 69 6e 70 Imode\fr is "inp
0140: 75 74 22 20 6f 72 20 22 6f 75 74 70 75 74 22 2c ut" or "output",
0150: 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e 75 6d returns the num
0160: 62 65 72 20 6f 66 20 0a 2b 62 79 74 65 73 20 6f ber of .+bytes o
0170: 66 20 69 6e 70 75 74 20 6f 72 20 6f 75 74 70 75 f input or outpu
0180: 74 20 28 72 65 73 70 65 63 74 69 76 65 6c 79 29 t (respectively)
0190: 20 63 75 72 72 65 6e 74 6c 79 20 62 75 66 66 65 currently buffe
01a0: 72 65 64 20 0a 2b 69 6e 74 65 72 6e 61 6c 6c 79 red .+internally
01b0: 20 66 6f 72 20 5c 66 49 63 68 61 6e 6e 65 6c 49 for \fIchannelI
01c0: 64 5c 66 72 20 28 65 73 70 65 63 69 61 6c 6c 79 d\fr (especially
01d0: 20 75 73 65 66 75 6c 20 69 6e 20 61 20 72 65 61 useful in a rea
01e0: 64 61 62 6c 65 20 65 76 65 6e 74 20 0a 2b 63 61 dable event .+ca
01f0: 6c 6c 62 61 63 6b 20 74 6f 20 69 6d 70 6f 73 65 llback to impose
0200: 20 61 70 70 6c 69 63 61 74 69 6f 6e 2d 73 70 65 application-spe
0210: 63 69 66 69 63 20 6c 69 6d 69 74 73 20 6f 6e 20 cific limits on
0220: 69 6e 70 75 74 20 6c 69 6e 65 20 6c 65 6e 67 74 input line lengt
0230: 68 73 20 74 6f 20 61 76 6f 69 64 0a 2b 61 20 70 hs to avoid.+a p
0240: 6f 74 65 6e 74 69 61 6c 20 64 65 6e 69 61 6c 2d otential denial-
0250: 6f 66 2d 73 65 72 76 69 63 65 20 61 74 74 61 63 of-service attac
0260: 6b 20 77 68 65 72 65 20 61 20 68 6f 73 74 69 6c k where a hostil
0270: 65 20 75 73 65 72 20 63 72 61 66 74 73 0a 2b 61 e user crafts.+a
0280: 6e 20 65 78 74 72 65 6d 65 6c 79 20 6c 6f 6e 67 n extremely long
0290: 20 6c 69 6e 65 20 74 68 61 74 20 65 78 63 65 65 line that excee
02a0: 64 73 20 74 68 65 20 61 76 61 69 6c 61 62 6c 65 ds the available
02b0: 20 6d 65 6d 6f 72 79 20 74 6f 20 62 75 66 66 65 memory to buffe
02c0: 72 20 69 74 29 2e 0a 2b 52 65 74 75 72 6e 73 20 r it)..+Returns
02d0: 2d 31 20 69 66 20 74 68 65 20 63 68 61 6e 6e 65 -1 if the channe
02e0: 6c 20 77 61 73 20 6e 6f 74 20 6f 70 65 6e 65 64 l was not opened
02f0: 20 66 6f 72 20 74 68 65 20 6d 6f 64 65 20 69 6e for the mode in
0300: 20 71 75 65 73 74 69 6f 6e 2e 0a 2b 2e 54 50 0a question..+.TP.
0310: 20 5c 66 42 63 68 61 6e 20 70 6f 73 74 65 76 65 \fBchan posteve
0320: 6e 74 20 5c 66 49 63 68 61 6e 6e 65 6c 49 64 20 nt \fIchannelId
0330: 65 76 65 6e 74 53 70 65 63 5c 66 52 0a 20 2e 0a eventSpec\fR. ..
0340: 20 54 68 69 73 20 73 75 62 63 6f 6d 6d 61 6e 64 This subcommand
0350: 20 69 73 20 75 73 65 64 20 62 79 20 63 6f 6d 6d is used by comm
0360: 61 6e 64 20 68 61 6e 64 6c 65 72 73 20 73 70 65 and handlers spe
0370: 63 69 66 69 65 64 20 77 69 74 68 20 5c 66 42 63 cified with \fBc
0380: 68 61 6e 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f han.--- generic/
0390: 74 63 6c 42 61 73 69 63 2e 63 2e 6f 72 69 67 09 tclBasic.c.orig.
03a0: 32 30 30 36 2d 31 30 2d 32 38 20 32 31 3a 35 35 2006-10-28 21:55
03b0: 3a 35 39 2e 30 30 30 30 30 30 30 30 30 20 2d 30 :59.000000000 -0
03c0: 36 30 30 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 600.+++ generic/
03d0: 74 63 6c 42 61 73 69 63 2e 63 09 32 30 30 36 2d tclBasic.c.2006-
03e0: 31 31 2d 32 31 20 31 39 3a 30 31 3a 35 39 2e 30 11-21 19:01:59.0
03f0: 30 30 30 30 30 30 30 30 20 2d 30 37 30 30 0a 40 00000000 -0700.@
0400: 40 20 2d 34 38 35 2c 36 20 2b 34 38 35 2c 31 30 @ -485,6 +485,10
0410: 20 40 40 0a 20 20 20 20 20 54 63 6c 5f 43 72 65 @@. Tcl_Cre
0420: 61 74 65 4f 62 6a 43 6f 6d 6d 61 6e 64 28 69 6e ateObjCommand(in
0430: 74 65 72 70 2c 20 22 3a 3a 74 63 6c 3a 3a 63 68 terp, "::tcl::ch
0440: 61 6e 3a 3a 72 50 6f 73 74 65 76 65 6e 74 22 2c an::rPostevent",
0450: 0a 20 09 20 20 20 20 54 63 6c 43 68 61 6e 50 6f . . TclChanPo
0460: 73 74 45 76 65 6e 74 4f 62 6a 43 6d 64 2c 20 28 stEventObjCmd, (
0470: 43 6c 69 65 6e 74 44 61 74 61 29 20 4e 55 4c 4c ClientData) NULL
0480: 2c 20 4e 55 4c 4c 29 3b 0a 20 0a 2b 20 20 20 20 , NULL);. .+
0490: 2f 2a 20 54 49 50 20 23 32 38 37 20 2a 2f 0a 2b /* TIP #287 */.+
04a0: 20 20 20 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 Tcl_CreateOb
04b0: 6a 43 6f 6d 6d 61 6e 64 28 69 6e 74 65 72 70 2c jCommand(interp,
04c0: 20 22 3a 3a 74 63 6c 3a 3a 63 68 61 6e 3a 3a 50 "::tcl::chan::P
04d0: 65 6e 64 69 6e 67 22 2c 0a 2b 09 20 20 20 20 54 ending",.+. T
04e0: 63 6c 43 68 61 6e 50 65 6e 64 69 6e 67 4f 62 6a clChanPendingObj
04f0: 43 6d 64 2c 20 28 43 6c 69 65 6e 74 44 61 74 61 Cmd, (ClientData
0500: 29 20 4e 55 4c 4c 2c 20 4e 55 4c 4c 29 3b 0a 2b ) NULL, NULL);.+
0510: 0a 20 20 20 20 20 2f 2a 0a 20 20 20 20 20 20 2a . /*. *
0520: 20 52 65 67 69 73 74 65 72 20 74 68 65 20 62 75 Register the bu
0530: 69 6c 74 2d 69 6e 20 66 75 6e 63 74 69 6f 6e 73 ilt-in functions
0540: 2e 20 54 68 69 73 20 69 73 20 65 6d 70 74 79 20 . This is empty
0550: 6e 6f 77 20 74 68 61 74 20 74 68 65 79 20 61 72 now that they ar
0560: 65 0a 20 20 20 20 20 20 2a 20 69 6d 70 6c 65 6d e. * implem
0570: 65 6e 74 65 64 20 61 73 20 63 6f 6d 6d 61 6e 64 ented as command
0580: 73 20 69 6e 20 74 68 65 20 3a 3a 74 63 6c 3a 3a s in the ::tcl::
0590: 6d 61 74 68 66 75 6e 63 20 6e 61 6d 65 73 70 61 mathfunc namespa
05a0: 63 65 2e 0a 2d 2d 2d 20 67 65 6e 65 72 69 63 2f ce..--- generic/
05b0: 74 63 6c 49 6e 74 2e 68 2e 6f 72 69 67 09 32 30 tclInt.h.orig.20
05c0: 30 36 2d 31 30 2d 32 38 20 32 32 3a 30 38 3a 33 06-10-28 22:08:3
05d0: 38 2e 30 30 30 30 30 30 30 30 30 20 2d 30 36 30 8.000000000 -060
05e0: 30 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 0.+++ generic/tc
05f0: 6c 49 6e 74 2e 68 09 32 30 30 36 2d 31 31 2d 32 lInt.h.2006-11-2
0600: 31 20 31 38 3a 33 31 3a 33 37 2e 30 30 30 30 30 1 18:31:37.00000
0610: 30 30 30 30 20 2d 30 37 30 30 0a 40 40 20 2d 32 0000 -0700.@@ -2
0620: 32 38 36 2c 36 20 2b 32 32 38 36 2c 39 20 40 40 286,6 +2286,9 @@
0630: 0a 20 4d 4f 44 55 4c 45 5f 53 43 4f 50 45 20 69 . MODULE_SCOPE i
0640: 6e 74 09 54 63 6c 5f 43 64 4f 62 6a 43 6d 64 28 nt.Tcl_CdObjCmd(
0650: 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e ClientData clien
0660: 74 44 61 74 61 2c 0a 20 09 09 09 20 20 20 20 54 tData,. ... T
0670: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
0680: 70 2c 20 69 6e 74 20 6f 62 6a 63 2c 0a 20 09 09 p, int objc,. ..
0690: 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f . Tcl_Obj *CO
06a0: 4e 53 54 20 6f 62 6a 76 5b 5d 29 3b 0a 2b 4d 4f NST objv[]);.+MO
06b0: 44 55 4c 45 5f 53 43 4f 50 45 20 69 6e 74 09 54 DULE_SCOPE int.T
06c0: 63 6c 43 68 61 6e 50 65 6e 64 69 6e 67 4f 62 6a clChanPendingObj
06d0: 43 6d 64 28 0a 2b 09 09 09 20 20 20 20 43 6c 69 Cmd(.+... Cli
06e0: 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 entData clientDa
06f0: 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a ta, Tcl_Interp *
0700: 69 6e 74 65 72 70 2c 0a 2b 09 09 09 20 20 20 20 interp,.+...
0710: 69 6e 74 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 int objc, Tcl_Ob
0720: 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 j *CONST objv[])
0730: 3b 20 2f 2a 20 54 49 50 20 32 38 37 20 2a 2f 0a ; /* TIP 287 */.
0740: 20 4d 4f 44 55 4c 45 5f 53 43 4f 50 45 20 69 6e MODULE_SCOPE in
0750: 74 09 54 63 6c 43 68 61 6e 54 72 75 6e 63 61 74 t.TclChanTruncat
0760: 65 4f 62 6a 43 6d 64 28 0a 20 09 09 09 20 20 20 eObjCmd(. ...
0770: 20 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 ClientData clie
0780: 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 ntData, Tcl_Inte
0790: 72 70 20 2a 69 6e 74 65 72 70 2c 0a 20 09 09 09 rp *interp,. ...
07a0: 20 20 20 20 69 6e 74 20 6f 62 6a 63 2c 20 54 63 int objc, Tc
07b0: 6c 5f 4f 62 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a l_Obj *CONST obj
07c0: 76 5b 5d 29 3b 0a 2d 2d 2d 20 67 65 6e 65 72 69 v[]);.--- generi
07d0: 63 2f 74 63 6c 49 4f 43 6d 64 2e 63 2e 6f 72 69 c/tclIOCmd.c.ori
07e0: 67 09 32 30 30 36 2d 31 30 2d 32 38 20 32 31 3a g.2006-10-28 21:
07f0: 35 38 3a 32 37 2e 30 30 30 30 30 30 30 30 30 20 58:27.000000000
0800: 2d 30 36 30 30 0a 2b 2b 2b 20 67 65 6e 65 72 69 -0600.+++ generi
0810: 63 2f 74 63 6c 49 4f 43 6d 64 2e 63 09 32 30 30 c/tclIOCmd.c.200
0820: 36 2d 31 31 2d 32 31 20 32 32 3a 35 31 3a 33 36 6-11-21 22:51:36
0830: 2e 30 30 30 30 30 30 30 30 30 20 2d 30 37 30 30 .000000000 -0700
0840: 0a 40 40 20 2d 31 36 31 39 2c 36 20 2b 31 36 31 .@@ -1619,6 +161
0850: 39 2c 37 34 20 40 40 0a 20 7d 0a 20 0c 0a 20 2f 9,74 @@. }. .. /
0860: 2a 0a 2b 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *.+ *-----------
0870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
08a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
08b0: 0a 2b 20 2a 0a 2b 20 2a 20 54 63 6c 43 68 61 6e .+ *.+ * TclChan
08c0: 50 65 6e 64 69 6e 67 4f 62 6a 43 6d 64 20 2d 2d PendingObjCmd --
08d0: 0a 2b 20 2a 0a 2b 20 2a 09 54 68 69 73 20 66 75 .+ *.+ *.This fu
08e0: 6e 63 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 nction is invoke
08f0: 64 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 65 d to process the
0900: 20 54 63 6c 20 22 63 68 61 6e 20 70 65 6e 64 69 Tcl "chan pendi
0910: 6e 67 22 20 0a 2b 20 2a 09 63 6f 6d 6d 61 6e 64 ng" .+ *.command
0920: 20 28 54 49 50 20 23 32 38 37 29 2e 20 53 65 65 (TIP #287). See
0930: 20 74 68 65 20 75 73 65 72 20 64 6f 63 75 6d 65 the user docume
0940: 6e 74 61 74 69 6f 6e 20 66 6f 72 20 64 65 74 61 ntation for deta
0950: 69 6c 73 20 6f 6e 20 0a 2b 20 2a 09 77 68 61 74 ils on .+ *.what
0960: 20 69 74 20 64 6f 65 73 2e 0a 2b 20 2a 0a 2b 20 it does..+ *.+
0970: 2a 20 52 65 73 75 6c 74 73 3a 0a 2b 20 2a 09 41 * Results:.+ *.A
0980: 20 73 74 61 6e 64 61 72 64 20 54 63 6c 20 72 65 standard Tcl re
0990: 73 75 6c 74 2e 0a 2b 20 2a 0a 2b 20 2a 20 53 69 sult..+ *.+ * Si
09a0: 64 65 20 65 66 66 65 63 74 73 3a 0a 2b 20 2a 09 de effects:.+ *.
09b0: 53 65 74 73 20 69 6e 74 65 72 70 27 73 20 72 65 Sets interp's re
09c0: 73 75 6c 74 20 74 6f 20 74 68 65 20 6e 75 6d 62 sult to the numb
09d0: 65 72 20 6f 66 20 62 79 74 65 73 20 6f 66 20 62 er of bytes of b
09e0: 75 66 66 65 72 65 64 20 69 6e 70 75 74 20 6f 72 uffered input or
09f0: 0a 2b 20 2a 09 6f 75 74 70 75 74 20 28 64 65 70 .+ *.output (dep
0a00: 65 6e 64 69 6e 67 20 6f 6e 20 77 68 65 74 68 65 ending on whethe
0a10: 72 20 74 68 65 20 66 69 72 73 74 20 61 72 67 75 r the first argu
0a20: 6d 65 6e 74 20 69 73 20 22 69 6e 70 75 74 22 20 ment is "input"
0a30: 6f 72 0a 2b 20 2a 09 22 6f 75 74 70 75 74 22 29 or.+ *."output")
0a40: 2c 20 6f 72 20 2d 31 20 69 66 20 74 68 65 20 63 , or -1 if the c
0a50: 68 61 6e 6e 65 6c 20 77 61 73 6e 27 74 20 6f 70 hannel wasn't op
0a60: 65 6e 65 64 20 66 6f 72 20 74 68 61 74 20 6d 6f ened for that mo
0a70: 64 65 2e 0a 2b 20 2a 0a 2b 20 2a 2d 2d 2d 2d 2d de..+ *.+ *-----
0a80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0a90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ac0: 2d 2d 2d 2d 2d 2d 0a 2b 20 2a 2f 0a 2b 0a 2b 09 ------.+ */.+.+.
0ad0: 2f 2a 20 41 52 47 53 55 53 45 44 20 2a 2f 0a 2b /* ARGSUSED */.+
0ae0: 69 6e 74 0a 2b 54 63 6c 43 68 61 6e 50 65 6e 64 int.+TclChanPend
0af0: 69 6e 67 4f 62 6a 43 6d 64 28 0a 2b 20 20 20 20 ingObjCmd(.+
0b00: 43 6c 69 65 6e 74 44 61 74 61 20 75 6e 75 73 65 ClientData unuse
0b10: 64 2c 09 09 2f 2a 20 4e 6f 74 20 75 73 65 64 2e d,../* Not used.
0b20: 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 49 6e 74 */.+ Tcl_Int
0b30: 65 72 70 20 2a 69 6e 74 65 72 70 2c 09 09 2f 2a erp *interp,../*
0b40: 20 43 75 72 72 65 6e 74 20 69 6e 74 65 72 70 72 Current interpr
0b50: 65 74 65 72 2e 20 2a 2f 0a 2b 20 20 20 20 69 6e eter. */.+ in
0b60: 74 20 6f 62 6a 63 2c 09 09 09 2f 2a 20 4e 75 6d t objc,.../* Num
0b70: 62 65 72 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 ber of arguments
0b80: 2e 20 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 . */.+ Tcl_Ob
0b90: 6a 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 j *CONST objv[])
0ba0: 09 2f 2a 20 41 72 67 75 6d 65 6e 74 20 6f 62 6a ./* Argument obj
0bb0: 65 63 74 73 2e 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 ects. */.+{.+
0bc0: 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 61 Tcl_Channel cha
0bd0: 6e 3b 0a 2b 20 20 20 20 69 6e 74 20 69 6e 64 65 n;.+ int inde
0be0: 78 2c 20 6d 6f 64 65 3b 0a 2b 20 20 20 20 63 68 x, mode;.+ ch
0bf0: 61 72 20 2a 61 72 67 3b 0a 2b 20 20 20 20 73 74 ar *arg;.+ st
0c00: 61 74 69 63 20 43 4f 4e 53 54 20 63 68 61 72 20 atic CONST char
0c10: 2a 6f 70 74 69 6f 6e 73 5b 5d 20 3d 20 7b 22 69 *options[] = {"i
0c20: 6e 70 75 74 22 2c 20 22 6f 75 74 70 75 74 22 2c nput", "output",
0c30: 20 28 63 68 61 72 20 2a 29 20 4e 55 4c 4c 7d 3b (char *) NULL};
0c40: 0a 2b 20 20 20 20 65 6e 75 6d 20 6f 70 74 69 6f .+ enum optio
0c50: 6e 73 20 7b 50 45 4e 44 49 4e 47 5f 49 4e 50 55 ns {PENDING_INPU
0c60: 54 2c 20 50 45 4e 44 49 4e 47 5f 4f 55 54 50 55 T, PENDING_OUTPU
0c70: 54 7d 3b 0a 2b 0a 2b 20 20 20 20 69 66 20 28 6f T};.+.+ if (o
0c80: 62 6a 63 20 21 3d 20 33 29 20 7b 0a 2b 09 54 63 bjc != 3) {.+.Tc
0c90: 6c 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 73 28 69 l_WrongNumArgs(i
0ca0: 6e 74 65 72 70 2c 20 31 2c 20 6f 62 6a 76 2c 20 nterp, 1, objv,
0cb0: 22 6d 6f 64 65 20 63 68 61 6e 6e 65 6c 49 64 22 "mode channelId"
0cc0: 29 3b 0a 2b 09 72 65 74 75 72 6e 20 54 43 4c 5f );.+.return TCL_
0cd0: 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a 2b 0a ERROR;.+ }.+.
0ce0: 2b 20 20 20 20 69 66 20 28 54 63 6c 5f 47 65 74 + if (Tcl_Get
0cf0: 49 6e 64 65 78 46 72 6f 6d 4f 62 6a 28 69 6e 74 IndexFromObj(int
0d00: 65 72 70 2c 20 6f 62 6a 76 5b 31 5d 2c 20 6f 70 erp, objv[1], op
0d10: 74 69 6f 6e 73 2c 20 22 6d 6f 64 65 22 2c 20 30 tions, "mode", 0
0d20: 2c 20 0a 2b 09 20 20 20 20 26 69 6e 64 65 78 29 , .+. &index)
0d30: 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 09 != TCL_OK) {.+.
0d40: 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 return TCL_ERROR
0d50: 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 ;.+ }.+.+
0d60: 61 72 67 20 3d 20 54 63 6c 5f 47 65 74 53 74 72 arg = Tcl_GetStr
0d70: 69 6e 67 28 6f 62 6a 76 5b 32 5d 29 3b 0a 2b 20 ing(objv[2]);.+
0d80: 20 20 20 63 68 61 6e 20 3d 20 54 63 6c 5f 47 65 chan = Tcl_Ge
0d90: 74 43 68 61 6e 6e 65 6c 28 69 6e 74 65 72 70 2c tChannel(interp,
0da0: 20 61 72 67 2c 20 26 6d 6f 64 65 29 3b 0a 2b 20 arg, &mode);.+
0db0: 20 20 20 69 66 20 28 63 68 61 6e 20 3d 3d 20 4e if (chan == N
0dc0: 55 4c 4c 29 20 7b 0a 2b 09 72 65 74 75 72 6e 20 ULL) {.+.return
0dd0: 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20 TCL_ERROR;.+
0de0: 7d 0a 2b 0a 2b 20 20 20 20 73 77 69 74 63 68 20 }.+.+ switch
0df0: 28 28 65 6e 75 6d 20 6f 70 74 69 6f 6e 73 29 20 ((enum options)
0e00: 69 6e 64 65 78 29 20 7b 0a 2b 20 20 20 20 63 61 index) {.+ ca
0e10: 73 65 20 50 45 4e 44 49 4e 47 5f 49 4e 50 55 54 se PENDING_INPUT
0e20: 3a 0a 2b 09 69 66 20 28 28 6d 6f 64 65 20 26 20 :.+.if ((mode &
0e30: 54 43 4c 5f 52 45 41 44 41 42 4c 45 29 20 3d 3d TCL_READABLE) ==
0e40: 20 30 29 20 7b 0a 2b 09 20 20 20 20 54 63 6c 5f 0) {.+. Tcl_
0e50: 53 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 SetObjResult(int
0e60: 65 72 70 2c 20 54 63 6c 5f 4e 65 77 49 6e 74 4f erp, Tcl_NewIntO
0e70: 62 6a 28 2d 31 29 29 3b 0a 2b 09 7d 20 65 6c 73 bj(-1));.+.} els
0e80: 65 20 7b 0a 2b 09 20 20 20 20 54 63 6c 5f 53 65 e {.+. Tcl_Se
0e90: 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 tObjResult(inter
0ea0: 70 2c 20 54 63 6c 5f 4e 65 77 49 6e 74 4f 62 6a p, Tcl_NewIntObj
0eb0: 28 54 63 6c 5f 49 6e 70 75 74 42 75 66 66 65 72 (Tcl_InputBuffer
0ec0: 65 64 28 63 68 61 6e 29 29 29 3b 0a 2b 09 7d 0a ed(chan)));.+.}.
0ed0: 2b 09 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b +.return TCL_OK;
0ee0: 0a 2b 20 20 20 20 63 61 73 65 20 50 45 4e 44 49 .+ case PENDI
0ef0: 4e 47 5f 4f 55 54 50 55 54 3a 0a 2b 09 69 66 20 NG_OUTPUT:.+.if
0f00: 28 28 6d 6f 64 65 20 26 20 54 43 4c 5f 57 52 49 ((mode & TCL_WRI
0f10: 54 41 42 4c 45 29 20 3d 3d 20 30 29 20 7b 0a 2b TABLE) == 0) {.+
0f20: 09 20 20 20 20 54 63 6c 5f 53 65 74 4f 62 6a 52 . Tcl_SetObjR
0f30: 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 54 63 esult(interp, Tc
0f40: 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 2d 31 29 29 l_NewIntObj(-1))
0f50: 3b 0a 2b 09 7d 20 65 6c 73 65 20 7b 0a 2b 09 20 ;.+.} else {.+.
0f60: 20 20 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65 73 Tcl_SetObjRes
0f70: 75 6c 74 28 69 6e 74 65 72 70 2c 20 54 63 6c 5f ult(interp, Tcl_
0f80: 4e 65 77 49 6e 74 4f 62 6a 28 54 63 6c 5f 4f 75 NewIntObj(Tcl_Ou
0f90: 74 70 75 74 42 75 66 66 65 72 65 64 28 63 68 61 tputBuffered(cha
0fa0: 6e 29 29 29 3b 0a 2b 09 7d 0a 2b 09 72 65 74 75 n)));.+.}.+.retu
0fb0: 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 rn TCL_OK;.+
0fc0: 7d 0a 2b 7d 0a 2b 0c 0a 2b 2f 2a 0a 20 20 2a 2d }.+}.+..+/*. *-
0fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1010: 2d 2d 2d 2d 2d 0a 20 20 2a 0a 20 20 2a 20 54 63 -----. *. * Tc
1020: 6c 5f 43 68 61 6e 54 72 75 6e 63 61 74 65 4f 62 l_ChanTruncateOb
1030: 6a 43 6d 64 20 2d 2d 0a 2d 2d 2d 20 6c 69 62 72 jCmd --.--- libr
1040: 61 72 79 2f 69 6e 69 74 2e 74 63 6c 2e 6f 72 69 ary/init.tcl.ori
1050: 67 09 32 30 30 36 2d 30 39 2d 32 32 20 31 32 3a g.2006-09-22 12:
1060: 31 33 3a 32 39 2e 30 30 30 30 30 30 30 30 30 20 13:29.000000000
1070: 2d 30 36 30 30 0a 2b 2b 2b 20 6c 69 62 72 61 72 -0600.+++ librar
1080: 79 2f 69 6e 69 74 2e 74 63 6c 09 32 30 30 36 2d y/init.tcl.2006-
1090: 31 31 2d 32 31 20 31 39 3a 30 33 3a 35 39 2e 30 11-21 19:03:59.0
10a0: 30 30 30 30 30 30 30 30 20 2d 30 37 30 30 0a 40 00000000 -0700.@
10b0: 40 20 2d 37 38 2c 37 20 2b 37 38 2c 39 20 40 40 @ -78,7 +78,9 @@
10c0: 0a 20 20 20 20 20 23 20 53 65 74 20 75 70 20 74 . # Set up t
10d0: 68 65 20 27 63 68 61 6e 27 20 65 6e 73 65 6d 62 he 'chan' ensemb
10e0: 6c 65 20 28 54 49 50 20 23 32 30 38 29 2e 0a 20 le (TIP #208)..
10f0: 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 65 76 namespace ev
1100: 61 6c 20 63 68 61 6e 20 7b 0a 20 20 20 20 20 20 al chan {.
1110: 20 20 20 23 20 54 49 50 20 23 32 31 39 2e 20 41 # TIP #219. A
1120: 64 64 65 64 20 6d 65 74 68 6f 64 73 3a 20 63 72 dded methods: cr
1130: 65 61 74 65 2c 20 70 6f 73 74 65 76 65 6e 74 2e eate, postevent.
1140: 0a 2b 20 20 20 20 20 20 20 20 23 20 54 49 50 20 .+ # TIP
1150: 23 32 38 37 2e 20 41 64 64 65 64 20 6d 65 74 68 #287. Added meth
1160: 6f 64 3a 20 70 65 6e 64 69 6e 67 2e 0a 20 20 20 od: pending..
1170: 20 20 20 20 20 20 6e 61 6d 65 73 70 61 63 65 20 namespace
1180: 65 6e 73 65 6d 62 6c 65 20 63 72 65 61 74 65 20 ensemble create
1190: 2d 63 6f 6d 6d 61 6e 64 20 3a 3a 63 68 61 6e 20 -command ::chan
11a0: 2d 6d 61 70 20 7b 0a 2b 20 20 20 20 20 20 20 20 -map {.+
11b0: 20 20 20 20 70 65 6e 64 69 6e 67 20 20 20 20 20 pending
11c0: 3a 3a 74 63 6c 3a 3a 63 68 61 6e 3a 3a 50 65 6e ::tcl::chan::Pen
11d0: 64 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 ding.
11e0: 20 20 62 6c 6f 63 6b 65 64 20 20 20 20 20 3a 3a blocked ::
11f0: 66 62 6c 6f 63 6b 65 64 0a 20 20 20 20 20 20 20 fblocked.
1200: 20 20 20 20 20 20 63 6c 6f 73 65 20 20 20 20 20 close
1210: 20 20 3a 3a 63 6c 6f 73 65 0a 20 20 20 20 20 20 ::close.
1220: 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 65 configure
1230: 20 20 20 3a 3a 66 63 6f 6e 66 69 67 75 72 65 0a ::fconfigure.
1240: 2d 2d 2d 20 74 65 73 74 73 2f 63 68 61 6e 2e 74 --- tests/chan.t
1250: 65 73 74 2e 6f 72 69 67 09 32 30 30 36 2d 31 30 est.orig.2006-10
1260: 2d 32 39 20 31 33 3a 35 39 3a 33 35 2e 30 30 30 -29 13:59:35.000
1270: 30 30 30 30 30 30 20 2d 30 37 30 30 0a 2b 2b 2b 000000 -0700.+++
1280: 20 74 65 73 74 73 2f 63 68 61 6e 2e 74 65 73 74 tests/chan.test
1290: 09 32 30 30 36 2d 31 31 2d 32 31 20 32 32 3a 33 .2006-11-21 22:3
12a0: 35 3a 32 34 2e 30 30 30 30 30 30 30 30 30 20 2d 5:24.000000000 -
12b0: 30 37 30 30 0a 40 40 20 2d 32 34 2c 37 20 2b 32 0700.@@ -24,7 +2
12c0: 34 2c 37 20 40 40 0a 20 7d 20 2d 72 65 74 75 72 4,7 @@. } -retur
12d0: 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 72 65 nCodes error -re
12e0: 73 75 6c 74 20 22 77 72 6f 6e 67 20 23 20 61 72 sult "wrong # ar
12f0: 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20 5c 22 gs: should be \"
1300: 63 68 61 6e 20 73 75 62 63 6f 6d 6d 61 6e 64 20 chan subcommand
1310: 3f 61 72 67 75 6d 65 6e 74 20 2e 2e 2e 3f 5c 22 ?argument ...?\"
1320: 22 0a 20 74 65 73 74 20 63 68 61 6e 2d 31 2e 32 ". test chan-1.2
1330: 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 20 67 {chan command g
1340: 65 6e 65 72 61 6c 20 73 79 6e 74 61 78 7d 20 2d eneral syntax} -
1350: 62 6f 64 79 20 7b 0a 20 20 20 20 20 63 68 61 6e body {. chan
1360: 20 46 4f 4f 42 41 52 0a 2d 7d 20 2d 72 65 74 75 FOOBAR.-} -retu
1370: 72 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 72 rnCodes error -r
1380: 65 73 75 6c 74 20 22 75 6e 6b 6e 6f 77 6e 20 6f esult "unknown o
1390: 72 20 61 6d 62 69 67 75 6f 75 73 20 73 75 62 63 r ambiguous subc
13a0: 6f 6d 6d 61 6e 64 20 5c 22 46 4f 4f 42 41 52 5c ommand \"FOOBAR\
13b0: 22 3a 20 6d 75 73 74 20 62 65 20 62 6c 6f 63 6b ": must be block
13c0: 65 64 2c 20 63 6c 6f 73 65 2c 20 63 6f 6e 66 69 ed, close, confi
13d0: 67 75 72 65 2c 20 63 6f 70 79 2c 20 63 72 65 61 gure, copy, crea
13e0: 74 65 2c 20 65 6f 66 2c 20 65 76 65 6e 74 2c 20 te, eof, event,
13f0: 66 6c 75 73 68 2c 20 67 65 74 73 2c 20 6e 61 6d flush, gets, nam
1400: 65 73 2c 20 70 6f 73 74 65 76 65 6e 74 2c 20 70 es, postevent, p
1410: 75 74 73 2c 20 72 65 61 64 2c 20 73 65 65 6b 2c uts, read, seek,
1420: 20 74 65 6c 6c 2c 20 6f 72 20 74 72 75 6e 63 61 tell, or trunca
1430: 74 65 22 0a 2b 7d 20 2d 72 65 74 75 72 6e 43 6f te".+} -returnCo
1440: 64 65 73 20 65 72 72 6f 72 20 2d 72 65 73 75 6c des error -resul
1450: 74 20 22 75 6e 6b 6e 6f 77 6e 20 6f 72 20 61 6d t "unknown or am
1460: 62 69 67 75 6f 75 73 20 73 75 62 63 6f 6d 6d 61 biguous subcomma
1470: 6e 64 20 5c 22 46 4f 4f 42 41 52 5c 22 3a 20 6d nd \"FOOBAR\": m
1480: 75 73 74 20 62 65 20 62 6c 6f 63 6b 65 64 2c 20 ust be blocked,
1490: 63 6c 6f 73 65 2c 20 63 6f 6e 66 69 67 75 72 65 close, configure
14a0: 2c 20 63 6f 70 79 2c 20 63 72 65 61 74 65 2c 20 , copy, create,
14b0: 65 6f 66 2c 20 65 76 65 6e 74 2c 20 66 6c 75 73 eof, event, flus
14c0: 68 2c 20 67 65 74 73 2c 20 6e 61 6d 65 73 2c 20 h, gets, names,
14d0: 70 65 6e 64 69 6e 67 2c 20 70 6f 73 74 65 76 65 pending, posteve
14e0: 6e 74 2c 20 70 75 74 73 2c 20 72 65 61 64 2c 20 nt, puts, read,
14f0: 73 65 65 6b 2c 20 74 65 6c 6c 2c 20 6f 72 20 74 seek, tell, or t
1500: 72 75 6e 63 61 74 65 22 0a 20 0a 20 74 65 73 74 runcate". . test
1510: 20 63 68 61 6e 2d 32 2e 31 20 7b 63 68 61 6e 20 chan-2.1 {chan
1520: 63 6f 6d 6d 61 6e 64 3a 20 62 6c 6f 63 6b 65 64 command: blocked
1530: 20 73 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 62 6f subcommand} -bo
1540: 64 79 20 7b 0a 20 20 20 20 20 63 68 61 6e 20 62 dy {. chan b
1550: 6c 6f 63 6b 65 64 20 66 6f 6f 20 62 61 72 0a 40 locked foo bar.@
1560: 40 20 2d 39 36 2c 36 20 2b 39 36 2c 31 31 36 20 @ -96,6 +96,116
1570: 40 40 0a 20 20 20 20 20 63 61 74 63 68 20 7b 72 @@. catch {r
1580: 65 6d 6f 76 65 46 69 6c 65 20 24 66 69 6c 65 7d emoveFile $file}
1590: 0a 20 7d 0a 20 0a 2b 23 20 54 49 50 20 32 38 37 . }. .+# TIP 287
15a0: 3a 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 0a 2b : chan pending.+
15b0: 74 65 73 74 20 63 68 61 6e 2d 31 36 2e 31 20 7b test chan-16.1 {
15c0: 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 chan command: pe
15d0: 6e 64 69 6e 67 20 73 75 62 63 6f 6d 6d 61 6e 64 nding subcommand
15e0: 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 } -body {.+ c
15f0: 68 61 6e 20 70 65 6e 64 69 6e 67 0a 2b 7d 20 2d han pending.+} -
1600: 72 65 74 75 72 6e 43 6f 64 65 73 20 65 72 72 6f returnCodes erro
1610: 72 20 2d 72 65 73 75 6c 74 20 22 77 72 6f 6e 67 r -result "wrong
1620: 20 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 20 # args: should
1630: 62 65 20 5c 22 63 68 61 6e 20 70 65 6e 64 69 6e be \"chan pendin
1640: 67 20 6d 6f 64 65 20 63 68 61 6e 6e 65 6c 49 64 g mode channelId
1650: 5c 22 22 0a 2b 74 65 73 74 20 63 68 61 6e 2d 31 \"".+test chan-1
1660: 36 2e 32 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e 6.2 {chan comman
1670: 64 3a 20 70 65 6e 64 69 6e 67 20 73 75 62 63 6f d: pending subco
1680: 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b mmand} -body {.+
1690: 20 20 20 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 chan pending
16a0: 20 73 74 64 69 6e 0a 2b 7d 20 2d 72 65 74 75 72 stdin.+} -retur
16b0: 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d 72 65 nCodes error -re
16c0: 73 75 6c 74 20 22 77 72 6f 6e 67 20 23 20 61 72 sult "wrong # ar
16d0: 67 73 3a 20 73 68 6f 75 6c 64 20 62 65 20 5c 22 gs: should be \"
16e0: 63 68 61 6e 20 70 65 6e 64 69 6e 67 20 6d 6f 64 chan pending mod
16f0: 65 20 63 68 61 6e 6e 65 6c 49 64 5c 22 22 0a 2b e channelId\"".+
1700: 74 65 73 74 20 63 68 61 6e 2d 31 36 2e 33 20 7b test chan-16.3 {
1710: 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 chan command: pe
1720: 6e 64 69 6e 67 20 73 75 62 63 6f 6d 6d 61 6e 64 nding subcommand
1730: 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 } -body {.+ c
1740: 68 61 6e 20 70 65 6e 64 69 6e 67 20 73 74 64 69 han pending stdi
1750: 6e 20 73 74 64 6f 75 74 20 73 74 64 65 72 72 0a n stdout stderr.
1760: 2b 7d 20 2d 72 65 74 75 72 6e 43 6f 64 65 73 20 +} -returnCodes
1770: 65 72 72 6f 72 20 2d 72 65 73 75 6c 74 20 22 77 error -result "w
1780: 72 6f 6e 67 20 23 20 61 72 67 73 3a 20 73 68 6f rong # args: sho
1790: 75 6c 64 20 62 65 20 5c 22 63 68 61 6e 20 70 65 uld be \"chan pe
17a0: 6e 64 69 6e 67 20 6d 6f 64 65 20 63 68 61 6e 6e nding mode chann
17b0: 65 6c 49 64 5c 22 22 0a 2b 74 65 73 74 20 63 68 elId\"".+test ch
17c0: 61 6e 2d 31 36 2e 34 20 7b 63 68 61 6e 20 63 6f an-16.4 {chan co
17d0: 6d 6d 61 6e 64 3a 20 70 65 6e 64 69 6e 67 20 73 mmand: pending s
17e0: 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79 ubcommand} -body
17f0: 20 7b 0a 2b 20 20 20 20 63 68 61 6e 20 70 65 6e {.+ chan pen
1800: 64 69 6e 67 20 7b 69 6e 70 75 74 20 6f 75 74 70 ding {input outp
1810: 75 74 7d 20 73 74 64 6f 75 74 0a 2b 7d 20 2d 72 ut} stdout.+} -r
1820: 65 74 75 72 6e 43 6f 64 65 73 20 65 72 72 6f 72 eturnCodes error
1830: 20 2d 72 65 73 75 6c 74 20 22 62 61 64 20 6d 6f -result "bad mo
1840: 64 65 20 5c 22 69 6e 70 75 74 20 6f 75 74 70 75 de \"input outpu
1850: 74 5c 22 3a 20 6d 75 73 74 20 62 65 20 69 6e 70 t\": must be inp
1860: 75 74 20 6f 72 20 6f 75 74 70 75 74 22 0a 2b 74 ut or output".+t
1870: 65 73 74 20 63 68 61 6e 2d 31 36 2e 35 20 7b 63 est chan-16.5 {c
1880: 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 6e han command: pen
1890: 64 69 6e 67 20 69 6e 70 75 74 20 73 75 62 63 6f ding input subco
18a0: 6d 6d 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b mmand} -body {.+
18b0: 20 20 20 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 chan pending
18c0: 20 69 6e 70 75 74 20 73 74 64 6f 75 74 20 0a 2b input stdout .+
18d0: 7d 20 2d 72 65 73 75 6c 74 20 2d 31 0a 2b 74 65 } -result -1.+te
18e0: 73 74 20 63 68 61 6e 2d 31 36 2e 36 20 7b 63 68 st chan-16.6 {ch
18f0: 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 6e 64 an command: pend
1900: 69 6e 67 20 69 6e 70 75 74 20 73 75 62 63 6f 6d ing input subcom
1910: 6d 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 mand} -body {.+
1920: 20 20 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 20 chan pending
1930: 69 6e 70 75 74 20 73 74 64 69 6e 0a 2b 7d 20 2d input stdin.+} -
1940: 72 65 73 75 6c 74 20 30 0a 2b 74 65 73 74 20 63 result 0.+test c
1950: 68 61 6e 2d 31 36 2e 37 20 7b 63 68 61 6e 20 63 han-16.7 {chan c
1960: 6f 6d 6d 61 6e 64 3a 20 70 65 6e 64 69 6e 67 20 ommand: pending
1970: 69 6e 70 75 74 20 73 75 62 63 6f 6d 6d 61 6e 64 input subcommand
1980: 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 } -body {.+ c
1990: 68 61 6e 20 70 65 6e 64 69 6e 67 20 69 6e 70 75 han pending inpu
19a0: 74 20 46 4f 4f 42 41 52 0a 2b 7d 20 2d 72 65 74 t FOOBAR.+} -ret
19b0: 75 72 6e 43 6f 64 65 73 20 65 72 72 6f 72 20 2d urnCodes error -
19c0: 72 65 73 75 6c 74 20 22 63 61 6e 20 6e 6f 74 20 result "can not
19d0: 66 69 6e 64 20 63 68 61 6e 6e 65 6c 20 6e 61 6d find channel nam
19e0: 65 64 20 5c 22 46 4f 4f 42 41 52 5c 22 22 0a 2b ed \"FOOBAR\"".+
19f0: 74 65 73 74 20 63 68 61 6e 2d 31 36 2e 38 20 7b test chan-16.8 {
1a00: 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 chan command: pe
1a10: 6e 64 69 6e 67 20 69 6e 70 75 74 20 73 75 62 63 nding input subc
1a20: 6f 6d 6d 61 6e 64 7d 20 2d 73 65 74 75 70 20 7b ommand} -setup {
1a30: 0a 2b 20 20 20 20 73 65 74 20 66 69 6c 65 20 5b .+ set file [
1a40: 6d 61 6b 65 46 69 6c 65 20 7b 7d 20 74 65 73 74 makeFile {} test
1a50: 41 76 61 69 6c 61 62 6c 65 5d 0a 2b 20 20 20 20 Available].+
1a60: 73 65 74 20 66 20 5b 6f 70 65 6e 20 24 66 69 6c set f [open $fil
1a70: 65 20 77 2b 5d 0a 2b 20 20 20 20 63 68 61 6e 20 e w+].+ chan
1a80: 63 6f 6e 66 69 67 75 72 65 20 24 66 20 2d 74 72 configure $f -tr
1a90: 61 6e 73 6c 61 74 69 6f 6e 20 6c 66 20 2d 62 75 anslation lf -bu
1aa0: 66 66 65 72 69 6e 67 20 6c 69 6e 65 0a 2b 7d 20 ffering line.+}
1ab0: 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 63 68 61 -body {.+ cha
1ac0: 6e 20 70 75 74 73 20 24 66 20 66 6f 6f 0a 2b 20 n puts $f foo.+
1ad0: 20 20 20 63 68 61 6e 20 70 75 74 73 20 24 66 20 chan puts $f
1ae0: 62 61 72 0a 2b 20 20 20 20 63 68 61 6e 20 70 75 bar.+ chan pu
1af0: 74 73 20 24 66 20 62 61 7a 0a 2b 20 20 20 20 63 ts $f baz.+ c
1b00: 68 61 6e 20 73 65 65 6b 20 24 66 20 30 0a 2b 20 han seek $f 0.+
1b10: 20 20 20 63 68 61 6e 20 67 65 74 73 20 24 66 0a chan gets $f.
1b20: 2b 20 20 20 20 63 68 61 6e 20 70 65 6e 64 69 6e + chan pendin
1b30: 67 20 69 6e 70 75 74 20 24 66 0a 2b 7d 20 2d 72 g input $f.+} -r
1b40: 65 73 75 6c 74 20 38 20 2d 63 6c 65 61 6e 75 70 esult 8 -cleanup
1b50: 20 7b 0a 2b 20 20 20 20 63 61 74 63 68 20 7b 63 {.+ catch {c
1b60: 68 61 6e 20 63 6c 6f 73 65 20 24 66 7d 0a 2b 20 han close $f}.+
1b70: 20 20 20 63 61 74 63 68 20 7b 72 65 6d 6f 76 65 catch {remove
1b80: 46 69 6c 65 20 24 66 69 6c 65 7d 0a 2b 7d 0a 2b File $file}.+}.+
1b90: 74 65 73 74 20 63 68 61 6e 2d 31 36 2e 39 20 7b test chan-16.9 {
1ba0: 63 68 61 6e 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 chan command: pe
1bb0: 6e 64 69 6e 67 20 69 6e 70 75 74 20 73 75 62 63 nding input subc
1bc0: 6f 6d 6d 61 6e 64 7d 20 2d 73 65 74 75 70 20 7b ommand} -setup {
1bd0: 0a 2b 20 20 20 20 70 72 6f 63 20 63 68 61 6e 2d .+ proc chan-
1be0: 31 36 2e 39 2d 61 63 63 65 70 74 20 7b 73 6f 63 16.9-accept {soc
1bf0: 6b 20 61 64 64 72 20 70 6f 72 74 7d 20 7b 0a 2b k addr port} {.+
1c00: 20 20 20 20 20 20 20 20 63 68 61 6e 20 63 6f 6e chan con
1c10: 66 69 67 75 72 65 20 24 73 6f 63 6b 20 2d 62 6c figure $sock -bl
1c20: 6f 63 6b 69 6e 67 20 30 20 2d 62 75 66 66 65 72 ocking 0 -buffer
1c30: 69 6e 67 20 6c 69 6e 65 20 2d 62 75 66 66 65 72 ing line -buffer
1c40: 73 69 7a 65 20 33 32 0a 2b 20 20 20 20 20 20 20 size 32.+
1c50: 20 63 68 61 6e 20 65 76 65 6e 74 20 24 73 6f 63 chan event $soc
1c60: 6b 20 72 65 61 64 61 62 6c 65 20 5b 6c 69 73 74 k readable [list
1c70: 20 63 68 61 6e 2d 31 36 2e 39 2d 72 65 61 64 61 chan-16.9-reada
1c80: 62 6c 65 20 24 73 6f 63 6b 5d 0a 2b 20 20 20 20 ble $sock].+
1c90: 7d 0a 2b 0a 2b 20 20 20 20 70 72 6f 63 20 63 68 }.+.+ proc ch
1ca0: 61 6e 2d 31 36 2e 39 2d 72 65 61 64 61 62 6c 65 an-16.9-readable
1cb0: 20 7b 73 6f 63 6b 7d 20 7b 0a 2b 20 20 20 20 20 {sock} {.+
1cc0: 20 20 20 73 65 74 20 72 20 5b 63 68 61 6e 20 67 set r [chan g
1cd0: 65 74 73 20 24 73 6f 63 6b 20 6c 69 6e 65 5d 0a ets $sock line].
1ce0: 2b 20 20 20 20 20 20 20 20 73 65 74 20 6c 20 5b + set l [
1cf0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6c string length $l
1d00: 69 6e 65 5d 0a 2b 20 20 20 20 20 20 20 20 73 65 ine].+ se
1d10: 74 20 65 20 5b 63 68 61 6e 20 65 6f 66 20 24 73 t e [chan eof $s
1d20: 6f 63 6b 5d 0a 2b 20 20 20 20 20 20 20 20 73 65 ock].+ se
1d30: 74 20 62 20 5b 63 68 61 6e 20 62 6c 6f 63 6b 65 t b [chan blocke
1d40: 64 20 24 73 6f 63 6b 5d 0a 2b 20 20 20 20 20 20 d $sock].+
1d50: 20 20 73 65 74 20 69 20 5b 63 68 61 6e 20 70 65 set i [chan pe
1d60: 6e 64 69 6e 67 20 69 6e 70 75 74 20 24 73 6f 63 nding input $soc
1d70: 6b 5d 0a 2b 0a 2b 20 20 20 20 20 20 20 20 6c 61 k].+.+ la
1d80: 70 70 65 6e 64 20 3a 3a 63 68 61 6e 2d 31 36 2e ppend ::chan-16.
1d90: 39 2d 64 61 74 61 20 24 72 20 24 6c 20 24 65 20 9-data $r $l $e
1da0: 24 62 20 24 69 0a 2b 0a 2b 20 20 20 20 20 20 20 $b $i.+.+
1db0: 20 69 66 20 7b 24 72 20 21 3d 20 2d 31 20 7c 7c if {$r != -1 ||
1dc0: 20 24 65 20 7c 7c 20 24 6c 20 7c 7c 20 21 24 62 $e || $l || !$b
1dd0: 20 7c 7c 20 24 69 20 3e 20 31 32 38 7d 20 7b 0a || $i > 128} {.
1de0: 2b 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 + set
1df0: 20 64 61 74 61 20 5b 72 65 61 64 20 24 73 6f 63 data [read $soc
1e00: 6b 20 24 69 5d 0a 2b 20 20 20 20 20 20 20 20 20 k $i].+
1e10: 20 20 20 6c 61 70 70 65 6e 64 20 3a 3a 63 68 61 lappend ::cha
1e20: 6e 2d 31 36 2e 39 2d 64 61 74 61 20 5b 73 74 72 n-16.9-data [str
1e30: 69 6e 67 20 72 61 6e 67 65 20 24 64 61 74 61 20 ing range $data
1e40: 30 20 32 5d 0a 2b 20 20 20 20 20 20 20 20 20 20 0 2].+
1e50: 20 20 6c 61 70 70 65 6e 64 20 3a 3a 63 68 61 6e lappend ::chan
1e60: 2d 31 36 2e 39 2d 64 61 74 61 20 5b 73 74 72 69 -16.9-data [stri
1e70: 6e 67 20 72 61 6e 67 65 20 24 64 61 74 61 20 65 ng range $data e
1e80: 6e 64 2d 32 20 65 6e 64 5d 0a 2b 20 20 20 20 20 nd-2 end].+
1e90: 20 20 20 20 20 20 20 73 65 74 20 3a 3a 63 68 61 set ::cha
1ea0: 6e 2d 31 36 2e 39 2d 64 6f 6e 65 20 31 0a 2b 20 n-16.9-done 1.+
1eb0: 20 20 20 20 20 20 20 7d 0a 2b 20 20 20 20 7d 0a }.+ }.
1ec0: 2b 0a 2b 20 20 20 20 70 72 6f 63 20 63 68 61 6e +.+ proc chan
1ed0: 2d 31 36 2e 39 2d 63 6c 69 65 6e 74 20 7b 7d 20 -16.9-client {}
1ee0: 7b 0a 2b 20 20 20 20 20 20 20 20 63 68 61 6e 20 {.+ chan
1ef0: 70 75 74 73 20 2d 6e 6f 6e 65 77 6c 69 6e 65 20 puts -nonewline
1f00: 24 3a 3a 63 6c 69 65 6e 74 20 41 42 43 44 45 46 $::client ABCDEF
1f10: 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 GHIJKLMNOPQRSTUV
1f20: 57 58 59 5a 31 32 33 34 35 36 37 38 39 30 0a 2b WXYZ1234567890.+
1f30: 20 20 20 20 20 20 20 20 63 68 61 6e 20 66 6c 75 chan flu
1f40: 73 68 20 24 3a 3a 63 6c 69 65 6e 74 0a 2b 20 20 sh $::client.+
1f50: 20 20 20 20 20 20 61 66 74 65 72 20 31 30 30 20 after 100
1f60: 63 68 61 6e 2d 31 36 2e 39 2d 63 6c 69 65 6e 74 chan-16.9-client
1f70: 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 73 .+ }.+.+ s
1f80: 65 74 20 3a 3a 73 65 72 76 65 72 20 5b 73 6f 63 et ::server [soc
1f90: 6b 65 74 20 2d 73 65 72 76 65 72 20 63 68 61 6e ket -server chan
1fa0: 2d 31 36 2e 39 2d 61 63 63 65 70 74 20 2d 6d 79 -16.9-accept -my
1fb0: 61 64 64 72 20 31 32 37 2e 30 2e 30 2e 31 20 30 addr 127.0.0.1 0
1fc0: 5d 0a 2b 20 20 20 20 73 65 74 20 3a 3a 63 6c 69 ].+ set ::cli
1fd0: 65 6e 74 20 5b 73 6f 63 6b 65 74 20 31 32 37 2e ent [socket 127.
1fe0: 30 2e 30 2e 31 20 5b 6c 69 6e 64 65 78 20 5b 66 0.0.1 [lindex [f
1ff0: 63 6f 6e 66 69 67 75 72 65 20 24 3a 3a 73 65 72 configure $::ser
2000: 76 65 72 20 2d 73 6f 63 6b 6e 61 6d 65 5d 20 32 ver -sockname] 2
2010: 5d 5d 0a 2b 20 20 20 20 73 65 74 20 3a 3a 63 68 ]].+ set ::ch
2020: 61 6e 2d 31 36 2e 39 2d 64 61 74 61 20 5b 6c 69 an-16.9-data [li
2030: 73 74 5d 0a 2b 20 20 20 20 73 65 74 20 3a 3a 63 st].+ set ::c
2040: 68 61 6e 2d 31 36 2e 39 2d 64 6f 6e 65 20 30 0a han-16.9-done 0.
2050: 2b 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 20 20 +} -body {.+
2060: 61 66 74 65 72 20 69 64 6c 65 20 63 68 61 6e 2d after idle chan-
2070: 31 36 2e 39 2d 63 6c 69 65 6e 74 20 0a 2b 20 20 16.9-client .+
2080: 20 20 76 77 61 69 74 20 3a 3a 63 68 61 6e 2d 31 vwait ::chan-1
2090: 36 2e 39 2d 64 6f 6e 65 0a 2b 20 20 20 20 73 65 6.9-done.+ se
20a0: 74 20 3a 3a 63 68 61 6e 2d 31 36 2e 39 2d 64 61 t ::chan-16.9-da
20b0: 74 61 0a 2b 7d 20 2d 72 65 73 75 6c 74 20 7b 2d ta.+} -result {-
20c0: 31 20 30 20 30 20 31 20 33 36 20 2d 31 20 30 20 1 0 0 1 36 -1 0
20d0: 30 20 31 20 37 32 20 2d 31 20 30 20 30 20 31 20 0 1 72 -1 0 0 1
20e0: 31 30 38 20 2d 31 20 30 20 30 20 31 20 31 34 34 108 -1 0 0 1 144
20f0: 20 41 42 43 20 38 39 30 7d 20 2d 63 6c 65 61 6e ABC 890} -clean
2100: 75 70 20 7b 0a 2b 20 20 20 20 63 61 74 63 68 20 up {.+ catch
2110: 7b 63 68 61 6e 20 63 6c 6f 73 65 20 24 63 6c 69 {chan close $cli
2120: 65 6e 74 7d 0a 2b 20 20 20 20 63 61 74 63 68 20 ent}.+ catch
2130: 7b 63 68 61 6e 20 63 6c 6f 73 65 20 24 73 65 72 {chan close $ser
2140: 76 65 72 7d 0a 2b 20 20 20 20 72 65 6e 61 6d 65 ver}.+ rename
2150: 20 63 68 61 6e 2d 31 36 2e 39 2d 61 63 63 65 70 chan-16.9-accep
2160: 74 20 7b 7d 0a 2b 20 20 20 20 72 65 6e 61 6d 65 t {}.+ rename
2170: 20 63 68 61 6e 2d 31 36 2e 39 2d 72 65 61 64 61 chan-16.9-reada
2180: 62 6c 65 20 7b 7d 0a 2b 20 20 20 20 72 65 6e 61 ble {}.+ rena
2190: 6d 65 20 63 68 61 6e 2d 31 36 2e 39 2d 63 6c 69 me chan-16.9-cli
21a0: 65 6e 74 20 7b 7d 0a 2b 20 20 20 20 75 6e 73 65 ent {}.+ unse
21b0: 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 3a 3a t -nocomplain ::
21c0: 63 68 61 6e 2d 31 36 2e 39 2d 64 61 74 61 0a 2b chan-16.9-data.+
21d0: 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d unset -nocom
21e0: 70 6c 61 69 6e 20 3a 3a 63 68 61 6e 2d 31 36 2e plain ::chan-16.
21f0: 39 2d 64 6f 6e 65 0a 2b 20 20 20 20 75 6e 73 65 9-done.+ unse
2200: 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 3a 3a t -nocomplain ::
2210: 73 65 72 76 65 72 0a 2b 20 20 20 20 75 6e 73 65 server.+ unse
2220: 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 3a 3a t -nocomplain ::
2230: 63 6c 69 65 6e 74 0a 2b 7d 0a 2b 74 65 73 74 20 client.+}.+test
2240: 63 68 61 6e 2d 31 36 2e 31 30 20 7b 63 68 61 6e chan-16.10 {chan
2250: 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 6e 64 69 6e command: pendin
2260: 67 20 6f 75 74 70 75 74 20 73 75 62 63 6f 6d 6d g output subcomm
2270: 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 and} -body {.+
2280: 20 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 20 6f chan pending o
2290: 75 74 70 75 74 20 73 74 64 69 6e 0a 2b 7d 20 2d utput stdin.+} -
22a0: 72 65 73 75 6c 74 20 2d 31 0a 2b 74 65 73 74 20 result -1.+test
22b0: 63 68 61 6e 2d 31 36 2e 31 31 20 7b 63 68 61 6e chan-16.11 {chan
22c0: 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 6e 64 69 6e command: pendin
22d0: 67 20 6f 75 74 70 75 74 20 73 75 62 63 6f 6d 6d g output subcomm
22e0: 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 and} -body {.+
22f0: 20 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 20 6f chan pending o
2300: 75 74 70 75 74 20 73 74 64 6f 75 74 0a 2b 7d 20 utput stdout.+}
2310: 2d 72 65 73 75 6c 74 20 30 0a 2b 74 65 73 74 20 -result 0.+test
2320: 63 68 61 6e 2d 31 36 2e 31 32 20 7b 63 68 61 6e chan-16.12 {chan
2330: 20 63 6f 6d 6d 61 6e 64 3a 20 70 65 6e 64 69 6e command: pendin
2340: 67 20 6f 75 74 70 75 74 20 73 75 62 63 6f 6d 6d g output subcomm
2350: 61 6e 64 7d 20 2d 62 6f 64 79 20 7b 0a 2b 20 20 and} -body {.+
2360: 20 20 63 68 61 6e 20 70 65 6e 64 69 6e 67 20 6f chan pending o
2370: 75 74 70 75 74 20 46 4f 4f 42 41 52 0a 2b 7d 20 utput FOOBAR.+}
2380: 2d 72 65 74 75 72 6e 43 6f 64 65 73 20 65 72 72 -returnCodes err
2390: 6f 72 20 2d 72 65 73 75 6c 74 20 22 63 61 6e 20 or -result "can
23a0: 6e 6f 74 20 66 69 6e 64 20 63 68 61 6e 6e 65 6c not find channel
23b0: 20 6e 61 6d 65 64 20 5c 22 46 4f 4f 42 41 52 5c named \"FOOBAR\
23c0: 22 22 0a 2b 74 65 73 74 20 63 68 61 6e 2d 31 36 "".+test chan-16
23d0: 2e 31 33 20 7b 63 68 61 6e 20 63 6f 6d 6d 61 6e .13 {chan comman
23e0: 64 3a 20 70 65 6e 64 69 6e 67 20 6f 75 74 70 75 d: pending outpu
23f0: 74 20 73 75 62 63 6f 6d 6d 61 6e 64 7d 20 2d 73 t subcommand} -s
2400: 65 74 75 70 20 7b 0a 2b 20 20 20 20 73 65 74 20 etup {.+ set
2410: 66 69 6c 65 20 5b 6d 61 6b 65 46 69 6c 65 20 7b file [makeFile {
2420: 7d 20 74 65 73 74 50 65 6e 64 69 6e 67 4f 75 74 } testPendingOut
2430: 70 75 74 5d 0a 2b 20 20 20 20 73 65 74 20 66 20 put].+ set f
2440: 5b 6f 70 65 6e 20 24 66 69 6c 65 20 77 2b 5d 0a [open $file w+].
2450: 2b 20 20 20 20 63 68 61 6e 20 63 6f 6e 66 69 67 + chan config
2460: 75 72 65 20 24 66 20 2d 74 72 61 6e 73 6c 61 74 ure $f -translat
2470: 69 6f 6e 20 6c 66 20 2d 62 75 66 66 65 72 69 6e ion lf -bufferin
2480: 67 20 66 75 6c 6c 20 2d 62 75 66 66 65 72 73 69 g full -buffersi
2490: 7a 65 20 31 30 32 34 0a 2b 7d 20 2d 62 6f 64 79 ze 1024.+} -body
24a0: 20 7b 0a 2b 20 20 20 20 73 65 74 20 72 65 73 75 {.+ set resu
24b0: 6c 74 20 5b 6c 69 73 74 5d 0a 2b 20 20 20 20 63 lt [list].+ c
24c0: 68 61 6e 20 70 75 74 73 20 24 66 20 5b 73 74 72 han puts $f [str
24d0: 69 6e 67 20 72 65 70 65 61 74 20 78 20 35 31 32 ing repeat x 512
24e0: 5d 0a 2b 20 20 20 20 6c 61 70 70 65 6e 64 20 72 ].+ lappend r
24f0: 65 73 75 6c 74 20 5b 63 68 61 6e 20 70 65 6e 64 esult [chan pend
2500: 69 6e 67 20 6f 75 74 70 75 74 20 24 66 5d 0a 2b ing output $f].+
2510: 20 20 20 20 63 68 61 6e 20 66 6c 75 73 68 20 24 chan flush $
2520: 66 0a 2b 20 20 20 20 6c 61 70 70 65 6e 64 20 72 f.+ lappend r
2530: 65 73 75 6c 74 20 5b 63 68 61 6e 20 70 65 6e 64 esult [chan pend
2540: 69 6e 67 20 6f 75 74 70 75 74 20 24 66 5d 0a 2b ing output $f].+
2550: 7d 20 2d 72 65 73 75 6c 74 20 5b 6c 69 73 74 20 } -result [list
2560: 35 31 33 20 30 5d 20 2d 63 6c 65 61 6e 75 70 20 513 0] -cleanup
2570: 7b 0a 2b 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f {.+ unset -no
2580: 63 6f 6d 70 6c 61 69 6e 20 72 65 73 75 6c 74 0a complain result.
2590: 2b 20 20 20 20 63 61 74 63 68 20 7b 63 68 61 6e + catch {chan
25a0: 20 63 6c 6f 73 65 20 24 66 7d 0a 2b 20 20 20 20 close $f}.+
25b0: 63 61 74 63 68 20 7b 72 65 6d 6f 76 65 46 69 6c catch {removeFil
25c0: 65 20 24 66 69 6c 65 7d 0a 2b 7d 0a 2b 0a 20 63 e $file}.+}.+. c
25d0: 6c 65 61 6e 75 70 54 65 73 74 73 0a 20 72 65 74 leanupTests. ret
25e0: 75 72 6e 0a 20 0a 2d 2d 2d 20 74 65 73 74 73 2f urn. .--- tests/
25f0: 69 6f 43 6d 64 2e 74 65 73 74 2e 6f 72 69 67 09 ioCmd.test.orig.
2600: 32 30 30 36 2d 31 30 2d 32 38 20 32 33 3a 30 36 2006-10-28 23:06
2610: 3a 34 34 2e 30 30 30 30 30 30 30 30 30 20 2d 30 :44.000000000 -0
2620: 36 30 30 0a 2b 2b 2b 20 74 65 73 74 73 2f 69 6f 600.+++ tests/io
2630: 43 6d 64 2e 74 65 73 74 09 32 30 30 36 2d 31 31 Cmd.test.2006-11
2640: 2d 32 31 20 31 39 3a 32 39 3a 34 32 2e 30 30 30 -21 19:29:42.000
2650: 30 30 30 30 30 30 20 2d 30 37 30 30 0a 40 40 20 000000 -0700.@@
2660: 2d 36 32 38 2c 37 20 2b 36 32 38 2c 37 20 40 40 -628,7 +628,7 @@
2670: 0a 20 74 65 73 74 20 69 6f 63 6d 64 2d 32 30 2e . test iocmd-20.
2680: 31 20 7b 63 68 61 6e 2c 20 75 6e 6b 6e 6f 77 6e 1 {chan, unknown
2690: 20 6d 65 74 68 6f 64 7d 20 7b 0a 20 20 20 20 20 method} {.
26a0: 63 61 74 63 68 20 7b 63 68 61 6e 20 66 6f 6f 7d catch {chan foo}
26b0: 20 6d 73 67 0a 20 20 20 20 20 73 65 74 20 6d 73 msg. set ms
26c0: 67 0a 2d 7d 20 7b 75 6e 6b 6e 6f 77 6e 20 6f 72 g.-} {unknown or
26d0: 20 61 6d 62 69 67 75 6f 75 73 20 73 75 62 63 6f ambiguous subco
26e0: 6d 6d 61 6e 64 20 22 66 6f 6f 22 3a 20 6d 75 73 mmand "foo": mus
26f0: 74 20 62 65 20 62 6c 6f 63 6b 65 64 2c 20 63 6c t be blocked, cl
2700: 6f 73 65 2c 20 63 6f 6e 66 69 67 75 72 65 2c 20 ose, configure,
2710: 63 6f 70 79 2c 20 63 72 65 61 74 65 2c 20 65 6f copy, create, eo
2720: 66 2c 20 65 76 65 6e 74 2c 20 66 6c 75 73 68 2c f, event, flush,
2730: 20 67 65 74 73 2c 20 6e 61 6d 65 73 2c 20 70 6f gets, names, po
2740: 73 74 65 76 65 6e 74 2c 20 70 75 74 73 2c 20 72 stevent, puts, r
2750: 65 61 64 2c 20 73 65 65 6b 2c 20 74 65 6c 6c 2c ead, seek, tell,
2760: 20 6f 72 20 74 72 75 6e 63 61 74 65 7d 0a 2b 7d or truncate}.+}
2770: 20 7b 75 6e 6b 6e 6f 77 6e 20 6f 72 20 61 6d 62 {unknown or amb
2780: 69 67 75 6f 75 73 20 73 75 62 63 6f 6d 6d 61 6e iguous subcomman
2790: 64 20 22 66 6f 6f 22 3a 20 6d 75 73 74 20 62 65 d "foo": must be
27a0: 20 62 6c 6f 63 6b 65 64 2c 20 63 6c 6f 73 65 2c blocked, close,
27b0: 20 63 6f 6e 66 69 67 75 72 65 2c 20 63 6f 70 79 configure, copy
27c0: 2c 20 63 72 65 61 74 65 2c 20 65 6f 66 2c 20 65 , create, eof, e
27d0: 76 65 6e 74 2c 20 66 6c 75 73 68 2c 20 67 65 74 vent, flush, get
27e0: 73 2c 20 6e 61 6d 65 73 2c 20 70 65 6e 64 69 6e s, names, pendin
27f0: 67 2c 20 70 6f 73 74 65 76 65 6e 74 2c 20 70 75 g, postevent, pu
2800: 74 73 2c 20 72 65 61 64 2c 20 73 65 65 6b 2c 20 ts, read, seek,
2810: 74 65 6c 6c 2c 20 6f 72 20 74 72 75 6e 63 61 74 tell, or truncat
2820: 65 7d 0a 20 0a 20 23 20 2d 2d 2d 20 2d 2d 2d 20 e}. . # --- ---
2830: 2d 2d 2d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 2d 2d --- --------- --
2840: 2d 2d 2d 2d 2d 2d 2d 20 2d 2d 2d 2d 2d 2d 2d 2d ------- --------
2850: 2d 0a 20 23 20 63 68 61 6e 20 63 72 65 61 74 65 -. # chan create
2860: 2c 20 61 6e 64 20 6d 65 74 68 6f 64 20 22 69 6e , and method "in
2870: 69 74 61 6c 69 7a 65 22 0a italize".