aboutsummaryrefslogtreecommitdiffstats
path: root/docs/examples
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples')
-rw-r--r--docs/examples/Makefile.am2
-rw-r--r--docs/examples/Makefile.inc3
-rw-r--r--docs/examples/Makefile.netware19
-rw-r--r--docs/examples/ephiperfifo.c12
-rw-r--r--docs/examples/urlapi.c72
5 files changed, 84 insertions, 24 deletions
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
index ce2e924d..e3845e02 100644
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -62,4 +62,4 @@ include Makefile.inc
all: $(check_PROGRAMS)
checksrc:
- @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c
+ @PERL@ $(top_srcdir)/lib/checksrc.pl -ASNPRINTF $(srcdir)/*.c
diff --git a/docs/examples/Makefile.inc b/docs/examples/Makefile.inc
index f51871f0..8dd55b9d 100644
--- a/docs/examples/Makefile.inc
+++ b/docs/examples/Makefile.inc
@@ -34,7 +34,8 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \
imap-tls imap-multi url2file sftpget ftpsget postinmemory http2-download \
http2-upload http2-serverpush getredirect ftpuploadfrommem \
ftpuploadresume sslbackend postit2-formadd multi-formadd \
- shared-connection-cache sftpuploadresume http2-pushinmemory parseurl
+ shared-connection-cache sftpuploadresume http2-pushinmemory parseurl \
+ urlapi
# These examples require external dependencies that may not be commonly
# available on POSIX systems, so don't bother attempting to compile them here.
diff --git a/docs/examples/Makefile.netware b/docs/examples/Makefile.netware
index 9b6c69b8..1f50a926 100644
--- a/docs/examples/Makefile.netware
+++ b/docs/examples/Makefile.netware
@@ -27,11 +27,6 @@ ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../../libssh2-1.5.0
endif
-# Edit the path below to point to the base of your axTLS package.
-ifndef AXTLS_PATH
-AXTLS_PATH = ../../../axTLS-1.2.7
-endif
-
# Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH
LIBIDN_PATH = ../../../libidn-1.32
@@ -197,14 +192,9 @@ WITH_SSH2 = 1
WITH_SSL = 1
WITH_ZLIB = 1
endif
-ifeq ($(findstring -axtls,$(CFG)),-axtls)
-WITH_AXTLS = 1
-WITH_SSL =
-else
ifeq ($(findstring -ssl,$(CFG)),-ssl)
WITH_SSL = 1
endif
-endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
WITH_ZLIB = 1
endif
@@ -245,15 +235,6 @@ ifdef WITH_SSL
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
IMPORTS += GetProcessSwitchCount RunningProcess
else
-ifdef WITH_AXTLS
- INCLUDES += -I$(AXTLS_PATH)/inc
-ifdef LINK_STATIC
- LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT)
-else
- MODULES += libaxtls.nlm
- IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp
-endif
-endif
endif
ifdef WITH_ZLIB
# INCLUDES += -I$(ZLIB_PATH)
diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c
index e2737259..efb27b1b 100644
--- a/docs/examples/ephiperfifo.c
+++ b/docs/examples/ephiperfifo.c
@@ -257,7 +257,9 @@ static void remsock(SockInfo *f, GlobalInfo* g)
{
if(f) {
if(f->sockfd) {
- epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL);
+ if(epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL))
+ fprintf(stderr, "EPOLL_CTL_DEL failed for fd: %d : %s\n",
+ f->sockfd, strerror(errno));
}
free(f);
}
@@ -274,7 +276,9 @@ static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
(act & CURL_POLL_OUT ? EPOLLOUT : 0);
if(f->sockfd) {
- epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL);
+ if(epoll_ctl(g->epfd, EPOLL_CTL_DEL, f->sockfd, NULL))
+ fprintf(stderr, "EPOLL_CTL_DEL failed for fd: %d : %s\n",
+ f->sockfd, strerror(errno));
}
f->sockfd = s;
@@ -283,7 +287,9 @@ static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act,
ev.events = kind;
ev.data.fd = s;
- epoll_ctl(g->epfd, EPOLL_CTL_ADD, s, &ev);
+ if(epoll_ctl(g->epfd, EPOLL_CTL_ADD, s, &ev))
+ fprintf(stderr, "EPOLL_CTL_ADD failed for fd: %d : %s\n",
+ s, strerror(errno));
}
diff --git a/docs/examples/urlapi.c b/docs/examples/urlapi.c
new file mode 100644
index 00000000..594f9420
--- /dev/null
+++ b/docs/examples/urlapi.c
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, 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
+ * are also available at https://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.
+ *
+ ***************************************************************************/
+/* <DESC>
+ * Set working URL with CURLU *.
+ * </DESC>
+ */
+#include <stdio.h>
+#include <curl/curl.h>
+
+#if !CURL_AT_LEAST_VERSION(7, 62, 0)
+#error "this example requires curl 7.62.0 or later"
+#endif
+
+int main(void)
+{
+ CURL *curl;
+ CURLcode res;
+
+ CURLU *urlp;
+ CURLUcode uc;
+
+ /* get a curl handle */
+ curl = curl_easy_init();
+
+ /* init Curl URL */
+ urlp = curl_url();
+ uc = curl_url_set(urlp, CURLUPART_URL,
+ "http://example.com/path/index.html", 0);
+
+ if(uc) {
+ fprintf(stderr, "curl_url_set() failed: %in", uc);
+ goto cleanup;
+ }
+
+ if(curl) {
+ /* set urlp to use as working URL */
+ curl_easy_setopt(curl, CURLOPT_CURLU, urlp);
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+
+ res = curl_easy_perform(curl);
+ /* Check for errors */
+ if(res != CURLE_OK)
+ fprintf(stderr, "curl_easy_perform() failed: %s\n",
+ curl_easy_strerror(res));
+
+ goto cleanup;
+ }
+
+ cleanup:
+ curl_url_cleanup(urlp);
+ curl_easy_cleanup(curl);
+ return 0;
+}