-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | cgit.c | 26 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | parsing.c (renamed from config.c) | 25 |
4 files changed, 29 insertions, 28 deletions
@@ -7,3 +7,3 @@ 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 @@ -19,3 +19,4 @@ install: all 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) @@ -55,28 +55,2 @@ 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) @@ -58,2 +58,3 @@ extern void html_link_close(void); extern int cgit_read_config(const char *filename, configfn fn); +extern int cgit_parse_query(char *txt, configfn fn); @@ -81 +81,26 @@ int cgit_read_config(const char *filename, configfn fn) +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; +} |