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>