httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Chin <httpd-...@mlists.thewrittenword.com>
Subject Re: sed magic in apr_common.m4 to source config.layout breaks on IRIX
Date Sun, 24 Aug 2003 15:39:24 GMT
On Sat, Aug 23, 2003 at 09:30:35AM +0200, Sascha Schumann wrote:
> On Sat, 23 Aug 2003, Albert Chin wrote:
> 
>     Can you give the patch a try?  It is _way_ easier to maintain
>     than the sed version.

Won't work. -v isn't supported by all awk's. It is by "nawk" and
"gawk". I've attached an updated patch to fix this and remove the
changequote's.

--- build/apr_common.m4.orig	Fri Aug 22 09:46:48 2003
+++ build/apr_common.m4	Sun Aug 24 10:22:06 2003
@@ -756,14 +756,12 @@
     exit 1
   fi
   pldconf=./config.pld
-  changequote({,})
-  sed -e "1s/[ 	]*<[lL]ayout[ 	]*$2[ 	]*>[ 	]*//;t" \
-      -e "1,/[ 	]*<[lL]ayout[ 	]*$2[ 	]*>[ 	]*/d" \
-      -e '/[ 	]*<\/Layout>[ 	]*/,$d' \
-      -e "s/^[ 	]*//g" \
-      -e "s/:[ 	]*/=\'/g" \
-      -e "s/[ 	]*$/'/g" \
-      $1 > $pldconf
+  awk '                                                         \
+        /<[[Ll]]ayout/ { if ([$]2 == "'$2'" ">") ok=1; next; }               \
+        ok == 1 && /<\/Layout>/ { exit; }                                 
  \
+        ok == 1 { print [substr]([$]1,1,length([$]1)-1) "=\"" [$]2 "\"" } '  \
+        < $1 > $pldconf
+
   layout_name=$2
   if test ! -s $pldconf; then
     echo "** Error: unable to find layout $layout_name"
@@ -786,7 +784,7 @@
         ;;
     esac
     val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
-    val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
+    val=`echo $val | sed -e 's:[[\$]]\([[a-z_]]*\):$[\1]:g'`
     if test "$autosuffix" = "yes"; then
       if echo $val | grep apache >/dev/null; then
         addtarget=no
@@ -799,7 +797,6 @@
     fi
     eval "$var='$val'"
   done
-  changequote([,])
 ])dnl
 
 dnl

-- 
albert chin (china@thewrittenword.com)

Mime
View raw message