Some work on call tag.
This commit is contained in:
parent
f1624b074a
commit
2dd41238de
@ -1,6 +1,7 @@
|
||||
#include "__call.h"
|
||||
#include "Exception.h"
|
||||
#include "MString.h"
|
||||
#include <ostream>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
@ -10,8 +11,8 @@ namespace jet {
|
||||
|
||||
__call::__call(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
if(hasContainer)
|
||||
throw coreutils::Exception("call cannot have a container.");
|
||||
if(!variableDefined(coreutils::ZString("pgm")))
|
||||
throw coreutils::Exception("call tag cannot have a container.");
|
||||
if(!variableDefined("pgm"))
|
||||
throw coreutils::Exception("pgm keyword must be specified.");
|
||||
argv[0] = variables["pgm"].c_str(); // TODO: Need to peel off the program name only and pass as argv[0].
|
||||
for(ix = 1; ix <= 50; ++ix) {
|
||||
@ -42,7 +43,6 @@ namespace jet {
|
||||
}
|
||||
rc = execve(variables["pgm"].c_str(), argv, NULL);
|
||||
close(fdo[1]);
|
||||
std::cout << "rc: " << rc << std::endl;
|
||||
exit(rc);
|
||||
}
|
||||
close(fdo[1]);
|
||||
@ -51,6 +51,8 @@ namespace jet {
|
||||
else
|
||||
out.read(fdo[0]);
|
||||
waitpid(pid, &status, 0);
|
||||
if(variableDefined("status"))
|
||||
global.variables[variables["status"]] = (status >> 8 & 255);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace jet {
|
||||
|
||||
__system::__system(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
if(hasContainer)
|
||||
throw coreutils::Exception("call cannot have a container.");
|
||||
throw coreutils::Exception("system tag cannot have a container.");
|
||||
if(!variableDefined(coreutils::ZString("pgm")))
|
||||
throw coreutils::Exception("pgm keyword must be specified.");
|
||||
argv[0] = variables["pgm"].c_str(); // TODO: Need to peel off the program name only and pass as argv[0].
|
||||
|
@ -50,8 +50,9 @@
|
||||
<for name="ix" start="1" end="5" step="1">
|
||||
-->#[ix]<--
|
||||
</for>
|
||||
<call pgm="/usr/bin/ls" arg1="-al" name="ls" />
|
||||
$[lsi]
|
||||
<call status="rc" pgm="/usr/bin/ls" arg1="-al" name="ls" />
|
||||
$[rc]
|
||||
$[ls]
|
||||
<read file="compile" name="file" />
|
||||
$[filex]
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user