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

Loading…
Cancel
Save