summaryrefslogtreecommitdiff
path: root/src/examples/eina/eina_list_01.c
blob: c82a7f1a0f9d6ca58fd53acef03238519f4f2bdc (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
36
37
38
39
40
41
42
43
44
45
46
//Compile with:
//gcc -g eina_list_01.c -o eina_list_01 `pkg-config --cflags --libs eina`

#include <stdio.h>
#include <Eina.h>

int
main(int argc, char **argv)
{
   (void)argc;
   (void)argv;
   Eina_List *list = NULL;
   Eina_List *l;
   void *list_data;

   eina_init();

   list = eina_list_append(list, "tigh");
   list = eina_list_append(list, "adar");
   list = eina_list_append(list, "baltar");
   list = eina_list_append(list, "roslin");

   EINA_LIST_FOREACH(list, l, list_data)
     printf("%s\n", (char*)list_data);
   printf("\n");

   l = eina_list_nth_list(list, 1);
   list = eina_list_append_relative_list(list, "cain", l);

   list = eina_list_append_relative(list, "zarek", "cain");

   list = eina_list_prepend(list, "adama");

   list = eina_list_prepend_relative(list, "gaeta", "cain");

   list = eina_list_prepend_relative_list(list, "lampkin", l);

   EINA_LIST_FOREACH(list, l, list_data)
     printf("%s\n", (char*)list_data);

   eina_list_free(list);

   eina_shutdown();

   return 0;
}