--- dir_cgi.c.txt 2005-10-17 15:35:18 +0400
+++ dir_cgi.c 2006-10-31 12:55:52 +0300
@@ -1,6 +1,7 @@
/*
* Copyright 2003, 2004 Michiel Boland.
* All rights reserved.
+ * Little improvements 2006 Ilya Evseev.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@@ -72,6 +73,36 @@ static void escape_html_print(const char
}
}
+static void print_list_header(void) {
+#if defined(FORMAT_V2)
+ printf("
Size | Last-Modified | Name |
\n");
+#endif
+}
+
+static void print_list_bottom(void) {
+#if defined(FORMAT_V2)
+ printf("
\n");
+#endif
+}
+
+static void print_dir_entry(struct cgi_dir_entry *p)
+{
+#if defined(FORMAT_V2)
+ printf(" %*ld | %s | ");
+ escape_html_print(p->name);
+ printf(" |
\n");
+#else
+ printf("name);
+ printf("/\">");
+ escape_html_print(p->name);
+ printf("\n");
+#endif
+}
+
static int sort_and_print(struct cgi_dir_entry *p, size_t n)
{
int notinroot;
@@ -90,32 +121,28 @@ static int sort_and_print(struct cgi_dir
printf(" of %s", script_name);
} else
notinroot = 1;
- printf("index");
+ printf("
Index");
if (script_name)
printf(" of %s", script_name);
- printf("
\n");
- printf("directories:
\n");
+ printf("\n");
if (notinroot)
- printf("- [parent directory]
\n");
+ printf("\n");
+ printf("Directories:
files:
\n");
+ print_list_bottom();
+ printf("
Files: