From 3e1caa61859a6057a65eb7c1585d47e05026c4f2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Nov 2004 16:11:35 +0000 Subject: HTTP "auth done right". See lib/README.httpauth --- docs/examples/anyauthput.c | 135 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 docs/examples/anyauthput.c (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c new file mode 100644 index 000000000..c5486333e --- /dev/null +++ b/docs/examples/anyauthput.c @@ -0,0 +1,135 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * $Id$ + */ + +#include +#include +#include + +#include + +#if LIBCURL_VERSION_NUM < 0x070c03 +#error "upgrade your libcurl to no less than 7.12.3" +#endif + +/* + * This example shows a HTTP PUT operation with authentiction using "any" + * type. It PUTs a file given as a command line argument to the URL also given + * on the command line. + * + * Since libcurl 7.12.3, using "any" auth and POST/PUT requires a set ioctl + * function. + * + * This example also uses its own read callback. + */ + +/* ioctl callback function */ +static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp) +{ + int fd = (int)userp; + + (void)handle; /* not used in here */ + + switch(cmd) { + case CURLIOCMD_RESTARTREAD: + /* mr libcurl kindly asks as to rewind the read data stream to start */ + if(-1 == lseek(fd, 0, SEEK_SET)) + /* couldn't rewind */ + return CURLIOE_FAILRESTART; + + break; + + default: /* ignore unknown commands */ + return CURLIOE_UNKNOWNCMD; + } + return CURLIOE_OK; /* success! */ +} + +/* read callback function, fread() look alike */ +size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + size_t retcode; + + int fd = (int)stream; + + retcode = read(fd, ptr, size * nmemb); + + fprintf(stderr, "*** We read %d bytes from file\n", retcode); + + return retcode; +} + +int main(int argc, char **argv) +{ + CURL *curl; + CURLcode res; + int hd ; + struct stat file_info; + + char *file; + char *url; + + if(argc < 3) + return 1; + + file= argv[1]; + url = argv[2]; + + /* get the file size of the local file */ + hd = open(file, O_RDONLY) ; + fstat(hd, &file_info); + + /* In windows, this will init the winsock stuff */ + curl_global_init(CURL_GLOBAL_ALL); + + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { + /* we want to use our own read function */ + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* which file to upload */ + curl_easy_setopt(curl, CURLOPT_READDATA, hd); + + /* set the ioctl function */ + curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, my_ioctl); + + /* pass the file descriptor to the ioctl callback as well */ + curl_easy_setopt(curl, CURLOPT_IOCTLDATA, hd); + + /* enable "uploading" (which means PUT when doing HTTP) */ + curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ; + + /* specify target URL, and note that this URL should also include a file + name, not only a directory (as you can do with GTP uploads) */ + curl_easy_setopt(curl,CURLOPT_URL, url); + + /* and give the size of the upload, this supports large file sizes + on systems that have general support for it */ + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_info.st_size); + + /* tell libcurl we can use "any" auth, which lets the lib pick one, but it + also costs one extra round-trip and possibly sending of all the PUT + data twice!!! */ + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + + /* set user name and password for the authentication */ + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); + + /* Now run off and do what you've been told! */ + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + close(hd); /* close the local file */ + + curl_global_cleanup(); + return 0; +} -- cgit v1.2.1 From 4a728747e6f8845e500910e397dfc99aaf4a7984 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 12 Jul 2007 20:55:17 +0000 Subject: make it compile fine --- docs/examples/anyauthput.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index c5486333e..54cea0017 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -18,6 +19,10 @@ #error "upgrade your libcurl to no less than 7.12.3" #endif +#ifndef TRUE +#define TRUE 1 +#endif + /* * This example shows a HTTP PUT operation with authentiction using "any" * type. It PUTs a file given as a command line argument to the URL also given -- cgit v1.2.1 From 4706a9334149f656eef9b5e8888da1ead23b0941 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 16 Jul 2007 21:22:12 +0000 Subject: Fixed some more simple compile warnings in the examples. --- docs/examples/anyauthput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 54cea0017..bc6138f58 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -57,7 +57,7 @@ static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp) } /* read callback function, fread() look alike */ -size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t retcode; -- cgit v1.2.1 From b12fef3f3137bc606d283a2e527dd9050edf2b12 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 27 Feb 2008 09:06:15 +0000 Subject: Michal Marek's cleanup of how curl_easy_setopt() is used in examples and test code. Thanks to his curl_easy_setopt() typechecker work... --- docs/examples/anyauthput.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index bc6138f58..2c8f738ea 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -37,7 +37,7 @@ /* ioctl callback function */ static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp) { - int fd = (int)userp; + intptr_t fd = (intptr_t)userp; (void)handle; /* not used in here */ @@ -61,7 +61,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t retcode; - int fd = (int)stream; + intptr_t fd = (intptr_t)stream; retcode = read(fd, ptr, size * nmemb); @@ -74,7 +74,7 @@ int main(int argc, char **argv) { CURL *curl; CURLcode res; - int hd ; + intptr_t hd ; struct stat file_info; char *file; @@ -100,13 +100,13 @@ int main(int argc, char **argv) curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); /* which file to upload */ - curl_easy_setopt(curl, CURLOPT_READDATA, hd); + curl_easy_setopt(curl, CURLOPT_READDATA, (void*)hd); /* set the ioctl function */ curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, my_ioctl); /* pass the file descriptor to the ioctl callback as well */ - curl_easy_setopt(curl, CURLOPT_IOCTLDATA, hd); + curl_easy_setopt(curl, CURLOPT_IOCTLDATA, (void*)hd); /* enable "uploading" (which means PUT when doing HTTP) */ curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ; -- cgit v1.2.1 From ade57a781cfc3ec6877acd6ab30225c20e3efd09 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 15 May 2008 22:31:23 +0000 Subject: Included stdint.h to get the intptr_t type (needed on OpenBSD at least). --- docs/examples/anyauthput.c | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 2c8f738ea..952c7c2d7 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include -- cgit v1.2.1 From e664cd5826d43930fcc5b5dbaedbec94af33184b Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 22 May 2008 21:20:07 +0000 Subject: Fixed a surprising number of example programs that were passing int arguments to curl_easy_setopt instead of long. --- docs/examples/anyauthput.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 952c7c2d7..41531f7aa 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -110,7 +110,7 @@ int main(int argc, char **argv) curl_easy_setopt(curl, CURLOPT_IOCTLDATA, (void*)hd); /* enable "uploading" (which means PUT when doing HTTP) */ - curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ; + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L) ; /* specify target URL, and note that this URL should also include a file name, not only a directory (as you can do with GTP uploads) */ @@ -118,12 +118,13 @@ int main(int argc, char **argv) /* and give the size of the upload, this supports large file sizes on systems that have general support for it */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_info.st_size); + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); /* tell libcurl we can use "any" auth, which lets the lib pick one, but it also costs one extra round-trip and possibly sending of all the PUT data twice!!! */ - curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY); /* set user name and password for the authentication */ curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); -- cgit v1.2.1 From 79ffbf7fe1af3fb3d6a4a1ad31eeaaecb1dbd8e6 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 31 Aug 2008 12:12:35 +0000 Subject: MSVC adjustment --- docs/examples/anyauthput.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 41531f7aa..11c9d3c77 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -9,10 +9,23 @@ */ #include -#include #include +#ifdef WIN32 +# include +#else +# include +# include +#endif +#include #include -#include + +#ifdef _MSC_VER +# ifdef _WIN64 + typedef __int64 intptr_t; +# else + typedef int intptr_t; +# endif +#endif #include -- cgit v1.2.1 From 6582895b5146149aab7c619cbcb0ea292cfe12e6 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 5 Jun 2009 18:40:40 +0000 Subject: docs/example patches for VMS --- docs/examples/anyauthput.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 11c9d3c77..dd5b5ddf7 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -13,7 +13,9 @@ #ifdef WIN32 # include #else -# include +# ifndef __VMS +# include +# endif # include #endif #include -- cgit v1.2.1 From 5d502eb90c674dcba8e169550174b8439c5061da Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 10 Jun 2009 12:59:59 +0000 Subject: VMS adjustment --- docs/examples/anyauthput.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index dd5b5ddf7..c96f3c180 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -13,7 +13,9 @@ #ifdef WIN32 # include #else -# ifndef __VMS +# ifdef __VMS + typedef int intptr_t; +# else # include # endif # include -- cgit v1.2.1 From 46b112bcd439f4413925a7300d66a3e6f148765e Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 16 Feb 2010 13:32:45 +0000 Subject: replaced tabs with spaces --- docs/examples/anyauthput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index c96f3c180..d0c65cf1b 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -136,7 +136,7 @@ int main(int argc, char **argv) /* and give the size of the upload, this supports large file sizes on systems that have general support for it */ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)file_info.st_size); + (curl_off_t)file_info.st_size); /* tell libcurl we can use "any" auth, which lets the lib pick one, but it also costs one extra round-trip and possibly sending of all the PUT -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- docs/examples/anyauthput.c | 1 - 1 file changed, 1 deletion(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index d0c65cf1b..cec9fede5 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -5,7 +5,6 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * $Id$ */ #include -- cgit v1.2.1 From 1aeb635cdd296c16acb375a4a83a78f13166ccab Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 10 Mar 2011 11:48:02 +0100 Subject: sources: update source headers All C and H files now (should) feature the proper project curl source code header, which includes basic info, a copyright statement and some basic disclaimers. --- docs/examples/anyauthput.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index cec9fede5..6b3d74a4b 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -1,12 +1,24 @@ -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - */ - + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ #include #include #ifdef WIN32 -- cgit v1.2.1 From c4bc1d473f324220738f2c60984b3a8ee198bc38 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 28 Apr 2011 22:14:05 +0200 Subject: anyauthput.c: stdint.h must not be included unconditionally As it is already included by curlbuild.h if it exists on the platform it was included here superfluously anyway. Reported by: Dagobert Michelsen Bug: http://curl.haxx.se/bug/view.cgi?id=3294509 --- docs/examples/anyauthput.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 6b3d74a4b..76fa15853 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -26,8 +26,6 @@ #else # ifdef __VMS typedef int intptr_t; -# else -# include # endif # include #endif -- cgit v1.2.1 From ba52e0a93bbdfa0430d12cda14d4ed71616b92a1 Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Fri, 23 Sep 2011 01:22:18 +0200 Subject: Added a workaround for printing size_t. --- docs/examples/anyauthput.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 76fa15853..bab36c57b 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -41,6 +41,7 @@ #endif #include +#include "printf_macro.h" #if LIBCURL_VERSION_NUM < 0x070c03 #error "upgrade your libcurl to no less than 7.12.3" @@ -92,7 +93,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) retcode = read(fd, ptr, size * nmemb); - fprintf(stderr, "*** We read %d bytes from file\n", retcode); + fprintf(stderr, "*** We read %" _FMT_SIZE_T " bytes from file\n", retcode); return retcode; } -- cgit v1.2.1 From 46724b87b769ff50e1e6b90d2aabc50b8ba7c1a9 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Tue, 6 Dec 2011 19:54:48 -0800 Subject: Added some include files in a couple of example programs This improves portability of the examples. This patch was submitted to the OpenBSD ports collection by naddy. --- docs/examples/anyauthput.c | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index bab36c57b..2997a1e98 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -27,6 +27,7 @@ # ifdef __VMS typedef int intptr_t; # endif +# include # include #endif #include -- cgit v1.2.1 From 865893fb143540037ca34f6a4438ebe2e286ec5a Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 13 Apr 2012 17:58:41 +0200 Subject: examples: fix compiler warnings --- docs/examples/anyauthput.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 2997a1e98..a28ecb769 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -42,7 +42,6 @@ #endif #include -#include "printf_macro.h" #if LIBCURL_VERSION_NUM < 0x070c03 #error "upgrade your libcurl to no less than 7.12.3" @@ -89,12 +88,16 @@ static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp) static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t retcode; + curl_off_t nread; intptr_t fd = (intptr_t)stream; retcode = read(fd, ptr, size * nmemb); - fprintf(stderr, "*** We read %" _FMT_SIZE_T " bytes from file\n", retcode); + nread = (curl_off_t)retcode; + + fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T + " bytes from file\n", nread); return retcode; } -- cgit v1.2.1 From a3dbbcfd2ac7ab8f597e26e76935726279d3fa0c Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Wed, 4 Jul 2012 17:03:52 +0200 Subject: Added error checking for samples. --- docs/examples/anyauthput.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index a28ecb769..5dac0e779 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -162,6 +162,10 @@ int main(int argc, char **argv) /* Now run off and do what you've been told! */ res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); /* always cleanup */ curl_easy_cleanup(curl); -- cgit v1.2.1 From 23f8dca6fb91329fe78bb5a00527286692d2a357 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 5 Dec 2012 00:37:57 +0100 Subject: examples: fix compilation issues --- docs/examples/anyauthput.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docs/examples/anyauthput.c') 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 +# if defined(_AIX) || defined(__sgi) || defined(__osf) + typedef long intptr_t; +# else +# include +# endif # include #endif #include -- cgit v1.2.1 From 7332a7cafba43c96893a8df9b08e5d15df4f3288 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 5 Dec 2012 11:43:40 +0100 Subject: examples: fix compilation issues - commit 23f8dca6fb follow-up --- docs/examples/anyauthput.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 54e5f1aff..6eea98f1d 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -27,9 +27,7 @@ # ifdef __VMS typedef int intptr_t; # endif -# if defined(_AIX) || defined(__sgi) || defined(__osf) - typedef long intptr_t; -# else +# if !defined(_AIX) && !defined(__sgi) && !defined(__DECC) # include # endif # include @@ -55,6 +53,12 @@ #define TRUE 1 #endif +#if defined(_AIX) || defined(__sgi) || defined(__DECC) +#ifndef intptr_t +#define intptr_t long +#endif +#endif + /* * This example shows a HTTP PUT operation with authentiction using "any" * type. It PUTs a file given as a command line argument to the URL also given -- cgit v1.2.1 From d758234ade7c1cbc4cdd91ea1bd6defb6b690340 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 10 Dec 2012 15:42:12 +0100 Subject: examples/anyauthput.c: fix Tru64 compilation issue --- docs/examples/anyauthput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/examples/anyauthput.c') diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index 6eea98f1d..b89dca2e1 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -27,7 +27,7 @@ # ifdef __VMS typedef int intptr_t; # endif -# if !defined(_AIX) && !defined(__sgi) && !defined(__DECC) +# if !defined(_AIX) && !defined(__sgi) && !defined(__osf__) # include # endif # include @@ -53,7 +53,7 @@ #define TRUE 1 #endif -#if defined(_AIX) || defined(__sgi) || defined(__DECC) +#if defined(_AIX) || defined(__sgi) || defined(__osf__) #ifndef intptr_t #define intptr_t long #endif -- cgit v1.2.1