]> git.cameronkatri.com Git - cgit.git/blobdiff - html.c
ui-log: honor id=sha1 on querystring
[cgit.git] / html.c
diff --git a/html.c b/html.c
index 3a5d28d9f7a255320b05755f2e42bc5aec7e520d..33a956fd5db8140eed9c1a237d3db31337d76918 100644 (file)
--- a/html.c
+++ b/html.c
@@ -117,6 +117,15 @@ void html_attr(char *txt)
                html(txt);
 }
 
+void html_hidden(char *name, char *value)
+{
+       html("<input type='hidden' name='");
+       html_attr(name);
+       html("' value='");
+       html_attr(value);
+       html("'/>");
+}
+
 void html_link_open(char *url, char *title, char *class)
 {
        html("<a href='");
@@ -149,9 +158,25 @@ void html_filemode(unsigned short mode)
                html("d");
        else if (S_ISLNK(mode))
                html("l");
+       else if (S_ISDIRLNK(mode))
+               html("m");
        else
                html("-");
        html_fileperm(mode >> 6);
        html_fileperm(mode >> 3);
        html_fileperm(mode);
 }
+
+int html_include(const char *filename)
+{
+       FILE *f;
+       char buf[4096];
+       size_t len;
+
+       if (!(f = fopen(filename, "r")))
+               return -1;
+       while((len = fread(buf, 1, 4096, f)) > 0)
+               write(htmlfd, buf, len);
+       fclose(f);
+       return 0;
+}