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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include "interpreter.h"
#include "config.h"
#include "laymanapi.h"
#include "message.h"
int main(int argc, char *argv[])
{
argc = argc;
argv = argv;
int ret = 0;
interpreterInit();
Message *msg = messageCreate("layman", 0, 0, 0);
BareConfig *cfg = bareConfigCreate(msg, 0, 0, 0);
/*if (!bareConfigSetOptionValue(cfg, "local_list", "/home/detlev/src/gsoc2010/layman/layman/tests/testfiles/global-overlays.xml"))
printf("Error setting config option.\n");
if (!bareConfigSetOptionValue(cfg, "storage", "/home/detlev/gsoc2010/layman-test"))
printf("Error setting config option.\n");
printf("config: %s\n", bareConfigGetOptionValue(cfg, "config"));
printf("storage: %s\n", bareConfigGetOptionValue(cfg, "storage"));
printf("local_list: %s\n", bareConfigGetOptionValue(cfg, "local_list"));*/
LaymanAPI *l = laymanAPICreate(cfg, 0, 0);
/*if (0 == laymanAPIFetchRemoteList(l))
{
printf("Unable to fetch the remote list.\n");
ret = -1;
goto finish;
}*/
StringList *strs = laymanAPIGetAvailable(l, 0);
printf("list:\n");
stringListPrint(strs);
printf("\n");
unsigned int len = stringListCount(strs);
//OverlayInfo *infos = calloc(len, sizeof(OverlayInfo));
//int count = laymanAPIGetAllInfos(l, strs, infos);
OverlayInfo *oi = laymanAPIGetAllInfo(l, "enlightenment");
if (oi)
{
printf("%s\n~~~~~~~~~~~~~~~~~~~~\n", oi->name);
printf("%s\n\n", oi->description);
overlayInfoFree(*oi);
free(oi);
}
for (unsigned int i = 0; i < len; i++)
{
OverlayInfo *oi = laymanAPIGetAllInfo(l, stringListGetAt(strs, i));
if (!oi)
continue;
printf("%s\n~~~~~~~~~~~~~~~~~~~~\n", oi->name);
printf("%s\n\n", oi->description);
overlayInfoFree(*oi);
free(oi);
}
printf("\n");
//free(infos);
bareConfigFree(cfg);
laymanAPIFree(l);
stringListFree(strs);
interpreterFinalize();
return ret;
}
|