doc: Write an EXAMPLES section for the directory(3)/scandir(3) manpage(s)
completed by: Aviral Dasgupta
mentors: Samuel J. Greear, Pratyush Kshirsagar
setjmp and longjmp allow a program to save an execution context and return to it at a later point in time, it is used to implement complicated flow control within programs, such as threads.
directory(3) has an existing example within the text, use your best judgement for whether to expand upon this and move it into the EXAMPLES section or leave it in place as a reference.
Write an EXAMPLES section for the scandir(3)/directory(3) manpage(s) showing the usage of the functions defined in those manpage(s) in a plausible, real-world and if possible only semi-contrived scenario.
All examples should follow the style guidelines in the style(9) manpage.
All examples should be written in a manner that is self-documenting and make copious use of comments in order to explain the actions being taken.
Examples should be real and working code. They should not include headers or even a main function, but it should be reasonable for a developer to copy and paste an example from a manpage and expect it to work.
An example of a manpage with excellent example code is umtx(2).
Deliverables: A complete EXAMPLES manpage section in mdoc format.