* c-lang.c (c_printstr): If a C string ends in a null, don't

print the null.
This commit is contained in:
John Gilmore
1993-02-18 12:18:23 +00:00
parent eece984d99
commit c5c00171a2
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/* C language support routines for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc.
Copyright 1992, 1993 Free Software Foundation, Inc.
This file is part of GDB.
@ -108,6 +108,12 @@ c_printstr (stream, string, length, force_ellipses)
extern int repeat_count_threshold;
extern int print_max;
/* If the string was not truncated due to `set print elements', and
the last byte of it is a null, we don't print that, in traditional C
style. */
if ((!force_ellipses) && string[length-1] == '\0')
length--;
if (length == 0)
{
fputs_filtered ("\"\"", stdout);