1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2013 - Scilab Enterprises - Cedric Delamarre
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  *
14  */
15 /*--------------------------------------------------------------------------*/
16 #include "filemanager.hxx"
17 #include "file.hxx"
18 
19 extern "C" {
20 #include "getfiletype.h"
21 }
22 /*--------------------------------------------------------------------------*/
C2F(getfiletype)23 void C2F(getfiletype)(int *fd, int *type, int *ierr)
24 {
25     if (*fd < 0)
26     {
27         *ierr = 1;
28         return;
29     }
30 
31     types::File* pFile = FileManager::getFile(*fd);
32 
33     if (*fd >= FileManager::getFileMaxID() || pFile == NULL || pFile->getFileType() == 0)
34     {
35         *ierr = 2;
36         return;
37     }
38 
39     *type = pFile->getFileType();
40     *ierr = 0;
41 }
42 /*--------------------------------------------------------------------------*/
43