shithub: npe

Download patch

ref: 2565da9396836897b97d335f19f177f993274407
parent: ffcac5481aa489250d0752f69c1bbbf0f0ae1977
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Aug 16 21:25:17 EDT 2023

npe: add div

--- a/include/npe/stdlib.h
+++ b/include/npe/stdlib.h
@@ -3,6 +3,14 @@
 
 #include <npe.h>
 
+typedef struct div_t div_t;
+
+struct div_t
+{
+	int quot;
+	int rem;
+};
+
 #define RAND_MAX 32767
 #define EXIT_SUCCESS 0
 #define EXIT_FAILURE 1
@@ -10,5 +18,6 @@
 int setenv(char *name, char *value, int overwrite);
 char *realpath(char *path, char *buffer);
 int mkstemp(char *t);
+div_t div(int n, int d);
 
 #endif
--- /dev/null
+++ b/libnpe/div.c
@@ -1,0 +1,7 @@
+#include <stdlib.h>
+
+div_t
+div(int n, int d)
+{
+	return (div_t){n/d, n%d};
+}
--- a/libnpe/mkfile
+++ b/libnpe/mkfile
@@ -16,8 +16,10 @@
 	closedir.$O\
 	dirfd.$O\
 	dirname.$O\
+	div.$O\
 	fstat.$O\
 	exp2.$O\
+	fmax.$O\
 	fstatat.$O\
 	fts_children.$O\
 	fts_close.$O\