Index: modules/standard/mod_autoindex.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v retrieving revision 1.87 diff -u -r1.87 mod_autoindex.c --- mod_autoindex.c 1998/08/06 17:30:56 1.87 +++ mod_autoindex.c 1998/08/14 05:29:05 @@ -865,15 +865,29 @@ autoindex_config_rec * d, request_rec *r, int autoindex_opts, char keyid, char direction) { - int x, len; + int x; char *name = r->uri; char *tp; int static_columns = (autoindex_opts & SUPPRESS_COLSORT); pool *scratch = ap_make_sub_pool(r->pool); + int name_width; + char *name_scratch; if (name[0] == '\0') name = "/"; + name_width = 23; + for (x = 0; x < n; x++) { + int t = strlen(ar[x]->name); + if (t > name_width) { + name_width = t; + } + } + ++name_width; + name_scratch = ap_palloc(r->pool, name_width + 1); + memset(name_scratch, ' ', name_width); + name_scratch[name_width] = 0; + if (autoindex_opts & FANCY_INDEXING) { ap_rputs("
", r);
if ((tp = find_default_icon(d, "^^BLANKICON^^"))) {
@@ -891,7 +905,7 @@
ap_rputs("> ", r);
}
emit_link(r, "Name", K_NAME, keyid, direction, static_columns);
- ap_rputs(" ", r);
+ ap_rputs(name_scratch + 4, r);
if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
emit_link(r, "Last modified", K_LAST_MOD, keyid, direction,
static_columns);
@@ -912,7 +926,8 @@
}
for (x = 0; x < n; x++) {
- char *anchor = NULL, *t = NULL, *t2 = NULL;
+ char *anchor, *t, *t2;
+ char *pad;
ap_clear_pool(scratch);
@@ -922,40 +937,21 @@
if (t[0] == '\0') {
t = "/";
}
- anchor = ap_pstrcat(scratch, "", NULL);
- t2 = "Parent Directory ";
+ /* 1234567890123456 */
+ t2 = "Parent Directory";
+ pad = name_scratch + 16;
+ anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0));
}
else {
t = ar[x]->name;
- len = strlen(t);
- if (len > 23) {
- t2 = ap_pstrdup(scratch, t);
- t2[21] = '.';
- t2[22] = '.';
- t2[23] = '\0';
- t2 = ap_escape_html(scratch, t2);
- t2 = ap_pstrcat(scratch, t2, "", NULL);
- }
- else {
- char buff[24] = " ";
- t2 = ap_escape_html(scratch, t);
- buff[23 - len] = '\0';
- t2 = ap_pstrcat(scratch, t2, "", buff, NULL);
- }
- anchor = ap_pstrcat(scratch, "", NULL);
+ pad = name_scratch + strlen(t);
+ t2 = ap_escape_html(scratch, t);
+ anchor = ap_escape_html(scratch, ap_os_escape_path(scratch, t, 0));
}
if (autoindex_opts & FANCY_INDEXING) {
if (autoindex_opts & ICONS_ARE_LINKS) {
- ap_rputs(anchor, r);
+ ap_rvputs(r, "", NULL);
}
if ((ar[x]->icon) || d->default_icon) {
ap_rvputs(r, "
", r);
}
- ap_rvputs(r, " ", anchor, t2, NULL);
+ ap_rvputs(r, " ", t2, "", pad, NULL);
if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
if (ar[x]->lm != -1) {
char time_str[MAX_STRING_LEN];
@@ -998,7 +994,7 @@
}
}
else {
- ap_rvputs(r, "