summaryrefslogtreecommitdiffstats
path: root/loader/urltest.c
blob: e9e22b5c7b07a9048a040f87912ce8655e65c14f (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();
}