lib: posix: move fnmatch from lib/util to lib/posix

The `fnmatch()` function is specified by POSIX and should be
a part of `lib/posix`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
This commit is contained in:
Chris Friedt 2023-02-25 08:03:11 -05:00 committed by Stephanos Ioannidis
parent afd4346965
commit f923441146
11 changed files with 11 additions and 38 deletions

View file

@ -7,6 +7,5 @@ endif()
add_subdirectory_ifdef(CONFIG_CPP cpp)
add_subdirectory(hash)
add_subdirectory(os)
add_subdirectory(util)
add_subdirectory_ifdef(CONFIG_SMF smf)
add_subdirectory_ifdef(CONFIG_OPENAMP open-amp)

View file

@ -15,8 +15,6 @@ source "lib/posix/Kconfig"
source "lib/open-amp/Kconfig"
source "lib/util/Kconfig"
source "lib/smf/Kconfig"
endmenu

View file

@ -33,6 +33,7 @@ zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_key.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_MQUEUE mqueue.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_FS fs.c)
zephyr_library_sources_ifdef(CONFIG_EVENTFD eventfd.c)
zephyr_library_sources_ifdef(CONFIG_FNMATCH fnmatch.c)
add_subdirectory_ifdef(CONFIG_GETOPT getopt)
zephyr_library_include_directories(

View file

@ -156,3 +156,10 @@ config EVENTFD_MAX
range 1 4096
help
The maximum number of supported event file descriptors.
config FNMATCH
bool "Support for fnmatch"
default y if POSIX_API
help
Match filenames using the the fnmatch function. For example, the pattern
"*.c" matches the filename "hello.c".

View file

@ -40,9 +40,10 @@
*/
#include <ctype.h>
#include "fnmatch.h"
#include <string.h>
#include <zephyr/posix/fnmatch.h>
#define EOS '\0'
static inline int foldcase(int ch, int flags)

View file

@ -1,3 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory_ifdef(CONFIG_FNMATCH fnmatch)

View file

@ -1,9 +0,0 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
menu "Util libraries"
source "lib/util/fnmatch/Kconfig"
endmenu

View file

@ -1,14 +0,0 @@
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
#
zephyr_include_directories_ifdef(
CONFIG_FNMATCH
.
)
zephyr_sources_ifdef(
CONFIG_FNMATCH
fnmatch.c
)

View file

@ -1,7 +0,0 @@
# Copyright (c) 2018 Nordic Semiconductor
# SPDX-License-Identifier: Apache-2.0
config FNMATCH
bool "Fnmatch Support"
help
This option enables the fnmatch library

View file

@ -5,7 +5,7 @@
*/
#include <string.h>
#include <fnmatch.h>
#include <zephyr/posix/fnmatch.h>
#include "shell_wildcard.h"
#include "shell_utils.h"
#include "shell_ops.h"