patch-2.4.0-test10 linux/scripts/tkparse.c

Next file: linux/CREDITS
Previous file: linux/scripts/Menuconfig
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test9/linux/scripts/tkparse.c linux/scripts/tkparse.c
@@ -326,6 +326,7 @@
 static const char * tokenize_choices( struct kconfig * cfg_choose,
     const char * pnt )
 {
+    int default_checked = 0;
     for ( ; ; )
     {
 	struct kconfig * cfg;
@@ -349,12 +350,20 @@
 	cfg->token      = token_choice_item;
 	cfg->cfg_parent = cfg_choose;
 	pnt = get_string( pnt, &cfg->label );
+	if ( ! default_checked &&
+	     ! strncmp( cfg->label, cfg_choose->value, strlen( cfg_choose->value ) ) )
+	{
+	    default_checked = 1;
+	    free( cfg_choose->value );
+	    cfg_choose->value = cfg->label;
+	}
 	while ( *pnt == ' ' || *pnt == '\t' )
 	    pnt++;
 	pnt = get_string( pnt, &buffer );
 	cfg->nameindex = get_varnum( buffer );
     }
-
+    if ( ! default_checked )
+	syntax_error( "bad 'choice' default value" );
     return pnt;
 }
 
@@ -515,7 +524,6 @@
 	    pnt = get_qstring ( pnt, &cfg->label  );
 	    pnt = get_qstring ( pnt, &choice_list );
 	    pnt = get_string  ( pnt, &cfg->value  );
-
 	    cfg->nameindex = -(choose_number++);
 	    tokenize_choices( cfg, choice_list );
 	    free( choice_list );


FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)