You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Jim Jagielski <ji...@hyperreal.com> on 1996/06/08 00:47:23 UTC
cvs commit: apache/src http_core.c
jim 96/06/07 15:47:22
Modified: src http_core.c
Log:
Add ConfigDir and minor fluff
Revision Changes Path
1.15 +45 -1 apache/src/http_core.c
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C3 -r1.14 -r1.15
*** http_core.c 1996/06/07 20:18:58 1.14
--- http_core.c 1996/06/07 22:47:21 1.15
***************
*** 359,365 ****
void *sconf = cmd->server->module_config;
core_server_config *conf = get_module_config (sconf, &core_module);
! if (!is_directory (arg)) return "DocumentRoot must be a directory";
conf->document_root = arg;
return NULL;
--- 359,369 ----
void *sconf = cmd->server->module_config;
core_server_config *conf = get_module_config (sconf, &core_module);
! if (!is_directory (arg))
! if (cmd->server->is_virtual)
! fprintf (stderr, "Warning: DocumentRoot [%s] does not exist", arg);
! else
! return "DocumentRoot must be a directory";
conf->document_root = arg;
return NULL;
***************
*** 608,613 ****
--- 612,656 ----
return errmsg;
}
+ char *read_configdir (cmd_parms *cmd, void *dummy, char *arg)
+ {
+ DIR *vdir;
+ struct DIR_TYPE *vdir_entry;
+ char *dirname, *fname, *p;
+
+ dirname = server_root_relative (cmd->pool, arg);
+
+ if (!is_directory (dirname))
+ log_error ("ConfigDir must be a valid directory", cmd->server);
+
+ vdir = opendir (dirname);
+
+ if (vdir == NULL) {
+ return NULL;
+ }
+
+ if ((p = strrchr (dirname, '\0')))
+ {
+ if (*--p != '/')
+ dirname = pstrcat (cmd->pool, dirname, "/", NULL);
+ }
+
+ while ((vdir_entry = readdir (vdir))) {
+
+ if ((strstr(vdir_entry->d_name, ".conf")) != NULL)
+ {
+ fname = pstrcat (cmd->pool, dirname, vdir_entry->d_name, NULL);
+ process_resource_config (cmd->server, fname,
+ cmd->pool, cmd->temp_pool);
+ }
+ else
+ continue;
+ }
+
+ closedir (vdir);
+ return NULL;
+ }
+
char *set_server_string_slot (cmd_parms *cmd, void *dummy, char *arg)
{
/* This one's pretty generic... */
***************
*** 837,842 ****
--- 880,886 ----
"a port number or a numeric IP address and a port number"},
{ "<VirtualHost", virtualhost_section, NULL, RSRC_CONF, RAW_ARGS, NULL },
{ "</VirtualHost>", end_virtualhost_section, NULL, RSRC_CONF, NO_ARGS, NULL },
+ { "ConfigDir", read_configdir, NULL, RSRC_CONF, TAKE1, "directory containing config files" },
{ NULL },
};