Portability - Solaris

- Added include of auto.h to allow #ifdef SOLARIS to work.
- Put #ifdef around glob arguments that aren't supported on Solaris.
- Fixed uninitialized variable that only gcc on Solaris spotted.
This commit is contained in:
Paul Beckingham 2010-02-12 20:58:56 -05:00
parent 75666c56cc
commit 9b80017323
3 changed files with 8 additions and 2 deletions

View file

@ -32,6 +32,7 @@
#include <pwd.h>
#include <unistd.h>
#include "Path.h"
#include "../auto.h"
////////////////////////////////////////////////////////////////////////////////
Path::Path ()
@ -201,7 +202,11 @@ std::vector <std::string> Path::glob (const std::string& pattern)
std::vector <std::string> results;
glob_t g;
#ifdef SOLARIS
if (!::glob (pattern.c_str (), GLOB_ERR, NULL, &g))
#else
if (!::glob (pattern.c_str (), GLOB_ERR | GLOB_BRACE | GLOB_TILDE, NULL, &g))
#endif
for (int i = 0; i < (int) g.gl_pathc; ++i)
results.push_back (g.gl_pathv[i]);