.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "libinn_list 3" .TH libinn_list 3 2024-04-01 "INN 2.7.2" "InterNetNews Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME list \- list routines .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& struct node { \& struct node *succ; \& struct node *pred; \& }; \& \& struct list { \& struct node *head; \& struct node *tail; \& struct node *tailpred; \& }; \& \& void list_new(struct list *list); \& \& struct node *list_addhead(struct list *list, struct node *node); \& \& struct node *list_addtail(struct list *list, struct node *node); \& \& struct node *list_head(struct list *list); \& \& struct node *list_tail(struct list *list); \& \& struct node *list_succ(struct node *node); \& \& struct node *list_pred(struct node *node); \& \& struct node *list_remhead(struct list *list); \& \& struct node *list_remtail(struct list *list); \& \& struct node *list_remove(struct node *node); \& \& struct node *list_insert(struct list *list, struct node *node, \& struct node *pred); \& \& bool list_isempty(struct list *list); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBlist_new\fR initialises the list header \fIlist\fR so as to create an empty list. .PP \&\fBlist_addhead\fR adds \fInode\fR to the head of \fIlist\fR, returning the node just added. .PP \&\fBlist_addtail\fR adds \fInode\fR to the tail of \fIlist\fR, returning the node just added. .PP \&\fBlist_head\fR returns a pointer to the node at the head of \fIlist\fR or \fBNULL\fR if the list is empty. .PP \&\fBlist_tail\fR returns a pointer to the node at the tail of \fIlist\fR or \fBNULL\fR if the list is empty. .PP \&\fBlist_succ\fR returns the next (successor) node on the list after \&\fInode\fR or \fBNULL\fR if \fInode\fR was the final node. .PP \&\fBlist_pred\fR returns the previous (predecessor) node on the list before \&\fInode\fR or \fBNULL\fR if \fInode\fR was the first node. .PP \&\fBlist_remhead\fR removes the first node from \fIlist\fR and returns it to the caller. If the list is empty \fBNULL\fR is returned. .PP \&\fBlist_remtail\fR removes the last node from \fIlist\fR and returns it to the caller. If the list is empty \fBNULL\fR is returned. .PP \&\fBlist_remove\fR removes \fInode\fR from the list it is on and returns it to the caller. .PP \&\fBlist_insert\fR inserts \fInode\fR onto \fIlist\fR after the node \fIpred\fR. If \&\fIpred\fR is \fBNULL\fR then \fInode\fR is added to the head of \fIlist\fR. .SH HISTORY .IX Header "HISTORY" Written by Alex Kiernan for InterNetNews\ 2.4.0.