[PATCH] some obvious config fixes

From: Andrzej Krzysztofowicz (ankry@green.mif.pg.gda.pl)
Date: Fri May 26 2000 - 10:07:19 EST


Hi,
   These are two fixes for 2.4.0-test* series containing:

- for config files, which contain "string" option without default value
  (it is mandatory) or with an improper default value (spaces, not quoted)
- for xconfig to properly handle unquoted "string" values (it is legal)
  and to report an error when no default value is set. Current situation
  breaks xconfig in libc5 case (thanks <lamarqu1@col.bsf.alcatel.fr> for
  the report).

Xconfig seems to be quite good config file tester ... :)

Regards
   Andrzej
********************************************************************
--- 2.4.0-test1-ac1/drivers/atm/Config.in Fri Apr 14 18:37:10 2000
+++ linux/drivers/atm/Config.in Fri May 26 16:12:31 2000
@@ -59,7 +59,7 @@
       if [ "$CONFIG_ATM_FORE200E_PCA" = "y" ]; then
         bool ' Use default PCA-200E firmware (normally enabled)' CONFIG_ATM_FORE200E_PCA_DEFAULT_FW
         if [ "$CONFIG_ATM_FORE200E_PCA_DEFAULT_FW" = "n" ]; then
- string ' Pathname of user-supplied binary firmware' CONFIG_ATM_FORE200E_PCA_FW
+ string ' Pathname of user-supplied binary firmware' CONFIG_ATM_FORE200E_PCA_FW ""
         fi
       fi
     fi
--- 2.4.0-test1-ac1/arch/ppc/config.in Fri May 26 16:33:04 2000
+++ linux/arch/ppc/config.in Fri May 26 16:33:16 2000
@@ -161,7 +161,7 @@
 if [ "$CONFIG_PREP" = "y" -o "$CONFIG_ALL_PPC" = "y" ]; then
   bool 'PReP bootloader kernel arguments' CONFIG_CMDLINE_BOOL y
   if [ "$CONFIG_CMDLINE_BOOL" = "y" ] ; then
- string 'Initial kernel command string' CONFIG_CMDLINE console=ttyS0,9600 console=tty0 root=/dev/sda2
+ string 'Initial kernel command string' CONFIG_CMDLINE "console=ttyS0,9600 console=tty0 root=/dev/sda2"
   fi
 fi
 
--- 2.4.0-test1-ac1/arch/arm/config.in Fri May 26 16:33:35 2000
+++ linux/arch/arm/config.in Fri May 26 16:33:41 2000
@@ -189,7 +189,7 @@
      "$CONFIG_ARCH_NETWINDER" = "y" -o \
      "$CONFIG_ARCH_PERSONAL_SERVER" = "y" -o \
      "$CONFIG_ARCH_CATS" = "y" ]; then
- string 'Initial kernel command string' CONFIG_CMDLINE
+ string 'Initial kernel command string' CONFIG_CMDLINE ""
 fi
 if [ "$CONFIG_ARCH_NETWINDER" = "y" -o \
      "$CONFIG_ARCH_EBSA110" = "y" -o \
--- 2.4.0-test1-ac1/scripts/tkparse.c Tue May 23 13:08:30 2000
+++ linux/scripts/tkparse.c Fri May 26 16:03:57 2000
@@ -173,6 +173,28 @@
 
 
 /*
+ * Get a quoted or unquoted string. It is recognized by the first
+ * non-white character. '"' and '"' are not allowed inside the string.
+ */
+static const char * get_qnqstring( const char * pnt, char ** label )
+{
+ char quote_char;
+
+ while ( *pnt == ' ' || *pnt == '\t' )
+ pnt++;
+
+ if ( *pnt == '\0' )
+ return pnt;
+ quote_char = *pnt;
+ if ( quote_char == '"' || quote_char == '\'' )
+ return get_qstring( pnt, label );
+ else
+ return get_string( pnt, label );
+}
+
+
+
+/*
  * Tokenize an 'if' statement condition.
  */
 static struct condition * tokenize_if( const char * pnt )
@@ -505,6 +527,8 @@
         if ( last_menuoption != NULL )
         {
             pnt = get_qstring(pnt, &cfg->label);
+ if (cfg->label == NULL)
+ syntax_error( "missing comment text" );
             last_menuoption->label = cfg->label;
             last_menuoption = NULL;
         }
@@ -546,7 +570,9 @@
     case token_define_string:
         pnt = get_string( pnt, &buffer );
         cfg->nameindex = get_varnum( buffer );
- pnt = get_qstring( pnt, &cfg->value );
+ pnt = get_qnqstring( pnt, &cfg->value );
+ if (cfg->value == NULL)
+ syntax_error( "missing value" );
         break;
 
     case token_dep_bool:
@@ -659,7 +685,9 @@
         pnt = get_qstring ( pnt, &cfg->label );
         pnt = get_string ( pnt, &buffer );
         cfg->nameindex = get_varnum( buffer );
- pnt = get_qstring ( pnt, &cfg->value );
+ pnt = get_qnqstring ( pnt, &cfg->value );
+ if (cfg->value == NULL)
+ syntax_error( "missing initial value" );
         break;
 
     case token_if:
********************************************************************

-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Technical University of Gdansk

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:16 EST