doxygen: prevent GPL license block from being parsed as doxygen comment.
[blender.git] / source / blender / blenlib / intern / winstuff.c
index ace677e..71eac3c 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  * Windows-posix compatibility layer, windows-specific functions.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef WIN32
 
 #include <stdlib.h>
 #include <stdio.h>
 
 #include "MEM_guardedalloc.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
+#include "BKE_utildefines.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_util.h"
 #define WIN32_SKIP_HKEY_PROTECTION             // need to use HKEY
 #include "BLI_winstuff.h"
 
-#include "BKE_utildefines.h" /* FILE_MAXDIR + FILE_MAXFILE */
+ /* FILE_MAXDIR + FILE_MAXFILE */
 
 int BLI_getInstallationDir( char * str ) {
        char dir[FILE_MAXDIR];
@@ -196,11 +194,55 @@ void get_default_root(char* root) {
        }
 }
 
-#else
+int check_file_chars(char *filename)
+{
+       char *p = filename;
+       while (*p) {
+               switch (*p) {
+                       case ':':
+                       case '?':
+                       case '*':
+                       case '|':
+                       case '\\':
+                       case '/':
+                       case '\"':
+                               return 0;
+                               break;
+               }
+
+               p++;
+       }
+       return 1;
+}
 
-static void BLI_WINSTUFF_C_IS_EMPTY_FOR_UNIX(void) 
+/* Copied from http://sourceware.org/ml/newlib/2005/msg00248.html */
+/* Copyright 2005 Shaun Jackman
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+#include <string.h>
+char* dirname(char *path)
 {
-  /*intentionally empty*/
+          char *p;
+          if( path == NULL || *path == '\0' )
+                          return ".";
+          p = path + strlen(path) - 1;
+          while( *p == '/' ) {
+                          if( p == path )
+                                          return path;
+                          *p-- = '\0';
+          }
+          while( p >= path && *p != '/' )
+                          p--;
+          return
+                          p < path ? "." :
+                          p == path ? "/" :
+                          (*p = '\0', path);
 }
+/* End of copied part */
+
+#else
+
+/* intentionally empty for UNIX */
 
 #endif