From b1f9b9c1459cb9a30ebf80721aff6ef788d1f891 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 23 Feb 2008 22:45:33 +0100 Subject: Introduce html.h All html-functions can be quite easily separated from the rest of cgit, so lets do it; the only issue was html_filemode which uses some git-defined macros so the function is moved into ui-shared.c::cgit_print_filemode(). Signed-off-by: Lars Hjemli --- ui-blob.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ui-blob.c') diff --git a/ui-blob.c b/ui-blob.c index f5b844b..be4fb88 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -1,4 +1,13 @@ +/* ui-blob.c: show blob content + * + * Copyright (C) 2008 Lars Hjemli + * + * Licensed under GNU General Public License v2 + * (see COPYING for full license text) + */ + #include "cgit.h" +#include "html.h" void cgit_print_blob(struct cacheitem *item, const char *hex, char *path) { -- cgit v1.2.3-24-g4f1b From f3c1a187fe2bc33f8423cd535d5045899699995b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Mar 2008 00:51:19 +0100 Subject: Add struct cgit_page to cgit_context This struct is used when generating http headers, and as such is another small step towards the goal of the whole cleanup series; to invoke each page/view function with a function pointer. Signed-off-by: Lars Hjemli --- ui-blob.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui-blob.c') diff --git a/ui-blob.c b/ui-blob.c index be4fb88..bd44574 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -35,6 +35,8 @@ void cgit_print_blob(struct cacheitem *item, const char *hex, char *path) } buf[size] = '\0'; - cgit_print_snapshot_start("text/plain", path, item); + ctx.page.mimetype = "text/plain"; + ctx.page.filename = path; + cgit_print_http_headers(&ctx); write(htmlfd, buf, size); } -- cgit v1.2.3-24-g4f1b From b608e88adb6f77328288afb6dd0eddf674fc9b5b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Mar 2008 01:00:36 +0100 Subject: Remove obsolete cacheitem parameter to ui-functions This parameter hasn't been used for a very long time... Signed-off-by: Lars Hjemli --- ui-blob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui-blob.c') diff --git a/ui-blob.c b/ui-blob.c index bd44574..3b29132 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -9,7 +9,7 @@ #include "cgit.h" #include "html.h" -void cgit_print_blob(struct cacheitem *item, const char *hex, char *path) +void cgit_print_blob(const char *hex, char *path) { unsigned char sha1[20]; -- cgit v1.2.3-24-g4f1b From a4d1ca1dc6ff8171694d9e2280b6075a1beced0c Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Mar 2008 16:50:57 +0100 Subject: Add ui-shared.h This is finally a proper headerfile for the shared ui-functions which used to reside in cgit.h Signed-off-by: Lars Hjemli --- ui-blob.c | 1 + 1 file changed, 1 insertion(+) (limited to 'ui-blob.c') diff --git a/ui-blob.c b/ui-blob.c index 3b29132..11589db 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -8,6 +8,7 @@ #include "cgit.h" #include "html.h" +#include "ui-shared.h" void cgit_print_blob(const char *hex, char *path) { -- cgit v1.2.3-24-g4f1b