[qfcc] Improve string quoting when dumping strings

Not knowing if a blank line is an empty string or spaces...
This commit is contained in:
Bill Currie 2020-03-28 21:46:46 +09:00
parent 1cd7bd2bf0
commit ac9f3404ef

View file

@ -44,14 +44,14 @@ dump_string_block (const char *strblock, unsigned size)
{
const char *s = strblock;
printf ("%x ", 0);
printf ("%x \"", 0);
while (s - strblock < size) {
char c = *s++;
switch (c) {
case 0:
fputs ("\n", stdout);
fputs ("\"\n", stdout);
if (s - strblock < size)
printf ("%lx ", s - strblock);
printf ("%lx \"", s - strblock);
break;
case 9:
fputs ("\\t", stdout);
@ -62,6 +62,12 @@ dump_string_block (const char *strblock, unsigned size)
case 13:
fputs ("\\r", stdout);
break;
case '\"':
fputs ("\\\"", stdout);
break;
case '\\':
fputs ("\\\\", stdout);
break;
default:
fputc (sys_char_map[(unsigned char)c], stdout);
break;