]> code.citadel.org Git - citadel.git/blobdiff - webcit/subst.c
* ignore .swp and .orig files so some more void files won't make it into our template...
[citadel.git] / webcit / subst.c
index 31be4b4a8a016399b0b8da15ee98caf110367ce4..a4d8d2aaf06d490e9f835c5e288fb3e36e5e4c87 100644 (file)
@@ -1420,7 +1420,7 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
        case SV_NEG_CONDITIONAL:
                if (NewToken->nParameters <2) {
                        LogTemplateError(
-                               NULL, "Conditional", ERR_NAME, &TP,
+                               NULL, "Conditional", ERR_PARM1, &TP,
                                "require at least 2 parameters, you gave %d params", 
                                NewToken->nParameters);
                        NewToken->Flags = 0;
@@ -1428,7 +1428,7 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
                }
                if (NewToken->Params[1]->lvalue == 0) {
                        LogTemplateError(
-                               NULL, "Conditional", ERR_NAME, &TP,
+                               NULL, "Conditional", ERR_PARM1, &TP,
                                "Conditional ID (Parameter 1) mustn't be 0!");
                        NewToken->Flags = 0;
                        break;
@@ -1442,7 +1442,7 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
                            (NewToken->Params[0]->Start[0] == 'X'))
                                break;
                        LogTemplateError(
-                               NULL, "Conditional", ERR_NAME, &TP,
+                               NULL, "Conditional", ERR_PARM1, &TP,
                                "Not found!");
 /*
                        NewToken->Error = NewStrBuf();
@@ -1626,7 +1626,7 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co
        Toplevel = StrLength(BaseKey) == 0;
        SubDirectory = NewStrBuf();
        SubKey = NewStrBuf();
-       FileName = NewStrBuf();
+       FileName = NewStrBufPlain(NULL, PATH_MAX);
        Key = NewStrBuf();
        while ((readdir_r(filedir, d, &filedir_entry) == 0) &&
               (filedir_entry != NULL))
@@ -1678,7 +1678,7 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co
                case DT_DIR:
                        /* Skip directories we are not interested in... */
                        if (strcmp(filedir_entry->d_name, ".svn") == 0)
-                               break;
+                               continue;
 
                        FlushStrBuf(SubKey);
                        if (!Toplevel) {
@@ -1705,7 +1705,9 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co
                                d_without_ext --;
                        if ((d_without_ext == 0) || (d_namelen < 3))
                                continue;
-                       if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
+                       if (((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~') ||
+                           (strcmp(&filedir_entry->d_name[d_without_ext], ".orig") == 0) ||
+                           (strcmp(&filedir_entry->d_name[d_without_ext], ".swp") == 0))
                                continue; /* Ignore backup files... */
                        /* .m.xxx is for mobile useragents! */
                        if (d_without_ext > 2)
@@ -1724,7 +1726,7 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *wireless, HashList *big, co
                        }
                        StrBufAppendBufPlain(Key, filedir_entry->d_name, MinorPtr - filedir_entry->d_name, 0);
 
-                       if (LoadTemplates > 1)
+                       if (LoadTemplates >= 1)
                                lprintf(1, "%s %d %s\n", ChrPtr(FileName), IsMobile, ChrPtr(Key));
                        if (LoadTemplates == 0)
                                load_template(FileName, Key, (IsMobile)?wireless:big);
@@ -2054,7 +2056,7 @@ int preeval_iterate(WCTemplateToken *Token)
        TP->Tokens = Token;
        if (!GetHash(Iterators, TKEY(0), &vIt)) {
                LogTemplateError(
-                       NULL, "Iterator", ERR_NAME, TP,
+                       NULL, "Iterator", ERR_PARM1, TP,
                        "not found");
                return 0;
        }