| 1416 | } |
| 1417 | |
| 1418 | static char *terminate_description(autoindex_config_rec *d, char *desc, |
| 1419 | apr_int32_t autoindex_opts, int desc_width) |
| 1420 | { |
| 1421 | int maxsize = desc_width; |
| 1422 | int x; |
| 1423 | |
| 1424 | /* |
| 1425 | * If there's no DescriptionWidth in effect, default to the old |
| 1426 | * behaviour of adjusting the description size depending upon |
| 1427 | * what else is being displayed. Otherwise, stick with the |
| 1428 | * setting. |
| 1429 | */ |
| 1430 | if (d->desc_adjust == K_UNSET) { |
| 1431 | if (autoindex_opts & SUPPRESS_ICON) { |
| 1432 | maxsize += 6; |
| 1433 | } |
| 1434 | if (autoindex_opts & SUPPRESS_LAST_MOD) { |
| 1435 | maxsize += 19; |
| 1436 | } |
| 1437 | if (autoindex_opts & SUPPRESS_SIZE) { |
| 1438 | maxsize += 7; |
| 1439 | } |
| 1440 | } |
| 1441 | for (x = 0; desc[x] && ((maxsize > 0) || (desc[x] == '<')); x++) { |
| 1442 | if (desc[x] == '<') { |
| 1443 | while (desc[x] != '>') { |
| 1444 | if (!desc[x]) { |
| 1445 | maxsize = 0; |
| 1446 | break; |
| 1447 | } |
| 1448 | ++x; |
| 1449 | } |
| 1450 | } |
| 1451 | else if (desc[x] == '&') { |
| 1452 | /* entities like ä count as one character */ |
| 1453 | --maxsize; |
| 1454 | for ( ; desc[x] != ';'; ++x) { |
| 1455 | if (desc[x] == '\0') { |
| 1456 | maxsize = 0; |
| 1457 | break; |
| 1458 | } |
| 1459 | } |
| 1460 | } |
| 1461 | else { |
| 1462 | --maxsize; |
| 1463 | } |
| 1464 | } |
| 1465 | if (!maxsize && desc[x] != '\0') { |
| 1466 | desc[x - 1] = '>'; /* Grump. */ |
| 1467 | desc[x] = '\0'; /* Double Grump! */ |
| 1468 | } |
| 1469 | return desc; |
| 1470 | } |
| 1471 | |
| 1472 | /* |
| 1473 | * Emit the anchor for the specified field. If a field is the key for the |
no outgoing calls
no test coverage detected