summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/truncate.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix/truncate.c')
-rw-r--r--otherlibs/unix/truncate.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/otherlibs/unix/truncate.c b/otherlibs/unix/truncate.c
new file mode 100644
index 000000000..1226df122
--- /dev/null
+++ b/otherlibs/unix/truncate.c
@@ -0,0 +1,18 @@
+#include <mlvalues.h>
+#include "unix.h"
+
+#ifdef HAS_TRUNCATE
+
+value unix_truncate(path, len) /* ML */
+ value path, len;
+{
+ if (truncate(String_val(path), Long_val(len)) == -1)
+ uerror("truncate", path);
+ return Val_unit;
+}
+
+#else
+
+value unix_truncate() { invalid_argument("truncate not implemented"); }
+
+#endif