Testsuite: Automation for TLDA regen
[exim.git] / test / aux-fixed / exim-ca / tlsa_regenerate.awk
1 # The commands beaing read-out and run assume CWD is the test/ directory
2 #
3 # start collecting a command to run
4 /^; TLSA_AUTOGEN$/ { active = 1; print; next; }
5 #
6 # keep appending to the command while there is a continuation-line marker (trailing backslash)
7 active==1 && /^;/ { print;
8                     if (NF > 1)
9                       {
10                       cmdstr = cmdstr " " substr($0, 2);
11                       if (cmdstr ~ /\\$/)
12                         cmdstr = substr(cmdstr, 1, length(cmdstr)-1);
13                       else
14                         active = 2;
15                       }
16                     next;
17                   }
18 #
19 # apply the command to the next TLSA linem and go quiescent
20 active==2 && /TLSA/ { cmdstr | getline cmdres;
21                       if (NF == 7)
22                         { printf("%s %s %s %s %s %s %s\n", $1, $2, $3, $4, $5, $6, cmdres); }
23                       else
24                         { printf("%s %s %s %s %s %s\n",    $1, $2, $3, $4, $5, cmdres); }
25                       cmdstr = "";
26                       active = 0;
27                       next;
28                     }
29 #
30 # just copy other lines
31 { print; }