patch-2.2.0-pre8 linux/scripts/tkparse.c

Next file: linux/scripts/tkparse.h
Previous file: linux/scripts/tkgen.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre7/linux/scripts/tkparse.c linux/scripts/tkparse.c
@@ -17,7 +17,18 @@
  * and build the actual wish script.
  *
  * This file contains the code to do the first parse of config.in.
+ *
+ * Change History
+ *
+ * 7 January 1999, Michael Elizabeth Chastain, <mailto:mec@shout.net>
+ * Teach dep_tristate about a few literals, such as:
+ *   dep_tristate 'foo' CONFIG_FOO m
+ * Also have it print an error message and exit on some parse failures.
+ *
+ * 14 January 1999, Michael Elizabeth Chastain, <mailto:mec@shout.net>
+ * Don't fclose stdin.  Thanks to Tony Hoyle for nailing this one.
  */
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -467,8 +478,20 @@
       pnt = get_qstring(pnt, &kcfg->label);
       pnt = get_string(pnt, &kcfg->optionname);
       pnt = skip_whitespace(pnt);
-      if( *pnt == '$') pnt++;
-      pnt = get_string(pnt, &kcfg->depend.str);
+
+      if ( ( pnt[0] == 'y'  || pnt[0] == 'm' || pnt[0] == 'n'  )
+      &&   ( pnt[1] == '\0' || pnt[1] == ' ' || pnt[1] == '\t' ) ) {
+	if      ( pnt[0] == 'y' ) kcfg->depend.str = strdup( "CONSTANT_Y" );
+	else if ( pnt[0] == 'm' ) kcfg->depend.str = strdup( "CONSTANT_M" );
+	else                      kcfg->depend.str = strdup( "CONSTANT_N" );
+	pnt++;
+      } else if ( *pnt == '$' ) {
+	pnt++;
+	pnt = get_string(pnt, &kcfg->depend.str);
+      } else {
+	fprintf( stderr, "Can't handle dep_tristate condition\n" );
+	exit( 1 );
+      }
 
       /*
        * Create a conditional for this object's dependency.
@@ -629,8 +652,8 @@
 	  offset = 0;
 	}
     }
-  fclose(infile);
   if( infile != stdin ) {
+    fclose(infile);
     current_file = old_file;
   }
   lineno = old_lineno;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov