cygwin/popen fix from kayvan

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5331 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-09-23 16:03:11 +00:00
parent a610cde867
commit 72956b1c3b
6 changed files with 38 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2002-09-16 Kayvan A. Sylvan <kayvan@sylvan.com>
* os.h, os_os2.C, os_win32.C, os_unix.C: Added popen_read_mode(),
since at least for Cygwin, the "rb" read_mode acceptable for
fopen() is illegal for popen(), whose mode argument *must* be "r"
or "w".
* filetools.C (RunCommand): Uses os::popen_read_mode() instead
of os::read_mode()
2002-08-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Makefile.am (libsupport_la_SOURCES): delete smart_ptr.h and

View File

@ -1294,7 +1294,7 @@ cmd_ret const RunCommand(string const & cmd)
// pstream (process stream), with the
// variants ipstream, opstream
FILE * inf = ::popen(cmd.c_str(), os::read_mode());
FILE * inf = ::popen(cmd.c_str(), os::popen_read_mode());
// (Claus Hentschel) Check if popen was succesful ;-)
if (!inf)

View File

@ -52,9 +52,11 @@ public:
static string internal_path(string const &p);
// is path absolute?
static bool is_absolute_path(string const & p);
// returns a string suitable to be passed to fopen/popen when
// returns a string suitable to be passed to fopen when
// reading a file
static char const * read_mode();
// same for popen().
static char const * popen_read_mode();
//
static void warn(string mesg);
private:

View File

@ -174,9 +174,16 @@ bool os::is_absolute_path(string const & p)
}
// returns a string suitable to be passed to fopen/popen when
// returns a string suitable to be passed to fopen when
// reading a file
char const * os::read_mode()
{
return "r";
}
// returns a string suitable to be passed to popen when
// reading a pipe
char const * os::popen_read_mode()
{
return "r";
}

View File

@ -77,9 +77,16 @@ bool os::is_absolute_path(string const & p)
return (!p.empty() && p[0] == '/');
}
// returns a string suitable to be passed to fopen/popen when
// returns a string suitable to be passed to fopen when
// reading a file
char const * os::read_mode()
{
return "r";
}
// returns a string suitable to be passed to popen when
// reading a pipe
char const * os::popen_read_mode()
{
return "r";
}

View File

@ -119,9 +119,16 @@ bool os::is_absolute_path(string const & p)
return isDosPath | isUnixPath;
}
// returns a string suitable to be passed to fopen/popen when
// returns a string suitable to be passed to fopen when
// reading a file
char const * os::read_mode()
{
return "rb";
}
// returns a string suitable to be passed to popen when
// reading a pipe
char const * os::popen_read_mode()
{
return "r";
}