diff --git a/src/catools/caget.c b/src/catools/caget.c index 8489ecbcb..1ce588615 100644 --- a/src/catools/caget.c +++ b/src/catools/caget.c @@ -391,7 +391,7 @@ int main (int argc, char *argv[]) int nPvs; /* Number of PVs */ pv* pvs = 0; /* Array of PV structures */ - setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ + LINE_BUFFER(stdout); /* Configure stdout buffering */ while ((opt = getopt(argc, argv, ":taicnhsSe:f:g:l:#:d:0:w:p:F:")) != -1) { switch (opt) { diff --git a/src/catools/cainfo.c b/src/catools/cainfo.c index e86cdb4d5..a287f6984 100644 --- a/src/catools/cainfo.c +++ b/src/catools/cainfo.c @@ -6,8 +6,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -136,7 +135,7 @@ int main (int argc, char *argv[]) int nPvs; /* Number of PVs */ pv* pvs = 0; /* Array of PV structures */ - setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ + LINE_BUFFER(stdout); /* Configure stdout buffering */ while ((opt = getopt(argc, argv, ":nhw:s:p:")) != -1) { switch (opt) { diff --git a/src/catools/camonitor.c b/src/catools/camonitor.c index b11334b91..617ee7622 100644 --- a/src/catools/camonitor.c +++ b/src/catools/camonitor.c @@ -6,8 +6,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -214,7 +213,7 @@ int main (int argc, char *argv[]) int nPvs; /* Number of PVs */ pv* pvs = 0; /* Array of PV structures */ - setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ + LINE_BUFFER(stdout); /* Configure stdout buffering */ while ((opt = getopt(argc, argv, ":nhm:sSe:f:g:l:#:0:w:t:p:F:")) != -1) { switch (opt) { diff --git a/src/catools/caput.c b/src/catools/caput.c index cf72ae298..9aaba38dc 100644 --- a/src/catools/caput.c +++ b/src/catools/caput.c @@ -275,8 +275,8 @@ int main (int argc, char *argv[]) int nPvs; /* Number of PVs */ pv* pvs = 0; /* Array of PV structures */ - setvbuf(stdout,NULL,_IOLBF,BUFSIZ); /* Set stdout to line buffering */ - putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */ + LINE_BUFFER(stdout); /* Configure stdout buffering */ + putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */ while ((opt = getopt(argc, argv, ":cnlhatsS#:w:p:F:")) != -1) { switch (opt) { diff --git a/src/catools/tool_lib.h b/src/catools/tool_lib.h index baebf7939..fb5c4af3c 100644 --- a/src/catools/tool_lib.h +++ b/src/catools/tool_lib.h @@ -5,8 +5,7 @@ * Operator of Los Alamos National Laboratory. * Copyright (c) 2002 Berliner Elektronenspeicherringgesellschaft fuer * Synchrotronstrahlung. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -50,6 +49,13 @@ #define DEFAULT_CA_PRIORITY 0 /* Default CA priority */ #define DEFAULT_TIMEOUT 1.0 /* Default CA timeout */ +#ifndef _WIN32 +# define LINE_BUFFER(stream) setvbuf(stream, NULL, _IOLBF, BUFSIZ) +#else +/* Windows doesn't support line mode, turn buffering off completely */ +# define LINE_BUFFER(stream) setvbuf(stream, NULL, _IONBF, 0) +#endif + /* Type of timestamp */ typedef enum { absolute, relative, incremental, incrementalByChan } TimeT;