aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-02-05 13:25:14 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-02-05 13:25:14 +0000
commitdc753b8315467d8373758d513cb3688eda88eb37 (patch)
tree9f3828a7375c82874fcc9f52597c461bdb8bdd12
parenta5c4442ebf63c3583ae7c2000376158e7efaf5e9 (diff)
Gisle Vanem fixed a windows compiler warning
-rw-r--r--lib/telnet.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/lib/telnet.c b/lib/telnet.c
index bdc354272..55d0a70e2 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1043,13 +1043,14 @@ CURLcode Curl_telnet(struct connectdata *conn)
HANDLE stdin_handle;
HANDLE objs[2];
DWORD waitret;
+ DWORD nread;
#else
fd_set readfd;
fd_set keepfd;
+ ssize_t nread;
#endif
bool keepon = TRUE;
char *buf = data->state.buffer;
- ssize_t nread;
struct TELNET *tn;
code = init_telnet(conn);
@@ -1086,60 +1087,57 @@ CURLcode Curl_telnet(struct connectdata *conn)
/* Keep on listening and act on events */
while(keepon) {
waitret = WaitForMultipleObjects(2, objs, FALSE, INFINITE);
- switch(waitret - WAIT_OBJECT_0)
+ switch(waitret - WAIT_OBJECT_0) {
+ case 0:
{
- case 0:
- {
- unsigned char outbuf[2];
- int out_count = 0;
- ssize_t bytes_written;
- char *buffer = buf;
+ unsigned char outbuf[2];
+ int out_count = 0;
+ ssize_t bytes_written;
+ char *buffer = buf;
- if(!ReadFile(stdin_handle, buf, 255, (LPDWORD)&nread, NULL)) {
- keepon = FALSE;
- break;
- }
+ if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
+ (LPDWORD)&nread, NULL)) {
+ keepon = FALSE;
+ break;
+ }
- while(nread--) {
- outbuf[0] = *buffer++;
- out_count = 1;
- if(outbuf[0] == CURL_IAC)
- outbuf[out_count++] = CURL_IAC;
+ while(nread--) {
+ outbuf[0] = *buffer++;
+ out_count = 1;
+ if(outbuf[0] == CURL_IAC)
+ outbuf[out_count++] = CURL_IAC;
- Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf,
- out_count, &bytes_written);
- }
+ Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf,
+ out_count, &bytes_written);
}
- break;
+ }
+ break;
- case 1:
- if(WSAEnumNetworkEvents(sockfd, event_handle, &events)
- != SOCKET_ERROR)
- {
- if(events.lNetworkEvents & FD_READ)
- {
- /* This reallu OUGHT to check its return code. */
- Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);
+ case 1:
+ if(WSAEnumNetworkEvents(sockfd, event_handle, &events)
+ != SOCKET_ERROR) {
+ if(events.lNetworkEvents & FD_READ) {
+ /* This reallu OUGHT to check its return code. */
+ Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);
- telrcv(conn, (unsigned char *)buf, nread);
-
- fflush(stdout);
+ telrcv(conn, (unsigned char *)buf, nread);
+
+ fflush(stdout);
- /* Negotiate if the peer has started negotiating,
- otherwise don't. We don't want to speak telnet with
- non-telnet servers, like POP or SMTP. */
- if(tn->please_negotiate && !tn->already_negotiated) {
- negotiate(conn);
- tn->already_negotiated = 1;
- }
+ /* Negotiate if the peer has started negotiating,
+ otherwise don't. We don't want to speak telnet with
+ non-telnet servers, like POP or SMTP. */
+ if(tn->please_negotiate && !tn->already_negotiated) {
+ negotiate(conn);
+ tn->already_negotiated = 1;
}
+ }
- if(events.lNetworkEvents & FD_CLOSE)
- {
- keepon = FALSE;
- }
+ if(events.lNetworkEvents & FD_CLOSE) {
+ keepon = FALSE;
}
- break;
+ }
+ break;
}
}
#else