Sfoglia il codice sorgente

LibC: Add stub for fnmatch and a set of defined values

This adds a stub for fnmatch and the following defined values:
- FNM_PATHNAME
- FNM_NOESCAPE
- FNM_PERIOD
- FNM_FILE_NAME
- FNM_LEADING_DIR
- FNM_CASEFOLD
- FNM_EXTMATCH
Kenneth Myhra 4 anni fa
parent
commit
8abfcb976d

+ 1 - 0
Userland/Libraries/LibC/CMakeLists.txt

@@ -7,6 +7,7 @@ set(LIBC_SOURCES
     dlfcn.cpp
     fcntl.cpp
     fenv.cpp
+    fnmatch.cpp
     getopt.cpp
     grp.cpp
     inttypes.cpp

+ 14 - 0
Userland/Libraries/LibC/fnmatch.cpp

@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2021, the SerenityOS developers
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/Format.h>
+#include <fnmatch.h>
+
+int fnmatch(char const*, char const*, int)
+{
+    dbgln("FIXME: Implement fnmatch()");
+    return 0;
+}

+ 23 - 0
Userland/Libraries/LibC/fnmatch.h

@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021, the SerenityOS developers
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <sys/types.h>
+
+#define FNM_PATHNAME 1
+#define FNM_NOESCAPE 2
+#define FNM_PERIOD 4
+#define FNM_FILE_NAME FNM_PATHNAME
+#define FNM_LEADING_DIR 8
+#define FNM_CASEFOLD 16
+#define FNM_EXTMATCH 32
+
+__BEGIN_DECLS
+
+int fnmatch(char const* pattern, char const* string, int flags);
+
+__END_DECLS