diff options
Diffstat (limited to 'common/print.c')
-rw-r--r-- | common/print.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/common/print.c b/common/print.c index d5d0ae07..b113bec1 100644 --- a/common/print.c +++ b/common/print.c @@ -1134,6 +1134,7 @@ static unsigned print_subexpression (expr, buf, len) buf [rv] = 0; return rv; } + break; case expr_gethostname: if (len > 13) { @@ -1245,7 +1246,12 @@ int token_print_indent (FILE *file, int col, int indent, const char *prefix, const char *suffix, const char *buf) { - int len = strlen (buf) + strlen (prefix); + int len = 0; + if (prefix != NULL) + len = strlen (prefix); + if (buf != NULL) + len += strlen (buf); + if (col + len > 79) { if (indent + len < 79) { indent_spaces (file, indent); @@ -1258,8 +1264,10 @@ int token_print_indent (FILE *file, int col, int indent, fputs (prefix, file); col += strlen (prefix); } - fputs (buf, file); - col += len; + if ((buf != NULL) && (*buf != 0)) { + fputs (buf, file); + col += strlen(buf); + } if (suffix && *suffix) { if (col + strlen (suffix) > 79) { indent_spaces (file, indent); |