diff --git a/src/utils/execmd.cpp b/src/utils/execmd.cpp index 0f60c7a6..f35db46a 100644 --- a/src/utils/execmd.cpp +++ b/src/utils/execmd.cpp @@ -1134,13 +1134,15 @@ void ReExec::reexec() #include #include "debuglog.h" -#include "cancelcheck.h" #include "execmd.h" +#ifdef BUILDING_RECOLL #include "smallut.h" +#include "cancelcheck.h" +#endif using namespace std; - +#ifdef BUILDING_RECOLL // Testing the rclexecm protocol outside of recoll. Here we use the // rcldoc.py filter, you can try with rclaudio too, adjust the file arg // accordingly @@ -1233,6 +1235,7 @@ bool exercise_mhexecm(const string& cmdstr, const string& mimetype, } return true; } +#endif static char *thisprog; static char usage [] = @@ -1270,6 +1273,7 @@ class MEAdv : public ExecCmdAdvise { public: void newData(int cnt) { if (op_flags & OPT_c) { +#ifdef BUILDING_RECOLL static int callcnt; if (callcnt++ == 10) { // Just sets the cancellation flag @@ -1278,6 +1282,7 @@ public: // exception. We call it here for simplicity CancelCheck::instance().checkCancel(); } +#endif } cerr << "newData(" << cnt << ")" << endl; } @@ -1338,12 +1343,14 @@ int main(int argc, char *argv[]) case 'c': op_flags |= OPT_c; break; case 'r': op_flags |= OPT_r; break; case 'w': op_flags |= OPT_w; break; +#ifdef BUILDING_RECOLL case 'm': op_flags |= OPT_m; break; +#endif case 'i': op_flags |= OPT_i; break; case 'o': op_flags |= OPT_o; break; default: Usage(); break; } - b1: argc--; argv++; + argc--; argv++; } if (argc < 1) @@ -1381,12 +1388,14 @@ int main(int argc, char *argv[]) return 0; } return 1; +#ifdef BUILDING_RECOLL } else if (op_flags & OPT_m) { if (l.size() < 2) Usage(); string mimetype = l[0]; l.erase(l.begin()); return exercise_mhexecm(arg1, mimetype, l) ? 0 : 1; +#endif } else { // Default: execute command line arguments ExecCmd mexec; @@ -1422,7 +1431,7 @@ int main(int argc, char *argv[]) int status = -1; try { status = mexec.doexec(arg1, l, ip, op); - } catch (CancelExcept) { + } catch (...) { cerr << "CANCELLED" << endl; } diff --git a/src/utils/execmd.h b/src/utils/execmd.h index 331f52fc..d593b51c 100644 --- a/src/utils/execmd.h +++ b/src/utils/execmd.h @@ -16,7 +16,6 @@ */ #ifndef _EXECMD_H_INCLUDED_ #define _EXECMD_H_INCLUDED_ -#include "autoconfig.h" #include #include @@ -138,6 +137,17 @@ class ExecCmd { const std::string *input = 0, std::string *output = 0); + /** Same as doexec but cmd and args in one vector */ + int doexec1(const std::vector& args, + const std::string *input = 0, + std::string *output = 0) { + if (args.empty()) + return -1; + return doexec(args[0], + std::vector(args.begin() + 1, args.end()), + input, output); + } + /* * The next four methods can be used when a Q/A dialog needs to be * performed with the command diff --git a/src/utils/netcon.cpp b/src/utils/netcon.cpp index f7729983..fe46d70f 100644 --- a/src/utils/netcon.cpp +++ b/src/utils/netcon.cpp @@ -19,7 +19,11 @@ #ifndef TEST_NETCON +#ifdef BUILDING_RECOLL #include "autoconfig.h" +#else +#include "config.h" +#endif #include #include @@ -43,7 +47,7 @@ #include -#ifdef RECOLL_DATADIR +#ifdef BUILDING_RECOLL #include "debuglog.h" #else diff --git a/src/utils/netcon.h b/src/utils/netcon.h index b7e20251..5dff0985 100644 --- a/src/utils/netcon.h +++ b/src/utils/netcon.h @@ -16,7 +16,11 @@ * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef BUILDING_RECOLL #include "autoconfig.h" +#else +#include "config.h" +#endif #include #include