chiark / gitweb /
Commit 2.4.5-5 as unpacked
[innduct.git] / doc / pod / list.pod
1 =head1 NAME
2
3 list - list routines
4
5 =head1 SYNOPSIS
6
7 B<#include E<lt>inn/list.hE<gt>>
8
9 struct node {
10     struct node *succ;
11     struct node *pred;
12 };
13
14 struct list {
15     struct node *head;
16     struct node *tail;
17     struct node *tailpred;
18 };
19
20 B<void list_new(struct list *>I<list>B<);>
21
22 B<struct node *list_addhead(struct list *>I<list>B<, struct node *>I<node>B<);>
23
24 B<struct node *list_addtail(struct list *>I<list>B<, struct node *>I<node>B<);>
25
26 B<struct node *list_head(struct list *>I<list>B<);>
27
28 B<struct node *list_tail(struct list *>I<list>B<);>
29
30 B<struct node *list_succ(struct node *>I<node>B<);>
31
32 B<struct node *list_pred(struct node *>I<node>B<);>
33
34 B<struct node *list_remhead(struct list *>I<list>B<);>
35
36 B<struct node *list_remtail(struct list *>I<list>B<);>
37
38 B<struct node *list_remove(struct node *>I<node>B<);>
39
40 B<struct node *list_insert(struct list *>I<list>B<, struct node *>I<node>B<, struct node *>I<pred>B<);>
41
42 B<bool list_isempty(struct list *>I<list>B<);>
43
44 =head1 DESCRIPTION
45
46 B<list_new> initialises the list header I<list> so as to create an
47 empty list.
48
49 B<list_addhead> adds I<node> to the head of I<list>, returning the node
50 just added.
51
52 B<list_addtail> adds I<node> to the tail of I<list>, returning the node
53 just added.
54
55 B<list_head> returns a pointer to the the node at the head of I<list>
56 or B<NULL> if the list is empty.
57
58 B<list_tail> returns a pointer to the the node at the tail of I<list>
59 or B<NULL> if the list is empty.
60
61 B<list_succ> returns the next (successor) node on the list after
62 I<node> or B<NULL> if I<node> was the final node.
63
64 B<list_pred> returns the previous (predecessor) node on the list before
65 I<node> or B<NULL> if I<node> was the first node.
66
67 B<list_remhead> removes the first node from I<list> and returns it to
68 the caller. If the list is empty B<NULL> is returned.
69
70 B<list_remtail> removes the last node from I<list> and returns it to
71 the caller. If the list is empty B<NULL> is returned.
72
73 B<list_remove> removes I<node> from the list it is on and returns it
74 to the caller.
75
76 B<list_insert> inserts I<node> onto I<list> after the node I<pred>. If
77 I<pred> is B<NULL> then I<node> is added to the head of I<list>.
78
79 =head1 HISTORY
80
81 Written by Alex Kiernan <alex.kiernan@thus.net> for InterNetNews 2.4.0.
82
83 $Id: list.pod 6168 2003-01-21 06:27:32Z alexk $