Redirection support for vprintf()
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user