summaryrefslogtreecommitdiffstats
path: root/man3/tailq.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/tailq.3')
-rw-r--r--man3/tailq.320
1 files changed, 10 insertions, 10 deletions
diff --git a/man3/tailq.3 b/man3/tailq.3
index e57dd6438..af34c5424 100644
--- a/man3/tailq.3
+++ b/man3/tailq.3
@@ -341,35 +341,35 @@ without interfering with the traversal.
#include <stdio.h>
#include <stdlib.h>
#include <sys/queue.h>
-
+\&
struct entry {
int data;
TAILQ_ENTRY(entry) entries; /* Tail queue */
};
-
+\&
TAILQ_HEAD(tailhead, entry);
-
+\&
int
main(void)
{
struct entry *n1, *n2, *n3, *np;
struct tailhead head; /* Tail queue head */
int i;
-
+\&
TAILQ_INIT(&head); /* Initialize the queue */
-
+\&
n1 = malloc(sizeof(struct entry)); /* Insert at the head */
TAILQ_INSERT_HEAD(&head, n1, entries);
-
+\&
n1 = malloc(sizeof(struct entry)); /* Insert at the tail */
TAILQ_INSERT_TAIL(&head, n1, entries);
-
+\&
n2 = malloc(sizeof(struct entry)); /* Insert after */
TAILQ_INSERT_AFTER(&head, n1, n2, entries);
-
+\&
n3 = malloc(sizeof(struct entry)); /* Insert before */
TAILQ_INSERT_BEFORE(n2, n3, entries);
-
+\&
TAILQ_REMOVE(&head, n2, entries); /* Deletion */
free(n2);
/* Forward traversal */
@@ -387,7 +387,7 @@ main(void)
n1 = n2;
}
TAILQ_INIT(&head);
-
+\&
exit(EXIT_SUCCESS);
}
.EE