]> git.cameronkatri.com Git - cgit.git/blobdiff - html.c
Fix html error detected by test-suite
[cgit.git] / html.c
diff --git a/html.c b/html.c
index 175b4b687efb75d443b847738775a1de92e97cf6..eb163d9d1f3a249feb36ee155ab5a464ef4aa64a 100644 (file)
--- a/html.c
+++ b/html.c
@@ -126,6 +126,18 @@ void html_hidden(char *name, char *value)
        html("'/>");
 }
 
+void html_option(char *value, char *text, char *selected_value)
+{
+       html("<option value='");
+       html_attr(value);
+       html("'");
+       if (selected_value && !strcmp(selected_value, value))
+               html(" selected='selected'");
+       html(">");
+       html_txt(text);
+       html("</option>\n");
+}
+
 void html_link_open(char *url, char *title, char *class)
 {
        html("<a href='");
@@ -158,7 +170,7 @@ void html_filemode(unsigned short mode)
                html("d");
        else if (S_ISLNK(mode))
                html("l");
-       else if (S_ISDIRLNK(mode))
+       else if (S_ISGITLINK(mode))
                html("m");
        else
                html("-");
@@ -166,3 +178,17 @@ void html_filemode(unsigned short mode)
        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;
+}