Exercises

  1. Add scroll bars to the terminal emulator on page 442. Make it allow for resizeable text widgets.

  2. The terminal emulator is based on an ANSI terminal. Change the emulator so that it emulates a particular terminal that is not ANSI-conforming. This could be useful if you have to interact with a program or service that is hardwired for a terminal type. Make the emulator understand any type of terminal.

  3. Write a version of the UNIX script command that automatically strips out any character graphics as the output is logged to a file.

  4. Modify the term_expect procedure on page 453 so that it does not require Tk. Use a list of character strings to emulate a Tk text widget. Then try it with an array. Which is faster? Is this what you had expected?

  5. Expand on the previous exercise, by emulating multiple terminals. Provide “hotkeys” so that you can switch between different terminal sessions in a single keystroke.

  6. Write a script for browsing through the archives of the comp.lang.tcl newsgroup. Display the subjects in a scrollable window, allowing them to be ordered by date, subject, or author. Upon selection, download the posting and display it.

  7. Modify the script from the previous exercise so that postings may be saved locally or cached so that the script does not have to ftp them again if they are selected.

  8. Modify the tkpasswd script so that it rejects passwords containing fewer than two digits and two alphabetic characters, one uppercase and one lowercase. Use exercise 4 on page 160.

  9. The tkpasswd ...

Get Exploring Expect now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.