More beautification of the generated script

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4779 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-11-01 16:32:18 +00:00
parent 5015d66dec
commit 4d6cf619fe
2 changed files with 19 additions and 11 deletions

View File

@ -4907,12 +4907,20 @@ __EOF__
}
#
# Post-process generated script
# Post-process generated script to:
#
# - Suppress redundant blank lines
# - Replace leading spaces with tabs
#
mycat()
{
if [ -n "$(mywhich awk)" ]; then
awk 'BEGIN {blnk=0;}; /^\s*$/ {blnk=1; next; }; { if (blnk == 1 ) { print ""; blnk=0; }; print; }' $*
local awk=$(mywhich awk)
if [ -n "$awk" ]; then
$awk 'BEGIN {blnk=0;}; \
/^\s*$/ {blnk=1; next; }; \
{ while (/^\t* /) sub(/ /, "\t" ); }; \
{ if (blnk == 1 ) { print ""; blnk=0; }; print; }' $*
else
cat $*
fi