shithub: npe

Download patch

ref: 79415728d062bab70c67feef94aa59b49648db12
parent: 5d1e15c890a322d1beca4dcae8af685b970b7c21
author: Noam Preil <noam@pixelhero.dev>
date: Thu Dec 11 23:33:33 EST 2025

expanded support for janet

--- a/include/npe/errno.h
+++ b/include/npe/errno.h
@@ -5,6 +5,7 @@
 
 enum {
 	ENOENT = 2,
+	EEXIST = 8,
 	EACCES = 13,
 	EISDIR = 14,
 	EINVAL = 22,
--- a/include/npe/stdlib.h
+++ b/include/npe/stdlib.h
@@ -16,6 +16,7 @@
 #define EXIT_FAILURE 1
 
 int setenv(char *name, char *value, int overwrite);
+int unsetenv(char *name);
 char *realpath(char *path, char *buffer);
 int mkstemp(char *t);
 div_t div(int n, int d);
--- a/include/npe/time.h
+++ b/include/npe/time.h
@@ -38,5 +38,7 @@
 size_t strftime(char *s, size_t max, const char *format, const struct tm *tm);
 time_t mktime(struct tm *tm);
 int clock_gettime(clockid_t clockid, struct timespec *tp);
+int nanosleep(struct timespec *req, struct timespec *rem);
+
 
 #endif
--- a/include/npe/unistd.h
+++ b/include/npe/unistd.h
@@ -43,11 +43,19 @@
 #define stat npe_stat
 #define fstat npe_fstat
 
+typedef int mode_t;
+
 struct stat {
 	uvlong st_size;
-	int st_mode;
+	mode_t st_mode;
 	long st_mtime;
 	long st_atime;
+	long st_ctime;
+	int st_dev, st_ino;
+	int st_nlink;
+	int st_uid, st_gid;
+	int st_rdev;
+	int st_blocks, st_blksize;
 };
 
 int npe_stat(char *filename, struct stat *buf);
--- a/libnpe/mkfile
+++ b/libnpe/mkfile
@@ -51,6 +51,7 @@
 	mkdir.$O\
 	mkstemp.$O\
 	mktime.$O\
+	nanosleep.$O\
 	opendir.$O\
 	pclose.$O\
 	popen.$O\
--- a/libnpe/setenv.c
+++ b/libnpe/setenv.c
@@ -13,3 +13,9 @@
 
 	return putenv(name, value);
 }
+
+int
+unsetenv(char *name)
+{
+	return remove(name);
+}
--