aboutsummaryrefslogtreecommitdiff
path: root/jimiocompat.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2024-04-26 18:57:53 +1000
committerSteve Bennett <steveb@workware.net.au>2024-04-26 18:57:53 +1000
commitbc2a0226c524de0ca8755c9328d26aa89a81d998 (patch)
tree4ed741adf862f3f0c82659d7195e9ae30d27101a /jimiocompat.c
parent4b980e667b2a07f5ea3aeb437079db9be6f89979 (diff)
downloadjimtcl-kos-fixes.zip
jimtcl-kos-fixes.tar.gz
jimtcl-kos-fixes.tar.bz2
fixes for kos-portskos-fixes
Ticket #303 Some of these (like missing getpeername) are reasonable, but it seems like an odd platform that declares but doesn't implement access and umask, and implements but doesn't declare lstat. These changes need testing to see if enough works to be useful.
Diffstat (limited to 'jimiocompat.c')
-rw-r--r--jimiocompat.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/jimiocompat.c b/jimiocompat.c
index 8e7f3f2..1384e61 100644
--- a/jimiocompat.c
+++ b/jimiocompat.c
@@ -249,3 +249,21 @@ int Jim_OpenForRead(const char *filename)
}
#endif
+
+#ifndef HAVE_UMASK
+mode_t umask(mode_t mode) {
+ return 0;
+}
+#endif
+
+#ifndef HAVE_ACCESS
+/* poor-mans access() - ignore mode and treat everything as F_OK */
+int access(const char *path, int mode)
+{
+ struct stat sb;
+ if (Jim_Stat(path, &sb) == 0 && S_ISREG(sb.st_mode)) {
+ return 0;
+ }
+ return -1;
+}
+#endif