summaryrefslogtreecommitdiff
path: root/drumgizmo
diff options
context:
space:
mode:
authorGoran Mekić <meka@tilda.center>2017-05-09 01:20:50 +0200
committerGoran Mekić <meka@tilda.center>2017-05-11 12:56:33 +0200
commitb4a3767a189145d62177182fdd418bb3ba5dd455 (patch)
tree767f959c3affeda0c1148a0b511cd86d064134ab /drumgizmo
parent128f7f3c863e486820054353c00ca203efb9fcb8 (diff)
Expand shell globs in input params
Diffstat (limited to 'drumgizmo')
-rw-r--r--drumgizmo/drumgizmoc.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc
index 6ee0905..feae0ae 100644
--- a/drumgizmo/drumgizmoc.cc
+++ b/drumgizmo/drumgizmoc.cc
@@ -35,6 +35,7 @@
#include <sstream>
#include <chrono>
#include <thread>
+#include <wordexp.h>
#include <hugin.hpp>
@@ -261,11 +262,19 @@ int main(int argc, char* argv[])
std::string parm;
std::string val;
bool inval = false;
+ wordexp_t exp_result;
for(size_t i = 0; i < iparms.size(); ++i)
{
if(iparms[i] == ',')
{
- ie->setParm(parm, val);
+ int error = wordexp(val.data(), &exp_result, 0);
+ if(error)
+ {
+ std::cerr << "Wrong argument: ";
+ std::cerr << parm << " = " << val << std::endl;
+ return 1;
+ }
+ ie->setParm(parm, exp_result.we_wordv[0]);
parm = "";
val = "";
inval = false;
@@ -289,7 +298,14 @@ int main(int argc, char* argv[])
}
if(parm != "")
{
- ie->setParm(parm, val);
+ int error = wordexp(val.data(), &exp_result, 0);
+ if(error)
+ {
+ std::cerr << "Wrong argument: ";
+ std::cerr << parm << " = " << val << std::endl;
+ return 1;
+ }
+ ie->setParm(parm, exp_result.we_wordv[0]);
}
}