list_util
- List Manipulation UtilitiesN
lines from standard input,
(ii) displays the N
saved lines, and (iii)
deletes the saved text:
#include <stdio.h> -- Standard I/O definitions. #include "list_util.h" -- List manipulation functions. #include "str_util.h" -- String manipulation functions. char buffer[MAXINPUT], *s ; List list = NULL ; ... while (s = gets (buffer)) -- Input and save text. listAdd (&list, -1, (void *) str_dupl (s, -1)) ; for (i = 1 ; s = (char *) listGet (list, i) ; i++) printf ("Line %d: %s\n", i, s) ; -- Display text. while (listDelete (&list, 1) != NULL) ; -- Delete text. ...
listAdd()
- adds an item to a list.
listDelete()
- deletes an item from a list.
listFind()
- finds an item in a list.
listGet()
- retrieves the value of an item from a list.
listLength()
- returns the number of items in a list.
list_util.c
list_util.h
(See libgpl
for the
complete source, including support routines and build files.)