mi: Use the value in mi_console_file->quote as the quoting character

In mi_interpreter_init, multiple MI consoles/channels are created and a quoting
character is given.  In mi_console_raw_packet, we check if the value is not 0
to decide if we should quote the string, but we don't use the value. It is
hardcoded to ".  We might never use another quoting character than an actual
quote, but I suggest we change it, for correctness.  There is not visible
behavior change.

I changed the latest fputs_unfiltered changed to fputc_unfiltered just to stay
consistent.

gdb/ChangeLog:

2014-05-12  Simon Marchi  <simon.marchi@ericsson.com>

	* mi/mi-console.c (mi_console_raw_packet): Use the value from
	mi_console->quote as the quoting character.
This commit is contained in:
Simon Marchi 2014-04-26 18:10:40 -04:00 committed by Simon Marchi
parent 196100a019
commit 303a33faef
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2014-05-12 Simon Marchi <simon.marchi@ericsson.com>
* mi/mi-console.c (mi_console_raw_packet): Use the value from
mi_console->quote as the quoting character.
2014-05-12 Simon Marchi <simon.marchi@ericsson.com> 2014-05-12 Simon Marchi <simon.marchi@ericsson.com>
* MAINTAINERS (Write After Approval): Add "Simon Marchi". * MAINTAINERS (Write After Approval): Add "Simon Marchi".

View File

@ -110,15 +110,16 @@ mi_console_raw_packet (void *data, const char *buf, long length_buf)
fputs_unfiltered (mi_console->prefix, mi_console->raw); fputs_unfiltered (mi_console->prefix, mi_console->raw);
if (mi_console->quote) if (mi_console->quote)
{ {
fputs_unfiltered ("\"", mi_console->raw); fputc_unfiltered (mi_console->quote, mi_console->raw);
fputstrn_unfiltered (buf, length_buf, fputstrn_unfiltered (buf, length_buf,
mi_console->quote, mi_console->raw); mi_console->quote, mi_console->raw);
fputs_unfiltered ("\"\n", mi_console->raw); fputc_unfiltered (mi_console->quote, mi_console->raw);
fputc_unfiltered ('\n', mi_console->raw);
} }
else else
{ {
fputstrn_unfiltered (buf, length_buf, 0, mi_console->raw); fputstrn_unfiltered (buf, length_buf, 0, mi_console->raw);
fputs_unfiltered ("\n", mi_console->raw); fputc_unfiltered ('\n', mi_console->raw);
} }
gdb_flush (mi_console->raw); gdb_flush (mi_console->raw);
} }