define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / compiler / clib / __get_default_file.c
blob00d5c6fa2d8aa524eddcbd1bcb05bca27f42256f
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Function to get a dos.library file handle associated with given file
6 descriptor.
7 */
9 #include "__arosc_privdata.h"
10 #include "__open.h"
12 /*****************************************************************************
14 NAME */
16 int __get_default_file (
18 /* SYNOPSIS */
19 int file_descriptor,
20 long * file_handle)
22 /* FUNCTION
23 Gets dos.library file handle associated with a given file descriptor.
25 INPUTS
26 file_descriptor - the File Descriptor you wish to obtain the associated
27 file handle for.
28 file_handle - Pointer to store the associated file handle.
30 RESULT
31 !=0 on error, 0 on success.
33 NOTES
34 This function is not a part of the ISO C standard, it comes from clib2
35 project and was implemented to make porting of abc-shell easier.
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 ******************************************************************************/
47 if(
48 file_descriptor < 0 ||
49 file_descriptor > __numslots ||
50 !__fd_array[file_descriptor]
51 ) return -1;
52 else
54 *(BPTR*)file_handle = (BPTR) __fd_array[file_descriptor]->fcb->fh;
56 return 0;