blob: 00a184ade57b7ceaeeabe93ba9b515f576488df5 (
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 <stdio.h>
#include <unistd.h>
#include "mem.h"
#include "dom.h"
int main(int argc, char *argv[])
{
if (argc < 2)
errx(1, "usage: glacier <file>");
unveil(argv[1], "r");
unveil(NULL, NULL);
pledge("stdio rpath", NULL);
FILE *file;
char *html;
long len;
file = fopen("test.html", "rb");
fseek(file, 0, SEEK_END);
len = ftell(file);
fseek(file, 0, SEEK_SET);
html = MALLOC((size_t)len + 1);
fread(html, 1, len, file);
html[len] = '\0';
fclose(file);
init_dom(html);
free(html);
return 0;
}
|