Do not try to get stack pointer from invalid ESP field, which coincidentally
[AROS.git] / rom / dos / isinteractive.c
blobed2abe395ae5496d0f131748bb7f4441ccb267b0
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Query a filesystem for interactiveness.
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include <dos/filesystem.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH1(LONG, IsInteractive,
19 /* SYNOPSIS */
20 AROS_LHA(BPTR, file, D1),
22 /* LOCATION */
23 struct DosLibrary *, DOSBase, 36, Dos)
25 /* FUNCTION
26 Check if file is bound to an interactive device such as a console
27 or shell window.
29 INPUTS
30 file - filehandle
32 RESULT
33 != 0 if the file is interactive, 0 if it is not.
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 /* Get pointer to filehandle */
50 struct FileHandle *fh=(struct FileHandle *)BADDR(file);
52 /* Get pointer to I/O request. Use stackspace for now. */
53 struct IOFileSys iofs;
55 /* Prepare I/O request. */
56 InitIOFS(&iofs, FSA_IS_INTERACTIVE, DOSBase);
58 iofs.IOFS.io_Device = fh->fh_Device;
59 iofs.IOFS.io_Unit = fh->fh_Unit;
61 /* Send the request. */
62 DosDoIO(&iofs.IOFS);
64 /* Return */
65 if(iofs.io_DosError != 0)
66 return 0;
67 else
68 return iofs.io_Union.io_IS_INTERACTIVE.io_IsInteractive;
70 AROS_LIBFUNC_EXIT
71 } /* IsInteractive */