Switch to unified view

a/src/utils/execmd.h b/src/utils/execmd.h
...
...
16
 */
16
 */
17
#ifndef _EXECMD_H_INCLUDED_
17
#ifndef _EXECMD_H_INCLUDED_
18
#define _EXECMD_H_INCLUDED_
18
#define _EXECMD_H_INCLUDED_
19
#include <signal.h>
19
#include <signal.h>
20
#include <string>
20
#include <string>
21
#include <list>
22
#include <vector>
21
#include <vector>
23
#include <stack>
22
#include <stack>
24
#ifndef NO_NAMESPACES
23
#ifndef NO_NAMESPACES
25
using std::list;
26
using std::string;
24
using std::string;
27
using std::vector;
25
using std::vector;
28
using std::stack;
26
using std::stack;
29
#endif
27
#endif
30
28
...
...
117
     * The function is exception-safe. In case an exception occurs in the 
115
     * The function is exception-safe. In case an exception occurs in the 
118
     * advise callback, fds and pids will be cleaned-up properly.
116
     * advise callback, fds and pids will be cleaned-up properly.
119
     *
117
     *
120
     * @param cmd the program to execute. This must be an absolute file name 
118
     * @param cmd the program to execute. This must be an absolute file name 
121
     *   or exist in the PATH.
119
     *   or exist in the PATH.
122
     * @param args the argument list (NOT including argv[0]).
120
     * @param args the argument vector (NOT including argv[0]).
123
     * @param input Input to send TO the command.
121
     * @param input Input to send TO the command.
124
     * @param output Output FROM the command.
122
     * @param output Output FROM the command.
125
     * @return the exec ouput status (0 if ok), or -1
123
     * @return the exec ouput status (0 if ok), or -1
126
     */
124
     */
127
    int doexec(const string &cmd, const list<string>& args, 
125
    int doexec(const string &cmd, const vector<string>& args, 
128
           const string *input = 0, 
126
           const string *input = 0, 
129
           string *output = 0);
127
           string *output = 0);
130
128
131
    /*
129
    /*
132
     * The next four methods can be used when a Q/A dialog needs to be 
130
     * The next four methods can be used when a Q/A dialog needs to be 
133
     * performed with the command
131
     * performed with the command
134
     */
132
     */
135
    int startExec(const string &cmd, const list<string>& args, 
133
    int startExec(const string &cmd, const vector<string>& args, 
136
          bool has_input, bool has_output);
134
          bool has_input, bool has_output);
137
    int send(const string& data);
135
    int send(const string& data);
138
    int receive(string& data, int cnt = -1);
136
    int receive(string& data, int cnt = -1);
139
    int getline(string& data);
137
    int getline(string& data);
140
    int wait();
138
    int wait();
...
...
200
    m_pipein[0] = m_pipein[1] = m_pipeout[0] = m_pipeout[1] = -1;
198
    m_pipein[0] = m_pipein[1] = m_pipeout[0] = m_pipeout[1] = -1;
201
    m_pid = -1;
199
    m_pid = -1;
202
    sigemptyset(&m_blkcld);
200
    sigemptyset(&m_blkcld);
203
    }
201
    }
204
    // Child process code
202
    // Child process code
205
    void dochild(const string &cmd, const list<string>& args, 
203
    void dochild(const string &cmd, const vector<string>& args, 
206
         bool has_input, bool has_output);
204
         bool has_input, bool has_output);
207
    /* Copyconst and assignment private and forbidden */
205
    /* Copyconst and assignment private and forbidden */
208
    ExecCmd(const ExecCmd &) {}
206
    ExecCmd(const ExecCmd &) {}
209
    ExecCmd& operator=(const ExecCmd &) {return *this;};
207
    ExecCmd& operator=(const ExecCmd &) {return *this;};
210
};
208
};