| 1501 | } |
| 1502 | |
| 1503 | static void output_directories(struct ent **ar, int n, |
| 1504 | autoindex_config_rec *d, request_rec *r, |
| 1505 | apr_int32_t autoindex_opts, char keyid, |
| 1506 | char direction, const char *colargs) |
| 1507 | { |
| 1508 | int x; |
| 1509 | apr_size_t rv; |
| 1510 | char *tp; |
| 1511 | int static_columns = !!(autoindex_opts & SUPPRESS_COLSORT); |
| 1512 | apr_pool_t *scratch; |
| 1513 | int name_width; |
| 1514 | int desc_width; |
| 1515 | char *datetime_format; |
| 1516 | char *name_scratch; |
| 1517 | char *pad_scratch; |
| 1518 | char *breakrow = ""; |
| 1519 | |
| 1520 | apr_pool_create(&scratch, r->pool); |
| 1521 | apr_pool_tag(scratch, "autoindex_scratch"); |
| 1522 | |
| 1523 | name_width = d->name_width; |
| 1524 | desc_width = d->desc_width; |
| 1525 | datetime_format = d->datetime_format ? d->datetime_format : "%Y-%m-%d %H:%M"; |
| 1526 | |
| 1527 | if ((autoindex_opts & (FANCY_INDEXING | TABLE_INDEXING)) |
| 1528 | == FANCY_INDEXING) { |
| 1529 | if (d->name_adjust == K_ADJUST) { |
| 1530 | for (x = 0; x < n; x++) { |
| 1531 | int t = strlen(ar[x]->name); |
| 1532 | if (t > name_width) { |
| 1533 | name_width = t; |
| 1534 | } |
| 1535 | } |
| 1536 | } |
| 1537 | |
| 1538 | if (d->desc_adjust == K_ADJUST) { |
| 1539 | for (x = 0; x < n; x++) { |
| 1540 | if (ar[x]->desc != NULL) { |
| 1541 | int t = strlen(ar[x]->desc); |
| 1542 | if (t > desc_width) { |
| 1543 | desc_width = t; |
| 1544 | } |
| 1545 | } |
| 1546 | } |
| 1547 | } |
| 1548 | } |
| 1549 | name_scratch = apr_palloc(r->pool, name_width + 1); |
| 1550 | pad_scratch = apr_palloc(r->pool, name_width + 1); |
| 1551 | memset(pad_scratch, ' ', name_width); |
| 1552 | pad_scratch[name_width] = '\0'; |
| 1553 | |
| 1554 | if (autoindex_opts & TABLE_INDEXING) { |
| 1555 | int cols = 1; |
| 1556 | if (d->style_sheet != NULL) { |
| 1557 | /* Emit table with style id */ |
| 1558 | ap_rputs(" <table id=\"indexlist\">\n <tr class=\"indexhead\">", r); |
| 1559 | } else { |
| 1560 | ap_rputs(" <table>\n <tr>", r); |
no test coverage detected