- {
- /* Just some character; Copy it if the whole multi-byte form
- fit in the buffer. */
- char *save_bufptr = bufptr;
-
- do { *bufptr++ = *fmt++; }
- while (fmt < format_end && --bufsize > 0 && !CHAR_HEAD_P (*fmt));
- if (!CHAR_HEAD_P (*fmt))
- {
- /* Truncate, but return value that will signal to caller
- that the buffer was too small. */
- *save_bufptr = 0;
- break;
- }
- }
- };
+ char const *src;
+ ptrdiff_t srclen;
+ if (quoting_style == CURVE_QUOTING_STYLE && fmtchar == '`')
+ src = uLSQM, srclen = sizeof uLSQM - 1;
+ else if (quoting_style == CURVE_QUOTING_STYLE && fmtchar == '\'')
+ src = uRSQM, srclen = sizeof uRSQM - 1;
+ else if (quoting_style == STRAIGHT_QUOTING_STYLE && fmtchar == '`')
+ src = "'", srclen = 1;
+ else
+ {
+ while (fmt < format_end && !CHAR_HEAD_P (*fmt))
+ fmt++;
+ src = fmt0, srclen = fmt - fmt0;
+ }
+
+ if (bufsize < srclen)
+ {
+ /* Truncate, but return value that will signal to caller
+ that the buffer was too small. */
+ do
+ *bufptr++ = '\0';
+ while (--bufsize != 0);
+ }
+ else
+ {
+ do
+ *bufptr++ = *src++;
+ while (--srclen != 0);
+ }
+ }