2020-08-08 15:47:34 +02:00
|
|
|
#!/usr/bin/gawk -f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FNR == 1 {
|
|
|
|
|
if (_filename_ != "")
|
|
|
|
|
endfile(_filename_)
|
|
|
|
|
_filename_ = FILENAME
|
|
|
|
|
#print "processing: " FILENAME >"/dev/stderr"
|
|
|
|
|
beginfile(FILENAME)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
END { endfile(_filename_) }
|
|
|
|
|
|
|
|
|
|
###### begin user code ########################
|
|
|
|
|
|
|
|
|
|
BEGIN{
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-16 03:34:45 +02:00
|
|
|
/Tcl_GetStringResult\(interp\)/{
|
2020-08-08 15:47:34 +02:00
|
|
|
found = 1
|
2020-08-16 03:34:45 +02:00
|
|
|
gsub(/Tcl_GetStringResult\(interp\)/, "tclresult()")
|
2020-08-08 15:47:34 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-16 03:34:45 +02:00
|
|
|
|
2020-08-08 15:47:34 +02:00
|
|
|
function replace_pattern(old, new)
|
|
|
|
|
{
|
|
|
|
|
if($0 ~ old) {
|
|
|
|
|
gsub(old, new)
|
|
|
|
|
found = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###### end user code ########################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
__a[__lines++] = $0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function beginfile(f)
|
|
|
|
|
{
|
|
|
|
|
__lines=0
|
|
|
|
|
found=0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function endfile(f, i)
|
|
|
|
|
{
|
|
|
|
|
if(found) {
|
|
|
|
|
print "patching: " f >"/dev/stderr"
|
|
|
|
|
for(i=0;i<__lines;i++)
|
|
|
|
|
{
|
|
|
|
|
print __a[i] > f
|
|
|
|
|
}
|
|
|
|
|
close(f)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|