aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-01-12 18:24:44 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-01-12 18:24:48 +0000
commit3a4cd2ad8d309d2dfc6f696f2520ea1f947fc639 (patch)
tree7984dc6c0c828a86156f935e92c04822d9e5729c /docs/examples
parent82c472228e064a6e7e37660615cf3a7269d92231 (diff)
smtp-multi.c: Minor coding style tidyup following POP3 and IMAP additions
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/smtp-multi.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/docs/examples/smtp-multi.c b/docs/examples/smtp-multi.c
index 5a3125b7c..7f3d333df 100644
--- a/docs/examples/smtp-multi.c
+++ b/docs/examples/smtp-multi.c
@@ -78,19 +78,19 @@ static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
static struct timeval tvnow(void)
{
- /*
- ** time() returns the value of time in seconds since the Epoch.
- */
struct timeval now;
+
+ /* time() returns the value of time in seconds since the epoch */
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
+
return now;
}
static long tvdiff(struct timeval newer, struct timeval older)
{
- return (newer.tv_sec-older.tv_sec)*1000+
- (newer.tv_usec-older.tv_usec)/1000;
+ return (newer.tv_sec - older.tv_sec) * 1000 +
+ (newer.tv_usec - older.tv_usec) / 1000;
}
int main(void)
@@ -150,15 +150,15 @@ int main(void)
while(still_running) {
struct timeval timeout;
- int rc; /* select() return code */
-
fd_set fdread;
fd_set fdwrite;
fd_set fdexcep;
int maxfd = -1;
+ int rc;
long curl_timeo = -1;
+ /* Initialise the file descriptors */
FD_ZERO(&fdread);
FD_ZERO(&fdwrite);
FD_ZERO(&fdexcep);
@@ -187,17 +187,16 @@ int main(void)
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
- fprintf(stderr, "ABORTING TEST, since it seems "
- "that it would have run forever.\n");
+ fprintf(stderr,
+ "ABORTING: Since it seems that we would have run forever.\n");
break;
}
switch(rc) {
- case -1:
- /* select error */
+ case -1: /* select error */
break;
- case 0: /* timeout */
- default: /* action */
+ case 0: /* timeout */
+ default: /* action */
curl_multi_perform(mcurl, &still_running);
break;
}