1 /* ui-view.c: functions to output _any_ object, given it's sha1
3 * Copyright (C) 2006 Lars Hjemli
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
11 void cgit_print_view(const char *hex, char *path)
13 unsigned char sha1[20];
14 enum object_type type;
18 if (get_sha1_hex(hex, sha1)){
19 cgit_print_error(fmt("Bad hex value: %s", hex));
23 type = sha1_object_info(sha1, &size);
24 if (type == OBJ_BAD) {
25 cgit_print_error(fmt("Bad object name: %s", hex));
29 buf = read_sha1_file(sha1, &type, &size);
31 cgit_print_error(fmt("Error reading object %s", hex));
36 html("<table class='list'>\n");
37 html("<tr class='nohover'><th class='left'>");
40 htmlf("%s %s, %li bytes", typename(type), hex, size);
45 html_attr(cgit_pageurl(cgit_query_repo, "blob",
49 html("'>download</a>");
51 html("<tr><td class='blob'>\n");
53 html("\n</td></tr>\n");