ports/x11/lxqt/runner/patches/patch-providers_cpp

59 lines
1.2 KiB
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
Index: providers.cpp
--- providers.cpp.orig
+++ providers.cpp
@@ -28,6 +28,9 @@
*
* END_COMMON_COPYRIGHT_HEADER */
+#if defined(__OpenBSD__)
+#define NO_WORDEXP
+#endif
#include "providers.h"
#include "yamlparser.h"
@@ -48,7 +51,11 @@
#include <LXQt/ScreenSaver>
#include "providers.h"
#include <LXQtGlobalKeys/Action>
+#ifdef NO_WORDEXP
+#include <glob.h>
+#else
#include <wordexp.h>
+#endif
#include <QStandardPaths>
#define MAX_HISTORY 100
@@ -60,6 +67,24 @@
static QString expandCommand(const QString &command, QStringList *arguments=0)
{
QString program;
+ #ifdef NO_WORDEXP
+ glob_t words;
+
+ if (glob(command.toLocal8Bit().data(), 0, NULL, &words) != 0)
+ return QString();
+
+ char **w;
+ w = words.gl_pathv;
+ program = QString::fromLocal8Bit(w[0]);
+
+ if (arguments)
+ {
+ for (size_t i = 1; i < words.gl_pathc; i++)
+ *arguments << QString::fromLocal8Bit(w[i]);
+ }
+
+ globfree(&words);
+ #else
wordexp_t words;
if (wordexp(command.toLocal8Bit().data(), &words, 0) != 0)
@@ -76,6 +101,7 @@ static QString expandCommand(const QString &command, Q
}
wordfree(&words);
+ #endif
return program;
}