Browse Source

genlink.awk: no need to make mode a regexp

Since I don't understand regular expressions and don't see how they are
useful in this case I made the mode selection a simple string match
pull/689/merge
Jonas Meyer 9 years ago
committed by Karl Palsson
parent
commit
60ca09c61e
  1. 16
      scripts/genlink.awk

16
scripts/genlink.awk

@ -23,8 +23,6 @@
BEGIN {
PAT = tolower(PAT);
if (length(MODE) == 0)
MODE = ".*";
}
!/^#/{
#remove cr on windows
@ -41,37 +39,37 @@ BEGIN {
PAT=$2;
for (i = 3; i <= NF; i = i + 1) {
if ($i ~ /^CPU=/) {
if ("CPU" ~ MODE){
if ("CPU" == MODE){
sub(/[^=]*=/,"",$i);
printf "%s",$i;
exit;
}
}
else if ($i ~ /^FPU=/) {
if ("FPU" ~ MODE){
if ("FPU" == MODE){
sub(/[^=]*=/,"",$i);
printf "%s",$i;
exit;
}
}
else if ($i ~ /[[:upper:]]*=/) {
if ("DEFS" ~ MODE)
if ("DEFS" == MODE)
printf "-D_%s ",$i;
}
}
if (PAT=="END"){
if ("FAMILY" ~ MODE)
if ("FAMILY" == MODE)
printf "%s",family;
else if ("SUBFAMILY" ~ MODE)
else if ("SUBFAMILY" == MODE)
printf "%s",subfamily;
exit;
}
else{
subfamily = family;
family = PAT;
if ("CPPFLAGS" ~ MODE)
if ("CPPFLAGS" == MODE)
printf "-D%s ",toupper(PAT);
else if("DEFS" ~ MODE)
else if("DEFS" == MODE)
printf "-D%s ",toupper(PAT);
}
}

Loading…
Cancel
Save