Redirection support for vprintf()

This commit is contained in:
Andrew Johnson
2021-11-22 15:51:08 -06:00
parent 2256c979b0
commit 6e496e80d1
2 changed files with 14 additions and 0 deletions

View File

@@ -118,6 +118,11 @@ int epicsStdCall epicsStdoutPrintf(const char *pFormat, ...)
return nchar;
}
int epicsStdCall epicsStdoutVPrintf(const char *pformat, va_list ap)
{
return vfprintf(epicsGetStdout(), pformat, ap);
}
int epicsStdCall epicsStdoutPuts(const char *str)
{
return fprintf(epicsGetStdout(), "%s\n", str);

View File

@@ -36,6 +36,7 @@
* - `printf` becomes epicsStdoutPrintf()
* - `puts` becomes epicsStdoutPuts()
* - `putchar` becomes epicsStdoutPutchar()
* - `vprintf` becomes epicsStdoutVPrintf()
*
* The epicsSetThreadStdin(), epicsSetThreadStdout() and epicsSetThreadStderr()
* routines allow the standard file streams to be redirected on a per thread
@@ -75,6 +76,11 @@ extern "C" {
# endif
# define printf epicsStdoutPrintf
# ifdef vprintf
# undef vprintf
# endif
# define vprintf epicsStdoutVPrintf
# ifdef puts
# undef puts
# endif
@@ -172,6 +178,8 @@ LIBCOM_API void epicsStdCall epicsSetThreadStderr(FILE *);
LIBCOM_API int epicsStdCall epicsStdoutPrintf(
const char *pformat, ...) EPICS_PRINTF_STYLE(1,2);
LIBCOM_API int epicsStdCall epicsStdoutVPrintf(
const char *pformat, va_list ap);
LIBCOM_API int epicsStdCall epicsStdoutPuts(const char *str);
LIBCOM_API int epicsStdCall epicsStdoutPutchar(int c);
@@ -185,6 +193,7 @@ using ::epicsGetStdin;
using ::epicsGetStdout;
using ::epicsGetStderr;
using ::epicsStdoutPrintf;
using ::epicsStdoutVPrintf;
using ::epicsStdoutPuts;
using ::epicsStdoutPutchar;
}