last++ = _evenodd[i & 0x01];
+ /*
+ * Alternative implementation:
+ * *b->last++ = (i & 0x01) ? 'e' : 'o';
+ */
+ b->last = nfi_cpymem_ssz(b->last, "\">last, entry[i].name.data, entry[i].name.len,
@@ -449,8 +457,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
b->last += entry[i].name.len + entry[i].escape;
} else {
- b->last = ngx_cpymem(b->last, entry[i].name.data,
- entry[i].name.len);
+ b->last = nfi_cpymem_str(b->last, entry[i].name);
}
if (entry[i].dir) {
@@ -465,7 +472,6 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
if (entry[i].name.len - len) {
if (len > NGX_HTTP_FANCYINDEX_NAME_LEN) {
copy = NGX_HTTP_FANCYINDEX_NAME_LEN - 3 + 1;
-
} else {
copy = NGX_HTTP_FANCYINDEX_NAME_LEN + 1;
}
@@ -480,7 +486,7 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
}
if (len > NGX_HTTP_FANCYINDEX_NAME_LEN) {
- b->last = ngx_cpymem(last, "..>", sizeof("..>") - 1);
+ b->last = nfi_cpymem_ssz(last, "..>");
} else {
if (entry[i].dir && NGX_HTTP_FANCYINDEX_NAME_LEN - len > 0) {
@@ -488,33 +494,19 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
len++;
}
- b->last = ngx_cpymem(b->last, "", sizeof("") - 1);
- ngx_memset(b->last, ' ', NGX_HTTP_FANCYINDEX_NAME_LEN - len);
- b->last += NGX_HTTP_FANCYINDEX_NAME_LEN - len;
+ b->last = nfi_cpymem_ssz(b->last, " | ");
}
- *b->last++ = ' ';
-
- ngx_gmtime(entry[i].mtime + tp->gmtoff * 60 * alcf->localtime, &tm);
-
- b->last = ngx_sprintf(b->last, "%02d-%s-%d %02d:%02d ",
- tm.ngx_tm_mday,
- months[tm.ngx_tm_mon - 1],
- tm.ngx_tm_year,
- tm.ngx_tm_hour,
- tm.ngx_tm_min);
-
if (alcf->exact_size) {
if (entry[i].dir) {
- b->last = nfi_cpymem_ssz(b->last, " -");
+ *b->last++ = '-';
} else {
b->last = ngx_sprintf(b->last, "%19O", entry[i].size);
}
} else {
if (entry[i].dir) {
- b->last = nfi_cpymem_ssz(b->last, " -");
-
+ *b->last++ = '-';
} else {
length = entry[i].size;
@@ -555,6 +547,16 @@ ngx_http_fancyindex_handler(ngx_http_request_t *r)
}
}
+ ngx_gmtime(entry[i].mtime + tp->gmtoff * 60 * alcf->localtime, &tm);
+
+ b->last = ngx_sprintf(b->last, " | %02d-%s-%d %02d:%02d |
",
+ tm.ngx_tm_mday,
+ months[tm.ngx_tm_mon - 1],
+ tm.ngx_tm_year,
+ tm.ngx_tm_hour,
+ tm.ngx_tm_min);
+
+
*b->last++ = CR;
*b->last++ = LF;
}