]> git.ozlabs.org Git - petitboot/blobdiff - test/urls/parse-url.c
test/parser: Allow checks for NULL boot_args
[petitboot] / test / urls / parse-url.c
index 3e2f10f0871c2be2aead6de56751942f239b0dfc..1688eab9540a5f1331bbed76c47cdbab554b11bb 100644 (file)
@@ -2,28 +2,30 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <ui/common/url.h>
+#include <url/url.h>
 #include <log/log.h>
 
 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;
        }
 
-       /* discard log output */
-       null = fopen("/dev/null", "w");
-       pb_log_set_stream(null);
-
        url = pb_url_parse(NULL, argv[1]);
        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);