You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2007/12/16 07:09:17 UTC
svn commit: r604556 - /httpd/mod_ftp/trunk/build/addloadexample.awk
Author: wrowe
Date: Sat Dec 15 22:09:15 2007
New Revision: 604556
URL: http://svn.apache.org/viewvc?rev=604556&view=rev
Log:
Case insensitivity, avoid duplicating the example Include or the
LoadModule, be a bit more conservative with extra whitespace
and drop LoadModule at the first blank line we see, instead of
the first non-loadmodule line.
Modified:
httpd/mod_ftp/trunk/build/addloadexample.awk
Modified: httpd/mod_ftp/trunk/build/addloadexample.awk
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/build/addloadexample.awk?rev=604556&r1=604555&r2=604556&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/build/addloadexample.awk (original)
+++ httpd/mod_ftp/trunk/build/addloadexample.awk Sat Dec 15 22:09:15 2007
@@ -1,29 +1,44 @@
# Invoke as awk addloadexample.awk
BEGIN {
- lm = "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE ".so";
- lms = 0
+ lms = 0;
}
-/^ *LoadModule/{
- if ( ! lms ) lms = 1;
-}
-
-!/LoadModule/{
- if ( lms == 1 ) {
- print lm;
+tolower($0) ~ /^[# \t]*loadmodule[ \t]/ {
+ if ( $2 == MODULE "_module" ) {
+ print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE ".so";
lms = 2;
+ next;
}
-}
+ # test $3 since # LoadModule is split into two tokens
+ else if ( $3 == MODULE "_module" ) {
+ print $1 "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE ".so";
+ lms = 2;
+ next;
+ }
+ else if ( ! lms ) lms = 1;
+}
-{
- print $0;
+$0 ~ /^[ \t]*$/ && lms == 1 {
+ print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE ".so";
+ lms = 2;
}
+tolower($0) ~ /^[# \t]*include[ \t]/ && $NF == EXAMPLECONF {
+ lms = 3;
+}
+
+{ print }
+
END {
- if ( lms < 2 ) { print; print lm; }
- print;
- print "# Example mod_" MODULE " configuration";
- print "#Include " EXAMPLECONF "\n";
+ if ( lms < 3 ) {
+ if ( ! /^[ \t]*$/ ) print "";
+ if ( lms < 2 ) {
+ print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE ".so";
+ print "";
+ }
+ print "# Example mod_" MODULE " configuration";
+ print "#Include " EXAMPLECONF "\n";
+ }
}