# shellcheck shell=dash

___x_cmd_proxy_normalize(){
    if      [ -z "$http_proxy" ]; then                  http_proxy="$HTTP_PROXY"
    elif    [ -z "$HTTP_PROXY" ]; then                  HTTP_PROXY="$http_proxy"
    elif    [ "$http_proxy" != "$HTTP_PROXY" ]; then
        proxy:warn "[http_proxy=$http_proxy] are not equal to [HTTP_PROXY=$HTTP_PROXY]"
        return 1
    fi

    if      [ -z "$https_proxy" ]; then                 https_proxy="$HTTPS_PROXY"
    elif    [ -z "$HTTPS_PROXY" ]; then                 HTTPS_PROXY="$https_proxy"
    elif    [ "$https_proxy" != "$HTTPS_PROXY" ]; then
        proxy:warn "[https_proxy=$https_proxy] are not equal to [HTTPS_PROXY=$HTTPS_PROXY]"
        return 1
    fi

    if      [ -z "$ftp_proxy" ]; then                   ftp_proxy="$FTP_PROXY"
    elif    [ -z "$FTP_PROXY" ]; then                   FTP_PROXY="$ftp_proxy"
    elif    [ "$ftp_proxy" != "$FTP_PROXY" ]; then
        proxy:warn "[ftp_proxy=$ftp_proxy] are not equal to [FTP_PROXY=$HTTP_PROXY]"
        return 1
    fi

    if      [ -z "$all_proxy" ]; then                   all_proxy="$ALL_PROXY"
    elif    [ -z "$ALL_PROXY" ]; then                   ALL_PROXY="$all_proxy"
    elif    [ "$all_proxy" != "$ALL_PROXY" ]; then
        proxy:warn "[all_proxy=$all_proxy] are not equal to [ALL_PROXY=$ALL_PROXY]"
        return 1
    fi
}
