Fixed read tag merge issue.

This commit is contained in:
brad Arant committed 2024-07-08 18:38:32 -07:00
commit 666a12e16b
10 files changed
+115 -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 &parent, Global &global) : Tag(in, parent, 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. Not a container tag.");
// 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);
}
}