u-boot/doc/api
Sean Anderson 72eda5074b lib: Add getopt
Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-10-30 10:56:11 -04:00
..
dfu.rst doc: dfu: add DFU to HTML documentation 2020-05-25 11:54:53 -04:00
efi.rst efi_loader: prepare for read only OP-TEE variables 2020-07-11 23:14:16 +02:00
getopt.rst lib: Add getopt 2020-10-30 10:56:11 -04:00
index.rst lib: Add getopt 2020-10-30 10:56:11 -04:00
linker_lists.rst doc: Move existing rst files into api sub-directory 2019-07-24 10:07:24 -04:00
pinctrl.rst pinctrl: Reformat documentation in dm/pinctrl.h 2020-10-08 11:42:36 -04:00
rng.rst doc: random number generation 2020-06-14 21:07:20 +02:00
serial.rst doc: Move existing rst files into api sub-directory 2019-07-24 10:07:24 -04:00
timer.rst doc: Document timer API 2020-10-22 09:54:53 -04:00
unicode.rst doc: add Unicode functions to API description 2020-05-09 09:30:28 +02:00