Esempio n. 1
0
static void rls() {
  llist_t list = netroute_ls();
  llist_iter_t it = llist_iter_alloc(list);
  fprintf(stdout, "Destination\tGateway\tInterface\tSource\n");
  while(llist_iter_has_more(it)) {
    struct netroute_item_ls_s *i = (struct netroute_item_ls_s*)llist_value(llist_iter_next(it));
    printf("%s\t%s\t%s\t%s\n", i->dst, i->gateway, i->iface, i->src);
  }
  llist_iter_free(it);
  llist_clear(&list);
}
Esempio n. 2
0
	//So I can compile/debug ;)
	int main()
	{
		int a = 42;
		int b = 1337;
		int c = 214;
		int d = 1234;
		int e = 5005;
		int f = 69;
		int place = 3;
		printf("---------------\n|** Excist ***|\n---------------\n");
		printf("%d\n", llist_excist());
		printf("---------------\n|*** Begin ***|\n---------------\n");
		llist_add(&a);
		llist_add(&b);
		llist_add(&c);
		llist_add(&d);
		llist_add(&e);
		printf("---------------\n|** Excist ***|\n---------------\n");
		printf("%d\n", llist_excist());
		//printf("Derde waarde: %d\n", *nodeList.firstNode->nextNode->nextNode->value);
		printf("---------------\n|*No of items*|\n---------------\n");
		printf("%d\n", llist_nrItems());
		printf("---------------\n|**Print func*|\n---------------\n");
		llist_show();
		printf("---------------\n|*Add on place|\n---------------\n");
		llist_add_on_place(&place,&f);
		printf("---------------\n|**Print func*|\n---------------\n");
		llist_show();
		printf("---------------\n|**Delet func*|\n---------------\n");
		llist_remove(42);
		llist_show();
		printf("---------------\n|** Excist ***|\n---------------\n");
		printf("%d\n", llist_excist());
		printf("---------------\n|**Clear func*|\n---------------\n");
		llist_clear();
		printf("---------------\n|** Excist ***|\n---------------\n");
		printf("%d\n", llist_excist());
		return 0;
	}