* lib/linux/_getcwd.c: Rename from getcwd.c.
* lib/linux/_open3.c: Rename from open.c.
* lib/posix/getcwd.c: New file with bits from ../linux/getcwd.c.
* lib/posix/open.c: New file with bits ../linux/getcwd.c.
* build-aux/build-lib.sh (libc_SOURCES): Update.
lib/mes/__assert_fail.c
lib/mes/__mes_debug.c
lib/posix/execv.c
+lib/posix/getcwd.c
lib/posix/getenv.c
lib/posix/isatty.c
lib/posix/read.c
+lib/posix/open.c
lib/posix/setenv.c
lib/posix/wait.c
lib/stdio/fgetc.c
lib/linux/execve.c
lib/linux/fork.c
lib/linux/fsync.c
-lib/linux/getcwd.c
+lib/linux/_getcwd.c
lib/linux/gettimeofday.c
lib/linux/ioctl.c
-lib/linux/open.c
+lib/linux/_open3.c
lib/linux/_read.c
lib/linux/time.c
lib/linux/unlink.c
int fdputc (int c, int fd);
int fdputs (char const *s, int fd);
int fdungetc (int c, int fd);
+char * _getcwd (char *buffer, size_t size);
int isnumber (int c, int base);
int mes_open (char const *file_name, int flags, int mask);
int _open2 (char const *file_name, int flags);
--- /dev/null
+/* -*-comment-start: "//";comment-end:""-*-
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ *
+ * 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-mini.h>
+#include <linux/syscall.h>
+#include <syscall.h>
+
+char *
+_getcwd (char *buffer, size_t size)
+{
+ int r = _sys_call2 (SYS_getcwd, (long) buffer, (long) size);
+ if (r >= 0)
+ return buffer;
+ return 0;
+}
--- /dev/null
+/* -*-comment-start: "//";comment-end:""-*-
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ *
+ * 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 <linux/syscall.h>
+#include <syscall.h>
+#include <mes/lib.h>
+#include <fcntl.h>
+
+int
+_open3 (char const *file_name, int flags, int mask)
+{
+ int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask);
+ __ungetc_init ();
+ if (r > 2)
+ __ungetc_clear (r);
+ return r;
+}
+++ /dev/null
-/* -*-comment-start: "//";comment-end:""-*-
- * GNU Mes --- Maxwell Equations of Software
- * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
- *
- * 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 <linux/syscall.h>
-#include <syscall.h>
-#include <limits.h>
-#include <sys/types.h>
-
-char *
-_getcwd (char *buffer, size_t size)
-{
- int r = _sys_call2 (SYS_getcwd, (long) buffer, (long) size);
- if (r >= 0)
- return buffer;
- return 0;
-}
-
-char *
-getcwd (char *buffer, size_t size)
-{
- static char buf[PATH_MAX];
- if (buffer)
- return _getcwd (buffer, size);
- return _getcwd (buf, PATH_MAX);
-}
+++ /dev/null
-/* -*-comment-start: "//";comment-end:""-*-
- * GNU Mes --- Maxwell Equations of Software
- * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
- *
- * 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 <linux/syscall.h>
-#include <syscall.h>
-#include <mes/lib.h>
-#include <fcntl.h>
-#include <stdarg.h>
-
-int
-_open3 (char const *file_name, int flags, int mask)
-{
- int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask);
- __ungetc_init ();
- if (r > 2)
- __ungetc_clear (r);
- return r;
-}
-
-int
-_open2 (char const *file_name, int flags)
-{
- int mask = 0777;
- return _open3 (file_name, flags, mask);
-}
-
-int
-open (char const *file_name, int flags, ...)
-{
- va_list ap;
- va_start (ap, flags);
- int mask = va_arg (ap, int);
- int r = _open3 (file_name, flags, mask);
- va_end (ap);
- return r;
-}
--- /dev/null
+/* -*-comment-start: "//";comment-end:""-*-
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ *
+ * 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 <limits.h>
+#include <sys/types.h>
+
+char *
+getcwd (char *buffer, size_t size)
+{
+ static char buf[PATH_MAX];
+ if (buffer)
+ return _getcwd (buffer, size);
+ return _getcwd (buf, PATH_MAX);
+}
--- /dev/null
+/* -*-comment-start: "//";comment-end:""-*-
+ * GNU Mes --- Maxwell Equations of Software
+ * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ *
+ * 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 <fcntl.h>
+#include <stdarg.h>
+
+int
+_open2 (char const *file_name, int flags)
+{
+ int mask = 0777;
+ return _open3 (file_name, flags, mask);
+}
+
+int
+open (char const *file_name, int flags, ...)
+{
+ va_list ap;
+ va_start (ap, flags);
+ int mask = va_arg (ap, int);
+ int r = _open3 (file_name, flags, mask);
+ va_end (ap);
+ return r;
+}
lib/mes/__assert_fail.c\
lib/mes/__mes_debug.c\
lib/posix/execv.c\
+ lib/posix/getcwd.c\
lib/posix/getenv.c\
lib/posix/isatty.c\
+ lib/posix/open.c\
lib/posix/setenv.c\
lib/posix/wait.c\
lib/stdio/fgetc.c\
lib/linux/execve.c\
lib/linux/fork.c\
lib/linux/fsync.c\
- lib/linux/getcwd.c\
+ lib/linux/_getcwd.c\
lib/linux/gettimeofday.c\
lib/linux/ioctl.c\
- lib/linux/open.c\
+ lib/linux/_open3.c\
lib/linux/read.c\
lib/linux/time.c\
lib/linux/unlink.c\