add filesep & pathsep functions
[scilab.git] / scilab / modules / fileio / sci_gateway / c / sci_filesep.c
1 /*-----------------------------------------------------------------------------------*/\r
2 /* INRIA 2007 */\r
3 /* Allan CORNET */\r
4 /*-----------------------------------------------------------------------------------*/\r
5 #include "gw_fileio.h"\r
6 #include "stack-c.h"\r
7 #include "MALLOC.h"\r
8 #include "Scierror.h"\r
9 /*-----------------------------------------------------------------------------------*/\r
10 int C2F(sci_filesep) _PARAMS((char *fname,unsigned long fname_len))\r
11 {\r
12         static int n1,m1;\r
13         char *separator=NULL;\r
14 \r
15         CheckRhs(0,0);\r
16         CheckLhs(1,1);\r
17 \r
18         separator=(char*)MALLOC(sizeof(char)*(strlen(DIR_SEPARATOR)+1));\r
19         if (separator) strcpy(separator,DIR_SEPARATOR);\r
20 \r
21         n1 = 1;\r
22         CreateVarFromPtr(Rhs+1, "c",(m1=(int)strlen(separator), &m1),&n1,&separator);\r
23         LhsVar(1)=Rhs+1;\r
24         C2F(putlhsvar)();\r
25 \r
26         if (separator) {FREE(separator);separator=NULL;}\r
27 \r
28         return 0;\r
29 }\r
30 /*-----------------------------------------------------------------------------------*/\r
31 \r