small adjustments for out-of-recoll builds

This commit is contained in:
Jean-Francois Dockes 2016-03-21 18:51:41 +01:00
parent c344b3ed4c
commit e6af8c6020
4 changed files with 33 additions and 6 deletions

View file

@ -1134,13 +1134,15 @@ void ReExec::reexec()
#include <vector>
#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;
}

View file

@ -16,7 +16,6 @@
*/
#ifndef _EXECMD_H_INCLUDED_
#define _EXECMD_H_INCLUDED_
#include "autoconfig.h"
#include <string>
#include <vector>
@ -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<std::string>& args,
const std::string *input = 0,
std::string *output = 0) {
if (args.empty())
return -1;
return doexec(args[0],
std::vector<std::string>(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

View file

@ -19,7 +19,11 @@
#ifndef TEST_NETCON
#ifdef BUILDING_RECOLL
#include "autoconfig.h"
#else
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
@ -43,7 +47,7 @@
#include <map>
#ifdef RECOLL_DATADIR
#ifdef BUILDING_RECOLL
#include "debuglog.h"
#else

View file

@ -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 <sys/time.h>
#include <map>