Commit of the code which was suggested by Georg as a fix for:
[cake.git] / rom / dos / setmode.c
blob07fcab1db92689520ef0b0d9b77c76630c04ff71
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set the current mode of a console device.
6 Lang: english
7 */
8 #include "dos_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/dos.h>
15 AROS_LH2(LONG, SetMode,
17 /* SYNOPSIS */
18 AROS_LHA(BPTR, fh, D1),
19 AROS_LHA(LONG, mode, D2),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 71, Dos)
24 /* FUNCTION
25 SetMode() can be used to change a console handler between
26 RAW: mode and CON: mode.
28 INPUTS
29 fh - The filehandle describing the console.
30 mode - The new mode of the console:
31 1 - RAW: mode
32 0 - CON: mode
34 RESULT
35 This function will return whether it succeeded:
37 == DOSTRUE console mode changed
38 != DOSTRUE console mode change failed.
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct IOFileSys iofs;
55 struct FileHandle *fha = (struct FileHandle *)BADDR(fh);
57 InitIOFS(&iofs, FSA_CONSOLE_MODE, DOSBase);
59 iofs.IOFS.io_Device = fha->fh_Device;
60 iofs.IOFS.io_Unit = fha->fh_Unit;
62 iofs.io_Union.io_CONSOLE_MODE.io_ConsoleMode = mode;
64 DosDoIO(&iofs.IOFS);
66 SetIoErr(iofs.io_DosError);
68 return iofs.io_DosError == 0 ? DOSTRUE : DOSFALSE;
70 AROS_LIBFUNC_EXIT
71 } /* SetMode */