split sci_fileio.c and remove C2F
[scilab.git] / scilab / modules / fileio / sci_gateway / c / sci_filesep.c
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2007 - INRIA - Allan CORNET
4  * ...
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  */
13 /*--------------------------------------------------------------------------*/
14 #include "gw_fileio.h"
15 #include "stack-c.h"
16 #include "MALLOC.h"
17 #include "Scierror.h"
18 /*--------------------------------------------------------------------------*/
19 int sci_filesep(char *fname,unsigned long fname_len)
20 {
21         static int n1,m1;
22         char *separator=NULL;
23
24         CheckRhs(0,0);
25         CheckLhs(1,1);
26
27         separator=(char*)MALLOC(sizeof(char)*(strlen(DIR_SEPARATOR)+1));
28         if (separator) strcpy(separator,DIR_SEPARATOR);
29
30         n1 = 1;
31         CreateVarFromPtr(Rhs+1,STRING_DATATYPE,(m1=(int)strlen(separator), &m1),&n1,&separator);
32         LhsVar(1)=Rhs+1;
33         C2F(putlhsvar)();
34
35         if (separator) {FREE(separator);separator=NULL;}
36
37         return 0;
38 }
39 /*--------------------------------------------------------------------------*/
40