diff options
Diffstat (limited to 'man3/insque.3')
-rw-r--r-- | man3/insque.3 | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/man3/insque.3 b/man3/insque.3 index 337ff87d7..d3444ce41 100644 --- a/man3/insque.3 +++ b/man3/insque.3 @@ -14,7 +14,7 @@ .\" mtk, 2010-09-09: Noted glibc 2.4 bug, added info on circular .\" lists, added example program .\" -.TH insque 3 2023-02-05 "Linux man-pages 6.03" +.TH insque 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME insque, remque \- insert/remove an item from a queue .SH LIBRARY @@ -82,24 +82,20 @@ doubly linked list. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR insque (), .BR remque () T} Thread safety MT-Safe .TE -.hy -.ad .sp 1 -.SH STANDARDS -POSIX.1-2001, POSIX.1-2008. -.SH NOTES +.SH VERSIONS On ancient systems, .\" e.g., SunOS, Linux libc4 and libc5 the arguments of these functions were of type \fIstruct qelem *\fP, @@ -126,6 +122,10 @@ The above is the POSIX version. Some systems place them in \fI<string.h>\fP. .\" Linux libc4 and libc 5 placed them .\" in \fI<stdlib.h>\fP. +.SH STANDARDS +POSIX.1-2008. +.SH HISTORY +POSIX.1-2001. .SH BUGS In glibc 2.4 and earlier, it was not possible to specify .I prev @@ -156,36 +156,36 @@ That was a circular list #include <stdio.h> #include <stdlib.h> #include <unistd.h> - +\& struct element { struct element *forward; struct element *backward; char *name; }; - +\& static struct element * new_element(void) { struct element *e; - +\& e = malloc(sizeof(*e)); if (e == NULL) { fprintf(stderr, "malloc() failed\en"); exit(EXIT_FAILURE); } - +\& return e; } - +\& int main(int argc, char *argv[]) { struct element *first, *elem, *prev; int circular, opt, errfnd; - +\& /* The "\-c" command\-line option can be used to specify that the list is circular. */ - +\& errfnd = 0; circular = 0; while ((opt = getopt(argc, argv, "c")) != \-1) { @@ -198,19 +198,19 @@ main(int argc, char *argv[]) break; } } - +\& if (errfnd || optind >= argc) { fprintf(stderr, "Usage: %s [\-c] string...\en", argv[0]); exit(EXIT_FAILURE); } - +\& /* Create first element and place it in the linked list. */ - +\& elem = new_element(); first = elem; - +\& elem\->name = argv[optind]; - +\& if (circular) { elem\->forward = elem; elem\->backward = elem; @@ -218,29 +218,29 @@ main(int argc, char *argv[]) } else { insque(elem, NULL); } - +\& /* Add remaining command\-line arguments as list elements. */ - +\& while (++optind < argc) { prev = elem; - +\& elem = new_element(); elem\->name = argv[optind]; insque(elem, prev); } - +\& /* Traverse the list from the start, printing element names. */ - +\& printf("Traversing completed list:\en"); elem = first; do { printf(" %s\en", elem\->name); elem = elem\->forward; } while (elem != NULL && elem != first); - +\& if (elem == first) printf("That was a circular list\en"); - +\& exit(EXIT_SUCCESS); } .EE |