|
a/src/utils/execmd.cpp |
|
b/src/utils/execmd.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.1 2004-12-12 08:58:12 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.2 2004-12-14 17:54:16 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
|
4 |
|
5 |
#include <unistd.h>
|
5 |
#include <unistd.h>
|
6 |
#include <sys/types.h>
|
6 |
#include <sys/types.h>
|
7 |
#include <sys/wait.h>
|
7 |
#include <sys/wait.h>
|
|
... |
|
... |
12 |
#include <string>
|
12 |
#include <string>
|
13 |
#include <sstream>
|
13 |
#include <sstream>
|
14 |
#include <iostream>
|
14 |
#include <iostream>
|
15 |
|
15 |
|
16 |
#include "execmd.h"
|
16 |
#include "execmd.h"
|
|
|
17 |
#include "pathut.h"
|
17 |
|
18 |
|
18 |
using namespace std;
|
19 |
using namespace std;
|
19 |
#define MAX(A,B) (A>B?A:B)
|
20 |
#define MAX(A,B) (A>B?A:B)
|
20 |
|
21 |
|
21 |
int
|
22 |
int
|
|
... |
|
... |
150 |
cerr << "Malloc error" << endl;
|
151 |
cerr << "Malloc error" << endl;
|
151 |
exit(1);
|
152 |
exit(1);
|
152 |
}
|
153 |
}
|
153 |
|
154 |
|
154 |
// Fill up argv
|
155 |
// Fill up argv
|
155 |
argv[0] = cmd.c_str();
|
156 |
argv[0] = path_getsimple(cmd).c_str();
|
156 |
i = 1;
|
157 |
i = 1;
|
157 |
for (it = args.begin(); it != args.end(); it++) {
|
158 |
for (it = args.begin(); it != args.end(); it++) {
|
158 |
argv[i++] = it->c_str();
|
159 |
argv[i++] = it->c_str();
|
159 |
}
|
160 |
}
|
160 |
argv[i] = 0;
|
161 |
argv[i] = 0;
|
161 |
|
162 |
|
162 |
#if 0
|
163 |
#if 0
|
163 |
{int i = 0;cerr << "cmd: " << cmd << endl << "ARGS:" << endl;
|
164 |
{int i = 0;cerr << "cmd: " << cmd << endl << "ARGS: " << endl;
|
164 |
while (argv[i]) cerr << argv[i++] << endl;}
|
165 |
while (argv[i]) cerr << argv[i++] << endl;}
|
165 |
#endif
|
166 |
#endif
|
166 |
|
167 |
|
167 |
execvp(cmd.c_str(), (char *const*)argv);
|
168 |
execvp(cmd.c_str(), (char *const*)argv);
|
168 |
// Hu ho
|
169 |
// Hu ho
|