mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-30 05:50:53 +03:00
blockcheck: support cygwin native ping
This commit is contained in:
parent
4e8766f245
commit
23f2de8014
@ -1353,8 +1353,13 @@ pingtest()
|
|||||||
ping -c 1 -w 1 $1 >/dev/null
|
ping -c 1 -w 1 $1 >/dev/null
|
||||||
;;
|
;;
|
||||||
CYGWIN)
|
CYGWIN)
|
||||||
|
if starts_with "$(which ping)" /cygdrive; then
|
||||||
# cygwin does not have own PING by default. use windows PING.
|
# cygwin does not have own PING by default. use windows PING.
|
||||||
ping -n 1 -w 1000 $1 >/dev/null
|
ping -n 1 -w 1000 $1 >/dev/null
|
||||||
|
else
|
||||||
|
# they have installed cygwin ping
|
||||||
|
ping -c 1 -W 1 $1 >/dev/null
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ping -c 1 -W 1 $1 >/dev/null
|
ping -c 1 -W 1 $1 >/dev/null
|
||||||
|
@ -49,6 +49,17 @@ contains()
|
|||||||
# check if substring $2 contains in $1
|
# check if substring $2 contains in $1
|
||||||
[ "${1#*$2}" != "$1" ]
|
[ "${1#*$2}" != "$1" ]
|
||||||
}
|
}
|
||||||
|
starts_with()
|
||||||
|
{
|
||||||
|
# $1 : what
|
||||||
|
# $2 : starts with
|
||||||
|
case "$1" in
|
||||||
|
"$2"*)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
find_str_in_list()
|
find_str_in_list()
|
||||||
{
|
{
|
||||||
[ -n "$1" ] && {
|
[ -n "$1" ] && {
|
||||||
@ -290,7 +301,7 @@ shell_name()
|
|||||||
SHELL_NAME=$(ps -p $$ -o comm=)
|
SHELL_NAME=$(ps -p $$ -o comm=)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$SHELL_NAME" ] || SHELL_NAME=$(basename "$SHELL")
|
[ -n "$SHELL_NAME" ] || SHELL_NAME="$(basename "$SHELL")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user