diff --git a/src/support/ChangeLog b/src/support/ChangeLog index f81d1cc6ff..70ec20926e 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,10 +1,15 @@ +2002-02-08 Jean-Marc Lasgouttes + + * filetools.C (do_popen): fix for cygwin compatibility (from Claus + Hentschel). This code should maybe be moved to os:: class. + 2002-02-08 Herbert Voss - * filetools.[C]: (unzipFile) fix typo + * filetools.C: (unzipFile) fix typo 2002-02-06 Herbert Voss - * filetools.[Ch]: fix sume bugs for detecting zipped files + * filetools.[Ch]: fix some bugs for detecting zipped files adding unzipFile() 2002-02-04 Herbert Voss diff --git a/src/support/filetools.C b/src/support/filetools.C index 515e2ea8e1..37aab49fc7 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -1134,7 +1134,18 @@ cmdret const do_popen(string const & cmd) // of course the best would be to have a // pstream (process stream), with the // variants ipstream, opstream - FILE * inf = ::popen(cmd.c_str(), "r"); + + // CYGWIN needs 'b', but linux only works without it +#ifdef __CYGWIN__ + FILE * inf = ::popen(cmd.c_str(), "rb"); +#else + FILE * inf = ::popen(cmd.c_str(), "r"); +#endif + + // (Claus Hentschel) Check if popen was succesful ;-) + if (!inf) + return make_pair(-1, string()); + string ret; int c = fgetc(inf); while (c != EOF) {