Cleaned up read tag and call tag to compile.
This commit is contained in:
parent
666a12e16b
commit
49edce1f34
11
__call.cpp
11
__call.cpp
@ -1,7 +1,6 @@
|
|||||||
#include "__call.h"
|
#include "__call.h"
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
#include "MString.h"
|
#include "MString.h"
|
||||||
#include <limits.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -14,11 +13,11 @@ namespace jet {
|
|||||||
throw coreutils::Exception("call cannot have a container.");
|
throw coreutils::Exception("call cannot have a container.");
|
||||||
if(!variableDefined(coreutils::ZString("pgm")))
|
if(!variableDefined(coreutils::ZString("pgm")))
|
||||||
throw coreutils::Exception("pgm keyword must be specified.");
|
throw coreutils::Exception("pgm keyword must be specified.");
|
||||||
pipe[fd]; // TODO: Get these pipes to work with name and input keywords.
|
pipe(fd); // TODO: Get these pipes to work with name and input keywords.
|
||||||
dup2(0);
|
dup2(fd[0], 1);
|
||||||
if(pid != fork()) {
|
if(pid != fork()) {
|
||||||
argv[0] = variables["pgm"]; // TODO: Need to peel off the program name only and pass as argv[0].
|
argv[0] = variables["pgm"].c_str(); // TODO: Need to peel off the program name only and pass as argv[0].
|
||||||
for(ix = 1; ix <= ARG_MAX; ++ix) {
|
for(ix = 1; ix <= 50; ++ix) {
|
||||||
coreutils::MString arg("arg");
|
coreutils::MString arg("arg");
|
||||||
arg << ix;
|
arg << ix;
|
||||||
if(variableDefined(arg))
|
if(variableDefined(arg))
|
||||||
@ -30,7 +29,7 @@ namespace jet {
|
|||||||
execve(variables["pgm"].c_str(), argv, NULL);
|
execve(variables["pgm"].c_str(), argv, NULL);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
waitpid(&status);
|
waitpid(pid, &status,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "__cpmment.h"
|
#include "__comment.h"
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
|
|
||||||
namespace jet {
|
namespace jet {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "__read.h"
|
#include "__read.h"
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ namespace jet {
|
|||||||
throw coreutils::Exception("file keyword must be specified.");
|
throw coreutils::Exception("file keyword must be specified.");
|
||||||
if(hasContainer)
|
if(hasContainer)
|
||||||
throw coreutils::Exception("read tag does not have a container.");
|
throw coreutils::Exception("read tag does not have a container.");
|
||||||
fd = open(variables["file"], O_RDONLY);
|
fd = open(variables["file"].c_str(), O_RDONLY);
|
||||||
while(len = read(fd, &buffer, sizeof(buffer - 1))) {
|
while(len = read(fd, &buffer, sizeof(buffer - 1))) {
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
out << buffer;
|
out << buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user