Yun Fu pointed out a flaw in the loop that checks handles, and I indented

the code more curl-style
This commit is contained in:
Daniel Stenberg
2010-01-21 09:53:30 +00:00
parent 6291a1cf23
commit a74e885bef

View File

@@ -105,20 +105,23 @@ int main(int argc, char **argv)
/* See how the transfers went */ /* See how the transfers went */
while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
if (msg->msg == CURLMSG_DONE) { if (msg->msg == CURLMSG_DONE) {
int idx, found = 0;
int idx, found = 0; /* Find out which handle this message is about */
for (idx=0; idx<HANDLECOUNT; idx++) {
found = (msg->easy_handle == handles[idx]);
if(found)
break;
}
/* Find out which handle this message is about */ switch (idx) {
for (idx=0; (!found && (idx<HANDLECOUNT)); idx++) found = (msg->easy_handle == handles[idx]); case HTTP_HANDLE:
printf("HTTP transfer completed with status %d\n", msg->data.result);
switch (idx) { break;
case HTTP_HANDLE: case FTP_HANDLE:
printf("HTTP transfer completed with status %d\n", msg->data.result); printf("FTP transfer completed with status %d\n", msg->data.result);
break; break;
case FTP_HANDLE: }
printf("FTP transfer completed with status %d\n", msg->data.result);
break;
}
} }
} }