[PATCH] xconfig, Menuconfig fixes (2.2.18pre15)

From: Andrzej Krzysztofowicz (ankry@green.mif.pg.gda.pl)
Date: Thu Oct 05 2000 - 12:21:31 EST


Hi Alan,

Two patches for 2.2.18pre15 configuration follow.

1. I found two bugs in configuration utilities:

- Menuconfig doesn't ignore commented out "endmenu" commands (while
  commented out "mainmenu_option" it does). I don't think it is
  intentional... Especially as it breaks s390 architecture configuration
  (commented "endmenu" -> missing uncommented one -> xconfig has problems;
  this is fixead in the second patch, but requires this one)

- Both Menuconfig and xconfig has problem with shortened default values for
  choice lists, eg.:

  choice 'Processor family' \
           [...]
           PPro/6x86MX CONFIG_M686" PPro
           ^^^^^^^^^^^ ^^^^
  In effect, if one hits this value usage case it not properly recognized.
  And no choice variable is set (all are unset) unless he entered the choice
  menu and rechoose. In fact, the default value is rarely used.

2. Fixed some obvious bugs in configuration scripts:

- missing "endmenu" (effect of Menuconfig bug), [drivers/s390]
- double "==" instead a single one "=", [arch/m68k]
- bool/int outside menu (in the main menu), [arch/s390]
- duplicated condition in IDE section. [drivers/block]

Regards
   Andrzej

******************** PATCH 1 *****************************************
diff -uNr linux-2.2.18pre15/scripts/Menuconfig linux/scripts/Menuconfig
--- linux-2.2.18pre15/scripts/Menuconfig Thu Oct 5 19:16:19 2000
+++ linux/scripts/Menuconfig Thu Oct 5 19:17:01 2000
@@ -634,6 +634,7 @@
         title="$1"
         choices="$2"
         current="$3"
+ chosen=
 
         #
         # Scan current value of choices and set radiolist switches.
@@ -644,7 +645,12 @@
         while [ -n "$2" ]
         do
                 case "$1" in
- "$current") list="$list $2 $1 ON " ;;
+ "$current"*) if [ -z "$chosen" ]; then
+ list="$list $2 $1 ON "
+ chosen=1
+ else
+ list="$list $2 $1 OFF "
+ fi ;;
                 *) list="$list $2 $1 OFF " ;;
                 esac
                         
@@ -721,13 +727,13 @@
 
                         parser(ifile, "MCmenu"menu_no)
                 }
+ else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {
+ printf("") >>menu
+ }
                 else if ($1 ~ "endmenu") {
                         printf("}\n") >>menu
                         return
                 }
- else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {
- printf("") >>menu
- }
                 else if ($1 == "source") {
                         parser($2,menu)
                 }
@@ -750,12 +756,12 @@
 function parser(ifile,menu) {
 
         while (getline <ifile) {
- if ($1 ~ /mainmenu_option|endmenu/) {
- printf("") >>menu
- }
- else if ($0 ~ /^#|$MAKE|mainmenu_name/) {
+ if ($0 ~ /^#|$MAKE|mainmenu_name/) {
                         printf("") >>menu
                 }
+ else if ($1 ~ /mainmenu_option|endmenu/) {
+ printf("") >>menu
+ }
                 else if ($1 == "source") {
                         parser($2,menu)
                 }
@@ -1192,6 +1198,7 @@
                 choices="$2"
                 default="$3"
                 current=
+ chosen=
 
                 set -- $choices
                 while [ -n "$2" ]
@@ -1215,12 +1222,15 @@
                 set -- $choices
                 while [ -n "$2" ]
                 do
- if eval [ "$1" = "$current" ]
- then
- define_bool "$2" "y"
- else
- define_bool "$2" "n"
- fi
+ case "$1" in
+ "$current"*) if [ -z "$chosen" ]; then
+ define_bool "$2" "y"
+ chosen=1
+ else
+ define_bool "$2" "n"
+ fi ;;
+ *) define_bool "$2" "n" ;;
+ esac
                         shift ; shift
                 done
         }
diff -uNr linux-2.2.18pre15/scripts/tkparse.c linux/scripts/tkparse.c
--- linux-2.2.18pre15/scripts/tkparse.c Thu Oct 5 19:16:19 2000
+++ linux/scripts/tkparse.c Thu Oct 5 19:17:01 2000
@@ -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 );
**********************************************************************
******************** PATCH 2 *****************************************
diff -uNr linux-2.2.18pre15/arch/m68k/config.in linux/arch/m68k/config.in
--- linux-2.2.18pre15/arch/m68k/config.in Sat Jul 1 15:56:23 2000
+++ linux/arch/m68k/config.in Thu Oct 5 00:45:18 2000
@@ -115,7 +115,7 @@
        fi
     fi
   fi
- if [ "$CONFIG_ATARI" == "y" ]; then
+ if [ "$CONFIG_ATARI" = "y" ]; then
     dep_tristate ' Atari builtin port' CONFIG_PARPORT_ATARI $CONFIG_PARPORT
   fi
 fi
diff -uNr linux-2.2.18pre15/arch/s390/config.in linux/arch/s390/config.in
--- linux-2.2.18pre15/arch/s390/config.in Sat Jul 1 15:56:23 2000
+++ linux/arch/s390/config.in Thu Oct 5 00:46:23 2000
@@ -43,11 +43,15 @@
 endmenu
 
 source drivers/s390/Config.in
+
+mainmenu_option next_comment
 comment 'Character devices'
+
 bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS
 if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
   int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
 fi
+endmenu
 
 if [ "$CONFIG_NET" = "y" ]; then
   source net/Config.in
diff -uNr linux-2.2.18pre15/drivers/block/Config.in linux/drivers/block/Config.in
--- linux-2.2.18pre15/drivers/block/Config.in Thu Oct 5 00:39:42 2000
+++ linux/drivers/block/Config.in Thu Oct 5 00:48:18 2000
@@ -23,7 +23,6 @@
   dep_tristate ' Include IDE/ATAPI TAPE support' CONFIG_BLK_DEV_IDETAPE $CONFIG_BLK_DEV_IDE
   dep_tristate ' Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
   dep_tristate ' SCSI emulation support' CONFIG_BLK_DEV_IDESCSI $CONFIG_BLK_DEV_IDE
- if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
     bool ' CMD640 chipset bugfix/support' CONFIG_BLK_DEV_CMD640
     if [ "$CONFIG_BLK_DEV_CMD640" = "y" ]; then
       bool ' CMD640 enhanced support' CONFIG_BLK_DEV_CMD640_ENHANCED
@@ -78,7 +77,6 @@
          fi
       fi
     fi
- fi
 fi
 if [ "$CONFIG_MCA" = "y" ]; then
   tristate 'PS/2 ESDI hard disk support' CONFIG_BLK_DEV_PS2
diff -uNr linux-2.2.18pre15/drivers/s390/Config.in linux/drivers/s390/Config.in
--- linux-2.2.18pre15/drivers/s390/Config.in Tue Sep 12 07:48:08 2000
+++ linux/drivers/s390/Config.in Thu Oct 5 00:46:48 2000
@@ -40,6 +40,7 @@
     bool ' Support for DIAG access to CMS formatted Disks' CONFIG_DASD_MDSK
   fi
 fi
+endmenu
 
 #menu_option next_comment
 # comment 'S/390-SCSI support'
**********************************************************************

-- 
=======================================================================
  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.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:17 EST