CACHE_ROOT = /var/cache/cgit
EXTLIBS = ../git/libgit.a ../git/xdiff/lib.a -lz -lcrypto
-OBJECTS = config.o html.o cache.o
+OBJECTS = parsing.o html.o cache.o
CFLAGS += -Wall
rm -rf $(CACHE_ROOT)/*
cgit: cgit.c cgit.h git.h $(OBJECTS)
- $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit $(OBJECTS) $(EXTLIBS)
+ $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \
+ $(OBJECTS) $(EXTLIBS)
$(OBJECTS): cgit.h git.h
struct cacheitem cacheitem;
-int cgit_parse_query(char *txt, configfn fn)
-{
- char *t, *value = NULL, c;
-
- if (!txt)
- return 0;
-
- t = txt = xstrdup(txt);
-
- while((c=*t) != '\0') {
- if (c=='=') {
- *t = '\0';
- value = t+1;
- } else if (c=='&') {
- *t = '\0';
- (*fn)(txt, value);
- txt = t+1;
- value = NULL;
- }
- t++;
- }
- if (t!=txt)
- (*fn)(txt, value);
- return 0;
-}
-
void cgit_global_config_cb(const char *name, const char *value)
{
if (!strcmp(name, "root"))
extern int cgit_read_config(const char *filename, configfn fn);
+extern int cgit_parse_query(char *txt, configfn fn);
extern void cache_prepare(struct cacheitem *item);
extern int cache_lock(struct cacheitem *item);
return ret;
}
+int cgit_parse_query(char *txt, configfn fn)
+{
+ char *t, *value = NULL, c;
+
+ if (!txt)
+ return 0;
+
+ t = txt = xstrdup(txt);
+
+ while((c=*t) != '\0') {
+ if (c=='=') {
+ *t = '\0';
+ value = t+1;
+ } else if (c=='&') {
+ *t = '\0';
+ (*fn)(txt, value);
+ txt = t+1;
+ value = NULL;
+ }
+ t++;
+ }
+ if (t!=txt)
+ (*fn)(txt, value);
+ return 0;
+}