.\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
.\" and Copyright (C) 2007 Justin Pryzby <pryzbyj@justinpryzby.com>
.\"
+.\" %%%LICENSE_START(PERMISSIVE_MISC)
.\" Permission is hereby granted, free of charge, to any person obtaining
.\" a copy of this software and associated documentation files (the
.\" "Software"), to deal in the Software without restriction, including
.\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
.\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+.\" %%%LICENSE_END
.\"
-.TH GETSUBOPT 3 2008-05-29 "GNU" "Linux Programmer's Manual"
+.TH GETSUBOPT 3 2014-04-08 "GNU" "Linux Programmer's Manual"
.SH NAME
getsubopt \- parse suboption arguments from a string
.SH SYNOPSIS
-.B #define _XOPEN_SOURCE 500
-.br
.B #include <stdlib.h>
.BI "int getsubopt(char **"optionp ", char * const *" tokens \
", char **" valuep );
+.sp
+.in -4n
+Feature Test Macro Requirements for glibc (see
+.BR feature_test_macros (7)):
+.in
+.sp
+.BR getsubopt ():
+.ad l
+.RS 4
+.PD 0
+_XOPEN_SOURCE\ >= 500 ||
+_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+.br
+|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
+.PD
+.RE
+.ad
.SH DESCRIPTION
.BR getsubopt ()
parses the list of comma-separated suboptions provided in
The
.I tokens
-argument is a pointer to a NULL-terminated list of the tokens that
+argument is a pointer to a NULL-terminated array of pointers to the tokens that
.BR getsubopt ()
will look for in
.IR optionp .
.BR getsubopt ()
returns,
.I optionp
-points to the next suboption, or to the null character at the end of the
+points to the next suboption,
+or to the null byte (\(aq\\0\(aq) at the end of the
string if the last suboption was just processed.
.SH RETURN VALUE
If the first suboption in
.BR getsubopt ()
is not (necessarily) the same as the first suboption after
.BR getsubopt ().
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR getsubopt ()
+function is thread-safe.
.SH CONFORMING TO
POSIX.1-2001.
.SH NOTES
#include <assert.h>
#include <stdio.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
enum {
RO_OPT = 0,
}
.fi
.SH SEE ALSO
-.BR getopt (3),
-.BR feature_test_macros (7)
+.BR getopt (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.