diff options
Diffstat (limited to 'man3/stailq.3')
-rw-r--r-- | man3/stailq.3 | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/man3/stailq.3 b/man3/stailq.3 index ddbcccc83..f0584beec 100644 --- a/man3/stailq.3 +++ b/man3/stailq.3 @@ -316,39 +316,39 @@ BSD. #include <stdio.h> #include <stdlib.h> #include <sys/queue.h> - +\& struct entry { int data; STAILQ_ENTRY(entry) entries; /* Singly linked tail queue */ }; - +\& STAILQ_HEAD(stailhead, entry); - +\& int main(void) { struct entry *n1, *n2, *n3, *np; struct stailhead head; /* Singly linked tail queue head */ - +\& STAILQ_INIT(&head); /* Initialize the queue */ - +\& n1 = malloc(sizeof(struct entry)); /* Insert at the head */ STAILQ_INSERT_HEAD(&head, n1, entries); - +\& n1 = malloc(sizeof(struct entry)); /* Insert at the tail */ STAILQ_INSERT_TAIL(&head, n1, entries); - +\& n2 = malloc(sizeof(struct entry)); /* Insert after */ STAILQ_INSERT_AFTER(&head, n1, n2, entries); - +\& STAILQ_REMOVE(&head, n2, entry, entries); /* Deletion */ free(n2); - +\& n3 = STAILQ_FIRST(&head); STAILQ_REMOVE_HEAD(&head, entries); /* Deletion from the head */ free(n3); - +\& n1 = STAILQ_FIRST(&head); n1\->data = 0; for (unsigned int i = 1; i < 5; i++) { @@ -367,7 +367,7 @@ main(void) n1 = n2; } STAILQ_INIT(&head); - +\& exit(EXIT_SUCCESS); } .EE |