From 1c68ddaaa0ef7523ea1e9a8659a56c992f42aa70 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Thu, 13 Sep 2007 16:47:16 +0000 Subject: [PATCH] New file required for WIN32 --- motorApp/NewportSrc/strtok_r.cpp | 49 ++++++++++++++++++++++++++++++++ motorApp/NewportSrc/strtok_r.h | 4 +++ 2 files changed, 53 insertions(+) create mode 100755 motorApp/NewportSrc/strtok_r.cpp create mode 100755 motorApp/NewportSrc/strtok_r.h diff --git a/motorApp/NewportSrc/strtok_r.cpp b/motorApp/NewportSrc/strtok_r.cpp new file mode 100755 index 00000000..5ac6491b --- /dev/null +++ b/motorApp/NewportSrc/strtok_r.cpp @@ -0,0 +1,49 @@ + +#include "strtok_r.h" +#include + +char* strtok_r(char *s, const char *delim, char **lasts) +{ + char *spanp; + int c, sc; + char *tok; + + + if (s == NULL && (s = *lasts) == NULL) + return (NULL); + + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ + cont: + c = *s++; + for (spanp = (char *)delim; (sc = *spanp++) != 0;) { + if (c == sc) + goto cont; + } + + if (c == 0) { /* no non-delimiter characters */ + *lasts = NULL; + return (NULL); + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) { + c = *s++; + spanp = (char *)delim; + do { + if ((sc = *spanp++) == c) { + if (c == 0) + s = NULL; + else + s[-1] = 0; + *lasts = s; + return (tok); + } + } while (sc != 0); + } +} diff --git a/motorApp/NewportSrc/strtok_r.h b/motorApp/NewportSrc/strtok_r.h new file mode 100755 index 00000000..48aa61da --- /dev/null +++ b/motorApp/NewportSrc/strtok_r.h @@ -0,0 +1,4 @@ + + +/* strtok_r prototype */ +char* strtok_r(char *, const char *, char **); \ No newline at end of file