* use the static.local / static aproach in our templates section too.
LIB_SUBDIRS=
PROG_SUBDIRS=@PROG_SUBDIRS@
SUBDIRS=$(LIB_SUBDIRS) $(PROG_SUBDIRS)
-#LOCALEDIR=@LOCALEDIR@
-#WWWDIR=@WWWDIR@
-#EDITORDIR=@EDITORDIR@
+LOCALEDIR=@LOCALEDIR@
+WWWDIR=@WWWDIR@
# End of configuration section
.cpp.o:
$(CC) $(CFLAGS) $(DEFS) -c $(PTHREAD_DEFS) $<
-#.c.o:
-# $(CC) $(CFLAGS) $(DEFS) -c $(PTHREAD_DEFS) \
-# -DWEBCITDIR=\"$(WWWDIR)\" \
-# -DLOCALEDIR=\"$(LOCALEDIR)\" \
-# -DEDITORDIR=\"$(EDITORDIR)\" $<
-#
-#.cpp.o:
-# $(CC) $(CFLAGS) $(DEFS) -c $(PTHREAD_DEFS) \
-# -DWEBCITDIR=\"$(WWWDIR)\" \
-# -DLOCALEDIR=\"$(LOCALEDIR)\" \
-# -DEDITORDIR=\"$(EDITORDIR)\"$<
-#
Makefile: $(srcdir)/Makefile.in config.status
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
]
)
AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
+LOCALEDIR=$localedir
+AC_SUBST(LOCALEDIR)
dnl Checks where to put our templates
AC_ARG_WITH(wwwdir,
]
)
AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
-
+WWWDIR=$wwwdir
+AC_SUBST(WWWDIR)
dnl Checks for the run-dir for the sockets
/*@{*/
-#include "webcit.h"
+#include "sysdep.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "webcit.h"
/**
* \brief Clear out the list of substitution variables local to this session
}
}
-
+extern char *static_dirs[PATH_MAX]; /**< Disk representation */
/**
* \brief Display a variable-substituted template
* \param templatename template file to load
*/
void do_template(void *templatename) {
+ char flat_filename[PATH_MAX];
char filename[PATH_MAX];
FILE *fp;
char inbuf[1024];
char outbuf[sizeof inbuf];
char key[sizeof inbuf];
int i, pos;
+ struct stat mystat;
- strcpy(filename, "static/");
- strcat(filename, templatename);
+ strcpy(flat_filename, templatename);
if (WC->is_wap)
- strcat(filename, ".wml");
+ strcat(flat_filename, ".wml");
else
- strcat(filename, ".html");
+ strcat(flat_filename, ".html");
+ strcpy(filename, static_dirs[1]);
+ strcat(filename, flat_filename);
+ if (stat(filename, &mystat) == -1)
+ {
+ strcpy(filename, static_dirs[0]);
+ strcat(filename, flat_filename);
+ }
+
fp = fopen(filename, "r");
if (fp == NULL) {
wprintf(_("ERROR: could not open template "));
(dirbuffer[0]!='\0')?"/":"");
basedir=RUNDIR;
COMPUTE_DIRECTORY(socket_dir);
- basedir=DATADIR "/static";
+ basedir=WWWDIR "/static";
COMPUTE_DIRECTORY(static_dir);
- basedir=DATADIR "/static.local";
+ basedir=WWWDIR "/static.local";
COMPUTE_DIRECTORY(static_local_dir);
snprintf(file_crpt_file_key,