bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] lib: Add putenv stub.


From: Andrius Štikonas
Subject: [PATCH] lib: Add putenv stub.
Date: Sat, 1 Jun 2024 21:02:51 +0100

* lib/stub/putenv.c: New file.
* build-aux/configure-lib.sh (libc_tcc_SOURCES): Add it.
* include/stdlib.h (putenv): New declaration.
---
 build-aux/configure-lib.sh |  1 +
 include/stdlib.h           |  1 +
 lib/stub/putenv.c          | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 lib/stub/putenv.c

diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh
index 26ab1299..d70e432d 100644
--- a/build-aux/configure-lib.sh
+++ b/build-aux/configure-lib.sh
@@ -328,6 +328,7 @@ lib/stub/sigaction.c
 lib/stub/ldexp.c
 lib/stub/mprotect.c
 lib/stub/localtime.c
+lib/stub/putenv.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 01a387b4..ec622372 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -49,6 +49,7 @@ char *getenv (char const *s);
 int setenv (char const *s, char const *v, int overwrite_p);
 void unsetenv (char const *name);
 void *malloc (size_t);
+int putenv(char *string);
 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);
diff --git a/lib/stub/putenv.c b/lib/stub/putenv.c
new file mode 100644
index 00000000..4f5e6aa8
--- /dev/null
+++ b/lib/stub/putenv.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>
+
+int
+putenv(char *string)
+{
+  static int stub = 0;
+  if (__mes_debug () && !stub)
+    eputs ("putenv stub\n");
+  stub = 1;
+  errno = 0;
+  return 0;
+}
-- 
2.44.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]