source: main/trunk/greenstone2/runtime-src/packages/apache-httpd/mod_winmak_file.awk

Last change on this file was 31425, checked in by ak19, 5 years ago

Fix to commits 31421 and 31422. Adding Dr Bainbridge's new awk file script (with slight modification) now used by adjust-winmakefiles.bat in place of sed. To prevent race conditions when compiling up apache-httpd2 for GS2, tempfile.bat files should be numbered incrementally within each win32.mak in httpd-2.2.11, not incrementally between each win32.mak within httpd-2.2.11.

File size: 1.3 KB
Line 
1# This program replaces each occurrence of tempfile.bat in the current input line
2# with tempfile-concatenated-to-current-count-.bat.
3
4# The current line is denoted by dollar-0. The global substitution regex, gsub,
5# doesn't return anything, but replaces what's in the 3rd argument. By default
6# gsub's 3rd argument is dollar-0 but we explicitly provide this as 3rd argument here.
7# The print command then outputs what we want for the current input line, in this
8# case dollar-0 which has been modified by the gsub.
9
10# https://www.gnu.org/software/gawk/manual/gawk.html#Two-Rules
11# For global substition function gsub, see https://www.tutorialspoint.com/awk/awk_string_functions.htm
12
13
14# The begin block is for initialisation such as declaration of vars
15BEGIN { count = 1 }
16
17# We can have as many regex rules here as we want. Each gets applied in
18# sequence to the current input line. In this case we have one regex rule
19# It matches tempfile\d*.bat and then defines what should happen when that
20# line is encountered.
21/tempfile\.bat/ {
22 uniq_temp = "tempfile" count ".bat"
23 gsub("tempfile.bat",uniq_temp,$0)
24 count++
25 }
26/\/MD/ {
27 gsub("/MD", "/MT")
28}
29
30# the current line is now correct, output it
31{
32 print $0
33}
Note: See TracBrowser for help on using the repository browser.