Switch to unified view

a/src/internfile/mh_exec.cpp b/src/internfile/mh_exec.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.5 2006-01-23 13:32:28 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.6 2006-01-26 17:59:50 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
20
20
21
#include "execmd.h"
21
#include "execmd.h"
22
#include "mh_exec.h"
22
#include "mh_exec.h"
23
#include "mh_html.h"
23
#include "mh_html.h"
24
#include "debuglog.h"
24
#include "debuglog.h"
25
#include "cancelcheck.h"
25
26
26
#ifndef NO_NAMESPACES
27
#ifndef NO_NAMESPACES
27
using namespace std;
28
using namespace std;
28
#endif /* NO_NAMESPACES */
29
#endif /* NO_NAMESPACES */
30
31
class MEAdv : public ExecCmdAdvise {
32
public:
33
    void newData(int) {
34
  CancelCheck::instance().checkCancel();
35
    }
36
};
29
37
30
// Execute an external program to translate a file from its native format
38
// Execute an external program to translate a file from its native format
31
// to html. Then call the html parser to do the actual indexing
39
// to html. Then call the html parser to do the actual indexing
32
MimeHandler::Status 
40
MimeHandler::Status 
33
MimeHandlerExec::mkDoc(RclConfig *conf, const string &fn, 
41
MimeHandlerExec::mkDoc(RclConfig *conf, const string &fn, 
...
...
47
    list<string>myparams(++it, params.end());
55
    list<string>myparams(++it, params.end());
48
    myparams.push_back(fn);
56
    myparams.push_back(fn);
49
57
50
    // Execute command and store the result text, which is supposedly html
58
    // Execute command and store the result text, which is supposedly html
51
    string html;
59
    string html;
52
    ExecCmd exec;
60
    ExecCmd mexec;
61
    MEAdv adv;
62
    mexec.setAdvise(&adv);
53
    exec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
63
    mexec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
54
        "RECOLL_FILTER_FORPREVIEW=no");
64
        "RECOLL_FILTER_FORPREVIEW=no");
55
    int status = exec.doexec(cmd, myparams, 0, &html);
65
    int status = mexec.doexec(cmd, myparams, 0, &html);
56
    if (status) {
66
    if (status) {
57
    LOGERR(("MimeHandlerExec: command status 0x%x: %s\n", 
67
    LOGERR(("MimeHandlerExec: command status 0x%x: %s\n", 
58
        status, cmd.c_str()));
68
        status, cmd.c_str()));
59
    return MimeHandler::MHError;
69
    return MimeHandler::MHError;
60
    }
70
    }