Indentation fix, cleanup.
[AROS.git] / rom / dos / waitforchar.c
blob1b1f78dc9ff74083274a4ac9a60e37bfcd46e69e
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Waits for a character to arrive at a filehandle.
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include "dos_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/dos.h>
15 #include <exec/types.h>
17 AROS_LH2(LONG, WaitForChar,
19 /* SYNOPSIS */
20 AROS_LHA(BPTR, file, D1),
21 AROS_LHA(LONG, timeout, D2),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 34, Dos)
26 /* FUNCTION
27 Wait for a character to arrive at a filehandle. The filehandle
28 can be either a console handle, or a regular file. For a regular
29 file most filesystems will return a character immediately, but
30 sometimes (for example, a network handler) the character may not
31 have arrived.
33 INPUTS
34 file - File to wait for a character on.
35 timeout - Number of microseconds to wait for the character
36 to arrive.
38 RESULT
39 != 0 if a character arrived before the timeout expired
40 == 0 if no character arrived
42 NOTES
43 Many filesystems do not implement this function.
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct FileHandle *fh = (struct FileHandle *)BADDR(file);
58 LONG status;
60 /* NULL-pointers are okay. */
61 if(file == BNULL)
62 return 0;
64 status = dopacket1(DOSBase, NULL, fh->fh_Type, ACTION_WAIT_CHAR, timeout);
65 return status;
67 AROS_LIBFUNC_EXIT
68 } /* WaitForChar */