if anyone tries to define one here. */
case '+':
default:
- error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
- STRING_CHAR ((unsigned char *) tem),
- (unsigned) STRING_CHAR ((unsigned char *) tem),
- (unsigned) STRING_CHAR ((unsigned char *) tem));
+ {
+ /* How many bytes are left unprocessed in the specs string?
+ (Note that this excludes the trailing null byte.) */
+ ptrdiff_t bytes_left = SBYTES (specs) - (tem - string);
+ unsigned letter;
+
+ /* If we have enough bytes left to treat the sequence as a
+ character, show that character's codepoint; otherwise
+ show only its first byte. */
+ if (bytes_left >= BYTES_BY_CHAR_HEAD (*((unsigned char *) tem)))
+ letter = STRING_CHAR ((unsigned char *) tem);
+ else
+ letter = *((unsigned char *) tem);
+
+ error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
+ (int) letter, letter, letter);
+ }
}
if (varies[i] == 0)