Added call tag. Updated read tag.

This commit is contained in:
Brad Arant committed 2024-07-08 13:56:27 -07:00
1 parent d10ed783fa
commit 8443495675
8 files changed
+83 -8

No files matched your search

+9 -5
View File
@@ -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);
}
}