From 7a6743a8701639b88103399b20af3e4425e1b68d Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 3 Sep 2012 15:16:32 +0000 Subject: configure.sh now will ignore appconfig files if CONFIG_NUTTX_NEWCONFIG is defined git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5080 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/tools/configure.sh | 18 ++++++++++++++++-- nuttx/tools/csvparser.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/nuttx/tools/configure.sh b/nuttx/tools/configure.sh index 8b4a3e4860..0d6c412a5c 100755 --- a/nuttx/tools/configure.sh +++ b/nuttx/tools/configure.sh @@ -115,6 +115,18 @@ if [ ! -r "${configpath}/defconfig" ]; then exit 6 fi +# Extract values needed from the defconfig file. We need: +# (1) The CONFIG_NUTTX_NEWCONFIG setting to know if this is a "new" style +# configuration, and +# (2) The CONFIG_APPS_DIR to see if there is a configured location for the +# application directory. + +newconfig=`grep CONFIG_NUTTX_NEWCONFIG= "${configpath}/defconfig" | cut -d'=' -f2` + +if [ -z "${appdir}" ]; then + appdir=`grep CONFIG_APPS_DIR= "${configpath}/defconfig" | cut -d'=' -f2` +fi + # Check for the apps/ dir in the usual place if appdir was not provided if [ -z "${appdir}" ]; then @@ -150,9 +162,11 @@ chmod 755 "${TOPDIR}/setenv.sh" install -C "${configpath}/defconfig" "${TOPDIR}/.configX" || \ { echo "Failed to copy ${configpath}/defconfig" ; exit 9 ; } -# Copy option appconfig +# Copy appconfig file. The appconfig file will be copied to ${appdir}/.config +# if both (1) ${appdir} is defined and (2) we are not using the new configuration +# (which does not require a .config file in the appsdir. -if [ ! -z "${appdir}" ]; then +if [ ! -z "${appdir}" -a "X${newconfig}" != "Xy" ]; then if [ ! -r "${configpath}/appconfig" ]; then echo "NOTE: No readable appconfig file found in ${configpath}" else diff --git a/nuttx/tools/csvparser.c b/nuttx/tools/csvparser.c index 739e5e1f8b..3f1916e2bf 100644 --- a/nuttx/tools/csvparser.c +++ b/nuttx/tools/csvparser.c @@ -67,17 +67,27 @@ int g_lineno; * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: skip_space + ****************************************************************************/ + static char *skip_space(char *ptr) { while (*ptr && isspace((int)*ptr)) ptr++; return ptr; } +/**************************************************************************** + * Name: copy_parm + ****************************************************************************/ + static char *copy_parm(char *src, char *dest) { char *start = src; int i; + /* De-quote the parameter and copy it into the parameter array */ + for (i = 0; i < MAX_PARMSIZE; i++) { if (*src == '"') @@ -100,6 +110,10 @@ static char *copy_parm(char *src, char *dest) exit(3); } +/**************************************************************************** + * Name: find_parm + ****************************************************************************/ + static char *find_parm(char *ptr) { char *start = ptr; @@ -138,6 +152,10 @@ static char *find_parm(char *ptr) * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: read_line + ****************************************************************************/ + char *read_line(FILE *stream) { char *ptr; @@ -166,6 +184,10 @@ char *read_line(FILE *stream) } } +/**************************************************************************** + * Name: parse_csvline + ****************************************************************************/ + int parse_csvline(char *ptr) { int nparms; @@ -185,6 +207,10 @@ int parse_csvline(char *ptr) ptr++; nparms = 0; + /* Copy each comma-separated value in an array (stripping quotes from each + * of the values). + */ + do { ptr = copy_parm(ptr, &g_parm[nparms][0]); @@ -193,6 +219,8 @@ int parse_csvline(char *ptr) } while (ptr); + /* If debug is enabled, show what we got */ + if (g_debug) { printf("Parameters: %d\n", nparms); @@ -201,5 +229,6 @@ int parse_csvline(char *ptr) printf(" Parm%d: \"%s\"\n", i+1, g_parm[i]); } } + return nparms; } -- cgit v1.2.3