");
if (strcmp(name, "..") == 0) {
- bozo_printf(httpd, "");
- bozo_printf(httpd, "Parent Directory");
- } else if (!nostat && S_ISDIR(sb.st_mode)) {
- bozo_printf(httpd, "", urlname);
+ bozo_printf(httpd, "");
+ } else {
unsigned long long len;
+ double d;
- strftime(buf, sizeof buf, "%d-%b-%Y %R", gmtime(&sb.st_mtime));
+ strftime(buf, sizeof buf, "", gmtime(&sb.st_mtime));
bozo_printf(httpd, " | %s", buf);
-
- len = ((unsigned long long)sb.st_size + 1023) / 1024;
- bozo_printf(httpd, " | %llukB", len);
+ if (S_ISDIR(sb.st_mode)) {
+ bozo_printf(httpd, " | %s", "-");
+ } else if (sb.st_size > 1024) {
+ if (sb.st_size < 10240) {
+ d = (double)sb.st_size / 1024;
+ bozo_printf(httpd, " | %.1lfK", d);
+ } else if (sb.st_size > 1048576) {
+ if (sb.st_size < 10485760) {
+ d = (double)sb.st_size / 1048576;
+ bozo_printf(httpd, " | %.1lfM", d);
+ } else {
+ len = (unsigned long long)sb.st_size / 1048576;
+ bozo_printf(httpd, " | %lluM", len);
+ }
+ } else {
+ len = (unsigned long long)sb.st_size / 1024;
+ bozo_printf(httpd, " | %lluK", len);
+ }
+ } else {
+ len = (unsigned long long)sb.st_size;
+ bozo_printf(httpd, " | %lluB", len);
+ }
}
bozo_printf(httpd, "\r\n");
}
@@ -199,7 +227,13 @@
while (k--)
free(deo[k]);
free(deo);
- bozo_printf(httpd, " |