Tcl Source Code

Hex Artifact Content
Login

Artifact dd24b26cc3fd756eeeae201484c329211a83bec4:

Attachment "zbug.tcl" to ticket [2762041fff] added by ferrieux 2010-02-23 05:02:30.
0000: 73 65 74 20 73 20 5b 73 74 72 69 6e 67 20 72 65  set s [string re
0010: 70 65 61 74 20 41 20 35 30 30 30 5d 0a 73 65 74  peat A 5000].set
0020: 20 63 73 20 5b 7a 6c 69 62 20 67 7a 69 70 20 24   cs [zlib gzip $
0030: 73 5d 0a 70 75 74 73 20 73 74 64 65 72 72 20 22  s].puts stderr "
0040: 43 6f 6d 70 72 65 73 73 65 64 20 73 69 7a 65 20  Compressed size 
0050: 69 73 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74  is [string lengt
0060: 68 20 24 63 73 5d 22 0a 0a 66 6f 72 65 61 63 68  h $cs]"..foreach
0070: 20 7b 70 72 20 70 77 7d 20 5b 63 68 61 6e 20 70   {pr pw} [chan p
0080: 69 70 65 5d 20 62 72 65 61 6b 0a 66 63 6f 6e 66  ipe] break.fconf
0090: 69 67 75 72 65 20 24 70 77 20 2d 62 75 66 66 65  igure $pw -buffe
00a0: 72 69 6e 67 20 66 75 6c 6c 20 2d 74 72 61 6e 73  ring full -trans
00b0: 6c 61 74 69 6f 6e 20 62 69 6e 61 72 79 0a 66 63  lation binary.fc
00c0: 6f 6e 66 69 67 75 72 65 20 24 70 72 20 2d 74 72  onfigure $pr -tr
00d0: 61 6e 73 6c 61 74 69 6f 6e 20 62 69 6e 61 72 79  anslation binary
00e0: 0a 0a 70 75 74 73 20 24 70 77 20 68 61 68 61 68  ..puts $pw hahah
00f0: 61 0a 70 75 74 73 20 2d 6e 6f 6e 65 77 6c 69 6e  a.puts -nonewlin
0100: 65 20 24 70 77 20 24 63 73 0a 66 6c 75 73 68 20  e $pw $cs.flush 
0110: 24 70 77 0a 63 6c 6f 73 65 20 24 70 77 0a 0a 70  $pw.close $pw..p
0120: 75 74 73 20 73 74 64 65 72 72 20 48 45 41 44 45  uts stderr HEADE
0130: 52 3a 5b 67 65 74 73 20 24 70 72 5d 0a 7a 6c 69  R:[gets $pr].zli
0140: 62 20 70 75 73 68 20 67 75 6e 7a 69 70 20 24 70  b push gunzip $p
0150: 72 0a 70 75 74 73 20 73 74 64 65 72 72 20 22 4e  r.puts stderr "N
0160: 6f 77 20 72 65 61 64 69 6e 67 20 74 68 72 6f 75  ow reading throu
0170: 67 68 20 67 75 6e 7a 69 70 22 0a 73 65 74 20 64  gh gunzip".set d
0180: 61 74 61 20 5b 72 65 61 64 20 24 70 72 5d 0a 70  ata [read $pr].p
0190: 75 74 73 20 73 74 64 65 72 72 20 22 52 65 63 65  uts stderr "Rece
01a0: 69 76 65 64 20 5b 73 74 72 69 6e 67 20 6c 65 6e  ived [string len
01b0: 67 74 68 20 24 64 61 74 61 5d 20 6f 75 74 20 6f  gth $data] out o
01c0: 66 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68  f [string length
01d0: 20 24 73 5d 22 0a 0a 0a                           $s]"...