Added call tag. Updated read tag.
This commit is contained in:
1 parent
d10ed783fa
commit
8443495675
8 files changed
+83
-8
No files matched your search
+9
-5
@@ -1,17 +1,21 @@
|
||||
#include "__read.h"
|
||||
#include "Exception.h"
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace jet {
|
||||
|
||||
__read::__read(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
if(!variableDefined(coreutils::ZString("file")))
|
||||
throw coreutils::Exception("file keyword must be specified.");
|
||||
|
||||
if(hasContainer)
|
||||
throw coreutils::Exception("missing / at end of tag definition.");
|
||||
|
||||
// process file request here.
|
||||
|
||||
throw coreutils::Exception("read tag does not have a container.");
|
||||
fd = open(variables["file"], O_RDONLY);
|
||||
while(len = read(fd, &buffer, sizeof(buffer - 1))) {
|
||||
buffer[len] = 0;
|
||||
out << buffer;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user