17 #include "lsoRecord.h" 18 #include "printfRecord.h" 19 #include "stringoutRecord.h" 24 static int stderrPrintf(
const char *fmt, ...);
25 static int logPrintf(
const char *fmt, ...);
28 static struct outStream {
33 {
"stderr", stderrPrintf},
34 {
"errlog", logPrintf},
38 static int stderrPrintf(
const char *fmt, ...) {
43 retval = vfprintf(
stderr, fmt, pvar);
49 static int logPrintf(
const char *fmt, ...) {
63 static long add_lso(dbCommon *pcommon) {
64 lsoRecord *
prec = (lsoRecord *) pcommon;
65 struct outStream *pstream;
70 for (pstream = outStreams; pstream->name; ++pstream) {
71 if (strcmp(prec->out.value.instio.string, pstream->name) == 0) {
80 static long del_lso(dbCommon *pcommon) {
81 lsoRecord *prec = (lsoRecord *) pcommon;
87 static struct dsxt dsxtLsoStdio = {
91 static long init_lso(
int pass)
97 static long write_lso(lsoRecord *prec)
99 struct outStream *pstream = (
struct outStream *)prec->dpvt;
101 pstream->print(
"%s\n", prec->val);
106 { 5,
NULL, init_lso,
NULL, NULL }, write_lso
113 static long add_printf(dbCommon *pcommon) {
114 printfRecord *prec = (printfRecord *) pcommon;
115 struct outStream *pstream;
120 for (pstream = outStreams; pstream->name; ++pstream) {
121 if (strcmp(prec->out.value.instio.string, pstream->name) == 0) {
122 prec->dpvt = pstream;
130 static long del_printf(dbCommon *pcommon) {
131 printfRecord *prec = (printfRecord *) pcommon;
137 static struct dsxt dsxtPrintfStdio = {
138 add_printf, del_printf
141 static long init_printf(
int pass)
143 if (pass == 0)
devExtend(&dsxtPrintfStdio);
147 static long write_printf(printfRecord *prec)
149 struct outStream *pstream = (
struct outStream *)prec->dpvt;
151 pstream->print(
"%s\n", prec->val);
156 {5,
NULL, init_printf,
NULL, NULL }, write_printf
163 static long add_stringout(dbCommon *pcommon) {
164 stringoutRecord *prec = (stringoutRecord *) pcommon;
165 struct outStream *pstream;
170 for (pstream = outStreams; pstream->name; ++pstream) {
171 if (strcmp(prec->out.value.instio.string, pstream->name) == 0) {
172 prec->dpvt = pstream;
180 static long del_stringout(dbCommon *pcommon) {
181 stringoutRecord *prec = (stringoutRecord *) pcommon;
187 static struct dsxt dsxtSoStdio = {
188 add_stringout, del_stringout
191 static long init_stringout(
int pass)
197 static long write_stringout(stringoutRecord *prec)
199 struct outStream *pstream = (
struct outStream *)prec->dpvt;
201 pstream->print(
"%s\n", prec->val);
206 {5,
NULL, init_stringout,
NULL, NULL},
void devExtend(dsxt *pdsxt)
int errlogVprintf(const char *pFormat, va_list pvar)
epicsExportAddress(dset, devLsoStdio)
int(* PRINTFFUNC)(const char *fmt,...)
printfdset devPrintfStdio