Fix build with latest Cygwin updates

Stop bash complaining about \0 bytes in input
(cherry picked from commit 8800292351dcf1f538c47ac6acf834ac2633ce6b)

Strip newlines from UCRT detecion using tr
(cherry picked from commit 37baabe6436037de604bfbc2702bfb0bc156c41b)

Remove stray CR from input
(cherry picked from commit 77779166569da389de44075b3d03413b353046a4)

Just get rid of CR when parsing .bat output
(cherry picked from commit 019ea173701eae4b8c5ffd45bb0063fc0a688ce0)

Change-Id: Ieef2f8eb98181f5a4ea6a5527bc36de9b88716b5
Reviewed-on: https://gerrit.libreoffice.org/35010
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
diff --git a/configure.ac b/configure.ac
index 1eff083..5eb20d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3147,28 +3147,32 @@ dnl ===================================================================
dnl Windows specific tests and stuff
dnl ===================================================================

# Get a value from the 32-bit side of the Registry
reg_get_value_32()
reg_get_value()
{
    # Return value: $regvalue
    unset regvalue
    _regvalue=`cat "/proc/registry32/$1" 2> /dev/null`

    if test $? -eq 0; then
        regvalue=$_regvalue
    local _regentry="/proc/registry${1}/${2}"
    if test -f "$_regentry"; then
        # Stop bash complaining about \0 bytes in input, as it can't handle them.
        # Registry keys read via /proc/registry* are always \0 terminated!
        local _regvalue=$(tr -d '\0' < "$_regentry")
        if test $? -eq 0; then
            regvalue=$_regvalue
        fi
    fi
}

# Get a value from the 32-bit side of the Registry
reg_get_value_32()
{
    reg_get_value "32" "$1"
}

# Get a value from the 64-bit side of the Registry
reg_get_value_64()
{
    # Return value: $regvalue
    unset regvalue
    _regvalue=`cat "/proc/registry64/$1" 2> /dev/null`

    if test $? -eq 0; then
        regvalue=$_regvalue
    fi
    reg_get_value "64" "$1"
}

if test "$_os" = "WINNT"; then
@@ -3300,7 +3304,7 @@ win_get_env_from_vsvars32bat()
    echo -e "@echo %$1%\r\n" >> $WRAPPERBATCHFILEPATH
    echo -e "@endlocal\r\n" >> $WRAPPERBATCHFILEPATH
    chmod +x $WRAPPERBATCHFILEPATH
    _win_get_env_from_vsvars32bat="`$WRAPPERBATCHFILEPATH | $SED -e s/^M^J//`"
    _win_get_env_from_vsvars32bat=$($WRAPPERBATCHFILEPATH | tr -d "\r")
    rm -f $WRAPPERBATCHFILEPATH
    echo $_win_get_env_from_vsvars32bat
}
@@ -6792,7 +6796,7 @@ if test "$ENABLE_JAVA" != ""; then

        if test -z "$with_jdk_home"; then
            for ver in 1.8 1.7 1.6; do
                reg_get_value_$bitness "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
                reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
                if test -n "$regvalue"; then
                    _jdk_home=$regvalue
                    break
diff --git a/solenv/gbuild/platform/filter-showIncludes.awk b/solenv/gbuild/platform/filter-showIncludes.awk
index 21a4585..6ec13e2 100755
--- a/solenv/gbuild/platform/filter-showIncludes.awk
+++ b/solenv/gbuild/platform/filter-showIncludes.awk
@@ -40,6 +40,7 @@ BEGIN {
}

{
    sub(/\r$/, "")
    sub(/^ */, "")
    if (index($0, showincludes_prefix) == 1) {
        $0 = substr($0, length(showincludes_prefix) + 1)