# there HAS to be a better way to do this...
#define IS_BACKSLASH(c) ((c) == '/')
+#ifdef PHP_WIN32
+/* stupid-ass non-extern declaration in tsrm_strtok.h breaks dumbass MS compiler */
+static inline int in_character_class(char ch, const char *delim)
+{
+ while (*delim) {
+ if (*delim == ch) {
+ return 1;
+ }
+ delim++;
+ }
+ return 0;
+}
+
+char *tsrm_strtok_r(char *s, const char *delim, char **last)
+{
+ char *token;
+
+ if (s == NULL) {
+ s = *last;
+ }
+
+ while (*s && in_character_class(*s, delim)) {
+ s++;
+ }
+ if (!*s) {
+ return NULL;
+ }
+
+ token = s;
+
+ while (*s && !in_character_class(*s, delim)) {
+ s++;
+ }
+ if (!*s) {
+ *last = s;
+ } else {
+ *s = '\0';
+ *last = s + 1;
+ }
+ return token;
+}
+#endif
+
/**
* Remove .. and . references within a phar filename
*/
#include "ext/standard/sha1.h"
#include "ext/standard/php_var.h"
#include "ext/standard/php_smart_str.h"
+#ifndef PHP_WIN32
#include "TSRM/tsrm_strtok_r.h"
+#endif
#if HAVE_SPL
#include "ext/spl/spl_array.h"
#include "ext/spl/spl_directory.h"
#endif
BEGIN_EXTERN_C()
+#ifdef PHP_WIN32
+char *tsrm_strtok_r(char *s, const char *delim, char **last);
+#endif
void phar_request_initialize(TSRMLS_D);