Commit 78bd8d63 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

use vector instead of list for execmd arg list

parent c7c9c494
......@@ -284,7 +284,7 @@ bool Aspell::buildDict(Rcl::Db &db, string &reason)
// We create the dictionary by executing the aspell command:
// aspell --lang=[lang] create master [dictApath]
ExecCmd aspell;
list<string> args;
vector<string> args;
args.push_back(string("--lang=")+ m_lang);
args.push_back("--encoding=utf-8");
args.push_back("create");
......
......@@ -57,7 +57,7 @@ static string mimetypefromdata(const string &fn, bool usfc)
#ifdef USE_SYSTEM_FILE_COMMAND
if (usfc && mime.empty()) {
// Last resort: use "file -i"
list<string> args;
vector<string> args;
args.push_back("-i");
args.push_back(fn);
......
......@@ -143,7 +143,7 @@ static bool uncompressfile(RclConfig *conf, const string& ifn,
// Substitute file name and temp dir in command elements
list<string>::const_iterator it = cmdv.begin();
++it;
list<string> args;
vector<string> args;
map<char, string> subs;
subs['f'] = ifn;
subs['t'] = tdir.dirname();
......
......@@ -88,7 +88,7 @@ bool MimeHandlerExec::next_document()
// Build parameter list: delete cmd name and add the file name
list<string>::iterator it = params.begin();
list<string>myparams(++it, params.end());
vector<string>myparams(++it, params.end());
myparams.push_back(m_fn);
if (!m_ipath.empty())
myparams.push_back(m_ipath);
......
......@@ -52,7 +52,7 @@ bool MimeHandlerExecMultiple::startCmd()
// Build parameter list: delete cmd name
list<string>::iterator it = params.begin();
list<string>myparams(++it, params.end());
vector<string>myparams(++it, params.end());
// Start filter
m_cmd.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
......
......@@ -340,7 +340,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
m_widgets.push_back(eskn);
gl1->addWidget(eskn, 0, 0, 1, 2);
list<string> args;
vector<string> args;
args.push_back("-l");
ExecCmd ex;
string icout;
......
......@@ -703,7 +703,7 @@ void RclMain::toggleIndexing()
break;
case IXST_NOTRUNNING:
{
list<string> args;
vector<string> args;
args.push_back("-c");
args.push_back(theconfig->getConfDir());
m_idxproc = new ExecCmd;
......@@ -729,7 +729,7 @@ void RclMain::rebuildIndex()
QMessageBox::Cancel,
QMessageBox::NoButton);
if (rep == QMessageBox::Ok) {
list<string> args;
vector<string> args;
args.push_back("-c");
args.push_back(theconfig->getConfDir());
args.push_back("-z");
......@@ -1256,7 +1256,7 @@ void RclMain::updateIdxForDocs(vector<Rcl::Doc>& docs)
vector<string> paths;
if (ConfIndexer::docsToPaths(docs, paths)) {
list<string> args;
vector<string> args;
args.push_back("-c");
args.push_back(theconfig->getConfDir());
args.push_back("-i");
......@@ -1522,7 +1522,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
ignoreipath = stringToBool(cmdplusattr);
// Split the command line
list<string> lcmd;
vector<string> lcmd;
if (!stringToStrings(cmd, lcmd)) {
QMessageBox::warning(0, "Recoll",
tr("Bad viewer command line for %1: [%2]\n"
......@@ -1633,7 +1633,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
}
// Get rid of the command name. lcmd is now argv[1...n]
lcmd.pop_front();
lcmd.erase(lcmd.begin());
// Substitute %xx inside arguments
string efftime;
......@@ -1658,7 +1658,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc)
subs[it->first] = it->second;
}
string ncmd;
for (list<string>::iterator it = lcmd.begin();
for (vector<string>::iterator it = lcmd.begin();
it != lcmd.end(); it++) {
pcSubst(*it, ncmd, subs);
LOGDEB(("%s->%s\n", it->c_str(), ncmd.c_str()));
......
......@@ -125,7 +125,7 @@ void RTIToolW::accept()
if (nowCB->isChecked()) {
ExecCmd cmd;
list<string> args;
vector<string> args;
int status;
args.push_back("-m");
......
......@@ -29,7 +29,7 @@ static bool eCrontabGetLines(vector<string>& lines)
{
string crontab;
ExecCmd croncmd;
list<string> args;
vector<string> args;
int status;
// Retrieve current crontab contents. An error here means that no
......@@ -51,7 +51,7 @@ static bool eCrontabWriteFile(const vector<string>& lines, string& reason)
{
string crontab;
ExecCmd croncmd;
list<string> args;
vector<string> args;
int status;
for (vector<string>::const_iterator it = lines.begin();
......
......@@ -32,7 +32,6 @@
#include <string.h>
#endif
#include <list>
#include <vector>
#include <string>
#include <sstream>
......@@ -173,12 +172,12 @@ ExecCmd::~ExecCmd()
ExecCmdRsrc(this);
}
int ExecCmd::startExec(const string &cmd, const list<string>& args,
int ExecCmd::startExec(const string &cmd, const vector<string>& args,
bool has_input, bool has_output)
{
{ // Debug and logging
string command = cmd + " ";
for (list<string>::const_iterator it = args.begin();it != args.end();
for (vector<string>::const_iterator it = args.begin();it != args.end();
it++) {
command += "{" + *it + "} ";
}
......@@ -314,7 +313,7 @@ private:
};
int ExecCmd::doexec(const string &cmd, const list<string>& args,
int ExecCmd::doexec(const string &cmd, const vector<string>& args,
const string *input, string *output)
{
......@@ -505,7 +504,7 @@ bool ExecCmd::maybereap(int *status)
// In child process. Set up pipes, environment, and exec command.
// This must not return. exit() on error.
void ExecCmd::dochild(const string &cmd, const list<string>& args,
void ExecCmd::dochild(const string &cmd, const vector<string>& args,
bool has_input, bool has_output)
{
// Start our own process group
......@@ -581,7 +580,7 @@ void ExecCmd::dochild(const string &cmd, const list<string>& args,
// Fill up argv
argv[0] = cmd.c_str();
int i = 1;
list<string>::const_iterator it;
vector<string>::const_iterator it;
for (it = args.begin(); it != args.end(); it++) {
argv[i++] = it->c_str();
}
......@@ -684,7 +683,7 @@ void ReExec::reexec()
#include <stdlib.h>
#include <string>
#include <iostream>
#include <list>
#include <vector>
#include "debuglog.h"
#include "cancelcheck.h"
......@@ -781,7 +780,7 @@ int main(int argc, char *argv[])
Usage();
string cmd = *argv++; argc--;
list<string> l;
vector<string> l;
while (argc > 0) {
l.push_back(*argv++); argc--;
}
......
......@@ -18,11 +18,9 @@
#define _EXECMD_H_INCLUDED_
#include <signal.h>
#include <string>
#include <list>
#include <vector>
#include <stack>
#ifndef NO_NAMESPACES
using std::list;
using std::string;
using std::vector;
using std::stack;
......@@ -119,12 +117,12 @@ class ExecCmd {
*
* @param cmd the program to execute. This must be an absolute file name
* or exist in the PATH.
* @param args the argument list (NOT including argv[0]).
* @param args the argument vector (NOT including argv[0]).
* @param input Input to send TO the command.
* @param output Output FROM the command.
* @return the exec ouput status (0 if ok), or -1
*/
int doexec(const string &cmd, const list<string>& args,
int doexec(const string &cmd, const vector<string>& args,
const string *input = 0,
string *output = 0);
......@@ -132,7 +130,7 @@ class ExecCmd {
* The next four methods can be used when a Q/A dialog needs to be
* performed with the command
*/
int startExec(const string &cmd, const list<string>& args,
int startExec(const string &cmd, const vector<string>& args,
bool has_input, bool has_output);
int send(const string& data);
int receive(string& data, int cnt = -1);
......@@ -202,7 +200,7 @@ class ExecCmd {
sigemptyset(&m_blkcld);
}
// Child process code
void dochild(const string &cmd, const list<string>& args,
void dochild(const string &cmd, const vector<string>& args,
bool has_input, bool has_output);
/* Copyconst and assignment private and forbidden */
ExecCmd(const ExecCmd &) {}
......
......@@ -29,7 +29,7 @@ bool rclionice(const string& clss, const string& cdata)
LOGDEB0(("rclionice: ionice not found\n"));
return false;
}
list<string> args;
vector<string> args;
args.push_back("-c");
args.push_back(clss);
......
......@@ -19,7 +19,6 @@
#include <string>
#include <iostream>
#include <list>
#include <vector>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment