/[cvs]/eggdrop1.9/src/egglib/linked_list_test.c
ViewVC logotype

Contents of /eggdrop1.9/src/egglib/linked_list_test.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Sun Oct 28 13:30:35 2001 UTC (17 years, 11 months ago) by ite
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-chdr
FILE REMOVED
Renamed src/adns, src/compat, src/egglib to lib/adns, lib/compat, lib/egglib respectively.

1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "linked_list.h"
4
5 main ()
6 {
7 linked_list_t *list;
8 linked_list_cursor_t *cursor;
9 int i, data;
10
11 list = linked_list_create(NULL, linked_list_int_cmp, LINKED_LIST_SORTED);
12
13 printf("creating list...\n");
14 for (i = 10; i > 0; i--) linked_list_prepend(list, (void *)i, (void *)(i+1));
15 for (i = 11; i < 20; i++) linked_list_append(list, (void *)i, (void *)(i+1));
16
17 cursor = linked_list_cursor_create(NULL, list);
18 printf("searching...\n");
19 linked_list_cursor_find(cursor, (void *)900000);
20 linked_list_cursor_get(cursor, &data);
21 printf("%d\n", data);
22 linked_list_cursor_find(cursor, (void *)900001);
23 linked_list_cursor_get(cursor, &data);
24 printf("%d\n", data);
25 linked_list_cursor_find(cursor, (void *)899999);
26 linked_list_cursor_get(cursor, &data);
27 printf("%d\n", data);
28
29 printf("walking list...\n");
30 for (linked_list_cursor_home(cursor); linked_list_cursor_get(cursor, &data); linked_list_cursor_next(cursor)) {
31 //printf("data: %d\n", data);
32 }
33 }

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23