From 7b50fd3601f4fc82f6c76f3acc01d636192e47a7 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 25 Oct 2012 21:51:08 -0700 Subject: [PATCH] unix: adding truncate-file. --- basis/unix/ffi/ffi.factor | 2 ++ basis/unix/unix.factor | 2 ++ 2 files changed, 4 insertions(+) diff --git a/basis/unix/ffi/ffi.factor b/basis/unix/ffi/ffi.factor index ba1b7646d2..8d8f6d4197 100644 --- a/basis/unix/ffi/ffi.factor +++ b/basis/unix/ffi/ffi.factor @@ -176,6 +176,8 @@ FUNCTION: int setuid ( uid_t uid ) ; FUNCTION: int socket ( int domain, int type, int protocol ) ; FUNCTION: int symlink ( c-string path1, c-string path2 ) ; FUNCTION: int link ( c-string path1, c-string path2 ) ; +FUNCTION: int ftruncate ( int fd, int length ) ; +FUNCTION: int truncate ( c-string path, int length ) ; FUNCTION: int unlink ( c-string path ) ; FUNCTION: int utimes ( c-string path, timeval[2] times ) ; FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ; diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index 7d5549e433..3ac845aab4 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -56,6 +56,8 @@ M: unix open-file [ open ] unix-system-call ; : make-fifo ( path mode -- ) [ mkfifo ] unix-system-call drop ; +: truncate-file ( path n -- ) [ truncate ] unix-system-call drop ; + : touch ( filename -- ) f [ utime ] unix-system-call drop ; : change-file-times ( filename access modification -- ) -- 2.34.1