patch-2.4.0-test2 linux/scripts/tkparse.c
Next file: linux/CREDITS
Previous file: linux/scripts/tkgen.c
Back to the patch index
Back to the overall index
- Lines: 61
- Date:
Mon Jun 19 13:45:52 2000
- Orig file:
v2.4.0-test1/linux/scripts/tkparse.c
- Orig date:
Tue May 23 15:31:37 2000
diff -u --recursive --new-file v2.4.0-test1/linux/scripts/tkparse.c linux/scripts/tkparse.c
@@ -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:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)