#include "printflocal.h"
static int __sprint(FILE *, locale_t, struct __suio *);
+#if 0
static int __sbprintf(FILE *, locale_t, const char *, va_list) __printflike(3, 0);
+#endif
static char *__wcsconv(wchar_t *, int, locale_t);
__private_extern__ const char *__fix_nogrouping(const char *);
return (err);
}
+#if 0
/*
* Helper function for `fprintf to unbuffered unix file': creates a
* temporary buffer. We only work on write-only files; this avoids
fp->_flags |= __SERR;
return (ret);
}
+#endif
/*
* Convert a wide character string argument for the %ls format to a multibyte
{
int ret;
- NORMALIZE_LOCALE(loc);
FLOCKFILE(fp);
- /* optimise fprintf(stderr) (and other unbuffered Unix files) */
- if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
- fp->_file >= 0)
- ret = __sbprintf(fp, loc, fmt0, ap);
- else
- ret = __vfprintf(fp, loc, fmt0, ap);
+ ret = __xvprintf(XPRINTF_PLAIN, NULL, fp, loc, fmt0, ap);
FUNLOCKFILE(fp);
return (ret);
}
vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
{
- return vfprintf_l(fp, __current_locale(), fmt0, ap);
+ int ret;
+
+ FLOCKFILE(fp);
+ ret = __xvprintf(XPRINTF_PLAIN, NULL, fp, __current_locale(), fmt0, ap);
+ FUNLOCKFILE(fp);
+ return ret;
}
/*
val = GETARG (int); \
}
-#if 0 // xprintf pending API review
- if (__use_xprintf == 0 && getenv("USE_XPRINTF"))
- __use_xprintf = 1;
- if (__use_xprintf > 0)
- return (__xvprintf(fp, loc, fmt0, ap));
-#endif
-
+ /* The following has been moved to __v2printf() */
+#if 0
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
if (prepwrite(fp) != 0) {
errno = EBADF;
return (EOF);
}
ORIENT(fp, -1);
+#endif
convbuf = NULL;
fmt = (char *)fmt0;
if (flags & LONGINT) {
wchar_t *wcp;
- if (convbuf != NULL)
- free(convbuf);
- if ((wcp = GETARG(wchar_t *)) == NULL)
+ free(convbuf);
+ if ((wcp = GETARG(wchar_t *)) == NULL) {
+ convbuf = NULL;
cp = "(null)";
- else {
+ } else {
convbuf = __wcsconv(wcp, prec, loc);
if (convbuf == NULL) {
fp->_flags |= __SERR;
if (dtoaresult != NULL)
freedtoa(dtoaresult);
#endif
- if (convbuf != NULL)
- free(convbuf);
+ free(convbuf);
if (__sferror(fp))
ret = EOF;
if ((argtable != NULL) && (argtable != statargtable))