- char buff[32];
- int len;
-
- if (header_extension)
- complain (_("multiple %%header_extension declarations"));
- fscanf (finput, "%s", buff);
- printf("-> %s\n", buff);
- len = strlen (buff);
- buff[len] = '\0';
- src_extension = XMALLOC (char, len + 1);
- stpcpy (header_extension, buff);
+ int ch = ungetc (skip_white_space (), finput);
+ char *muscle_key;
+ char *muscle_value;
+
+ /* Read key. */
+ if (!isalpha (ch) && ch != '_')
+ {
+ complain (_("invalid %s declaration"), "%define");
+ skip_to_char ('%');
+ return;
+ }
+ copy_identifier (finput, &muscle_obstack);
+ obstack_1grow (&muscle_obstack, 0);
+ muscle_key = obstack_finish (&muscle_obstack);
+
+ /* Read value. */
+ ch = skip_white_space ();
+ if (ch != '"')
+ {
+ ungetc (ch, finput);
+ if (ch != EOF)
+ {
+ complain (_("invalid %s declaration"), "%define");
+ skip_to_char ('%');
+ return;
+ }
+ else
+ fatal (_("Premature EOF after %s"), "\"");
+ }
+ copy_string2 (finput, &muscle_obstack, '"', 0);
+ obstack_1grow (&muscle_obstack, 0);
+ muscle_value = obstack_finish (&muscle_obstack);
+
+ /* Store the (key, value) pair in the environment. */
+ muscle_insert (muscle_key, muscle_value);
+}
+
+
+
+/*---------------------------------.
+| Parse a double quoted parameter. |
+`---------------------------------*/
+
+static const char *
+parse_dquoted_param (const char *from)
+{
+ struct obstack param_obstack;
+ const char *param = NULL;
+ int c;
+
+ obstack_init (¶m_obstack);
+ c = skip_white_space ();
+
+ if (c != '"')
+ {
+ complain (_("invalid %s declaration"), from);
+ ungetc (c, finput);
+ skip_to_char ('%');
+ return NULL;
+ }
+
+ while ((c = literalchar ()) != '"')
+ obstack_1grow (¶m_obstack, c);
+
+ obstack_1grow (¶m_obstack, '\0');
+ param = obstack_finish (¶m_obstack);
+
+ if (c != '"' || strlen (param) == 0)
+ {
+ complain (_("invalid %s declaration"), from);
+ if (c != '"')
+ ungetc (c, finput);
+ skip_to_char ('%');
+ return NULL;
+ }
+
+ return param;