From 5cf3304d44ecb8ee28045d44377e2e9747e80f26 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Thu, 31 Jan 2019 13:29:41 +0100 Subject: [ct] Add option {newline,string()} to ct_telnet:cmd and ct_telnet:send By default, each command is appended with "\n", but in some cases a command must end with "\r\n" to evaluate correctly. This can now be specified with option {newline,"\r\n"}. --- lib/common_test/doc/src/ct_telnet.xml | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'lib/common_test/doc') diff --git a/lib/common_test/doc/src/ct_telnet.xml b/lib/common_test/doc/src/ct_telnet.xml index 9a12ce79ed..76f5305c46 100644 --- a/lib/common_test/doc/src/ct_telnet.xml +++ b/lib/common_test/doc/src/ct_telnet.xml @@ -239,18 +239,21 @@ Connection = connection() Cmd = string() Opts = [Opt] - Opt = {timeout, timeout()} | {newline, boolean()} + Opt = {timeout, timeout()} | {newline, boolean() | string()} Data = [string()] Reason = term()

Sends a command through Telnet and waits for prompt.

-

By default, this function adds a new line to the end of the +

By default, this function adds "\n" to the end of the specified command. If this is not desired, use option {newline,false}. This is necessary, for example, when sending Telnet command sequences prefixed with character - Interprete As Command (IAC).

+ Interpret As Command (IAC). Option {newline,string()} + can also be used if a different line end than "\n" is + required, for instance {newline,"\r\n"}, to add both + carriage return and newline characters.

Option timeout specifies how long the client must wait for prompt. If the time expires, the function returns @@ -280,7 +283,7 @@ CmdFormat = string() Args = list() Opts = [Opt] - Opt = {timeout, timeout()} | {newline, boolean()} + Opt = {timeout, timeout()} | {newline, boolean() | string()} Data = [string()] Reason = term() @@ -339,7 +342,7 @@ subexpression number N. Subexpressions are denoted with '(' ')' in the regular expression.

-

If a Tag is speciifed, the returned Match also +

If a Tag is specified, the returned Match also includes the matched Tag. Otherwise, only RxMatch is returned.

@@ -382,7 +385,7 @@ can abort the operation of waiting for prompt.

repeat | repeat, N

The pattern(s) must be matched multiple times. If N - is speciified, the pattern(s) are matched N times, and + is specified, the pattern(s) are matched N times, and the function returns HaltReason = done. This option can be interrupted by one or more HaltPatterns. MatchList is always returned, that is, a list of Match instead of @@ -547,17 +550,20 @@ Connection = connection() Cmd = string() Opts = [Opt] - Opt = {newline, boolean()} + Opt = {newline, boolean() | string()} Reason = term()

Sends a Telnet command and returns immediately.

-

By default, this function adds a newline to the end of the +

By default, this function adds "\n" to the end of the specified command. If this is not desired, option {newline,false} can be used. This is necessary, for example, when sending Telnet command sequences prefixed with character - Interprete As Command (IAC).

+ Interpret As Command (IAC). Option {newline,string()} + can also be used if a different line end than "\n" is + required, for instance {newline,"\r\n"}, to add both + carriage return and newline characters.

The resulting output from the command can be read with ct_telnet:get_data/2 or @@ -584,12 +590,15 @@ CmdFormat = string() Args = list() Opts = [Opt] - Opt = {newline, boolean()} + Opt = {newline, boolean() | string()} Reason = term()

Sends a Telnet command and returns immediately (uses a format string and a list of arguments to build the command).

+ +

For details, see + ct_telnet:send/3.

-- cgit v1.2.3