summaryrefslogtreecommitdiffstats
path: root/loader/urltest.c
blob: 817e4aff39d27497c424bef5b9627e7ccc3c2073 (plain)
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
#include <newt.h>

#include "urls.h"

int main(void) {
    struct iurlinfo iu;
    char doSecondary;
    char buf[1024];
    int fd;
    int size;

    newtInit();
    newtCls();

    memset(&iu, 0, sizeof(iu));

    iu.protocol = URL_METHOD_FTP;
    iu.address = "mercury.devel.redhat.com";
    iu.prefix = "/mnt/redhat/test/oot/i386";

    iu.protocol = URL_METHOD_HTTP;
    iu.address = "mercury.devel.redhat.com";
    iu.prefix = "/";

    fd = urlinstStartTransfer(&iu, "test.html");
    if (fd >= 0) {
	size = read(fd, buf, sizeof(buf));
	buf[size] = '\0';
	urlinstFinishTransfer(&iu, fd);

	newtWinMessage("Got it", "Ok", "Got: '%s'", buf);
    }

    newtFinished();
}