Commit 93baf99b authored by Christophe Geuzaine's avatar Christophe Geuzaine

use isatty on unix to detect if we output messages to a terminal

parent c32c64c1
Pipeline #1982 passed with stage
in 10 minutes and 5 seconds
......@@ -17,6 +17,10 @@
#include "ProData.h" // for onelab
#include "ProParser.h" // for onelab
#if !defined(WIN32) || defined(__CYGWIN__)
#include <unistd.h>
#endif
#if !defined(WIN32) || defined(__CYGWIN__)
#include <sys/time.h>
#include <sys/resource.h>
......@@ -197,6 +201,13 @@ static int streamIsFile(FILE* stream)
static int streamIsVT100(FILE* stream)
{
// on unix directly check if the file descriptor refers to a terminal
#if !defined(WIN32) || defined(__CYGWIN__)
return isatty(fileno(stream));
#endif
// otherwise try to detect some known cases:
// if running inside emacs the terminal is not VT100
const char* emacs = getenv("EMACS");
if(emacs && *emacs == 't') return 0;
......
......@@ -46,6 +46,7 @@ int Check_IsEntityInExtendedGroup(struct Group * Group_P, int Entity, int Flag)
Generate_ExtendedGroup(Group_P) ;
return((!Group_P->InitialList ||
(List_Search(Group_P->ExtendedList, &Entity, fcmp_int))) &&
// assumes that SuppListType is SUPPLIST_NOT:
(!Group_P->InitialSuppList ||
(! List_Search(Group_P->ExtendedSuppList, &Entity, fcmp_int)))) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment