author | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 00:09:39 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 00:43:48 (UTC) |
commit | e0e4478e7b4812f822d60a13a33525f8e529e1e8 (patch) (side-by-side diff) | |
tree | 577c3927deb9b122f940b69ca7db66afe2422814 /parsing.c | |
parent | b608e88adb6f77328288afb6dd0eddf674fc9b5b (diff) | |
download | cgit-e0e4478e7b4812f822d60a13a33525f8e529e1e8.zip cgit-e0e4478e7b4812f822d60a13a33525f8e529e1e8.tar.gz cgit-e0e4478e7b4812f822d60a13a33525f8e529e1e8.tar.bz2 |
Add command dispatcher
This simplifies the code in cgit.c and makes it easier to extend cgit with
new pages/commands.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | parsing.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -161,25 +161,25 @@ void cgit_parse_url(const char *url) cmd[0] = '/'; cmd = strchr(cmd + 1, '/'); continue; } ctx.qry.repo = ctx.repo->url; p = strchr(cmd + 1, '/'); if (p) { p[0] = '\0'; if (p[1]) ctx.qry.path = trim_end(p + 1, '/'); } - cgit_cmd = cgit_get_cmd_index(cmd + 1); + if (cmd[1]) ctx.qry.page = xstrdup(cmd + 1); return; } } char *substr(const char *head, const char *tail) { char *buf; buf = xmalloc(tail - head + 1); strncpy(buf, head, tail - head); buf[tail - head] = '\0'; |