/* Output like sprintf to a buffer of specified size.
Also takes args differently: pass one pointer to the end
of the format string in addition to the format string itself.
- Copyright (C) 1985, 2001-2011 Free Software Foundation, Inc.
+ Copyright (C) 1985, 2001-2012 Free Software Foundation, Inc.
This file is part of GNU Emacs.
of the (`int') argument, suitable for display in an Emacs buffer.
. For %s and %c, when field width is specified (e.g., %25s), it accounts for
- the diplay width of each character, according to char-width-table. That
+ the display width of each character, according to char-width-table. That
is, it does not assume that each character takes one column on display.
. If the size of the buffer is not enough to produce the formatted string in
case 'e':
case 'g':
{
- double d = va_arg(ap, double);
+ double d = va_arg (ap, double);
sprintf (sprintf_buffer, fmtcpy, d);
/* Now copy into final output, truncating as necessary. */
string = sprintf_buffer;
case 'c':
{
- int chr = va_arg(ap, int);
+ int chr = va_arg (ap, int);
tem = CHAR_STRING (chr, (unsigned char *) charbuf);
string = charbuf;
string[tem] = 0;
return nbytes;
}
-/* Format to a buffer BUF of positive size BUFSIZE. This is like
- snprintf, except it is not limited to returning an 'int' so it
- doesn't have a silly 2 GiB limit on typical 64-bit hosts. However,
- it is limited to the Emacs-style formats that doprnt supports, and
- BUFSIZE must be positive.
-
- Return the number of bytes put into BUF, excluding the terminating
- '\0'. Unlike snprintf, always return a nonnegative value less than
- BUFSIZE; if the output is truncated, return BUFSIZE - 1, which is
- the length of the truncated output. */
-ptrdiff_t
-esnprintf (char *buf, ptrdiff_t bufsize, char const *format, ...)
-{
- ptrdiff_t nbytes;
- va_list ap;
- va_start (ap, format);
- nbytes = doprnt (buf, bufsize, format, 0, ap);
- va_end (ap);
- return nbytes;
-}
+#if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
/* Format to buffer *BUF of positive size *BUFSIZE, reallocating *BUF
and updating *BUFSIZE if the buffer is too small, and otherwise
return nbytes;
}
+#endif
+
/* Act like exprintf, except take a va_list. */
ptrdiff_t
evxprintf (char **buf, ptrdiff_t *bufsize,