(svn r8948) -Change: some sed implementations have problems with \n so rewrite r8832 using awk

This commit is contained in:
glx 2007-02-28 23:52:04 +00:00
parent 469fbc912c
commit 3dc71e3484

View File

@ -130,27 +130,33 @@ load_lang_data() {
generate() { generate() {
echo "Generating $2..." echo "Generating $2..."
# Everything above the !!FILES!! marker # Everything above the !!FILES!! marker
RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk ' cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
/^$/ { next } /^$/ { next }
/!!FILES!!/ { stop = 1; } /!!FILES!!/ { stop = 1; }
{ {
if (stop == 0) { print $0 } if (stop == 0) { print $0 }
} }
' > \"$ROOT_DIR/projects/$2\"`" ' > "$ROOT_DIR/projects/$2"
# The files-list # The files-list
if [ "$3" = "msvc2003" ]; then echo "$1" | awk -v type="$3" '
echo "$1" | sed 's@\
\
@\n@' >> "$ROOT_DIR/projects/$2" /
/ {
else if (type == "msvc2003") gsub("
", "\n", $0);
echo "$1" | sed ' }
s@Filter="">@>@; /Filter="">/ {
s@^\([ ]*\)\([^ <].*[^/]\)>$@\1\2\n\1>@g; if (type == "msvc2005") gsub("Filter=\"\">", ">", $0);
s@^ \([ ]*\)\([^ <].*\)/>$@ \1\2\n\1/>@g; }
/"\/>/ {
if (type == "msvc2005") gsub("/>", "\n" substr($0, 1, index($0, $1) - 2) "/>", $0);
}
/">/ {
if (type == "msvc2005") gsub(">", "\n" substr($0, 1, index($0, $1) - 1) ">", $0);
}
{ print $0 }
' >> "$ROOT_DIR/projects/$2" ' >> "$ROOT_DIR/projects/$2"
fi
# Everything below the !!FILES!! marker # Everything below the !!FILES!! marker
RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk ' cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
BEGIN { stop = 1; } BEGIN { stop = 1; }
/^$/ { next } /^$/ { next }
/!!FILES!!/ { stop = 2; } /!!FILES!!/ { stop = 2; }
@ -158,7 +164,7 @@ generate() {
if (stop == 0) { print $0 } if (stop == 0) { print $0 }
if (stop == 2) { stop = 0 } if (stop == 2) { stop = 0 }
} }
' >> \"$ROOT_DIR/projects/$2\"`" ' >> "$ROOT_DIR/projects/$2"
} }
load_main_data "$ROOT_DIR/source.list" openttd load_main_data "$ROOT_DIR/source.list" openttd