Hello community,
here is the log from the commit of package apache2-mod_macro
checked in at Wed Aug 30 16:43:08 CEST 2006.
--------
--- apache2-mod_macro/apache2-mod_macro.changes 2006-01-30 12:43:17.000000000 +0100
+++ apache2-mod_macro/apache2-mod_macro.changes 2006-08-30 03:43:13.000000000 +0200
@@ -1,0 +2,14 @@
+Wed Aug 30 03:34:21 CEST 2006 - mrueckert@suse.de
+
+- update to 1.1.8
+ * remove useless function.
+
+-------------------------------------------------------------------
+Fri Jun 16 14:27:51 CEST 2006 - poeml@suse.de
+
+- update to 1.1.7
+ * port to apache 2.2. Macro directives are
+ handled while reading the configuration file. A few casts to
+ avoid warnings.
+
+-------------------------------------------------------------------
Old:
----
mod_macro-1.1.6.tar.bz2
New:
----
mod_macro-1.1.8.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ apache2-mod_macro.spec ++++++
--- /var/tmp/diff_new_pack.ew7NAR/_old 2006-08-30 16:42:50.000000000 +0200
+++ /var/tmp/diff_new_pack.ew7NAR/_new 2006-08-30 16:42:50.000000000 +0200
@@ -1,11 +1,11 @@
#
-# spec file for package apache2-mod_macro (Version 1.1.6)
+# spec file for package apache2-mod_macro (Version 1.1.8)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
-# Please submit bugfixes or comments via http://bugs.opensuse.org
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
@@ -21,15 +21,15 @@
%define apache_serverroot %(%{apxs} -q PREFIX)
%define apache_localstatedir %(%{apxs} -q LOCALSTATEDIR)
%define apache_mmn %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)
-Version: 1.1.6
-Release: 7
+Version: 1.1.8
+Release: 1
License: Other License(s), see package, BSD
Group: Productivity/Networking/Web/Servers
Requires: apache2 %{apache_mmn}
Autoreqprov: on
Summary: Define and Use Macros within the Apache Configuration
URL: http://www.coelho.net/mod_macro/
-Source: %{modname}-%{version}.tar.bz2
+Source: http://www.coelho.net/mod_macro/%{modname}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Docdir: %{_defaultdocdir}/%{apache}
@@ -69,6 +69,14 @@
%{apache_libexecdir}/%{modname}.so
%changelog -n apache2-mod_macro
+* Wed Aug 30 2006 - mrueckert@suse.de
+- update to 1.1.8
+ * remove useless function.
+* Fri Jun 16 2006 - poeml@suse.de
+- update to 1.1.7
+ * port to apache 2.2. Macro directives are
+ handled while reading the configuration file. A few casts to
+ avoid warnings.
* Mon Jan 30 2006 - poeml@suse.de
- removed libapr-util1-devel from BuildRequires (apache2-devel does
require it)
++++++ mod_macro-1.1.6.tar.bz2 -> mod_macro-1.1.8.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/CHANGES new/mod_macro-1.1.8/CHANGES
--- old/mod_macro-1.1.6/CHANGES 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/CHANGES 2006-08-07 14:28:43.000000000 +0200
@@ -1,10 +1,28 @@
#
-# $Id: CHANGES,v 1.57 2004/07/15 06:54:09 coelho Exp $
+# $Id: CHANGES 548 2006-08-07 12:23:55Z coelho $
#
MOD_MACRO RELEASES
+Version: 1.1.8
+Date: Mon Aug 7 14:22:24 CEST 2006
+
+ - fix compilation for win32/win64.
+ - remove useless function.
+
+
+Version: 1.1.7
+Date: Wed Mar 1 07:48:08 CET 2006
+
+ - port to apache 2.2
+
+
+Version: 1.1.2b
+Date: Fri Jul 16 09:00:22 CEST 2004
+
+ - license also fixed for apache 1.3 version.
+
Version: 1.1.6
Date: Thu Jul 15 08:53:12 CEST 2004
@@ -16,7 +34,7 @@
Version: 1.1.3
Date: Sat Jun 1 23:49:48 CEST 2002
- - port to apache2
+ - port to apache 2
Version: 1.1.2
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/INSTALL new/mod_macro-1.1.8/INSTALL
--- old/mod_macro-1.1.6/INSTALL 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/INSTALL 2006-08-07 14:28:43.000000000 +0200
@@ -1,11 +1,11 @@
#
-# $Id: INSTALL.src,v 1.12 2002/06/01 22:02:23 coelho Exp $
+# $Id: INSTALL.src 467 2005-03-13 09:32:38Z coelho $
#
-Installing the mod_macro 1.1.6 module with apache 2.0.50 is simple,
+Installing the mod_macro 1.1.8 module with apache 2.2.0 is simple,
especially if you use mod_so for dynamic linking.
-Here is a sample installation with apache 2.0.50 and mod_macro 1.1.6:
+Here is a sample installation with apache 2.2.0 and mod_macro 1.1.8:
(0) get the latest mod_macro release:
@@ -32,15 +32,15 @@
(3) compile and install mod macro as a dynamic shared object library
ready to be loaded into apache.
- prompt> apxs -c -i -a mod_macro-1.1.6/mod_macro.c
+ prompt> apxs -c -i -a mod_macro-1.1.8/mod_macro.c
(4) you may also want to install the html documentation.
- prompt> cp mod_macro-1.1.6/mod_macro.html \
- apache_2.0.50/htdocs/manual/mod/
+ prompt> cp mod_macro-1.1.8/mod_macro.html \
+ apache_2.2.0/htdocs/manual/mod/
- and maybe update apache_2.0.50/htdocs/manual/mod/index.html to
+ and maybe update apache_2.2.0/htdocs/manual/mod/index.html to
add a reference to the mod_macro.html file.
(5) if you want a static binding, see the apache documentation;-)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/LICENSE new/mod_macro-1.1.8/LICENSE
--- old/mod_macro-1.1.6/LICENSE 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/LICENSE 2006-08-07 14:28:43.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * The following license applies to "mod_macro" version 1.1.6.
+ * The following license applies to "mod_macro" version 1.1.8.
* It is a third-party module by Fabien Coelho
* for the Apache Http Server (http://www.apache.org/).
*
@@ -7,7 +7,7 @@
* provision that any modification must be properly documented;-)
*
* ====================================================================
- * Copyright (c) 1998-2004 Fabien Coelho. All rights reserved.
+ * Copyright (c) 1998-2006 Fabien Coelho. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/README new/mod_macro-1.1.8/README
--- old/mod_macro-1.1.6/README 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/README 2006-08-07 14:28:43.000000000 +0200
@@ -1,5 +1,5 @@
#
-# $Id: README.src,v 1.7 2002/06/01 21:45:57 coelho Exp $
+# $Id: README.src 467 2005-03-13 09:32:38Z coelho $
#
APACHE MOD_MACRO MODULE:
@@ -10,7 +10,7 @@
To install it, see the INSTALL file.
-It has been tested with apache-2.0.50 on a Linux/Intel machine.
+It has been tested with apache-2.2.0 on a Linux/Intel machine.
However it does only use some string processing thus it should be portable
at least on any UN*X machine.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/mod_macro.c new/mod_macro-1.1.8/mod_macro.c
--- old/mod_macro-1.1.6/mod_macro.c 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/mod_macro.c 2006-08-07 14:28:43.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * The following license applies to "mod_macro" version 1.1.6.
+ * The following license applies to "mod_macro" version 1.1.8.
* It is a third-party module by Fabien Coelho
* for the Apache Http Server (http://www.apache.org/).
*
@@ -7,7 +7,7 @@
* provision that any modification must be properly documented;-)
*
* ====================================================================
- * Copyright (c) 1998-2004 Fabien Coelho. All rights reserved.
+ * Copyright (c) 1998-2006 Fabien Coelho. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -57,18 +57,20 @@
* ====================================================================
*/
/*
- $Id: mod_macro.src.c 1.71 2003/08/29 14:47:49 coelho Exp $
+ $Id: mod_macro.src.c 548 2006-08-07 12:23:55Z coelho $
- mod_macro version 1.1.6.
+ mod_macro version 1.1.8.
This modules allows the definition and use of macros within apache
runtime configuration files. Patch suggestions may be sent to the
author.
- Some updates on 14/05/2003 by Marc M. Adkins
-
Fabien Coelho .
URL: http://www.coelho.net/
+
+ TODO: use new configuration stuff...
+ - ap_pcfg_custom_config()
+ - array stuff processing for -c/-C
*/
#include "httpd.h"
@@ -80,7 +82,6 @@
#include "apr_portable.h"
#include "apr_file_io.h"
-
/************************************************ COMPILE TIME DEBUG CONTROL */
/*
debug:
@@ -92,9 +93,11 @@
no warnings:
#define MOD_MACRO_NO_WARNINGS 1
#define MOD_MACRO_NO_CHAR_PREFIX_WARNINGS 1
-*/
-/* #define MOD_MACRO_DEBUG */
+ no advertisement in version component:
+ #define MOD_MACRO_NO_ADVERTISEMENT 1
+*/
+#undef MOD_MACRO_DEBUG
#if defined(debug)
#undef debug
@@ -111,10 +114,19 @@
module AP_MODULE_DECLARE_DATA macro_module;
#define MACRO_MODULE_NAME "mod_macro"
-#define MACRO_MODULE_VERSION "1.1.6"
+#define MACRO_MODULE_VERSION "1.1.8"
-/* I used to advertise the macro module. (I was quite young;-)
- ap_add_version_component(MACRO_MODULE_NAME "/" MACRO_MODULE_VERSION);
+/* initializer for the macro module.
+ * just advertise the module in apache server signature.
+ */
+/*
+static void macro_startup(server_rec * dummy1, ap_pool_t * dummy2)
+{
+#if !defined(MOD_MACRO_NO_ADVERTISEMENT)
+// advertise the macro module;-)
+ ap_add_version_component(MACRO_MODULE_NAME "/" MACRO_MODULE_VERSION);
+#endif
+}
*/
/********************************************************** MACRO MANAGEMENT */
@@ -122,10 +134,10 @@
/* a macro: name, arguments, contents, location.
*/
typedef struct {
- char * name; /* case-insensitive name of the macro. */
- apr_array_header_t * arguments; /* of char* */
- apr_array_header_t * contents; /* of char* */
- char * location; /* of the macro definition for error messages. */
+ char * name; /* case-insensitive name of the macro. */
+ apr_array_header_t * arguments; /* of char* */
+ apr_array_header_t * contents;
+ char * location; /* of the macro definition. */
} macro_t;
/* configuration tokens.
@@ -138,66 +150,56 @@
/* macros are kept globally...
they are not per-server or per-directory entities.
- there are initialized/closed by mod_macro_init/mod_macro_close
- this is also used as a tag to know whether it has been initialized.
- [bug on first reading/check of the configuration file...]
+
+ I would need a hook BEFORE and AFTER configuration processing
+ to initialize and close them properly.
+
+ I would have such a hook if in the main/... I guess.
+
+ The "initializer" does not seem to be called before.
+
+ HACK:
+ -----
+ I put them in the temp_pool.
+ restarts are detected because the temp_pool has changed...
+ note that there is always a restart implicitely to check for the syntax.
*/
-static apr_array_header_t * macros = NULL;
+static apr_array_header_t * all_macros = NULL;
/* returns the macro structure for name, or NULL if not found.
*/
-static macro_t * get_macro_by_name(const char * name)
+static macro_t * get_macro_by_name(const apr_array_header_t * macros,
+ const char * name)
{
int i;
macro_t ** tab;
-
- debug(fprintf(stderr, "mod_macro:get_macro_by_name('%s')\n", name));
-
ap_assert(macros);
tab = (macro_t **)macros->elts;
for (i = 0; i < macros->nelts; i++) {
if (!strcasecmp(name, tab[i]->name)) {
- debug(fprintf(stderr, "macro found at index %d\n", i));
return tab[i];
}
}
- debug(fprintf(stderr, "macro not found\n"));
return NULL;
}
/* configuration state initialization.
the state is simply an apr_array_header_t which holds the macros.
*/
-static int mod_macro_init(
- apr_pool_t *pconf,
- apr_pool_t *plog,
- apr_pool_t *ptemp)
-{
- debug(fprintf(stderr, "mod_macro_init(%p)\n", ptemp));
-
- /* ??? */
- if (macros) return 0;
-
- ap_assert(!macros);
- macros = apr_array_make(ptemp, 1, sizeof(macro_t *));
- return 0;
-}
-
-static int mod_macro_close(
- apr_pool_t *pconf,
- apr_pool_t *plog,
- apr_pool_t *ptemp,
- server_rec *s)
+static void macro_init(apr_pool_t * p)
{
- debug(fprintf(stderr, "mod_macro_close(%p)\n", ptemp));
+ static apr_pool_t * last_time_temp_pool_hack = NULL;
- /* ??? */
- if (!macros) return 0;
+ debug(fprintf(stderr, "macro_init\n"));
- ap_assert(macros);
- macros = NULL;
- return 0;
+ /* is it a restart? what about concurrent threads?
+ */
+ if (last_time_temp_pool_hack != p) {
+ last_time_temp_pool_hack = p;
+ all_macros = apr_array_make(p, 1, sizeof(macro_t *));
+ debug(fprintf(stderr, "macro_init done for %p\n", p));
+ }
}
/*************************************************************** PARSE UTILS */
@@ -255,7 +257,7 @@
if (any_nesting<0) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
0, NULL,
- "bad (negative) nesting on line %d of %s\n",
+ "bad (negative) nesting on line %d of %s",
line_number, where);
}
#endif
@@ -271,7 +273,7 @@
if (any_nesting) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
0, NULL,
- "bad cumulated nesting (%+d) in %s\n",
+ "bad cumulated nesting (%+d) in %s",
any_nesting, where);
}
#endif
@@ -304,7 +306,7 @@
static int looks_like_an_argument(const char * word)
{
- return (int)strchr(ARGUMENT_PREFIX, *word);
+ return (int) ap_strchr(ARGUMENT_PREFIX, *word);
}
/* generates an error on macro with two arguments of the same name.
@@ -324,7 +326,7 @@
if (ltabi == 0) {
return apr_psprintf(p,
- "macro '%s' (%s)\n\tempty argument #%d name\n",
+ "macro '%s' (%s): empty argument #%d name",
macro->name, macro->location, i + 1);
}
@@ -332,9 +334,9 @@
!defined(MOD_MACRO_NO_WARNINGS)
if (!looks_like_an_argument(tab[i])) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
- "macro '%s' (%s)\n"
- "\targument name '%s' (#%d) without expected prefix.\n"
- "\tit is good practice to prefix argument names with one of '%s'.\n",
+ "macro '%s' (%s) "
+ "argument name '%s' (#%d) without expected prefix, "
+ "better prefix argument names with one of '%s'.",
macro->name, macro->location,
tab[i], i + 1, ARGUMENT_PREFIX);
}
@@ -345,9 +347,9 @@
if (!strcmp(tab[i], tab[j])) {
return apr_psprintf(p,
- "argument name conflict in macro '%s' (%s)\n"
- "\targument '%s': #%d and #%d\n"
- "\tchange argument names!",
+ "argument name conflict in macro '%s' (%s): "
+ "argument '%s': #%d and #%d, "
+ "change argument names!",
macro->name, macro->location,
tab[i], i + 1, j + 1);
}
@@ -356,9 +358,9 @@
if (!strncmp(tab[i], tab[j], ltabi < ltabj ? ltabi : ltabj)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
0, NULL,
- "macro '%s' (%s)\n"
- "\targument name prefix conflict (%s #%d and %s #%d)\n"
- "\tbe careful about your macro definition!\n",
+ "macro '%s' (%s): "
+ "argument name prefix conflict (%s #%d and %s #%d), "
+ "be careful about your macro definition!",
macro->name, macro->location,
tab[i], i + 1, tab[j], j + 1);
}
@@ -381,7 +383,7 @@
for (i = 0; i < array->nelts; i++) {
if (empty_string_p(tab[i])) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
- "%s\n\tempty argument #%d\n", where, i + 1);
+ "%s: empty argument #%d", where, i + 1);
}
}
#endif
@@ -437,7 +439,7 @@
size_t lchosen = 0, lfound;
for (i = 0; i < args->nelts; i++) {
- found = strstr(buf, tab[i]);
+ found = ap_strstr(buf, tab[i]);
lfound = strlen(tab[i]);
if (found && (!chosen || found < chosen ||
(found == chosen && lchosen < lfound))) {
@@ -462,7 +464,7 @@
char * ptr = buf, * errmsg,
** atab = (char **)macro->arguments->elts,
** rtab = (char **)replacements->elts;
- int whichone;
+ int whichone = -1;
if (used) {
ap_assert(used->nalloc >= replacements->nelts);
@@ -495,7 +497,7 @@
apr_array_header_t ** result)
{
apr_array_header_t * contents = macro->contents;
- char ** new, * errmsg, line[MAX_STRING_LEN]; /* sorry again. */
+ char ** new, * errmsg, line[MAX_STRING_LEN];
int i;
if (result) {
@@ -508,8 +510,8 @@
macro, replacements, used);
if (errmsg) {
return apr_psprintf(p, "while processing line %d of macro '%s'"
- " (%s)\n\t%s",
- i + 1, macro->name, macro->location, errmsg);
+ " (%s)%s",
+ i + 1, macro->name, macro->location, errmsg);
}
if (result) {
@@ -517,7 +519,6 @@
*new = apr_pstrdup(p, line);
}
}
-
return NULL;
}
@@ -534,7 +535,7 @@
if (macro->contents->nelts == 0) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
- "macro '%s' (%s)\n\tempty contents!\n",
+ "macro '%s' (%s): empty contents!",
macro->name, macro->location);
return NULL; /* no need to further warnings... */
}
@@ -555,7 +556,7 @@
for (i = 0; i < nelts; i++) {
if (!used->elts[i]) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
- "macro '%s' (%s)\n\targument '%s' (#%d) never used\n",
+ "macro '%s' (%s): argument '%s' (#%d) never used",
macro->name, macro->location, names[i], i + 1);
}
}
@@ -583,9 +584,9 @@
int index; /* current element. */
int char_index; /* current char in element. */
int length; /* cached length of the current line. */
- apr_array_header_t * contents; /* array of char * */
- ap_configfile_t * next; /* next config once this one is processed. */
- ap_configfile_t ** upper; /* hack: where to update it if needed. */
+ apr_array_header_t * contents; /* array of char * */
+ ap_configfile_t * next; /* next config once this one is processed. */
+ ap_configfile_t ** upper; /* hack: where to update it if needed. */
} array_contents_t;
/* next config if any. */
@@ -690,21 +691,23 @@
/* handles: any trash...
*/
-static const char * macro_section(cmd_parms * cmd,
- void * dummy,
- const char * arg)
+static const char *macro_section(cmd_parms * cmd,
+ void * dummy,
+ const char * arg)
{
const char * errmsg, * where;
- char ** new, * name, * endp = strrchr(arg, '>');
+ char ** new, * name, * endp;
macro_t * macro, * old;
- /* LAZY ??? */
- if (!macros) {
- mod_macro_init(NULL, NULL, cmd->temp_pool);
- }
+ debug(fprintf(stderr, "macro_section: arg='%s'\n", arg));
+
+ macro_init(cmd->temp_pool); /* lazy... */
- debug(fprintf(stderr, "macro_section -%s-\n", arg));
- ap_assert(cmd->config_file);
+ endp = ap_strrchr_c(arg, '>');
+ if (endp == NULL) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ "> directive missing closing '>'", NULL);
+ }
/* hmmm... drops out '>[^>]*$'
*/
@@ -715,57 +718,44 @@
/* get name. */
name = ap_getword_conf(cmd->temp_pool, &arg);
- debug(fprintf(stderr, "macro name is '%s'\n", name));
-
if (empty_string_p(name)) {
return "macro definition: name not specified";
}
- /* BUG on first reading??? */
- /* if (!macros) {
- debug(fprintf(stderr, "macros not initialized???\n"));
- return NULL;
- }*/
-
- old = get_macro_by_name(name);
+ old = get_macro_by_name(all_macros, name);
if (old) {
#if !defined(MOD_MACRO_NO_WARNINGS)
/* already define: warn about the redefinition. */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
- "macro '%s' multiply defined.\n"
- "\t%s, redefined on line %d of %s",
+ "macro '%s' multiply defined. "
+ "%s, redefined on line %d of %s",
old->name, old->location,
cmd->config_file->line_number, cmd->config_file->name);
#endif
macro = old;
- debug(fprintf(stderr, "macro %s is old\n", name));
}
else {
macro = (macro_t *)apr_palloc(cmd->temp_pool, sizeof(macro_t));
- debug(fprintf(stderr, "macro %s is new (%p)\n", name, macro));
}
macro->name = name;
-
- debug(fprintf(stderr, "cmd=%p config_file=%p\n", cmd, cmd->config_file));
+ debug(fprintf(stderr, "macro_section: name=%s\n", name));
/* get arguments. */
macro->location = apr_psprintf(cmd->temp_pool,
"defined on line %d of %s",
cmd->config_file->line_number,
cmd->config_file->name);
+ debug(fprintf(stderr, "macro_section: location=%s\n", macro->location));
where = apr_psprintf(cmd->temp_pool, "macro '%s' (%s)",
- macro->name, macro->location);
-
- debug(fprintf(stderr, "macro where='%s'\n", where));
+ macro->name, macro->location);
#if !defined(MOD_MACRO_NO_CHAR_PREFIX_WARNINGS) || \
!defined(MOD_MACRO_NO_WARNINGS)
if (looks_like_an_argument(name)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
- "%s\n\tit is good practice not "
- "to prefix a macro name with any of '%s'\n",
+ "%s better prefix a macro name with any of '%s'\n",
where, ARGUMENT_PREFIX);
}
#endif
@@ -778,9 +768,6 @@
return errmsg;
}
- debug(fprintf(stderr, "macro getting contents\n"));
-
- /* get contents */
errmsg = get_lines_till_end_token(cmd->temp_pool, cmd->config_file,
END_MACRO, BEGIN_MACRO,
where, ¯o->contents);
@@ -798,7 +785,7 @@
}
/* add the new macro. */
- new = apr_array_push(macros);
+ new = apr_array_push(all_macros);
*new = (char *)macro;
return NULL;
@@ -808,21 +795,22 @@
*/
static const char * use_macro(cmd_parms * cmd, void * dummy, const char * arg)
{
- char * name, * recursion;
+ char * name, * where = "", * recursion;
const char * errmsg;
apr_array_header_t * contents, * replacements;
macro_t * macro;
- char * where = "???";
debug(fprintf(stderr, "use_macro -%s-\n", arg));
+ macro_init(cmd->temp_pool); /* lazy... */
+
name = ap_getword_conf(cmd->temp_pool, &arg);
if (empty_string_p(name)) {
return "no macro name specified in " USE_MACRO;
}
- macro = get_macro_by_name(name);
+ macro = get_macro_by_name(all_macros, name);
if (!macro) {
return apr_psprintf(cmd->temp_pool, "macro '%s' is not defined", name);
@@ -835,9 +823,9 @@
*/
recursion = apr_pstrcat(cmd->temp_pool, "macro '", macro->name, "'", NULL);
- if (strstr(cmd->config_file->name, recursion)) {
+ if (ap_strstr(cmd->config_file->name, recursion)) {
return apr_psprintf(cmd->temp_pool,
- "%s\n\trecursive use of macro '%s' is invalid.",
+ "%s: recursive use of macro '%s' is invalid.",
where, macro->name);
}
@@ -845,10 +833,9 @@
if (macro->arguments->nelts != replacements->nelts) {
return apr_psprintf(cmd->temp_pool,
- "use of macro '%s' %s\n"
- "\twith %d argument%s instead of %d",
+ "use of macro '%s' %s "
+ " with %d arguments instead of %d",
macro->name, macro->location, replacements->nelts,
- replacements->nelts > 1 ? "s" : "", /* grammar;-) */
macro->arguments->nelts);
}
@@ -865,7 +852,7 @@
if (errmsg) {
return apr_psprintf(cmd->temp_pool,
- "%s\n\terror while substituting:\n%s",
+ "%s error while substituting:\n%s",
where, errmsg);
}
@@ -878,15 +865,6 @@
return NULL;
}
-/* handles: a lonely </Macro> or other unexpected keyword.
- * such a function already exists? where? could be in util.c or config.c?
- */
-static const char * unexpected_keyword(cmd_parms *parms, void * dummy)
-{
- return apr_psprintf(parms->temp_pool,
- "unexpected %s encountered", (char *)parms->info);
-}
-
/************************************ ERROR AND WARNING DURING CONFIGURATION */
/* maybe ConfigurationError and ConfigurationWarning could be used?
@@ -894,7 +872,7 @@
#define ERROR_KEYWORD "Error"
#define WARNING_KEYWORD "Warning"
-/* configuration generated errors or warnings.
+/* configuration generated erros or warnings.
*/
static const char * say_it(cmd_parms * parms, void * dummy, const char * arg)
{
@@ -902,7 +880,7 @@
trim(arg);
ap_log_error(APLOG_MARK, APLOG_NOERRNO|level, 0, NULL,
- "on line %d of %s:\n\t%s\n",
+ "on line %d of %s: %s",
parms->config_file->line_number,
parms->config_file->name, arg);
@@ -913,49 +891,40 @@
/************************************************************* EXPORT MODULE */
/* macro module commands.
- * the EXEC_ON_READ option is needed in apache 2 to get the config_file field.
*/
static const command_rec macro_cmds[] =
{
- /* configuration file macro stuff
- */
- AP_INIT_RAW_ARGS(BEGIN_MACRO, macro_section,
- NULL, EXEC_ON_READ|OR_ALL,
- "Beginning of a macro definition section."),
- AP_INIT_NO_ARGS(END_MACRO, unexpected_keyword,
- (void*)END_MACRO, EXEC_ON_READ|OR_ALL,
- "End of a macro definition section."),
- AP_INIT_RAW_ARGS(USE_MACRO, use_macro,
- NULL, EXEC_ON_READ|OR_ALL,
- "Use of a macro."),
-
- /* configuration errors and warnings.
- */
- AP_INIT_RAW_ARGS(ERROR_KEYWORD, say_it,
- (void*)APLOG_ERR, EXEC_ON_READ|OR_ALL,
- "Error in a configuration file."),
- AP_INIT_RAW_ARGS(WARNING_KEYWORD, say_it,
- (void*)APLOG_WARNING, EXEC_ON_READ|OR_ALL,
- "Warning in a configuration file."),
+ /* configuration file macro stuff
+ */
+ AP_INIT_RAW_ARGS(BEGIN_MACRO, macro_section, NULL, EXEC_ON_READ | OR_ALL,
+ "Beginning of a macro definition section."),
+ AP_INIT_RAW_ARGS(USE_MACRO, use_macro, NULL, EXEC_ON_READ | OR_ALL,
+ "Use of a macro."),
+
+ /* configuration errors and warnings.
+ */
+ AP_INIT_RAW_ARGS(ERROR_KEYWORD, say_it, (void *)APLOG_ERR, OR_ALL,
+ "Error in a configuration file."),
+ AP_INIT_RAW_ARGS(WARNING_KEYWORD, say_it, (void *)APLOG_WARNING, OR_ALL,
+ "Warning in a configuration file."),
- { NULL }
+ { NULL }
};
-/* module init and close
- */
-static void register_hooks(apr_pool_t *p)
-{
- debug(fprintf(stderr, "mod_macro:register_hooks()\n"));
- ap_hook_pre_config(mod_macro_init, NULL, NULL, APR_HOOK_LAST);
- ap_hook_post_config(mod_macro_close, NULL, NULL, APR_HOOK_LAST);
-}
+/* Module hooks are request-oriented thus it does not suit configuration
+ file utils a lot. I haven't found any clean hook to apply something
+ before then after configuration file processing. Also what about
+ .htaccess files?
+
+ Thus I think that main/http_co*.c would be a better place for this stuff.
+*/
-module AP_MODULE_DECLARE_DATA macro_module = {
+AP_DECLARE_DATA module macro_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-directory config */
NULL, /* merge per-directory config structures */
NULL, /* create per-server config structure */
NULL, /* merge per-server config structures */
- macro_cmds, /* command table, that's all there is! */
- register_hooks /* register hooks */
+ macro_cmds, /* command table */
+ NULL /* register hooks */
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/mod_macro.html new/mod_macro-1.1.8/mod_macro.html
--- old/mod_macro-1.1.6/mod_macro.html 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/mod_macro.html 2006-08-07 14:28:43.000000000 +0200
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- Copyright (c) 1998-2004 Fabien Coelho. All rights reserved. -->
-<!-- $Id: mod_macro.src.html,v 1.38 2003/09/09 11:24:19 coelho Exp $ -->
+<!-- Copyright (c) 1998-2006 Fabien Coelho. All rights reserved. -->
+<!-- $Id: mod_macro.src.html 536 2006-02-28 16:26:42Z coelho $ -->
<HTML>
<HEAD>
<TITLE>Apache module mod_macro</TITLE>
@@ -9,10 +9,10 @@
LINK="#0000FF" VLINK="#000080" ALINK="#FF0000">
<DIV ALIGN="CENTER">
<IMG SRC="../images/sub.gif" ALT="[APACHE DOCUMENTATION]">
-<H3>Apache HTTP Server Version 2.0</H3>
+<H3>Apache HTTP Server Version 2.2</H3>
</DIV>
-<H1 ALIGN="CENTER">Module mod_macro 1.1.6</H1>
+<H1 ALIGN="CENTER">Module mod_macro 1.1.8</H1>
<P>
This module is contained in the <CODE>mod_macro.c</CODE> file, and
is not compiled in by default. It provides for using macros within apache
@@ -21,7 +21,7 @@
and the result is processed normally.
</P>
<P>
-This documentation describes version 1.1.6 of mod_macro.
+This documentation describes version 1.1.8 of mod_macro.
For the latest version see:
</p>
<p>
@@ -98,7 +98,7 @@
<A HREF="directive-dict.html#Module" REL="Help">
<STRONG>Module:</STRONG></A> mod_macro<BR>
<A HREF="directive-dict.html#Compatibility" REL="Help">
-<STRONG>Compatibility:</STRONG></A> Apache 1.3 and 2.0 <BR>
+<STRONG>Compatibility:</STRONG></A> Apache 1.3, 2.0 and 2.2 <BR>
<P>
This directive issues an error from the configuration file and stop
@@ -124,7 +124,7 @@
<A HREF="directive-dict.html#Module" REL="Help">
<STRONG>Module:</STRONG></A> mod_macro<BR>
<A HREF="directive-dict.html#Compatibility" REL="Help">
-<STRONG>Compatibility:</STRONG></A> Apache 1.3 and 2.0<BR>
+<STRONG>Compatibility:</STRONG></A> Apache 1.3, 2.0 and 2.2<BR>
<P>
This directive controls the definition of a macro within the server
@@ -168,7 +168,7 @@
<A HREF="directive-dict.html#Module" REL="Help">
<STRONG>Module:</STRONG></A> mod_macro<BR>
<A HREF="directive-dict.html#Compatibility" REL="Help">
-<STRONG>Compatibility:</STRONG></A> Apache 1.3 and 2.0<BR>
+<STRONG>Compatibility:</STRONG></A> Apache 1.3, 2.0 and 2.2<BR>
<P>
This directive controls the use of a macro. The specified macro is
@@ -212,7 +212,7 @@
<A HREF="directive-dict.html#Module" REL="Help">
<STRONG>Module:</STRONG></A> mod_macro<BR>
<A HREF="directive-dict.html#Compatibility" REL="Help">
-<STRONG>Compatibility:</STRONG></A> Apache 1.3 and 2.0<BR>
+<STRONG>Compatibility:</STRONG></A> Apache 1.3, 2.0 and 2.2<BR>
<P>
This directive issues a warning from the configuration file.
@@ -231,7 +231,7 @@
</PRE>
<HR>
-<H3 ALIGN="CENTER">Apache HTTP Server Version 1.3 and 2.0</H3>
+<H3 ALIGN="CENTER">Apache HTTP Server Version 1.3, 2.0 and 2.2</H3>
<A HREF="./"><IMG SRC="../images/index.gif" ALT="Index"></A>
<A HREF="../"><IMG SRC="../images/home.gif" ALT="Home"></A>
</BODY>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/mod_macro-1.1.6/patch_to_apache_1.3.3 new/mod_macro-1.1.8/patch_to_apache_1.3.3
--- old/mod_macro-1.1.6/patch_to_apache_1.3.3 2004-07-15 09:02:27.000000000 +0200
+++ new/mod_macro-1.1.8/patch_to_apache_1.3.3 1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-*** apache_1.3.3/src/main/http_config.c.orig Sat Sep 26 02:07:08 1998
---- apache_1.3.3/src/main/http_config.c Tue Dec 22 11:58:26 1998
-***************
-*** 1188,1194 ****
-
- if (errmsg) {
- fprintf(stderr, "Syntax error on line %d of %s:\n",
-! parms.config_file->line_number, fname);
- fprintf(stderr, "%s\n", errmsg);
- exit(1);
- }
---- 1188,1194 ----
-
- if (errmsg) {
- fprintf(stderr, "Syntax error on line %d of %s:\n",
-! parms.config_file->line_number, parms.config_file->name);
- fprintf(stderr, "%s\n", errmsg);
- exit(1);
- }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org