1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- $OpenBSD: patch-src_celutil_unixdirectory_cpp,v 1.3 2012/08/19 22:30:37 ajacoutot Exp $
- --- src/celutil/unixdirectory.cpp.orig Mon Jun 22 17:44:24 2009
- +++ src/celutil/unixdirectory.cpp Mon Jul 20 11:55:18 2009
- @@ -7,11 +7,19 @@
- // as published by the Free Software Foundation; either version 2
- // of the License, or (at your option) any later version.
-
- +#if defined(__OpenBSD__)
- +#define NO_WORDEXP
- +#endif
- +
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <dirent.h>
- +#ifdef NO_WORDEXP
- +#include <glob.h>
- +#else
- #include <wordexp.h>
- +#endif
- #include "directory.h"
-
- using namespace std;
- @@ -107,6 +115,19 @@ bool IsDirectory(const std::string& filename)
-
- std::string WordExp(const std::string& filename)
- {
- +#ifdef NO_WORDEXP
- + glob_t g;
- + std::string expanded;
- + glob(filename.c_str(), GLOB_NOSORT | GLOB_TILDE, NULL, &g);
- + if (g.gl_matchc != 1) {
- + globfree(&g);
- + return filename;
- + } else {
- + expanded = g.gl_pathv[0];
- + globfree(&g);
- + return expanded;
- + }
- +#else
- #ifndef WORDEXP_PROBLEM
- wordexp_t result;
- std::string expanded;
- @@ -133,4 +154,5 @@ std::string WordExp(const std::string& filename)
- std::string expanded = filename;
- #endif
- return expanded;
- +#endif
- }
|