about summary refs log tree commit diff
path: root/shared.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-02-08 13:53:13 +0100
committerLars Hjemli <hjemli@gmail.com>2007-02-08 13:58:58 +0100
commitab2ab95f09994560f62fd631f07d3b6e3577aa6e (patch)
tree846763c1bcb78bd27dc37c99e5f6d703ca5ab179 /shared.c
parentcgit v0.2 (diff)
downloadcgit-pink-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.tar.gz
cgit-pink-ab2ab95f09994560f62fd631f07d3b6e3577aa6e.zip
Add support for snapshots
Make a link from the commit viewer to a snapshot of the corresponding tree.

Currently only zip-format is supported.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to '')
-rw-r--r--shared.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/shared.c b/shared.c
index 6fd70a8..5757d0c 100644
--- a/shared.c
+++ b/shared.c
@@ -44,10 +44,25 @@ char *cgit_query_search = NULL;
 char *cgit_query_sha1   = NULL;
 char *cgit_query_sha2   = NULL;
 char *cgit_query_path   = NULL;
+char *cgit_query_name   = NULL;
 int   cgit_query_ofs    = 0;
 
 int htmlfd = 0;
 
+int chk_zero(int result, char *msg)
+{
+	if (result != 0)
+		die("%s: %s", msg, strerror(errno));
+	return result;
+}
+
+int chk_positive(int result, char *msg)
+{
+	if (result <= 0)
+		die("%s: %s", msg, strerror(errno));
+	return result;
+}
+
 struct repoinfo *add_repo(const char *url)
 {
 	struct repoinfo *ret;
@@ -140,6 +155,8 @@ void cgit_querystring_cb(const char *name, const char *value)
 		cgit_query_ofs = atoi(value);
 	} else if (!strcmp(name, "path")) {
 		cgit_query_path = xstrdup(value);
+	} else if (!strcmp(name, "name")) {
+		cgit_query_name = xstrdup(value);
 	}
 }