-rw-r--r-- | ui-tree.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1,58 +1,59 @@ /* ui-tree.c: functions for tree output * * Copyright (C) 2006 Lars Hjemli * * Licensed under GNU General Public License v2 * (see COPYING for full license text) */ #include "cgit.h" #include "html.h" +#include "ui-shared.h" char *curr_rev; char *match_path; int header = 0; static void print_object(const unsigned char *sha1, char *path) { enum object_type type; char *buf; unsigned long size, lineno, start, idx; const char *linefmt = "<tr><td class='no'><a id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a></td><td class='txt'>"; type = sha1_object_info(sha1, &size); if (type == OBJ_BAD) { cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(sha1))); return; } buf = read_sha1_file(sha1, &type, &size); if (!buf) { cgit_print_error(fmt("Error reading object %s", sha1_to_hex(sha1))); return; } html(" blob: <a href='"); html_attr(cgit_pageurl(ctx.qry.repo, "blob", fmt("id=%s", sha1_to_hex(sha1)))); htmlf("'>%s</a>",sha1_to_hex(sha1)); html("<table summary='blob content' class='blob'>\n"); idx = 0; start = 0; lineno = 0; while(idx < size) { if (buf[idx] == '\n') { buf[idx] = '\0'; htmlf(linefmt, ++lineno); html_txt(buf + start); html("</td></tr>\n"); start = idx + 1; } idx++; } htmlf(linefmt, ++lineno); html_txt(buf + start); html("</td></tr>\n"); html("</table>\n"); |