Output And Debugging Miscellany

Some output and debugging controls exist in the library. The variety and flexibility of these are not great because there is not a lot of demand for more development in this area. For instance, interaction debugging is usually done using Tcl, not C.

The controls that exist parallel the commands in the Expect program and extension. They are manipulated using the following variables. All are 0 by default.

int exp_loguser;
int exp_logfile_all;
FILE *exp_logfile;
int exp_is_debugging;
FILE *exp_debugfile;

If exp_loguser is nonzero, the expect functions send any output from the spawned process to the standard output. Since interactive programs typically echo their input, this usually suffices to show both sides of the conversation.

If exp_logfile is also nonzero, this same output is written to the stream defined by exp_logfile.

If exp_logfile_all is nonzero, exp_logfile is written regardless of the value of exp_loguser.

Debugging information internal to Expect is sent to the standard error when exp_is_debugging is nonzero. The debugging information includes every character received and every attempt made to match the current input against the patterns. In addition, nonprintable characters are translated to a printable form. For example, a control-C appears as a caret followed by C. If exp_logfile is nonzero, this information is also written to exp_logfile.

If exp_debugfile is nonzero and set to a stream pointer, all normal and debugging information is written ...

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.