Fix Cygwin gcc compiling
[bonanza.git] / proce.c
diff --git a/proce.c b/proce.c
index 81707f9..8556ef1 100644 (file)
--- a/proce.c
+++ b/proce.c
@@ -109,6 +109,24 @@ int CONV is_move( const char *str )
 }
 
 
+#if defined(_WIN32)
+char *
+strtok_r( char *s, const char *t, char **next)
+{
+  char *p, *r;
+  if( ! s ) s = *next;
+  if( ! s ) return NULL;
+  while( *s && strchr(t, *s) ) s++;
+  if( ! *s ) return NULL;
+  r = s; 
+  while( *s && ! (p = strchr(t, *s)) ) s++;
+  *next = s + 1;
+  if( ! *s ) *next = NULL;
+  *s = '\0';
+  return r; 
+}
+#endif
+
 int CONV
 procedure( tree_t * restrict ptree )
 {