blob: c1cdd72580e0a335ee6413c7f2bc7f6d969cec45 (
plain) (
tree)
|
|
#include <stdio.h>
#include "yuri.h"
static void
_print_uri(struct uri *u)
{
int i;
printf("Scheme: \"%s\"\n", u->scheme);
printf("Authority type: %d\n", u->authority.type);
printf("Authority user: \"%s\"\n", u->authority.user);
printf("Authority host: \"%s\"\n", u->authority.host);
printf("Authority port: %d\n", u->authority.port);
for (i = 0; i < u->npath; i++)
printf("Path: %d: \"%s\"\n", i+1, u->path[i]);
printf("Query: \"%s\"\n", u->query);
printf("Fragment: \"%s\"\n", u->fragment);
}
int
main(int argc, char *argv[])
{
struct uri *u;
if (argc < 2) {
fprintf(stderr, "Usage %s url\n", argv[0]);
return 1;
}
u = uri_decode(argv[1]);
if (u == NULL)
return 1;
if (uri_normalize(u) == -1)
return 1;
_print_uri(u);
uri_free(u);
return 0;
}
|