fix linux startup after fcddafe
[scilab.git] / scilab / modules / windows_tools / src / c / scilab_windows / ConvertSlash.c
index e81683d..63523c5 100644 (file)
@@ -1,62 +1,72 @@
-/*\r
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\r
- * Copyright (C) 2008 - INRIA - Allan CORNET\r
- * \r
- * This file must be used under the terms of the CeCILL.\r
- * This source file is licensed as described in the file COPYING, which\r
- * you should have received as part of this distribution.  The terms\r
- * are also available at    \r
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt\r
- *\r
- */\r
-/*--------------------------------------------------------------------------*/\r
-#include <string.h>\r
-#include "ConvertSlash.h"\r
-/*--------------------------------------------------------------------------*/\r
-#define UNIX_SEPATATOR '/'\r
-#define WINDOWS_SEPATATOR '\\'\r
-/*--------------------------------------------------------------------------*/\r
-static BOOL convertSlash(char *path_in,char *path_out,BOOL slashToAntislash);\r
-/*--------------------------------------------------------------------------*/\r
-BOOL slashToAntislash(char *pathunix,char *pathwindows)\r
-{\r
-       return convertSlash(pathunix,pathwindows,TRUE);\r
-}\r
-/*--------------------------------------------------------------------------*/\r
-BOOL AntislashToSlash(char *pathwindows,char *pathunix)\r
-{\r
-       return convertSlash(pathwindows,pathunix,FALSE);\r
-}\r
-/*--------------------------------------------------------------------------*/\r
-static BOOL convertSlash(char *path_in,char *path_out,BOOL slashToAntislash)\r
-{\r
-       BOOL bOK = FALSE;\r
-       if ( (path_in) && (path_out) )\r
-       {\r
-               int i=0;\r
-               strcpy(path_out,path_in);\r
-               for (i=0;i<(int)strlen(path_out);i++)\r
-               {\r
-                       if ( slashToAntislash )\r
-                       {\r
-                               if (path_in[i] == UNIX_SEPATATOR) \r
-                               {\r
-                                       path_out[i] = WINDOWS_SEPATATOR;\r
-                                       bOK = TRUE;\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               if (path_in[i] == WINDOWS_SEPATATOR) \r
-                               {\r
-                                       path_out[i] = UNIX_SEPATATOR;\r
-                                       bOK = TRUE;\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       else bOK = FALSE;\r
-\r
-       return bOK;\r
-}\r
-/*--------------------------------------------------------------------------*/\r
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA - Allan CORNET
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ */
+/*--------------------------------------------------------------------------*/
+#include <string.h>
+#include "BOOL.h"
+#include "dynlib_scilab_windows.h"
+/*--------------------------------------------------------------------------*/
+#define UNIX_SEPATATOR '/'
+#define WINDOWS_SEPATATOR '\\'
+/*--------------------------------------------------------------------------*/
+static BOOL convertSlash(char *path_in, char *path_out, BOOL slashToAntislash);
+/*--------------------------------------------------------------------------*/
+SCILAB_WINDOWS_IMPEXP BOOL slashToAntislash(char *pathunix, char *pathwindows)
+{
+    return convertSlash(pathunix, pathwindows, TRUE);
+}
+/*--------------------------------------------------------------------------*/
+SCILAB_WINDOWS_IMPEXP BOOL AntislashToSlash(char *pathwindows, char *pathunix)
+{
+    return convertSlash(pathwindows, pathunix, FALSE);
+}
+/*--------------------------------------------------------------------------*/
+static BOOL convertSlash(char *path_in, char *path_out, BOOL slashToAntislash)
+{
+    BOOL bOK = FALSE;
+    if ( (path_in) && (path_out) )
+    {
+        int i = 0;
+        int len_path_out = 0;
+        strcpy(path_out, path_in);
+        len_path_out = (int)strlen(path_out);
+
+        for (i = 0; i < len_path_out; i++)
+        {
+            if ( slashToAntislash )
+            {
+                if (path_in[i] == UNIX_SEPATATOR)
+                {
+                    path_out[i] = WINDOWS_SEPATATOR;
+                    bOK = TRUE;
+                }
+            }
+            else
+            {
+                if (path_in[i] == WINDOWS_SEPATATOR)
+                {
+                    path_out[i] = UNIX_SEPATATOR;
+                    bOK = TRUE;
+                }
+            }
+        }
+    }
+    else
+    {
+        return FALSE;
+    }
+
+    return bOK;
+}
+/*--------------------------------------------------------------------------*/