Posted to tcl by aspect at Thu Nov 10 01:41:17 GMT 2011view raw

  1. #!/usr/bin/tclsh
  2. #
  3. # test.bin is made from:
  4. # ( ls /usr/share/doc/tcl8.6 ; echo END ; tar -C /usr/share/doc/tcl8.6 -cz . ) > test.bin
  5. #
  6. # why the need to [seek $f [tell $f]]? What should I be doing instead?
  7. # (eliminate that line and see tar error)
  8. #
  9. set f [open test.bin]
  10. while {[set l [gets $f]] != "END"} {}
  11.  
  12. chan configure $f -encoding binary -translation binary
  13.  
  14. # needing to do this is a bit odd
  15. seek $f [tell $f]
  16.  
  17. exec tar -tzv <@ $f
  18.  
  19. close $f
  20.