From: John Benediktsson Date: Fri, 26 Oct 2012 04:51:08 +0000 (-0700) Subject: unix: adding truncate-file. X-Git-Tag: 0.97~2145 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=7b50fd3601f4fc82f6c76f3acc01d636192e47a7 unix: adding truncate-file. --- 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 -- )