diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-03-18 16:48:19 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-04-29 13:55:32 +1000 |
commit | 6276a57e76cf22aac639236d4782b56e2e5b9d5e (patch) | |
tree | f76d19cc75601a07f13d3bec1f36e46e88707140 /test | |
parent | 62c2616b474415a7f2efa38faa4b10dd70003fef (diff) | |
download | talos-petitboot-6276a57e76cf22aac639236d4782b56e2e5b9d5e.tar.gz talos-petitboot-6276a57e76cf22aac639236d4782b56e2e5b9d5e.zip |
lib/url: Add pb_join_url
Add a a function to join a string to a base URL
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/urls/Makefile.am | 6 | ||||
-rw-r--r-- | test/urls/parse-url.c | 13 |
2 files changed, 15 insertions, 4 deletions
diff --git a/test/urls/Makefile.am b/test/urls/Makefile.am index d16ffdc..2163018 100644 --- a/test/urls/Makefile.am +++ b/test/urls/Makefile.am @@ -30,7 +30,11 @@ check_PROGRAMS = parse-url check_SCRIPTS = run-url-test TESTS = data/double-slash.test \ - data/http-simple.test + data/http-simple.test \ + data/join-full.test \ + data/join-absolute.test \ + data/join-relative.test + TEST_EXTENSIONS = .test TEST_LOG_COMPILER = $(builddir)/run-url-test diff --git a/test/urls/parse-url.c b/test/urls/parse-url.c index d748cdb..cfa6762 100644 --- a/test/urls/parse-url.c +++ b/test/urls/parse-url.c @@ -10,8 +10,8 @@ int main(int argc, char **argv) struct pb_url *url; FILE *null; - if (argc != 2) { - fprintf(stderr, "Usage: %s <URL>\n", argv[0]); + if (argc != 2 && argc != 3) { + fprintf(stderr, "Usage: %s <URL> [update]\n", argv[0]); return EXIT_FAILURE; } @@ -23,7 +23,14 @@ int main(int argc, char **argv) if (!url) return EXIT_FAILURE; - printf("%s\n", argv[1]); + if (argc == 2) { + printf("%s\n", argv[1]); + + } else { + printf("%s %s\n", argv[1], argv[2]); + url = pb_url_join(NULL, url, argv[2]); + } + printf("scheme\t%s\n", pb_url_scheme_name(url->scheme)); printf("host\t%s\n", url->host); printf("port\t%s\n", url->port); |