From 0cfe78aeaa6d2518651154e039fdcd4000456229 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 21 Jul 2006 20:31:39 +0000 Subject: [PATCH] New word for opening a stream that can read and write to the same path -- only useful for *nix devices --- library/io/unix/files.factor | 7 ++++--- library/io/unix/io.factor | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/io/unix/files.factor b/library/io/unix/files.factor index e4a1228c23..865cbb29a3 100644 --- a/library/io/unix/files.factor +++ b/library/io/unix/files.factor @@ -1,7 +1,8 @@ -! Copyright (C) 2005 Slava Pestov. -! See http://factor.sf.net/license.txt for BSD license. +! Copyright (C) 2005, 2006 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. IN: io -USE: io-internals +USING: io-internals kernel ; : ( path -- stream ) open-read ; : ( path -- stream ) open-write ; +: ( path -- stream ) open-r/w dup ; diff --git a/library/io/unix/io.factor b/library/io/unix/io.factor index 2f12c802da..e7d25b8bca 100644 --- a/library/io/unix/io.factor +++ b/library/io/unix/io.factor @@ -295,6 +295,7 @@ M: port stream-close ( stream -- ) ] unless drop ; ! Make a duplex stream for reading/writing a pair of fds +: open-r/w ( path -- fd ) O_RDWR file-mode open dup io-error ; : ( infd outfd -- stream ) >r r> ;