void Foam::primitiveEntry::append ( const token& currToken, const dictionary& dict, Istream& is ) { if (currToken.isWord()) { const word& w = currToken.wordToken(); if ( w.size() == 1 || ( !(w[0] == '$' && expandVariable(w, dict)) && !(w[0] == '#' && expandFunction(w, dict, is)) ) ) { newElmt(tokenIndex()++) = currToken; } } else { newElmt(tokenIndex()++) = currToken; } }
void Foam::primitiveEntry::append ( const token& currToken, const dictionary& dict, Istream& is ) { if (currToken.isWord()) { const word& w = currToken.wordToken(); if ( disableFunctionEntries || w.size() == 1 || ( !(w[0] == '$' && expandVariable(w, dict)) && !(w[0] == '#' && expandFunction(w, dict, is)) ) ) { newElmt(tokenIndex()++) = currToken; } } else if (currToken.isVariable()) { const string& w = currToken.stringToken(); if ( disableFunctionEntries || w.size() <= 3 || !( w[0] == '$' && w[1] == token::BEGIN_BLOCK && expandVariable(w, dict) ) ) { newElmt(tokenIndex()++) = currToken; } } else { newElmt(tokenIndex()++) = currToken; } }
char *ConfigCtx::getExpandedTag(const XmlNode *pNode, const char *pName, char *pBuf, int bufLen, int bKeyName) { const char *pVal = getTag(pNode, pName, bKeyName); if (!pVal) return NULL; //if ( expandVariable( pVal, pBuf, bufLen ) >= 0 ) if (expandVariable(pVal, pBuf, bufLen) >= 0) return pBuf; LS_NOTICE(this, "String is too long for tag: %s, value: %s, maxlen: %d", pName, pVal, bufLen); return NULL; }
int ConfigCtx::getAbsolute(char *res, const char *path, int pathOnly) { const char *pChroot = MainServerConfig::getInstance().getChroot(); int iChrootLen = MainServerConfig::getInstance().getChrootlen(); const char *pRoot = ""; const char *pPath = path; int ret; char achBuf[MAX_PATH_LEN]; char *dest = achBuf; int len = MAX_PATH_LEN; if (getRootPath(pRoot, pPath)) return LS_FAIL; if (pChroot) { if ((*pRoot) || (strncmp(path, pChroot, iChrootLen) != 0)) { memmove(dest, pChroot, iChrootLen); dest += iChrootLen; len -= iChrootLen; } } if (pathOnly) ret = GPath::getAbsolutePath(dest, len, pRoot, pPath); else ret = GPath::getAbsoluteFile(dest, len, pRoot, pPath); if (ret) { LS_ERROR(this, "Failed to tanslate to absolute path with root=%s, " "path=%s!", pRoot, path); } else { // replace "$VH_NAME" with the real name of the virtual host. if (expandVariable(achBuf, res, MAX_PATH_LEN) < 0) { LS_NOTICE(this, "Path is too long: %s", pPath); return LS_FAIL; } } return ret; }