Bug 199644 - getopt_long(3) manpage has unclear example
Summary: getopt_long(3) manpage has unclear example
Status: Closed Works As Intended
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Mateusz Piotrowski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-23 12:37 UTC by Patrick Lauer
Modified: 2019-09-22 13:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Lauer 2015-04-23 12:37:26 UTC
Minor cosmetic detail - 

getopt_long(3) manpage says:
(see for example https://www.freebsd.org/cgi/man.cgi?query=getopt_long&apropos=0&sektion=3&manpath=FreeBSD+11-current&arch=default&format=html )


"The last element of the longopts array has to be filled with zeroes."

and the example just below is written as:

"{ NULL,	     0,			     NULL,	     0 }"


While this accidentally works out it is confusing to read. The manpage of GNU getopt_long shows "{ 0, 0, 0, 0 }" for this example, which matches the text a lot better.
Comment 1 Mateusz Piotrowski freebsd_committer freebsd_triage 2019-09-22 13:01:53 UTC
I believe that since the struct members are pointers in this case, NULL might actually be better.