* c-lang.c (c_emit_char): Don't treat \0 specially unless quoter
authorTom Tromey <tromey@redhat.com>
Tue, 17 Sep 2002 17:01:47 +0000 (17:01 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 17 Sep 2002 17:01:47 +0000 (17:01 +0000)
is "'".

gdb/ChangeLog
gdb/c-lang.c

index 40cae6c2962abda921bc8361f203ce995734b4d3..7329b29661e19b82b9a35bc44abeb6025272628e 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-17  Tom Tromey  <tromey@redhat.com>
+
+       * c-lang.c (c_emit_char): Don't treat \0 specially unless quoter
+       is "'".
+
 2002-09-17  Corinna Vinschen  <vinschen@redhat.com>
 
        * MAINTAINERS: Remove "non multi-arched" text from h8300.
index 9ee92ad8b8c81494793a227cd503f99b028b4652..9c30483eff7f039ab8ad16cba906773570d6bb02 100644 (file)
@@ -78,9 +78,12 @@ c_emit_char (register int c, struct ui_file *stream, int quoter)
        case '\007':
          fputs_filtered ("\\a", stream);
          break;
-        case '\0':
-          fputs_filtered ("\\0", stream);
-          break;
+       case '\0':
+         if (quoter == '\'')
+           fputs_filtered ("\\0", stream);
+         else
+           fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
+         break;
        default:
          fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
          break;