summaryrefslogtreecommitdiff
path: root/nuttx/tools/mkdeps.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-13 20:24:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-13 20:24:30 +0000
commita0ebf07c2fc6e680fc440d52a0e477682cd641b7 (patch)
tree5cb43aa040cf2be867ecc2af6614546eeebdde66 /nuttx/tools/mkdeps.c
parentc2325703f1ba2889eff8ad2ef43fb38c958931d7 (diff)
downloadpx4-nuttx-a0ebf07c2fc6e680fc440d52a0e477682cd641b7.tar.gz
px4-nuttx-a0ebf07c2fc6e680fc440d52a0e477682cd641b7.tar.bz2
px4-nuttx-a0ebf07c2fc6e680fc440d52a0e477682cd641b7.zip
Centralized the definition of the INCDIR script in tools/Config.mk
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5346 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/tools/mkdeps.c')
-rw-r--r--nuttx/tools/mkdeps.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/nuttx/tools/mkdeps.c b/nuttx/tools/mkdeps.c
index a90595c98..c688b2b75 100644
--- a/nuttx/tools/mkdeps.c
+++ b/nuttx/tools/mkdeps.c
@@ -87,6 +87,75 @@ static char *g_topdir = NULL;
* Private Functions
****************************************************************************/
+ /* MinGW does not seem to provide strtok_r */
+
+#ifndef HAVE_STRTOK_R
+static char *strtok_r(char *str, const char *delim, char **saveptr)
+{
+ char *pbegin;
+ char *pend = NULL;
+
+ /* Decide if we are starting a new string or continuing from
+ * the point we left off.
+ */
+
+ if (str)
+ {
+ pbegin = str;
+ }
+ else if (saveptr && *saveptr)
+ {
+ pbegin = *saveptr;
+ }
+ else
+ {
+ return NULL;
+ }
+
+ /* Find the beginning of the next token */
+
+ for (;
+ *pbegin && strchr(delim, *pbegin) != NULL;
+ pbegin++);
+
+ /* If we are at the end of the string with nothing
+ * but delimiters found, then return NULL.
+ */
+
+ if (!*pbegin)
+ {
+ return NULL;
+ }
+
+ /* Find the end of the token */
+
+ for (pend = pbegin + 1;
+ *pend && strchr(delim, *pend) == NULL;
+ pend++);
+
+ /* pend either points to the end of the string or to
+ * the first delimiter after the string.
+ */
+
+ if (*pend)
+ {
+ /* Turn the delimiter into a null terminator */
+
+ *pend++ = '\0';
+ }
+
+ /* Save the pointer where we left off and return the
+ * beginning of the token.
+ */
+
+ if (saveptr)
+ {
+ *saveptr = pend;
+ }
+ return pbegin;
+}
+#endif
+
static void append(char **base, char *str)
{
char *oldbase;