[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] lib: Add realpath stub.
From: |
Andrius Štikonas |
Subject: |
[PATCH] lib: Add realpath stub. |
Date: |
Fri, 3 May 2024 19:14:14 +0100 |
lib/stub/realpath.c: New file.
---
build-aux/configure-lib.sh | 1 +
include/stdlib.h | 1 +
lib/stub/realpath.c | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 lib/stub/realpath.c
diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh
index 386ebf88..72ac470d 100644
--- a/build-aux/configure-lib.sh
+++ b/build-aux/configure-lib.sh
@@ -327,6 +327,7 @@ lib/stub/sigaction.c
lib/stub/ldexp.c
lib/stub/mprotect.c
lib/stub/localtime.c
+lib/stub/realpath.c
lib/stub/sigemptyset.c
lib/$mes_cpu-mes-$compiler/setjmp.c
"
diff --git a/include/stdlib.h b/include/stdlib.h
index 592a387b..75a32768 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -51,6 +51,7 @@ void *malloc (size_t);
void qsort (void *base, size_t nmemb, size_t size, int (*compar) (void const
*, void const *));
int rand (void);
void *realloc (void *p, size_t size);
+char* realpath(const char *restrict filename, char *restrict resolved);
double strtod (char const *string, char **tailptr);
float strtof (char const *string, char **tailptr);
long double strtold (char const *string, char **tailptr);
diff --git a/lib/stub/realpath.c b/lib/stub/realpath.c
new file mode 100644
index 00000000..b2443677
--- /dev/null
+++ b/lib/stub/realpath.c
@@ -0,0 +1,34 @@
+/* -*-comment-start: "//";comment-end:""-*-
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2024 Andrius Štikonas <andrius@stikonas.eu>
+ *
+ * This file is part of GNU Mes.
+ *
+ * GNU Mes is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * GNU Mes is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <mes/lib.h>
+#include <errno.h>
+#include <stdlib.h>
+
+char*
+realpath(const char *restrict filename, char *restrict resolved)
+{
+ static int stub = 0;
+ if (__mes_debug () && !stub)
+ eputs ("realpath stub\n");
+ stub = 1;
+ errno = 0;
+ return 0;
+}
--
2.43.2