aboutsummaryrefslogtreecommitdiff
path: root/docs/examples
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-12-05 00:37:57 +0100
committerYang Tse <yangsita@gmail.com>2012-12-05 00:37:57 +0100
commit23f8dca6fb91329fe78bb5a00527286692d2a357 (patch)
tree7c4e5b4fade05cfd3bad672bcafcdff0890a80d6 /docs/examples
parentb908376bef462644e204b50f7a8c3df5871883bf (diff)
examples: fix compilation issues
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/anyauthput.c6
-rw-r--r--docs/examples/ftpgetinfo.c10
-rw-r--r--docs/examples/progressfunc.c4
3 files changed, 12 insertions, 8 deletions
diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c
index 5dac0e779..54e5f1aff 100644
--- a/docs/examples/anyauthput.c
+++ b/docs/examples/anyauthput.c
@@ -27,7 +27,11 @@
# ifdef __VMS
typedef int intptr_t;
# endif
-# include <stdint.h>
+# if defined(_AIX) || defined(__sgi) || defined(__osf)
+ typedef long intptr_t;
+# else
+# include <stdint.h>
+# endif
# include <unistd.h>
#endif
#include <sys/types.h>
diff --git a/docs/examples/ftpgetinfo.c b/docs/examples/ftpgetinfo.c
index f0746693b..7063d89b9 100644
--- a/docs/examples/ftpgetinfo.c
+++ b/docs/examples/ftpgetinfo.c
@@ -43,8 +43,8 @@ int main(void)
char ftpurl[] = "ftp://ftp.example.com/gnu/binutils/binutils-2.19.1.tar.bz2";
CURL *curl;
CURLcode res;
- const time_t filetime;
- const double filesize;
+ long filetime = -1;
+ double filesize = 0.0;
const char *filename = strrchr(ftpurl, '/') + 1;
curl_global_init(CURL_GLOBAL_DEFAULT);
@@ -67,10 +67,10 @@ int main(void)
if(CURLE_OK == res) {
/* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */
res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
- if((CURLE_OK == res) && filetime)
- printf("filetime %s: %s", filename, ctime(&filetime));
+ if((CURLE_OK == res) && (filetime >= 0))
+ printf("filetime %s: %s", filename, ctime(&(time_t)filetime));
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize);
- if((CURLE_OK == res) && (filesize>0))
+ if((CURLE_OK == res) && (filesize>0.0))
printf("filesize %s: %0.0f bytes\n", filename, filesize);
} else {
/* we failed */
diff --git a/docs/examples/progressfunc.c b/docs/examples/progressfunc.c
index a49806028..51a9c9b5e 100644
--- a/docs/examples/progressfunc.c
+++ b/docs/examples/progressfunc.c
@@ -59,7 +59,7 @@ static int progress(void *p,
int main(void)
{
CURL *curl;
- CURLcode res=0;
+ CURLcode res = CURLE_OK;
struct myprogress prog;
curl = curl_easy_init();
@@ -74,7 +74,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
res = curl_easy_perform(curl);
- if(res)
+ if(res != CURLE_OK)
fprintf(stderr, "%s\n", curl_easy_strerror(res));
/* always cleanup */