aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-url.c
blob: 5d8d75951b59fcd478440d2bd4a9b1a7167f2737 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <camel.h>

int main (int argc, char **argv)
{
    CamelURL *url;
    CamelException *ex;

    if (argc != 2) {
        fprintf (stderr, "Usage: test-url URL\n");
        exit (1);
    }

    ex = camel_exception_new ();
    url = camel_url_new (argv[1], ex);
    if (!url) {
        fprintf (stderr, "Could not parse URL:\n%s",
             camel_exception_get_description (ex));
        exit (1);
    }

    printf ("URL     : %s\n\n", camel_url_to_string (url, TRUE));
    printf ("Protocol: %s\n", url->protocol);
    if (url->user)
        printf ("User    : %s\n", url->user);
    if (url->authmech)
        printf ("Authmech: %s\n", url->authmech);
    if (url->passwd)
        printf ("Password: %s\n", url->passwd);
    if (url->host)
        printf ("Host    : %s\n", url->host);
    if (url->port)
        printf ("Port    : %d\n", url->port);
    if (url->path)
        printf ("Path    : %s\n", url->path);

    return 0;
}