Skip to content

Commit 8311a5b

Browse files
committed
Disable epicsStdio.h redefinitions
readline.h uses printf in an attribute
1 parent 6e6cac0 commit 8311a5b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

modules/libcom/src/iocsh/iocsh.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#define EPICS_PRIVATE_API
2828

29+
// Recent readline.h uses printf in an attribute
30+
#define epicsStdioStdStreams
31+
#define epicsStdioStdPrintfEtc
32+
2933
#include "epicsMath.h"
3034
#include "errlog.h"
3135
#include "macLib.h"
@@ -41,7 +45,6 @@
4145
#include "iocsh.h"
4246

4347
#include "epicsReadlinePvt.h"
44-
4548
#if EPICS_COMMANDLINE_LIBRARY == EPICS_COMMANDLINE_LIBRARY_READLINE
4649
# include <readline/readline.h>
4750
# include <readline/history.h>
@@ -639,8 +642,9 @@ struct ReadlineContext {
639642
if(!hist_file.empty()) {
640643
if(int err = read_history(hist_file.c_str())) {
641644
if(err!=ENOENT)
642-
fprintf(stderr, ERL_ERROR " %s (%d) loading '%s'\n",
643-
strerror(err), err, hist_file.c_str());
645+
fprintf(epicsGetStderr(),
646+
ERL_ERROR " %s (%d) loading '%s'\n",
647+
strerror(err), err, hist_file.c_str());
644648
}
645649
stifle_history(1024); // some limit...
646650
}
@@ -654,8 +658,9 @@ struct ReadlineContext {
654658
#ifdef USE_READLINE
655659
if(!hist_file.empty()) {
656660
if(int err = write_history(hist_file.c_str())) {
657-
fprintf(stderr, ERL_ERROR " %s (%d) writing '%s'\n",
658-
strerror(err), err, hist_file.c_str());
661+
fprintf(epicsGetStderr(),
662+
ERL_ERROR " %s (%d) writing '%s'\n",
663+
strerror(err), err, hist_file.c_str());
659664
}
660665
}
661666
rl_readline_name = prev_rl_readline_name;
@@ -1167,7 +1172,7 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros)
11671172
if (c == '#') {
11681173
if ((prompt == NULL) && (commandLine == NULL))
11691174
if (raw[icin + 1] != '-') {
1170-
printf(ANSI_BLUE("%s") "\n", raw);
1175+
fprintf(epicsGetStdout(), ANSI_BLUE("%s") "\n", raw);
11711176
}
11721177
continue;
11731178
}
@@ -1194,7 +1199,7 @@ iocshBody (const char *pathname, const char *commandLine, const char *macros)
11941199
*/
11951200
if ((prompt == NULL) && *line && (commandLine == NULL)) {
11961201
if ((c != '#') || (line[icin + 1] != '-')) {
1197-
printf(ANSI_BOLD("%s") "\n", line);
1202+
fprintf(epicsGetStdout(), ANSI_BOLD("%s") "\n", line);
11981203
}
11991204
}
12001205

0 commit comments

Comments
 (0)