Loading docs/examples/Makefile.inc +3 −2 Original line number Diff line number Diff line Loading @@ -32,12 +32,13 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \ imap-list imap-lsub imap-fetch imap-store imap-append imap-examine \ imap-search imap-create imap-delete imap-copy imap-noop imap-ssl \ imap-tls imap-multi url2file sftpget ftpsget postinmemory http2-download \ http2-upload http2-serverpush getredirect ftpuploadfrommem http2-upload http2-serverpush getredirect ftpuploadfrommem \ ftpuploadresume # These examples require external dependencies that may not be commonly # available on POSIX systems, so don't bother attempting to compile them here. COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \ ghiper.c hiperfifo.c htmltidy.c multithread.c \ opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp \ multi-uv.c xmlstream.c usercertinmem.c sessioninfo.c docs/examples/ftpuploadresume.c +11 −24 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2017, 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 @@ -26,44 +26,31 @@ #include <stdlib.h> #include <stdio.h> #include <curl/curl.h> #if defined(_MSC_VER) && (_MSC_VER < 1300) # error _snscanf requires MSVC 7.0 or later. #endif /* The MinGW headers are missing a few Win32 function definitions, you shouldn't need this if you use VC++ */ #if defined(__MINGW32__) && !defined(__MINGW64__) int __cdecl _snscanf(const char *input, size_t length, const char *format, ...); #endif /* parse headers for Content-Length */ size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) static size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) { int r; long len = 0; /* _snscanf() is Win32 specific */ r = _snscanf(ptr, size * nmemb, "Content-Length: %ld\n", &len); if(r) /* Microsoft: we don't read the specs */ r = sscanf(ptr, "Content-Length: %ld\n", &len); if(r) *((long *) stream) = len; return size * nmemb; } /* discard downloaded data */ size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) static size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) { (void)ptr; (void)stream; return size * nmemb; } /* read data to upload */ size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) static size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) { FILE *f = stream; size_t n; Loading @@ -77,8 +64,8 @@ size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) } int upload(CURL *curlhandle, const char *remotepath, const char *localpath, long timeout, long tries) static int upload(CURL *curlhandle, const char *remotepath, const char *localpath, long timeout, long tries) { FILE *f; long uploaded_len = 0; Loading Loading @@ -156,7 +143,7 @@ int upload(CURL *curlhandle, const char *remotepath, const char *localpath, } } int main(int c, char **argv) int main(void) { CURL *curlhandle = NULL; Loading Loading
docs/examples/Makefile.inc +3 −2 Original line number Diff line number Diff line Loading @@ -32,12 +32,13 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \ imap-list imap-lsub imap-fetch imap-store imap-append imap-examine \ imap-search imap-create imap-delete imap-copy imap-noop imap-ssl \ imap-tls imap-multi url2file sftpget ftpsget postinmemory http2-download \ http2-upload http2-serverpush getredirect ftpuploadfrommem http2-upload http2-serverpush getredirect ftpuploadfrommem \ ftpuploadresume # These examples require external dependencies that may not be commonly # available on POSIX systems, so don't bother attempting to compile them here. COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \ ghiper.c hiperfifo.c htmltidy.c multithread.c \ opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp \ multi-uv.c xmlstream.c usercertinmem.c sessioninfo.c
docs/examples/ftpuploadresume.c +11 −24 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2017, 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 @@ -26,44 +26,31 @@ #include <stdlib.h> #include <stdio.h> #include <curl/curl.h> #if defined(_MSC_VER) && (_MSC_VER < 1300) # error _snscanf requires MSVC 7.0 or later. #endif /* The MinGW headers are missing a few Win32 function definitions, you shouldn't need this if you use VC++ */ #if defined(__MINGW32__) && !defined(__MINGW64__) int __cdecl _snscanf(const char *input, size_t length, const char *format, ...); #endif /* parse headers for Content-Length */ size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) static size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream) { int r; long len = 0; /* _snscanf() is Win32 specific */ r = _snscanf(ptr, size * nmemb, "Content-Length: %ld\n", &len); if(r) /* Microsoft: we don't read the specs */ r = sscanf(ptr, "Content-Length: %ld\n", &len); if(r) *((long *) stream) = len; return size * nmemb; } /* discard downloaded data */ size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) static size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream) { (void)ptr; (void)stream; return size * nmemb; } /* read data to upload */ size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) static size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) { FILE *f = stream; size_t n; Loading @@ -77,8 +64,8 @@ size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream) } int upload(CURL *curlhandle, const char *remotepath, const char *localpath, long timeout, long tries) static int upload(CURL *curlhandle, const char *remotepath, const char *localpath, long timeout, long tries) { FILE *f; long uploaded_len = 0; Loading Loading @@ -156,7 +143,7 @@ int upload(CURL *curlhandle, const char *remotepath, const char *localpath, } } int main(int c, char **argv) int main(void) { CURL *curlhandle = NULL; Loading