Masahiro Yamada ed562c5310 kconfig: refactor option parse code
The current option parse code is clumsy.

The 's' option is separately handled in an if-conditional due to the
following code:

    input_mode = (enum input_mode)opt;

If 's' is moved to the switch statement, the invalid value 's' would
be assigned to the input_mode.

Another potential problem is that we are mixing 'enum input_mode' and
ASCII characters. They could overwrap if we add more input modes.

To separate them out, set the flag field of long options to a pointer
of input_mode_opt. For mode select options, getopt_long() returns 0,
which never causes overwrap with ASCII characters that represent short
options.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2021-03-25 13:34:37 +09:00
..
2021-03-25 13:34:37 +09:00
2020-12-08 23:31:29 +09:00
2020-08-14 13:30:03 +09:00
2020-08-14 13:30:03 +09:00
2020-12-08 23:31:29 +09:00
2021-01-27 03:17:42 +09:00
2020-09-25 00:37:13 +09:00
2020-12-08 23:31:29 +09:00