home *** CD-ROM | disk | FTP | other *** search
- Title: Variable-length fields in FancyIndexing output in mod_dir.
- Submitter: Ken Coar <Coar@DECUS.Org>
- Date: Tue Jan 7 12:22:27 EST 1997
- Patch built against: Apache 1.2b4
-
- This patch provides the IndexNameWidth and IndexDescWidth directives
- to control the width of the filename and description fields,
- respectively, in FancyIndexed generated directory indices. These
- directives can appear in any configuration file in which the
- IndexOptions directive is available.
-
- The module and directive documentation pages are also patched to
- reflect the new directives and their explanations.
-
- To apply the patch, cd to the Apache source directory and use the
- command
-
- patch -c -s -b + + + -d ../htdocs/manual/mod < [patch-file]
-
- [Adjust the command appropriately if you've moved your manual
- pages.]
-
- BEWARE if you're not patching the 1.2b4 distribution! Caveat
- emptor!
-
- #ken :-)}
-
- Index: mod_dir.c
- ===================================================================
- *** 1.1 1996/12/31 12:37:02
- --- mod_dir.c 1997/01/05 18:39:55
- ***************
- *** 82,87 ****
- --- 82,92 ----
- #define SUPPRESS_SIZE 16
- #define SUPPRESS_DESC 32
-
- + #define DEFAULT_NAME_WIDTH 23
- + #define DEFAULT_DESC_WIDTH 23
- + #define LAST_MOD_WIDTH 17
- + #define SIZE_WIDTH SEND_SIZE_CHARS + 2
- +
- struct item {
- char *type;
- char *apply_to;
- ***************
- *** 95,101 ****
- char *index_names;
-
- array_header *icon_list, *alt_list, *desc_list, *ign_list;
- ! array_header *hdr_list, *rdme_list, *opts_list;
-
- } dir_config_rec;
-
- --- 100,106 ----
- char *index_names;
-
- array_header *icon_list, *alt_list, *desc_list, *ign_list;
- ! array_header *hdr_list, *rdme_list, *opts_list, *nw_list, *dw_list;
-
- } dir_config_rec;
-
- ***************
- *** 173,178 ****
- --- 178,220 ----
- return NULL;
- }
-
- + /*
- + ** This routine adds the value of the read IndexNameWidth directive to the
- + ** appropriate directory entry. This value controls the width of the filename
- + ** field in FancyIndexed generated indices.
- + */
- + const char *add_name_width (cmd_parms *cmd, void *d, char *cwidth) {
- + int width = atoi (cwidth);
- +
- + push_item
- + (
- + ((dir_config_rec *) d)->nw_list,
- + (char *) width,
- + NULL,
- + cmd->path,
- + NULL
- + );
- + return NULL;
- + }
- +
- + /*
- + ** Like its brother add_name_width above, this routine adds the value of the
- + ** just-read IndexDescWidth directive to the appropriate directory entry.
- + ** This controls the width of the description field in FancyIndexed generated
- + ** indices.
- + */
- + const char *add_desc_width (cmd_parms *cmd, void *d, char *cwidth) {
- + push_item
- + (
- + ((dir_config_rec *) d)->dw_list,
- + (char *) atoi (cwidth),
- + NULL,
- + cmd->path,
- + NULL
- + );
- + return NULL;
- + }
- +
-
- const char *add_opts_int(cmd_parms *cmd, void *d, int opts) {
- push_item(((dir_config_rec *)d)->opts_list, (char*)opts, NULL,
- ***************
- *** 241,246 ****
- --- 283,304 ----
- { "DirectoryIndex", set_string_slot,
- (void*)XtOffsetOf(dir_config_rec, index_names),
- DIR_CMD_PERMS, RAW_ARGS, NULL },
- + {
- + "IndexNameWidth",
- + add_name_width,
- + NULL,
- + DIR_CMD_PERMS,
- + TAKE1,
- + "width of filename field in generated indices"
- + },
- + {
- + "IndexDescWidth",
- + add_desc_width,
- + NULL,
- + DIR_CMD_PERMS,
- + TAKE1,
- + "width of description field in generated indices"
- + },
- { NULL }
- };
-
- ***************
- *** 257,262 ****
- --- 315,322 ----
- new->hdr_list = make_array (p, 4, sizeof (struct item));
- new->rdme_list = make_array (p, 4, sizeof (struct item));
- new->opts_list = make_array (p, 4, sizeof (struct item));
- + new->nw_list = make_array (p, 4, sizeof (struct item));
- + new->dw_list = make_array (p, 4, sizeof (struct item));
-
- return (void *)new;
- }
- ***************
- *** 277,282 ****
- --- 337,344 ----
- new->icon_list = append_arrays (p, add->icon_list, base->icon_list);
- new->rdme_list = append_arrays (p, add->rdme_list, base->rdme_list);
- new->opts_list = append_arrays (p, add->opts_list, base->opts_list);
- + new->nw_list = append_arrays (p, add->nw_list, base->nw_list);
- + new->dw_list = append_arrays (p, add->dw_list, base->dw_list);
-
- return new;
- }
- ***************
- *** 382,401 ****
- return 0;
- }
-
- ! int find_opts(dir_config_rec *d, request_rec *r) {
- ! char *path = r->filename;
- ! array_header *list = d->opts_list;
- ! struct item *items = (struct item *)list->elts;
- int i;
-
- for (i = 0; i < list->nelts; ++i) {
- struct item *p = &items[i];
-
- ! if(!strcmp_match(path,p->apply_path))
- return (int)p->type;
- }
- return 0;
- }
-
- /*****************************************************************
- *
- --- 444,504 ----
- return 0;
- }
-
- ! /*
- ! ** This routine looks through the array of options settings for one applying
- ! ** to the specified path, returning the value if found or zero otherwise.
- ! */
- ! int find_opts (dir_config_rec *d, request_rec *r) {
- ! int value;
- !
- ! value = find_int (r->filename, d->opts_list);
- ! return value;
- ! }
- !
- ! /*
- ! ** This routine scans the specified item array for a matching path, and
- ! ** returns the integer value from the item when one is found. If none is
- ! ** found, we return zero.
- ! */
- ! int find_int (char *path, array_header *list) {
- ! struct item *items;
- int i;
-
- + if (list == NULL) {
- + return 0;
- + };
- + items = (struct item *)list->elts;
- + if (items == NULL) {
- + return 0;
- + };
- +
- for (i = 0; i < list->nelts; ++i) {
- struct item *p = &items[i];
-
- ! if(!strcmp_match (path, p->apply_path))
- return (int)p->type;
- }
- return 0;
- }
- + /*
- + ** This routine looks through the list of user-defined widths for the file
- + ** name until it finds one that applies to the specified path. If none is
- + ** found, it returns zero, which means `use the default width.'
- + */
- + int find_name_width (dir_config_rec *d, request_rec *r) {
- + int value;
- +
- + value = find_int (r->filename, d->nw_list);
- + return value;
- + }
- +
- + /*
- + ** This routine is the same as its brother find_name_width above, except that
- + ** it looks for a value for the width of the description field for this path.
- + */
- + int find_desc_width (dir_config_rec *d, request_rec *r) {
- + return find_int (r->filename, d->dw_list);
- + }
-
- /*****************************************************************
- *
- ***************
- *** 417,426 ****
- if(stat(fn,&finfo) == -1)
- return 0;
- plaintext=1;
- ! if(rule) rputs("<HR>\n", r);
- ! rputs("<PRE>\n", r);
- }
- ! else if (rule) rputs("<HR>\n", r);
- if(!(f = pfopen(r->pool,fn,"r")))
- return 0;
- if (!plaintext)
- --- 520,529 ----
- if(stat(fn,&finfo) == -1)
- return 0;
- plaintext=1;
- ! if (rule) rputs (" <HR>\n", r);
- ! rputs (" <PRE>\n", r);
- }
- ! else if (rule) rputs(" <HR>\n", r);
- if(!(f = pfopen(r->pool,fn,"r")))
- return 0;
- if (!plaintext)
- ***************
- *** 452,458 ****
- }
- pfclose(r->pool, f);
- if(plaintext)
- ! rputs("</PRE>\n", r);
- return 1;
- }
-
- --- 555,561 ----
- }
- pfclose(r->pool, f);
- if(plaintext)
- ! rputs(" </PRE>\n", r);
- return 1;
- }
-
- ***************
- *** 535,646 ****
- return(p);
- }
-
- ! char *terminate_description(dir_config_rec *d, char *desc, int dir_opts) {
- ! int maxsize = 23;
- ! register int x;
- !
- ! if(dir_opts & SUPPRESS_LAST_MOD) maxsize += 17;
- ! if(dir_opts & SUPPRESS_SIZE) maxsize += 7;
- !
- ! for(x=0;desc[x] && maxsize;x++) {
- ! if(desc[x] == '<') {
- ! while(desc[x] != '>') {
- ! if(!desc[x]) {
- ! maxsize = 0;
- ! break;
- ! }
- ! ++x;
- ! }
- ! }
- ! else --maxsize;
- ! }
- ! if(!maxsize) {
- ! desc[x-1] = '>'; /* Grump. */
- ! desc[x] = '\0'; /* Double Grump! */
- ! }
- ! return desc;
- }
-
- void output_directories(struct ent **ar, int n,
- ! dir_config_rec *d, request_rec *r, int dir_opts)
- {
- int x, len;
- char *name = r->uri;
- char *tp;
- pool *scratch = make_sub_pool (r->pool);
-
- if(name[0] == '\0') name = "/";
-
- if(dir_opts & FANCY_INDEXING) {
- ! rputs("<PRE>", r);
- if((tp = find_default_icon(d,"^^BLANKICON^^")))
- ! rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
- ! "\" ALT=\" \"> ", NULL);
- ! rputs("Name ", r);
- if(!(dir_opts & SUPPRESS_LAST_MOD))
- ! rputs("Last modified ", r);
- if(!(dir_opts & SUPPRESS_SIZE))
- ! rputs("Size ", r);
- ! if(!(dir_opts & SUPPRESS_DESC))
- ! rputs("Description", r);
- ! rputs("\n<HR>\n", r);
- }
- else {
- ! rputs("<UL>", r);
- }
-
- ! for(x=0;x<n;x++) {
- char *anchor = NULL, *t = NULL, *t2 = NULL;
-
- clear_pool (scratch);
-
- ! if((!strcmp(ar[x]->name,"../")) || (!strcmp(ar[x]->name,".."))) {
- char *t = make_full_path (scratch, name, "../");
- ! getparents(t);
- ! if(t[0] == '\0') t = "/";
- ! anchor = pstrcat (scratch, "<A HREF=\"",
- ! escape_html(scratch, os_escape_path(scratch, t, 0)),
- ! "\">", NULL);
- ! t2 = "Parent Directory</A> ";
- }
- else {
- t = ar[x]->name;
- ! len = strlen(t);
- ! if(len > 23) {
- ! t2 = pstrdup(scratch, t);
- ! t2[21] = '.';
- ! t2[22] = '.';
- ! t2[23] = '\0';
- ! t2 = escape_html(scratch, t2);
- ! t2 = pstrcat(scratch, t2, "</A>", NULL);
- ! } else
- ! {
- ! char buff[24]=" ";
- ! t2 = escape_html(scratch, t);
- ! buff[23-len] = '\0';
- ! t2 = pstrcat(scratch, t2, "</A>", buff, NULL);
- ! }
- ! anchor = pstrcat (scratch, "<A HREF=\"",
- ! escape_html(scratch, os_escape_path(scratch, t, 0)),
- ! "\">", NULL);
- }
-
- ! if(dir_opts & FANCY_INDEXING) {
- ! if(dir_opts & ICONS_ARE_LINKS)
- ! rputs(anchor, r);
- ! if((ar[x]->icon) || d->default_icon) {
- ! rvputs(r, "<IMG SRC=\"",
- ! escape_html(scratch, ar[x]->icon ?
- ! ar[x]->icon : d->default_icon),
- ! "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : " "),
- ! "]\">", NULL);
- }
- ! if(dir_opts & ICONS_ARE_LINKS)
- ! rputs("</A>", r);
-
- ! rvputs(r," ", anchor, t2, NULL);
- ! if(!(dir_opts & SUPPRESS_LAST_MOD)) {
- ! if(ar[x]->lm != -1) {
- char time[MAX_STRING_LEN];
- struct tm *ts = localtime(&ar[x]->lm);
- strftime(time,MAX_STRING_LEN,"%d-%b-%y %H:%M ",ts);
- --- 638,845 ----
- return(p);
- }
-
- ! /*
- ! ** This routine sizes the specified text into the output buffer. If the text
- ! ** is larger than the specified maximum width, it is truncated and the tail
- ! ** end is replaced with the overflow text (as much as will fit). The suffix
- ! ** buffer is filled with enough spaces to reach the specified width whn added
- ! ** to the output buffer. Naturally, the assumption is made that the buffers
- ! ** are at least as wide as the maximum width plus one. We use the suffix
- ! ** buffer as a work area before finally filling it with the right number of
- ! ** spaces.
- ! */
- ! void *size_field
- ! (
- ! char *buffer, /* Buffer into which text is to be sized */
- ! char *suffix, /* Preallocated working/suffix buffer */
- ! int width, /* Maximum width of text in buffer */
- ! char *contents, /* Text to be inserted */
- ! char *overflow /* Suffix if text is too long */
- ! ) {
- ! int content_len = strlen (contents);
- ! int overflow_len = strlen (overflow);
- ! int actual_len = (content_len < width) ? content_len : width;
- ! int suffix_len = (width < overflow_len) ? width : overflow_len;
- !
- ! strcpy (buffer, contents);
- ! if (content_len > width) {
- ! int i;
- ! char *s1 = overflow;
- ! char *s2;
- !
- ! s2 = &buffer[width-suffix_len];
- ! for (i = 0; i < suffix_len; i++) {
- ! *s2++ = *s1++;
- ! };
- ! *s2 = '\0';
- ! };
- ! /*
- ! ** At this point, the output buffer contains the (possibly truncated) input
- ! ** string. Put the right number of blanks into the suffix buffer.
- ! */
- ! sprintf (suffix, "%*s", (width - actual_len), "");
- ! return NULL;
- }
-
- void output_directories(struct ent **ar, int n,
- ! dir_config_rec *d, request_rec *r, int dir_opts,
- ! int name_width, int desc_width)
- {
- int x, len;
- + int nwidth = name_width;
- + int dwidth = desc_width;
- + int total_width;
- char *name = r->uri;
- char *tp;
- + char *name_buff, *space_buff;
- pool *scratch = make_sub_pool (r->pool);
-
- + if (nwidth == 0) {
- + nwidth = DEFAULT_NAME_WIDTH;
- + };
- + /*
- + * Figure out how wide the description can be. If we're suppressing any
- + * of the other fields, add their widths to this.
- + */
- + if (dwidth == 0) {
- + dwidth = DEFAULT_DESC_WIDTH;
- + if (dir_opts & SUPPRESS_LAST_MOD) dwidth += 17;
- + if (dir_opts & SUPPRESS_SIZE) dwidth += 7;
- + };
- + /*
- + * Make sure we allocate space for the largest resizable item we'll need.
- + * This is static for the duration of the request, so we allocate it from
- + * the request pool rather than the subpool.
- + */
- + len = (nwidth > dwidth) ? nwidth : dwidth;
- + name_buff = (char *) palloc (r->pool, len + 5);
- + space_buff = (char *) palloc (r->pool, len + 5);
- +
- +
- if(name[0] == '\0') name = "/";
-
- if(dir_opts & FANCY_INDEXING) {
- ! rputs (" <PRE", r);
- ! total_width = nwidth;
- ! if (! (dir_opts & SUPPRESS_LAST_MOD)) {
- ! total_width += LAST_MOD_WIDTH;
- ! };
- ! if (! (dir_opts & SUPPRESS_SIZE)) {
- ! total_width += SIZE_WIDTH;
- ! };
- ! if (! (dir_opts & SUPPRESS_DESC)) {
- ! total_width += dwidth;
- ! };
- ! if (total_width > 80) {
- ! sprintf (name_buff, " WIDTH=%d", total_width);
- ! rputs (name_buff, r);
- ! };
- ! rputs (">", r);
- if((tp = find_default_icon(d,"^^BLANKICON^^")))
- ! rvputs
- ! (
- ! r,
- ! "<IMG SRC=\"",
- ! escape_html (scratch, tp),
- ! "\" ALT=\" \"> ",
- ! NULL
- ! );
- ! size_field (name_buff, space_buff, nwidth, "Name", "..");
- ! rvputs (r, name_buff, space_buff, " ", NULL);
- if(!(dir_opts & SUPPRESS_LAST_MOD))
- ! rputs ("Last modified ", r);
- if(!(dir_opts & SUPPRESS_SIZE))
- ! rputs (" Size ", r);
- ! if (!(dir_opts & SUPPRESS_DESC)) {
- ! size_field (name_buff, space_buff, dwidth, "Description", "..");
- ! rputs (name_buff, r);
- ! };
- ! rputs("\n <HR>\n", r);
- }
- else {
- ! rputs(" <UL>\n", r);
- }
-
- ! for (x = 0; x < n; x++) {
- char *anchor = NULL, *t = NULL, *t2 = NULL;
-
- clear_pool (scratch);
-
- ! if ((!strcmp (ar[x]->name, "../")) || (!strcmp (ar[x]->name, ".."))) {
- char *t = make_full_path (scratch, name, "../");
- ! getparents (t);
- ! if (t[0] == '\0') t = "/";
- ! anchor = pstrcat
- ! (
- ! scratch,
- ! "<A HREF=\"",
- ! escape_html
- ! (
- ! scratch,
- ! os_escape_path (scratch, t, 0)
- ! ),
- ! "\">",
- ! NULL
- ! );
- ! if (dir_opts & FANCY_INDEXING) {
- ! size_field
- ! (
- ! name_buff,
- ! space_buff,
- ! nwidth,
- ! "Parent Directory",
- ! ".."
- ! );
- ! t2 = name_buff;
- ! } else {
- ! t2 = "Parent Directory";
- ! space_buff[0] = '\0';
- ! };
- }
- else {
- t = ar[x]->name;
- ! len = strlen (t);
- ! t2 = escape_html (scratch, t);
- ! anchor = pstrcat
- ! (
- ! scratch,
- ! "<A HREF=\"",
- ! escape_html
- ! (
- ! scratch,
- ! os_escape_path (scratch, t, 0)
- ! ),
- ! "\">",
- ! NULL
- ! );
- }
-
- ! if (dir_opts & FANCY_INDEXING) {
- ! if (dir_opts & ICONS_ARE_LINKS)
- ! rputs (anchor, r);
- ! if ((ar[x]->icon) || d->default_icon) {
- ! rvputs
- ! (
- ! r,
- ! " <IMG SRC=\"",
- ! escape_html
- ! (
- ! scratch,
- ! ar[x]->icon ? ar[x]->icon : d->default_icon
- ! ),
- ! "\" ALT=\"[",
- ! (ar[x]->alt ? ar[x]->alt : " "),
- ! "]\">",
- ! NULL
- ! );
- }
- ! if (dir_opts & ICONS_ARE_LINKS)
- ! rputs ("</A>", r);
-
- ! size_field (name_buff, space_buff, nwidth, t2, "..");
- ! rvputs (r, " ", anchor, name_buff, "</A>", space_buff, " ", NULL);
- ! if (!(dir_opts & SUPPRESS_LAST_MOD)) {
- ! if (ar[x]->lm != -1) {
- char time[MAX_STRING_LEN];
- struct tm *ts = localtime(&ar[x]->lm);
- strftime(time,MAX_STRING_LEN,"%d-%b-%y %H:%M ",ts);
- ***************
- *** 647,679 ****
- rputs(time, r);
- }
- else {
- ! rputs(" ", r);
- }
- }
- ! if(!(dir_opts & SUPPRESS_SIZE)) {
- ! send_size(ar[x]->size,r);
- ! rputs(" ", r);
- }
- if(!(dir_opts & SUPPRESS_DESC)) {
- ! if(ar[x]->desc) {
- ! rputs(terminate_description(d, ar[x]->desc, dir_opts), r);
- }
- }
- }
- else
- ! rvputs(r, "<LI> ", anchor," ", t2, NULL);
- ! rputc('\n', r);
- }
- if(dir_opts & FANCY_INDEXING) {
- ! rputs("</PRE>", r);
- }
- else {
- ! rputs("</UL>", r);
- }
- }
-
-
- ! int dsortf(struct ent **s1,struct ent **s2)
- {
- return(strcmp((*s1)->name,(*s2)->name));
- }
- --- 846,886 ----
- rputs(time, r);
- }
- else {
- ! rputs (" ", r);
- }
- }
- ! if (!(dir_opts & SUPPRESS_SIZE)) {
- ! send_size (ar[x]->size, r);
- ! rputs (" ", r);
- }
- if(!(dir_opts & SUPPRESS_DESC)) {
- ! if (ar[x]->desc) {
- ! size_field
- ! (
- ! name_buff,
- ! space_buff,
- ! dwidth,
- ! ar[x]->desc,
- ! ".."
- ! );
- ! rputs (name_buff, r);
- }
- }
- }
- else
- ! rvputs (r, " <LI> ", anchor," ", t2, "</A>", NULL);
- ! rputc ('\n', r);
- }
- if(dir_opts & FANCY_INDEXING) {
- ! rputs (" </PRE>\n", r);
- }
- else {
- ! rputs (" </UL>\n", r);
- }
- }
-
-
- ! int dsortf (struct ent **s1, struct ent **s2)
- {
- return(strcmp((*s1)->name,(*s2)->name));
- }
- ***************
- *** 692,697 ****
- --- 899,906 ----
- struct ent **ar = NULL;
- char *tmp;
- int dir_opts = find_opts(dir_conf, r);
- + int name_width = find_name_width (dir_conf, r);
- + int desc_width = find_desc_width (dir_conf, r);
-
- if(!(d=opendir(name))) return FORBIDDEN;
-
- ***************
- *** 712,722 ****
- while (title_endp > title_name && *title_endp == '/')
- *title_endp-- = '\0';
-
- ! rvputs(r, "<HEAD><TITLE>Index of ", title_name, "</TITLE></HEAD><BODY>\n",
- ! NULL);
-
- if((!(tmp = find_header(dir_conf,r))) || (!(insert_readme(name,tmp,0,r))))
- ! rvputs(r, "<H1>Index of ", title_name, "</H1>\n", NULL);
-
- /*
- * Since we don't know how many dir. entries there are, put them into a
- --- 921,940 ----
- while (title_endp > title_name && *title_endp == '/')
- *title_endp-- = '\0';
-
- ! rvputs
- ! (
- ! r,
- ! "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n",
- ! "<HTML>\n",
- ! " <HEAD>\n",
- ! " <TITLE>Index of ", title_name, "</TITLE>\n",
- ! " </HEAD>\n",
- ! " <BODY>\n",
- ! NULL
- ! );
-
- if((!(tmp = find_header(dir_conf,r))) || (!(insert_readme(name,tmp,0,r))))
- ! rvputs(r, " <H1>Index of ", title_name, "</H1>\n", NULL);
-
- /*
- * Since we don't know how many dir. entries there are, put them into a
- ***************
- *** 746,752 ****
- (int (*)(const void *,const void *))dsortf);
- #endif
- }
- ! output_directories(ar, num_ent, dir_conf, r, dir_opts);
- closedir(d);
-
- if (dir_opts & FANCY_INDEXING)
- --- 964,979 ----
- (int (*)(const void *,const void *))dsortf);
- #endif
- }
- ! output_directories
- ! (
- ! ar,
- ! num_ent,
- ! dir_conf,
- ! r,
- ! dir_opts,
- ! name_width,
- ! desc_width
- ! );
- closedir(d);
-
- if (dir_opts & FANCY_INDEXING)
- ***************
- *** 753,762 ****
- if((tmp = find_readme(dir_conf, r)))
- insert_readme(name,tmp,1,r);
- else {
- ! rputs("</UL>", r);
- }
-
- ! rputs("</BODY>", r);
- return 0;
- }
-
- --- 980,989 ----
- if((tmp = find_readme(dir_conf, r)))
- insert_readme(name,tmp,1,r);
- else {
- ! rputs(" </UL>", r);
- }
-
- ! rvputs (r, " </BODY>\n", "</HTML>\n", NULL);
- return 0;
- }
-
- Index: util_script.h
- ===================================================================
- *** 1.1 1997/01/01 01:49:37
- --- util_script.h 1997/01/02 12:22:53
- ***************
- *** 65,70 ****
- --- 65,74 ----
- void add_common_vars(request_rec *r);
- #define scan_script_header(a1,a2) scan_script_header_err(a1,a2,NULL)
- int scan_script_header_err(request_rec *r, FILE *f, char *buffer);
- + /*
- + * Define the canonical width of the output from the send_size () routine.
- + */
- + #define SEND_SIZE_CHARS 5
- void send_size(size_t size, request_rec *r);
- void call_exec (request_rec *r, char *argv0, char **env, int shellcmd);
-
- Index: util_script.c
- ===================================================================
- *** 1.1 1997/01/01 04:28:30
- --- util_script.c 1997/01/02 12:24:54
- ***************
- *** 376,397 ****
- }
- }
-
- ! void send_size(size_t size, request_rec *r) {
- char ss[20];
-
- ! if(size == -1)
- ! strcpy(ss, " -");
- ! else if(!size)
- ! strcpy(ss, " 0k");
- ! else if(size < 1024)
- ! strcpy(ss, " 1k");
- ! else if(size < 1048576)
- ! sprintf(ss, "%4dk", (size + 512) / 1024);
- ! else if(size < 103809024)
- ! sprintf(ss, "%4.1fM", size / 1048576.0);
- else
- ! sprintf(ss, "%4dM", (size + 524288) / 1048576);
- ! rputs(ss, r);
- }
-
- #ifdef __EMX__
- --- 376,410 ----
- }
- }
-
- ! /*
- ! ** This routine converts the specified value into an abbreviated character
- ! ** representation (e.g., in kilo- or mega-units). The result is emitted to
- ! ** the output stream. The size of the output is fixed; if this routine is
- ! ** changed to output more or fewer characters, be sure to update the
- ! ** SEND_SIZE_CHARS definition in util_script.h, which makes this width
- ! ** available to calling routines that want to line things up.
- ! */
- ! #define SIZE_1K 1024
- ! #define SIZE_1M (SIZE_1K * SIZE_1K)
- ! #define SIZE_500K (SIZE_1M / 2)
- ! #define SIZE_1G (SIZE_1M * SIZE_1K)
- ! #define SIZE_500M (SIZE_1G / 2)
- ! void send_size (size_t size, request_rec *r) {
- char ss[20];
-
- ! if (size == -1)
- ! strcpy (ss, " -");
- ! else if (!size)
- ! strcpy (ss, " 0k");
- ! else if (size < SIZE_1K)
- ! strcpy (ss, " 1k");
- ! else if (size < SIZE_1M)
- ! sprintf (ss, "%4dk", (size + 512) / SIZE_1K);
- ! else if (size < (SIZE_1M * 100))
- ! sprintf (ss, "%4.1fM", ((float) size / (float) SIZE_1M));
- else
- ! sprintf (ss, "%4dM", (size + SIZE_500K) / SIZE_1M);
- ! rputs (ss, r);
- }
-
- #ifdef __EMX__
-
- Index: mod_dir.html
- ===================================================================
- *** 1.1 1997/01/05 18:42:12
- --- mod_dir.html 1997/01/05 23:08:42
- ***************
- *** 39,45 ****
- --- 39,47 ----
- <li><A HREF="#directoryindex">DirectoryIndex</A>
- <li><A HREF="#fancyindexing">FancyIndexing</A>
- <li><A HREF="#headername">HeaderName</A>
- + <li><A HREF="#indexdescwidth">IndexDescWidth</A>
- <li><A HREF="#indexignore">IndexIgnore</A>
- + <li><A HREF="#indexnamewidth">IndexNameWidth</A>
- <li><A HREF="#indexoptions">IndexOptions</A>
- <li><A HREF="#readmename">ReadmeName</A>
- </menu>
- ***************
- *** 207,212 ****
- --- 209,254 ----
-
- <p>See also <A HREF="#readmename">ReadmeName</A>.<p><hr>
-
- + <A NAME="indexdescwidth">
- + <H2>IndexDescWidth</H2>
- + </A>
- + <!--%plaintext <?INDEX {\tt IndexDescWidth} directive> -->
- + <STRONG>Syntax:</STRONG> IndexDescWidth <EM>number</EM>
- + <BR>
- + <STRONG>Context:</STRONG> server config, virtual host, directory, .htaccess
- + <BR>
- + <STRONG>Override:</STRONG> Indexes
- + <BR>
- + <STRONG>Status:</STRONG> Base
- + <BR>
- + <STRONG>Module:</STRONG> mod_dir
- + <P>
- + The IndexDescWidth sets a specific width for the description field in
- + FancyIndexed directory listings. By default, the width of this field
- + depends upon what other options are selected; SuppressLastModified and
- + SuppressSize will cause more space to be available for the description.
- + Using IndexDescWidth overrides this adjustment and allocates the
- + specified number of columns for the descriptive text.
- + <EM>Number</EM> is a decimal number
- + indicating exactly how wide the field should be.
- + Descriptions which are too long will be truncated.
- + Example:
- + <BLOCKQUOTE>
- + <CODE>
- + IndexDescWidth 32
- + </CODE>
- + </BLOCKQUOTE>
- + </P>
- + <P>
- + See also
- + <A HREF="#adddescription">AddDescription</A>,
- + <A HREF="#indexnamewidth">IndexNameWidth</A>,
- + <A HREF="#indexoptions">IndexOptions</A>,
- + and
- + <A HREF="#fancyindexing">FancyIndexing</A>.
- + </P>
- + <HR>
- +
- <A name="indexignore"><h2>IndexIgnore</h2></A>
- <!--%plaintext <?INDEX {\tt IndexIgnore} directive> -->
- <strong>Syntax:</strong> IndexIgnore <em>file file ...</em><br>
- ***************
- *** 224,229 ****
- --- 266,309 ----
- IndexIgnore README .htaccess *~
- </code></blockquote><p><hr>
-
- + <A NAME="indexnamewidth">
- + <H2>IndexNameWidth</H2>
- + </A>
- + <!--%plaintext <?INDEX {\tt IndexNameWidth} directive> -->
- + <STRONG>Syntax:</STRONG> IndexNameWidth <EM>number</EM>
- + <BR>
- + <STRONG>Context:</STRONG> server config, virtual host, directory, .htaccess
- + <BR>
- + <STRONG>Override:</STRONG> Indexes
- + <BR>
- + <STRONG>Status:</STRONG> Base
- + <BR>
- + <STRONG>Module:</STRONG> mod_dir
- + <P>
- + The IndexNameWidth sets a specific width for the filename field in
- + FancyIndexed directory listings. By default, this field is 23 columns
- + wide. Using IndexNameWidth overrides this default width and allocates the
- + specified number of columns for the filename.
- + <EM>Number</EM> is a decimal number
- + indicating how wide the field should be. Filenames which are longer
- + than this value will be truncated and "<SAMP>..</SAMP>"
- + substituted for the overflow.
- + Example:
- + <BLOCKQUOTE>
- + <CODE>
- + IndexNameWidth 32
- + </CODE>
- + </BLOCKQUOTE>
- + </P>
- + <P>
- + See also
- + <A HREF="#indexdescwidth">IndexDescWidth</A>,
- + <A HREF="#indexoptions">IndexOptions</A>,
- + and
- + <A HREF="#fancyindexing">FancyIndexing</A>.
- + </P>
- + <HR>
- +
- <A name="indexoptions"><h2>IndexOptions</h2></A>
- <!--%plaintext <?INDEX {\tt IndexOptions} directive> -->
- <strong>Syntax:</strong> IndexOptions <em>option option ...</em><br>
-
- Index: directives.html
- ===================================================================
- *** 1.1 1997/01/05 22:46:43
- --- directives.html 1997/01/05 23:07:57
- ***************
- *** 78,84 ****
- --- 78,86 ----
- <li><A HREF="mod_imap.html#imapbase">ImapBase</A>
- <li><A HREF="mod_imap.html#imapdefault">ImapDefault</A>
- <li><A HREF="mod_imap.html#imapmenu">ImapMenu</A>
- + <li><A HREF="mod_dir.html#indexdescwidth">IndexDescWidth</A>
- <li><A HREF="mod_dir.html#indexignore">IndexIgnore</A>
- + <li><A HREF="mod_dir.html#indexnamewidth">IndexNameWidth</A>
- <li><A HREF="mod_dir.html#indexoptions">IndexOptions</A>
- <li><A HREF="core.html#keepalive">KeepAlive</A>
- <li><A HREF="core.html#keepalivetimeout">KeepAliveTimeout</A>
-