aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2010-04-29 00:49:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-04-29 08:55:11 +0200
commit38d2afcefb3519f7e6a3b7c3afda4f5bfb67bde9 (patch)
treee70c69372560b881ebf809773dbff97a4012dcee /src/main.c
parent7f616eb513a692f3edf36bdbf34372186f5203f0 (diff)
telnet: Allow programatic use of telnet.
The main change is to allow input from user-specified methods, when they are specified with CURLOPT_READFUNCTION. All calls to fflush(stdout) in telnet.c were removed, which makes using 'curl telnet://foo.com' painful since prompts and other data are not always returned to the user promptly. Use 'curl --no-buffer telnet://foo.com' instead. In general, the user should have their CURLOPT_WRITEFUNCTION do a fflush for interactive use. Also fix assumption that reading from stdin never returns < 0. Old code could crash in that case. Call progress functions in telnet main loop. Signed-off-by: Ben Greear <greearb@candelatech.com>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 684869379..eff0f9a3b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4987,7 +4987,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
input.config = config;
my_setopt(curl, CURLOPT_READDATA, &input);
/* what call to read */
- my_setopt(curl, CURLOPT_READFUNCTION, my_fread);
+ if ((outfile && !curlx_strequal("-", outfile)) ||
+ !curlx_strnequal(url, "telnet:", 7))
+ my_setopt(curl, CURLOPT_READFUNCTION, my_fread);
/* in 7.18.0, the CURLOPT_SEEKFUNCTION/DATA pair is taking over what
CURLOPT_IOCTLFUNCTION/DATA pair previously provided for seeking */