- if (isgraph ((unsigned char) *lexer->prog))
- msg (SE, _("Bad character in input: `%c'."), *lexer->prog++);
- else
- msg (SE, _("Bad character in input: `\\%o'."), *lexer->prog++);
+ unsigned char c = *lexer->prog++;
+ char *c_name = xasprintf (c_isgraph (c) ? "%c" : "\\%o", c);
+ msg (SE, _("Bad character in input: `%s'."), c_name);
+ free (c_name);