Commit of the code which was suggested by Georg as a fix for:
[cake.git] / rom / dos / getconsoletask.c
blob1e06f7f691443599dc96315e13a85c3fdd767ef1
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get the "task" belonging to the process's console.
6 Lang: English
7 */
9 #include "dos_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
14 NAME */
16 #include <dos/dosextens.h>
17 #include <proto/dos.h>
19 AROS_LH0(struct MsgPort *, GetConsoleTask,
21 /* SYNOPSIS */
22 /* void */
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 85, Dos)
27 /* FUNCTION
28 Return the console handler for the current Process. The return
29 type depends upon whether AROS is running binary compatible.
31 INPUTS
32 None.
34 RESULT
35 The address of the console handler, or NULL if none is set.
37 NOTES
38 You will only get NULL from this call if you call it on a Task,
39 or when the Process is not attached to a console.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 SetConsoleTask()
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct Process *me = (struct Process *)FindTask(NULL);
56 if (__is_task(me))
58 return NULL;
61 return (struct MsgPort *)me->pr_ConsoleTask;
63 AROS_LIBFUNC_EXIT
64 } /* GetConsoleTask */