Getopt has been rework in this way that calling it does not require extra state parameter and its execution is thread safe. Global parameters describing the state of the getopt function have been made available to ensure full API compatibility in using this library. However, referencing these global variables directly is not thread safe. In order to get the state of the getopt function for the thread that is currently using it, call: getopt_state_get(); Extended the library with getopt_long and getopt_long_only functions. Moved getopt libary from utils to posix. Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
28 lines
1.0 KiB
Plaintext
28 lines
1.0 KiB
Plaintext
# Copyright (c) 2021 Nordic Semiconductor
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
menuconfig GETOPT
|
|
bool "Geopt library support"
|
|
help
|
|
This option adds support of getopt.
|
|
Different shell backends are use their own instance of getopt to
|
|
not interfere with each other.
|
|
All not shell threads share one global instance of getopt state, hence
|
|
apart from shell this library is not thread safe. User can add support
|
|
for other threads by extending function getopt_state_get in
|
|
getopt_common.c file.
|
|
This option enables the following function: getopt.
|
|
|
|
config GETOPT_LONG
|
|
bool "Getopt long library support"
|
|
depends on GETOPT
|
|
help
|
|
This option adds support of the getopt long.
|
|
Different shell backends are using their own instance of getopt to
|
|
not interfere with each other.
|
|
All not shell threads share one global instance of getopt state, hence
|
|
apart from shell this library is not thread safe. User can add support
|
|
for other threads by extending function getopt_state_get in
|
|
getopt_common.c file.
|