summaryrefslogtreecommitdiffabout
path: root/shared.c
Side-by-side diff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-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
@@ -41,16 +41,31 @@ char *cgit_query_repo = NULL;
char *cgit_query_page = NULL;
char *cgit_query_head = NULL;
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;
if (++cgit_repolist.count > cgit_repolist.length) {
if (cgit_repolist.length == 0)
@@ -137,12 +152,14 @@ void cgit_querystring_cb(const char *name, const char *value)
cgit_query_sha2 = xstrdup(value);
cgit_query_has_sha1 = 1;
} else if (!strcmp(name, "ofs")) {
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);
}
}
void *cgit_free_commitinfo(struct commitinfo *info)
{
free(info->author);