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