summaryrefslogtreecommitdiff
path: root/nuttx/tools
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-22 14:48:29 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-22 14:48:29 -0600
commit2c743749420b1fd6ad9cee20de829e7b580b6bb7 (patch)
tree694cad301c08cdcc43e9b569a02ed241b6eaf434 /nuttx/tools
parent440d27c51fed1c66e883a6d0584599e2d0569a94 (diff)
downloadpx4-nuttx-2c743749420b1fd6ad9cee20de829e7b580b6bb7.tar.gz
px4-nuttx-2c743749420b1fd6ad9cee20de829e7b580b6bb7.tar.bz2
px4-nuttx-2c743749420b1fd6ad9cee20de829e7b580b6bb7.zip
Changes to try to get P112 to compile with laster SDCC (it still does not)
Diffstat (limited to 'nuttx/tools')
-rw-r--r--nuttx/tools/bdf-converter.c77
-rw-r--r--nuttx/tools/mkdeps.c11
2 files changed, 85 insertions, 3 deletions
diff --git a/nuttx/tools/bdf-converter.c b/nuttx/tools/bdf-converter.c
index 2c4efa1ec..a93da0f2b 100644
--- a/nuttx/tools/bdf-converter.c
+++ b/nuttx/tools/bdf-converter.c
@@ -116,6 +116,83 @@ typedef struct nx_fontmetric_s
****************************************************************************/
/****************************************************************************
+ * Name: MY_strtok_r
+ *
+ * Description:
+ * MinGW does not seem to provide strtok_r
+ *
+ ****************************************************************************/
+
+#ifndef HAVE_STRTOK_R
+static char *MY_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;
+}
+
+#define strtok_r MY_strtok_r
+#endif
+
+/****************************************************************************
* Name: trimLine
*
* Description:
diff --git a/nuttx/tools/mkdeps.c b/nuttx/tools/mkdeps.c
index a4bc68955..c0b71e707 100644
--- a/nuttx/tools/mkdeps.c
+++ b/nuttx/tools/mkdeps.c
@@ -473,7 +473,7 @@ static void do_dependency(const char *file, char separator)
dotptr = strrchr(objname, '.');
if (dotptr)
{
- dotptr = '\0';
+ *dotptr = '\0';
}
snprintf(tmp, NAME_MAX+6, " -MT %s" DELIM "%s%s ",
@@ -515,7 +515,7 @@ static void do_dependency(const char *file, char separator)
g_command[cmdlen] = '\0';
/* Make a copy of g_altpath. We need to do this because at least the version
- * of strtok_r above does modifie it.
+ * of strtok_r above does modify it.
*/
alloc = strdup(g_altpath);
@@ -598,6 +598,11 @@ static void do_dependency(const char *file, char separator)
* from the compiler is in WEXITSTATUS(ret).
*/
+ if (g_debug)
+ {
+ fprintf(stderr, "Executing: %s\n", g_command);
+ }
+
ret = system(g_command);
#ifdef WEXITSTATUS
if (ret < 0 || WEXITSTATUS(ret) != 0)
@@ -687,7 +692,7 @@ static char *cywin2windows(const char *str, const char *append, enum slashmode_e
drive = toupper(*str);
if (drive < 'A' || drive > 'Z')
{
- fprintf(stderr, "ERROR: Drive charager: \"%s\"\n", str);
+ fprintf(stderr, "ERROR: Drive character: \"%s\"\n", str);
exit(EXIT_FAILURE);
}