fixed up call tag. Should be complete.
This commit is contained in:
parent
d3b8ab68e6
commit
5a7f7f2d18
@ -7,7 +7,7 @@
|
||||
|
||||
namespace jet {
|
||||
|
||||
Global::Global() {
|
||||
Global::Global(char **envp) : envp(envp) {
|
||||
|
||||
}
|
||||
|
||||
|
5
Global.h
5
Global.h
@ -11,7 +11,7 @@ namespace jet {
|
||||
class Global {
|
||||
|
||||
public:
|
||||
Global();
|
||||
Global(char **envp);
|
||||
virtual ~Global();
|
||||
|
||||
void dump();
|
||||
@ -30,7 +30,8 @@ namespace jet {
|
||||
std::map<coreutils::MString, __mysql *> sessions;
|
||||
std::map<coreutils::MString, coreutils::MString> headers;
|
||||
std::map<coreutils::MString, coreutils::MString> tags;
|
||||
coreutils::MString lastConverted;
|
||||
coreutils::MString lastConverted;
|
||||
char **envp;
|
||||
|
||||
};
|
||||
|
||||
|
15
__call.cpp
15
__call.cpp
@ -33,7 +33,7 @@ namespace jet {
|
||||
dup2(fdo[1], 1);
|
||||
if(variableDefined("input")) {
|
||||
resolveKeyword("input");
|
||||
coreutils::ZString input(variables[variables["input"]]);
|
||||
coreutils::ZString input(variables["input"]);
|
||||
pipe(fdi);
|
||||
if(fork() == 0) {
|
||||
close(fdi[0]);
|
||||
@ -41,12 +41,12 @@ namespace jet {
|
||||
close(fdi[1]);
|
||||
exit(0);
|
||||
}
|
||||
close(fdi[0]);
|
||||
close(fdi[1]);
|
||||
dup2(fdi[0], 0);
|
||||
}
|
||||
rc = execve(variables["pgm"].c_str(), argv, NULL);
|
||||
rc = execvpe(variables["pgm"].c_str(), argv, global.envp);
|
||||
close(fdo[1]);
|
||||
exit(rc);
|
||||
exit(errno);
|
||||
}
|
||||
close(fdo[1]);
|
||||
if(variableDefined("name")) {
|
||||
@ -63,9 +63,10 @@ namespace jet {
|
||||
} else
|
||||
out.read(fdo[0]);
|
||||
waitpid(pid, &status, 0);
|
||||
if(variableDefined("status"))
|
||||
resolveKeyword("status");
|
||||
global.variables[variables["status"]] = (status >> 8 & 255);
|
||||
if(variableDefined("error")) {
|
||||
resolveKeyword("error");
|
||||
global.variables[variables["error"]] = (status >> 8 & 255);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,14 +5,14 @@
|
||||
#include "Exception.h"
|
||||
#include "__jet.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
|
||||
coreutils::File script(argv[1]);
|
||||
script.read();
|
||||
coreutils::ZString data = script.asZString();
|
||||
data.goeol();
|
||||
|
||||
jet::Global global;
|
||||
jet::Global global(envp);
|
||||
|
||||
try {
|
||||
coreutils::MString out;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!../jet-2.0
|
||||
<jet name1="localname" filterblanklines="true" trimlines="true">
|
||||
<set name="abc" value="abcdefg" />
|
||||
<call pgm="/usr/bin/cat" status="stat" input="$[abc]" name="test1" />
|
||||
<call pgm="cat" error="error" input="$[abc]xyz" name="test1" />
|
||||
test1=$[test1]
|
||||
name1=#[localname]
|
||||
status=$[stat]
|
||||
error=$[error]
|
||||
</jet>
|
||||
|
Loading…
x
Reference in New Issue
Block a user