Detabbed
[AROS.git] / rom / dos / setconsoletask.c
blob01401ac86ccdcb34322278e46ad86e45d4c0da43
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set the console handler for the current process.
6 Lang: english
7 */
8 #include <aros/debug.h>
10 #include "dos_intern.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
16 #include <dos/dosextens.h>
17 #include <proto/dos.h>
19 AROS_LH1(struct MsgPort *, SetConsoleTask,
21 /* SYNOPSIS */
22 AROS_LHA(struct MsgPort *, handler, D1),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 86, Dos)
27 /* FUNCTION
28 Set the console handler for the current process, and return the
29 old handler.
31 INPUTS
32 handler - The new console handler for the process.
34 RESULT
35 The address of the old handler.
37 NOTES
38 The use of Task in the name is because historically filesystem
39 handlers were tasks (instead of Devices).
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 GetConsoleTask()
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 APTR old;
55 struct Process *pr;
57 pr = (struct Process *)FindTask(NULL);
58 ASSERT_VALID_PROCESS(pr);
60 old = pr->pr_ConsoleTask;
61 pr->pr_ConsoleTask = handler;
63 return old;
65 AROS_LIBFUNC_EXIT
66 } /* SetConsoleTask */