Loading docs/examples/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \ Makefile.netware makefile.dj printf_macro.h $(COMPLICATED_EXAMPLES) Makefile.netware makefile.dj $(COMPLICATED_EXAMPLES) # Specify our include paths here, and do it relative to $(top_srcdir) and # $(top_builddir), to ensure that these paths which belong to the library Loading docs/examples/anyauthput.c +6 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -42,7 +42,6 @@ #endif #include <curl/curl.h> #include "printf_macro.h" #if LIBCURL_VERSION_NUM < 0x070c03 #error "upgrade your libcurl to no less than 7.12.3" Loading Loading @@ -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; } Loading docs/examples/externalsocket.c +9 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -57,7 +57,10 @@ static curl_socket_t opensocket(void *clientp, curlsocktype purpose, struct curl_sockaddr *address) { curl_socket_t sockfd = *(curl_socket_t *)clientp; curl_socket_t sockfd; (void)purpose; (void)address; sockfd = *(curl_socket_t *)clientp; /* the actual externally set socket is passed in via the OPENSOCKETDATA option */ return sockfd; Loading @@ -66,6 +69,9 @@ static curl_socket_t opensocket(void *clientp, static int sockopt_callback(void *clientp, curl_socket_t curlfd, curlsocktype purpose) { (void)clientp; (void)curlfd; (void)purpose; /* This return code was added in libcurl 7.21.5 */ return CURL_SOCKOPT_ALREADY_CONNECTED; } Loading Loading @@ -96,7 +102,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999"); /* Create the socket "manually" */ if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) { if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD ) { printf("Error creating listening socket.\n"); return 3; } Loading docs/examples/ftp-wildcard.c +4 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -33,7 +33,7 @@ static long file_is_comming(struct curl_fileinfo *finfo, static long file_is_downloaded(struct callback_data *data); static size_t write_it(char *buff, size_t size, size_t nmemb, struct callback_data *data); void *cb_data); int main(int argc, char **argv) { Loading Loading @@ -135,8 +135,9 @@ static long file_is_downloaded(struct callback_data *data) } static size_t write_it(char *buff, size_t size, size_t nmemb, struct callback_data *data) void *cb_data) { struct callback_data *data = cb_data; size_t written = 0; if(data->output) written = fwrite(buff, size, nmemb, data->output); Loading docs/examples/ftpupload.c +6 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading @@ -32,7 +32,6 @@ #else #include <unistd.h> #endif #include "printf_macro.h" /* * This example shows an FTP upload, with a rename of the file just after Loading @@ -52,12 +51,16 @@ variable's memory when passed in to it from an app like this. */ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { curl_off_t nread; /* in real-world cases, this would probably get this data differently as this fread() stuff is exactly what the library already would do by default internally */ size_t retcode = fread(ptr, size, nmemb, stream); 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; } Loading Loading
docs/examples/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc EXTRA_DIST = README Makefile.example Makefile.inc Makefile.m32 \ Makefile.netware makefile.dj printf_macro.h $(COMPLICATED_EXAMPLES) Makefile.netware makefile.dj $(COMPLICATED_EXAMPLES) # Specify our include paths here, and do it relative to $(top_srcdir) and # $(top_builddir), to ensure that these paths which belong to the library Loading
docs/examples/anyauthput.c +6 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -42,7 +42,6 @@ #endif #include <curl/curl.h> #include "printf_macro.h" #if LIBCURL_VERSION_NUM < 0x070c03 #error "upgrade your libcurl to no less than 7.12.3" Loading Loading @@ -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; } Loading
docs/examples/externalsocket.c +9 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -57,7 +57,10 @@ static curl_socket_t opensocket(void *clientp, curlsocktype purpose, struct curl_sockaddr *address) { curl_socket_t sockfd = *(curl_socket_t *)clientp; curl_socket_t sockfd; (void)purpose; (void)address; sockfd = *(curl_socket_t *)clientp; /* the actual externally set socket is passed in via the OPENSOCKETDATA option */ return sockfd; Loading @@ -66,6 +69,9 @@ static curl_socket_t opensocket(void *clientp, static int sockopt_callback(void *clientp, curl_socket_t curlfd, curlsocktype purpose) { (void)clientp; (void)curlfd; (void)purpose; /* This return code was added in libcurl 7.21.5 */ return CURL_SOCKOPT_ALREADY_CONNECTED; } Loading Loading @@ -96,7 +102,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999"); /* Create the socket "manually" */ if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) { if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD ) { printf("Error creating listening socket.\n"); return 3; } Loading
docs/examples/ftp-wildcard.c +4 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -33,7 +33,7 @@ static long file_is_comming(struct curl_fileinfo *finfo, static long file_is_downloaded(struct callback_data *data); static size_t write_it(char *buff, size_t size, size_t nmemb, struct callback_data *data); void *cb_data); int main(int argc, char **argv) { Loading Loading @@ -135,8 +135,9 @@ static long file_is_downloaded(struct callback_data *data) } static size_t write_it(char *buff, size_t size, size_t nmemb, struct callback_data *data) void *cb_data) { struct callback_data *data = cb_data; size_t written = 0; if(data->output) written = fwrite(buff, size, nmemb, data->output); Loading
docs/examples/ftpupload.c +6 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading @@ -32,7 +32,6 @@ #else #include <unistd.h> #endif #include "printf_macro.h" /* * This example shows an FTP upload, with a rename of the file just after Loading @@ -52,12 +51,16 @@ variable's memory when passed in to it from an app like this. */ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { curl_off_t nread; /* in real-world cases, this would probably get this data differently as this fread() stuff is exactly what the library already would do by default internally */ size_t retcode = fread(ptr, size, nmemb, stream); 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; } Loading