Created $[$name] retrieve for environment variables.

This commit is contained in:
Brad Arant 2024-10-07 13:33:17 -07:00
parent fa711ddf86
commit 7d6bb8355f
3 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,7 @@
#include "Exception.h"
#include "__mysql.h"
#include <iostream>
#include <stdlib.h>
namespace jet {
@ -45,6 +46,8 @@ namespace jet {
// TODO: should only allow CGI variable name. Allow variable substitution.
} if(variable.ifNext("@")) {
// TODO: should only allow environment variables. Allow substitution.
} if(variable.ifNext("$")) {
return getenv(renderVariableName(name, variable).c_str());
} else {
coreutils::MString splitName = renderVariableName(name, variable);
splitName.split(".");

BIN
jet-2.0

Binary file not shown.

View File

@ -4,13 +4,13 @@
<comment>This is a comment and should not show up in the output.</comment>
<html>
$[nonexistant]
$[$HOME]
<comment>
<mysql host="localhost" database="barant" user="barant" password="uversa" sessionid="1">
<mysql host="barant.com" database="barant" user="barant" password="uversa1960" sessionid="1">
<sql sessionid="1">select * from testdata</sql>
<whilerow name="index" count="10" sessionid="1">
$[1.id] $[1.text] $[1.value]
</whilerow>
</mysql>
</comment>
<set name="ix" value="1" />
<set name="theexpr" expr="SUBSTRING('abcdefg', 5 - 4, 20 - 17)" />