mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-17 14:45:49 +01:00
Changed handling of quoted strings in the menu parser for consistency
As reported by Amadeusz Sławiński, the support for (d)quoted string
in the menu file was not exactly the same as in previous versions
of WindowMaker, so we had a regression which is not acceptable.
This patch propose a consistent handling for (d)quoted text instead
of the previous on-the-title-only code; now all (d)quoted strings
are still kept as-is (as expected) but the (d)quotes are always
removed.
As a side note, it also improve the support for \escaped character
to work correctly as mentioned in the example of the default menu.
Note: This reverts b2e7620868 which
was an incomplete solution to the problem.
This commit is contained in:
committed by
Carlos R. Mafra
parent
2eb1107e20
commit
5a3cab3cef
@@ -381,8 +381,7 @@ static Bool menu_parser_read_macro_def(WMenuParser parser, WParserMacro *macro,
|
||||
/* When a macro is being used in the file, this function will generate the
|
||||
expanded value for the macro in the parser's work line.
|
||||
It blindly supposes that the data generated in macro->value is valid */
|
||||
void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro,
|
||||
char *write_buf, int write_buf_size)
|
||||
void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro)
|
||||
{
|
||||
char save_buf[sizeof(parser->line_buffer)];
|
||||
char arg_values_buf[MAXLINE];
|
||||
@@ -390,7 +389,11 @@ void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro,
|
||||
char *src, *dst;
|
||||
unsigned char *rd;
|
||||
unsigned int size;
|
||||
int space_left;
|
||||
int i, space_left;
|
||||
|
||||
/* Skip the name of the macro, this was not done by caller */
|
||||
for (i = 0; macro->name[i] != '\0'; i++)
|
||||
parser->rd++;
|
||||
|
||||
if (macro->arg_count >= 0) {
|
||||
menu_parser_skip_spaces_and_comments(parser);
|
||||
@@ -409,8 +412,9 @@ void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro,
|
||||
while ((*dst++ = *parser->rd++) != '\0') ;
|
||||
|
||||
/* Generate expanded macro */
|
||||
dst = write_buf;
|
||||
space_left = write_buf_size - 1;
|
||||
dst = parser->line_buffer;
|
||||
parser->rd = dst;
|
||||
space_left = sizeof(parser->line_buffer) - 1;
|
||||
if (macro->function != NULL) {
|
||||
/* Parser's pre-defined macros actually proposes a function call to
|
||||
generate dynamic value for the expansion of the macro. In this case
|
||||
|
||||
Reference in New Issue
Block a user