Update to lasso handling. Adjust scroll amount based on difference between mouse...
[AROS.git] / rom / dos / pipe.c
blob8316f80ad6179202b137cefa88a0e7ee7428f838
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id: /aros/dos/src/rom/dos/open.c 26802 2007-06-11T21:17:31.715385Z rob $
5 Desc: Creates a pair of filehandles connected to each other
6 Lang: english
7 */
8 #include <exec/memory.h>
9 #include <exec/lists.h>
10 #include <proto/exec.h>
11 #include <utility/tagitem.h>
12 #include <dos/dosextens.h>
13 #include <dos/filesystem.h>
14 #include <dos/stdio.h>
15 #include <proto/dos.h>
16 #include <proto/utility.h>
17 #include "dos_intern.h"
19 /*****************************************************************************
21 NAME */
22 #include <proto/dos.h>
24 AROS_LH3(LONG, Pipe,
26 /* SYNOPSIS */
27 AROS_LHA(CONST_STRPTR, name, D1),
28 AROS_LHA(BPTR, *reader, D2),
29 AROS_LHA(BPTR, *writer, D3),
31 /* LOCATION */
32 struct DosLibrary *, DOSBase, 160, Dos)
34 /* FUNCTION
35 Creates a pair of file handles connected to each other
37 INPUTS
38 name - NULL-terminated name of the file
39 reader - Pointer to BPTR to store read handle in
40 writer - Pointer to BPTR to store write handle in
42 RESULT
43 DOSTRUE on success, DOSFALSE on failure. IoErr() gives additional
44 information if the call failed.
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct FileHandle *rfh, *wfh;
61 struct IOFileSys iofs;
62 LONG err;
64 if ((rfh = (struct FileHandle *) AllocDosObject(DOS_FILEHANDLE, NULL)) == NULL) {
65 return DOSFALSE;
67 if ((wfh = (struct FileHandle *) AllocDosObject(DOS_FILEHANDLE, NULL)) == NULL) {
68 return DOSFALSE;
71 InitIOFS(&iofs, FSA_PIPE, DOSBase);
72 err = DoIOFS(&iofs, NULL, name, DOSBase);
74 if (err != 0) {
75 FreeDosObject(DOS_FILEHANDLE, rfh);
76 FreeDosObject(DOS_FILEHANDLE, wfh);
77 return DOSFALSE;
80 rfh->fh_Device = iofs.IOFS.io_Device;
81 rfh->fh_Unit = iofs.IOFS.io_Unit;
83 wfh->fh_Device = iofs.IOFS.io_Device;
84 wfh->fh_Unit = iofs.io_Union.io_PIPE.io_Writer;
86 if (IsInteractive(MKBADDR(rfh)))
87 SetVBuf(MKBADDR(rfh), NULL, BUF_LINE, -1);
89 if (IsInteractive(MKBADDR(wfh)))
90 SetVBuf(MKBADDR(wfh), NULL, BUF_LINE, -1);
92 *reader = MKBADDR(rfh);
93 *writer = MKBADDR(wfh);
95 return DOSTRUE;
97 AROS_LIBFUNC_EXIT
98 } /* Pipe */