Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 14 insertions, 6 deletions
-rwxr-xr-xcsg20
diff --git a/csg b/csg
index 61b010f..7e33c18 100755
--- a/csg
+++ b/csg
@@ -176,20 +176,28 @@ then
# Remove first field
$1=""; sub(FS, "")
# Associate current file with regex
- if (awks[$0] == "") awks[$0] = FILENAME
- else awks[$0] = awks[$0] " " FILENAME
+ if (awks[$0] == "") {
+ awks[$0] = FILENAME
+ regexes[regexcount++] = $0
+ }
+ else {
+ awks[$0] = awks[$0] " " FILENAME
+ }
nextfile
}
END {
- for (reg in awks) {
- print reg
+ # Regexes are outputed in file alphabetic order
+ # Since certain scripts may require specific ordering
+ # between their rules, this is a crude way to allow that
+ for (regi = 0; regi < regexcount; regi++) {
+ print regexes[regi]
outf = TMP_DIR "/csg-" (awkcount++) ".awk"
print outf
- system("cat " awks[reg] " > " outf)
+ system("cat " awks[regexes[regi]] " > " outf)
}
}
- ' $(find $AWKSCRIPTS -type f -name "[A-Z]*.awk"))"
+ ' $(find $AWKSCRIPTS -type f -name "[A-Z]*.awk" | sort))"
overwriteLine "[Stage 1] Finding awk libraries"