mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-20 10:46:59 +02:00
384 lines
11 KiB
Diff
384 lines
11 KiB
Diff
Author: n/a
|
|
Description: Fixes sample expect shebang and excapes dashes.
|
|
|
|
--- a/expect.man
|
|
+++ b/expect.man
|
|
@@ -108,11 +108,11 @@
|
|
may also be invoked implicitly on systems which support the #! notation
|
|
by marking the script executable, and making the first line in your script:
|
|
|
|
- #!/usr/local/bin/expect \-f
|
|
+ #!/usr/bin/expect \-f
|
|
|
|
Of course, the path must accurately describe where
|
|
.B Expect
|
|
-lives. /usr/local/bin is just an example.
|
|
+lives. /usr/bin is just an example.
|
|
|
|
The
|
|
.B \-c
|
|
@@ -209,7 +209,7 @@
|
|
original arguments (including the script name) in the variable
|
|
.IR argv .
|
|
|
|
- #!/usr/local/bin/expect \-\-
|
|
+ #!/usr/bin/expect \-\-
|
|
|
|
Note that the usual getopt(3) and execve(2) conventions must be observed
|
|
when adding arguments to the #! line.
|
|
@@ -293,7 +293,7 @@
|
|
program.)
|
|
.I
|
|
.TP 6
|
|
-.BI close " [-slave] [\-onexec 0|1] [\-i spawn_id]"
|
|
+.BI close " [\-slave] [\-onexec 0|1] [\-i spawn_id]"
|
|
closes the connection to the current process.
|
|
Most interactive programs will detect EOF on their stdin and exit;
|
|
thus
|
|
@@ -322,7 +322,7 @@
|
|
|
|
The
|
|
.B \-slave
|
|
-flag closes the slave associated with the spawn id. (See "spawn -pty".)
|
|
+flag closes the slave associated with the spawn id. (See "spawn \-pty".)
|
|
When the connection is closed, the slave is automatically closed as
|
|
well if still open.
|
|
|
|
@@ -339,7 +339,7 @@
|
|
.B wait
|
|
below for more info.
|
|
.TP
|
|
-.BI debug " [[-now] 0|1]"
|
|
+.BI debug " [[\-now] 0|1]"
|
|
controls a Tcl debugger allowing you to step through statements, set
|
|
breakpoints, etc.
|
|
|
|
@@ -357,7 +357,7 @@
|
|
The
|
|
.B debug
|
|
command does not change any traps. Compare this to starting Expect with the
|
|
-.B -D
|
|
+.B \-D
|
|
flag (see above).
|
|
|
|
See the README file or SEE ALSO (below)
|
|
@@ -387,7 +387,7 @@
|
|
.nf
|
|
|
|
send_user "password?\\ "
|
|
- expect_user -re "(.*)\\n"
|
|
+ expect_user \-re "(.*)\\n"
|
|
for {} 1 {} {
|
|
if {[fork]!=0} {sleep 3600;continue}
|
|
disconnect
|
|
@@ -454,7 +454,7 @@
|
|
.B exit
|
|
is implicitly executed if the end of the script is reached.
|
|
.TP
|
|
-\fBexp_continue\fR [-continue_timer]
|
|
+\fBexp_continue\fR [\-continue_timer]
|
|
The command
|
|
.B exp_continue
|
|
allows
|
|
@@ -464,7 +464,7 @@
|
|
default
|
|
.B exp_continue
|
|
resets the timeout timer. The
|
|
-.I -continue_timer
|
|
+.I \-continue_timer
|
|
flag prevents timer from being restarted. (See
|
|
.B expect
|
|
for more information.)
|
|
@@ -627,8 +627,8 @@
|
|
be used to protect patterns that might otherwise match
|
|
.B expect
|
|
flags from doing so.
|
|
-Any pattern beginning with a "-" should be protected this way. (All strings
|
|
-starting with "-" are reserved for future options.)
|
|
+Any pattern beginning with a "\-" should be protected this way. (All strings
|
|
+starting with "\-" are reserved for future options.)
|
|
|
|
.IP
|
|
For example, the following fragment looks for a successful login.
|
|
@@ -735,7 +735,7 @@
|
|
through
|
|
.IR expect_out(9,string) .
|
|
If the
|
|
-.B -indices
|
|
+.B \-indices
|
|
flag is used before a pattern,
|
|
the starting and ending indices (in a form suitable for
|
|
.BR lrange )
|
|
@@ -782,7 +782,7 @@
|
|
set expect_out(buffer) abbbcabkkkk
|
|
|
|
.fi
|
|
-and "a\\n" is left in the output buffer. The pattern "*" (and -re ".*") will
|
|
+and "a\\n" is left in the output buffer. The pattern "*" (and \-re ".*") will
|
|
flush the output buffer without reading any more output from the
|
|
process.
|
|
.IP
|
|
@@ -790,7 +790,7 @@
|
|
This may be prevented by prefixing a pattern with the
|
|
.B \-notransfer
|
|
flag. This flag is especially useful in experimenting (and can be
|
|
-abbreviated to "-not" for convenience while experimenting).
|
|
+abbreviated to "\-not" for convenience while experimenting).
|
|
|
|
The spawn id associated with the matching output (or eof or
|
|
full_buffer) is stored in
|
|
@@ -874,9 +874,9 @@
|
|
|
|
expect {
|
|
Password: {
|
|
- stty -echo
|
|
+ stty \-echo
|
|
send_user "password (for $user) on $host: "
|
|
- expect_user -re "(.*)\\n"
|
|
+ expect_user \-re "(.*)\\n"
|
|
send_user "\\n"
|
|
send "$expect_out(1,string)\\r"
|
|
stty echo
|
|
@@ -891,7 +891,7 @@
|
|
send_user \\
|
|
"connection to host failed: $expect_out(buffer)"
|
|
exit
|
|
- } -re $prompt
|
|
+ } \-re $prompt
|
|
}
|
|
|
|
.fi
|
|
@@ -1023,14 +1023,14 @@
|
|
By default, it reports on the current spawn id. An optional spawn id specification may be given for information on that spawn id. For example
|
|
.nf
|
|
|
|
- expect_before -info -i $proc
|
|
+ expect_before \-info \-i $proc
|
|
|
|
.fi
|
|
At most one spawn id specification may be given. The flag \-indirect
|
|
suppresses direct spawn ids that come only from indirect specifications.
|
|
|
|
-Instead of a spawn id specification, the flag "-all" will cause
|
|
-"-info" to report on all spawn ids.
|
|
+Instead of a spawn id specification, the flag "\-all" will cause
|
|
+"\-info" to report on all spawn ids.
|
|
|
|
The output of the \-info flag can be reused as the argument to expect_before.
|
|
.TP
|
|
@@ -1123,7 +1123,7 @@
|
|
.ta \w' interact 'u +\w'$CTRLZ 'u +\w'{'u
|
|
set CTRLZ \\032
|
|
interact {
|
|
- -reset $CTRLZ {exec kill \-STOP [pid]}
|
|
+ \-reset $CTRLZ {exec kill \-STOP [pid]}
|
|
\\001 {send_user "you typed a control\-A\\n";
|
|
send "\\001"
|
|
}
|
|
@@ -1152,8 +1152,8 @@
|
|
flag may be used to protect patterns that might otherwise match
|
|
.B interact
|
|
flags from doing so.
|
|
-Any pattern beginning with a "-" should be protected this way. (All strings
|
|
-starting with "-" are reserved for future options.)
|
|
+Any pattern beginning with a "\-" should be protected this way. (All strings
|
|
+starting with "\-" are reserved for future options.)
|
|
|
|
The
|
|
.B \-re
|
|
@@ -1199,7 +1199,7 @@
|
|
messages:
|
|
.nf
|
|
|
|
- interact -input $user_spawn_id timeout 3600 return -output \\
|
|
+ interact \-input $user_spawn_id timeout 3600 return \-output \\
|
|
$spawn_id
|
|
|
|
.fi
|
|
@@ -1298,9 +1298,9 @@
|
|
.nf
|
|
|
|
interact {
|
|
- -echo ~g {getcurdirectory 1}
|
|
- -echo ~l {getcurdirectory 0}
|
|
- -echo ~p {putcurdirectory}
|
|
+ \-echo ~g {getcurdirectory 1}
|
|
+ \-echo ~l {getcurdirectory 0}
|
|
+ \-echo ~p {putcurdirectory}
|
|
}
|
|
|
|
.fi
|
|
@@ -1316,11 +1316,11 @@
|
|
.nf
|
|
|
|
proc lognumber {} {
|
|
- interact -nobuffer -re "(.*)\\r" return
|
|
+ interact \-nobuffer \-re "(.*)\\r" return
|
|
puts $log "[clock format [clock seconds]]: dialed $interact_out(1,string)"
|
|
}
|
|
|
|
- interact -nobuffer "atd" lognumber
|
|
+ interact \-nobuffer "atd" lognumber
|
|
|
|
.fi
|
|
.IP
|
|
@@ -1391,7 +1391,7 @@
|
|
command, except that any_spawn_id is not meaningful in
|
|
.BR interact .)
|
|
All following flags and
|
|
-strings (or patterns) apply to this input until another -input flag appears.
|
|
+strings (or patterns) apply to this input until another \-input flag appears.
|
|
If no
|
|
.B \-input
|
|
appears,
|
|
@@ -1429,7 +1429,7 @@
|
|
It is possible to change the processes that are being interacted with
|
|
by using indirect spawn ids. (Indirect spawn ids are described in the
|
|
section on the expect command.) Indirect spawn ids may be specified
|
|
-with the -i, -u, -input, or -output flags.
|
|
+with the \-i, \-u, \-input, or \-output flags.
|
|
.TP
|
|
.B interpreter " [args]"
|
|
causes the user to be interactively prompted for
|
|
@@ -1515,18 +1515,18 @@
|
|
flag.
|
|
|
|
The
|
|
-.B -info
|
|
+.B \-info
|
|
flag causes log_file to return a description of the
|
|
most recent non-info arguments given.
|
|
.TP
|
|
-.BI log_user " -info|0|1"
|
|
+.BI log_user " \-info|0|1"
|
|
By default, the send/expect dialogue is logged to stdout
|
|
(and a logfile if open).
|
|
The logging to stdout is disabled by the command "log_user 0"
|
|
and reenabled by "log_user 1". Logging to the logfile is unchanged.
|
|
|
|
The
|
|
-.B -info
|
|
+.B \-info
|
|
flag causes log_user to return a description of the
|
|
most recent non-info arguments given.
|
|
.TP
|
|
@@ -1647,7 +1647,7 @@
|
|
Any string can be preceded by "\-\-" whether or not it actually looks
|
|
like a flag. This provides a reliable mechanism to specify variable strings
|
|
without being tripped up by those that accidentally look like flags.
|
|
-(All strings starting with "-" are reserved for future options.)
|
|
+(All strings starting with "\-" are reserved for future options.)
|
|
|
|
The
|
|
.B \-i
|
|
@@ -1671,7 +1671,7 @@
|
|
The
|
|
.B \-break
|
|
flag generates a break condition. This only makes sense if the spawn
|
|
-id refers to a tty device opened via "spawn -open". If you have
|
|
+id refers to a tty device opened via "spawn \-open". If you have
|
|
spawned a process such as tip, you should use tip's convention for
|
|
generating a break.
|
|
|
|
@@ -1774,7 +1774,7 @@
|
|
except that the output is sent to stderr rather than the current
|
|
process.
|
|
.TP
|
|
-.BI send_log " [\--] string"
|
|
+.BI send_log " [\-\-] string"
|
|
is like
|
|
.BR send ,
|
|
except that the string is only sent to the log file (see
|
|
@@ -1951,7 +1951,7 @@
|
|
The variable
|
|
.I spawn_out(slave,fd)
|
|
is set to a file identifier corresponding to the pty slave.
|
|
-It can be closed using "close -slave".
|
|
+It can be closed using "close \-slave".
|
|
|
|
The
|
|
.B \-ignore
|
|
@@ -1978,7 +1978,7 @@
|
|
.fi
|
|
|
|
The
|
|
-.B -info
|
|
+.B \-info
|
|
flag causes strace to return a description of the
|
|
most recent non-info arguments given.
|
|
.TP
|
|
@@ -2018,7 +2018,7 @@
|
|
|
|
stty \-echo
|
|
send_user "Password: "
|
|
- expect_user -re "(.*)\\n"
|
|
+ expect_user \-re "(.*)\\n"
|
|
set password $expect_out(1,string)
|
|
stty echo
|
|
|
|
@@ -2153,7 +2153,7 @@
|
|
trap exit {SIGINT SIGTERM}
|
|
|
|
.fi
|
|
-If you use the -D flag to start the debugger, SIGINT is redefined
|
|
+If you use the \-D flag to start the debugger, SIGINT is redefined
|
|
to start the interactive debugger. This is due to the following trap:
|
|
.nf
|
|
|
|
@@ -2194,9 +2194,9 @@
|
|
normally returns a list of four integers.
|
|
The first integer is the pid of the process that was waited upon.
|
|
The second integer is the corresponding spawn id.
|
|
-The third integer is -1 if an operating system error occurred, or 0 otherwise.
|
|
+The third integer is \-1 if an operating system error occurred, or 0 otherwise.
|
|
If the third integer was 0, the fourth integer is the status returned by
|
|
-the spawned process. If the third integer was -1, the fourth integer is
|
|
+the spawned process. If the third integer was \-1, the fourth integer is
|
|
the value of errno set by the operating system. The global variable
|
|
errorCode is also set.
|
|
|
|
@@ -2212,7 +2212,7 @@
|
|
flag declares the process to wait corresponding to the named spawn_id
|
|
(NOT the process id).
|
|
Inside a SIGCHLD handler,
|
|
-it is possible to wait for any spawned process by using the spawn id -1.
|
|
+it is possible to wait for any spawned process by using the spawn id \-1.
|
|
|
|
The
|
|
.B \-nowait
|
|
@@ -2223,7 +2223,7 @@
|
|
The
|
|
.B wait
|
|
command may also be used wait for a forked process using the arguments
|
|
-"-i -1". Unlike its use with spawned processes, this command can be
|
|
+"\-i \-1". Unlike its use with spawned processes, this command can be
|
|
executed at any time. There is no control over which process is
|
|
reaped. However, the return value can be checked for the process id.
|
|
|
|
@@ -2374,7 +2374,7 @@
|
|
.nf
|
|
|
|
set env(SHELL) /bin/sh
|
|
- set env(HOME) /usr/local/bin
|
|
+ set env(HOME) /usr/bin
|
|
|
|
.fi
|
|
|
|
@@ -2427,7 +2427,7 @@
|
|
to set a flag in the trap code. Then check the flag immediately after
|
|
the command (i.e., sleep).
|
|
|
|
-The expect_background command ignores -timeout arguments and has no
|
|
+The expect_background command ignores \-timeout arguments and has no
|
|
concept of timeouts in general.
|
|
|
|
.SH "EXPECT HINTS"
|
|
@@ -2449,7 +2449,7 @@
|
|
set prompt "(%|#|\\\\$) $" ;# default prompt
|
|
catch {set prompt $env(EXPECT_PROMPT)}
|
|
|
|
- expect -re $prompt
|
|
+ expect \-re $prompt
|
|
|
|
.fi
|
|
I encourage you to write
|