Sub->Sub = Super->Sub;
Super->Sub = Sub;
}
+ if (Sub->Sub != NULL)
+ Sub->Sub->Super = Sub;
Sub->Super = Super;
Sub->Context = Context;
{
Sub->Super->Sub = Sub->Sub;
}
+ if (Sub->Sub != NULL)
+ {
+ Sub->Sub->Super = Sub->Super;
+ }
}
void UnStackDynamicContext(StrBuf *Target, WCTemplputParams **TPP)
{
}
if (TP->Tokens != NULL)
{
- syslog(1, "%s [%s] (in '%s' line %ld); %s; [%s]\n",
+ syslog(LOG_WARNING, "%s [%s] (in '%s' line %ld); %s; [%s]\n",
Type,
Err,
ChrPtr(TP->Tokens->FileName),
}
else
{
- syslog(1, "%s: %s;\n",
+ syslog(LOG_WARNING, "%s: %s;\n",
Type,
ChrPtr(Error));
}
FreeStrBuf(&Error);
/*
if (dbg_backtrace_template_errors)
- wc_backtrace();
+ wc_backtrace(LOG_DEBUG);
*/
}
-
-
-
void LogError (StrBuf *Target, const char *Type, const char *Format, ...)
{
wcsession *WCC;
StrBufVAppendPrintf(Error, Format, arg_ptr);
va_end(arg_ptr);
- syslog(1, "%s", ChrPtr(Error));
+ syslog(LOG_WARNING, "%s", ChrPtr(Error));
WCC = WC;
if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf();
FreeStrBuf(&Error);
/*
if (dbg_backtrace_template_errors)
- wc_backtrace();
+ wc_backtrace(LOG_DEBUG);
*/
}
LogTemplateError(Target,
"TokenParameter", N, TP,
"invalid token %d. this shouldn't have come till here.\n", N);
- wc_backtrace();
+ wc_backtrace(LOG_DEBUG);
return 0;
}
}
pche = pch;
if (*pch != quote) {
- syslog(1, "Error (in '%s' line %ld); "
+ syslog(LOG_WARNING, "Error (in '%s' line %ld); "
"evaluating template param [%s] in Token [%s]\n",
ChrPtr(pTmpl->FileName),
Tokens->Line,
else {
StrBufPeek(Buf, pch, -1, '\0');
if (LoadTemplates > 1) {
- syslog(1,
+ syslog(LOG_DEBUG,
"DBG: got param [%s] "SIZE_T_FMT" "SIZE_T_FMT"\n",
pchs, pche - pchs, strlen(pchs)
);
else {
Parm->lvalue = 0;
/* TODO whUT?
- syslog(1, "Error (in '%s' line %ld); "
+ syslog(LOG_DEBUG, "Error (in '%s' line %ld); "
"evaluating long template param [%s] in Token [%s]\n",
ChrPtr(pTmpl->FileName),
Tokens->Line,
fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY);
if (fd <= 0) {
- syslog(1, "ERROR: could not open template '%s' - %s\n",
+ syslog(LOG_WARNING, "ERROR: could not open template '%s' - %s\n",
ChrPtr(NewTemplate->FileName), strerror(errno));
return NULL;
}
if (fstat(fd, &statbuf) == -1) {
- syslog(1, "ERROR: could not stat template '%s' - %s\n",
+ syslog(LOG_WARNING, "ERROR: could not stat template '%s' - %s\n",
ChrPtr(NewTemplate->FileName), strerror(errno));
return NULL;
}
NewTemplate->Data = NewStrBufPlain(NULL, statbuf.st_size + 1);
if (StrBufReadBLOB(NewTemplate->Data, &fd, 1, statbuf.st_size, &Err) < 0) {
close(fd);
- syslog(1, "ERROR: reading template '%s' - %s<br>\n",
+ syslog(LOG_WARNING, "ERROR: reading template '%s' - %s<br>\n",
ChrPtr(NewTemplate->FileName), strerror(errno));
return NULL;
}
{
char *MinorPtr;
-#ifdef _DIRENT_HAVE_D_NAMELEN
+#ifdef _DIRENT_HAVE_D_NAMLEN
d_namelen = filedir_entry->d_namelen;
+
+#else
+ d_namelen = strlen(filedir_entry->d_name);
+#endif
+
+#ifdef _DIRENT_HAVE_D_TYPE
d_type = filedir_entry->d_type;
#else
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
#endif
- d_namelen = strlen(filedir_entry->d_name);
d_type = DT_UNKNOWN;
#endif
d_without_ext = d_namelen;
char path[PATH_MAX];
snprintf(path, PATH_MAX, "%s/%s",
ChrPtr(DirName), filedir_entry->d_name);
- if (stat(path, &s) == 0) {
+ if (lstat(path, &s) == 0) {
d_type = IFTODT(s.st_mode);
}
}
LoadTemplateDir(SubDirectory, big, SubKey);
break;
- case DT_LNK: /* TODO: check whether its a file or a directory */
+ case DT_LNK:
case DT_REG:
StrBufAppendBufPlain(Key, filedir_entry->d_name, MinorPtr - filedir_entry->d_name, 0);
if (LoadTemplates >= 1)
- syslog(1, "%s %s\n", ChrPtr(FileName), ChrPtr(Key));
+ syslog(LOG_DEBUG, "%s %s\n", ChrPtr(FileName), ChrPtr(Key));
prepare_template(FileName, Key, big);
default:
break;
WCTemplputParams *TP = *TPP;
/* much output, since pName is not terminated...
- syslog(1,"Doing token: %s\n",Token->pName);
+ syslog(LOG_DEBUG,"Doing token: %s\n",Token->pName);
*/
switch (TP->Tokens->Flags) {
WCTemplputParams TP;
WCTemplputParams *TPtr = &TP;
+ memset(TPtr, 0, sizeof(WCTemplputParams));
+
memcpy(&TP.Filter, &CallingTP->Filter, sizeof(ContextFilter));
TP.Context = CallingTP->Context;
if (LoadTemplates != 0) {
if (LoadTemplates > 1)
- syslog(1, "DBG: ----- loading: [%s] ------ \n",
+ syslog(LOG_DEBUG, "DBG: ----- loading: [%s] ------ \n",
ChrPtr(Tmpl->FileName));
pTmpl = duplicate_template(Tmpl);
if(load_template(Target, pTmpl) == NULL) {
if (len == 0)
{
- syslog(1, "Can't to load a template with empty name!\n");
+ syslog(LOG_WARNING, "Can't to load a template with empty name!\n");
StrBufAppendPrintf(Target, "<pre>\nCan't to load a template with empty name!\n</pre>");
return NULL;
}
if (!GetHash(StaticLocal, templatename, len, &vTmpl) &&
!GetHash(Static, templatename, len, &vTmpl)) {
- syslog(1, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename));
+ syslog(LOG_WARNING, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename));
StrBufAppendPrintf(Target, "<pre>\ndidn't find Template [%s] %ld %ld\n</pre>",
templatename, len,
(long)strlen(templatename));
res = Cond->CondF(Target, TP);
if (res == Neg)
rc = TP->Tokens->Params[1]->lvalue;
+
if (LoadTemplates > 5)
- syslog(1, "<%s> : %d %d==%d\n",
+ syslog(LOG_DEBUG, "<%s> : %d %d==%d\n",
ChrPtr(TP->Tokens->FlatToken),
rc, res, Neg);
+
if (TP->Sub != NULL)
{
*TPP = TP->Sub;
NewSort->GroupChange = GroupChange;
NewSort->ContextType = ContextType;
if (ContextType == CTX_NONE) {
- syslog(1, "sorting requires a context. CTX_NONE won't make it.\n");
+ syslog(LOG_WARNING, "sorting requires a context. CTX_NONE won't make it.\n");
exit(1);
}
LogTemplateError(
NULL, "Sorting", ERR_PARM1, TP,
"Illegal default sort: [%s]", Default);
- wc_backtrace();
+ wc_backtrace(LOG_WARNING);
}
}
SortBy = (SortStruct*)vSortBy;
StrBufAppendPrintf(Buf, "%d: %ld]\n", i, LongVector[i]);
}
- syslog(1, "%s", ChrPtr(Buf));
+ syslog(LOG_DEBUG, "%s", ChrPtr(Buf));
FreeStrBuf(&Buf);
}