Standardize function declaration
There were no fewer than three styles of function declaration going
on in these files, so I attempted to standardize them to the typical
myfucn() {
}
style.
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
# (at your option) any later version.
|
||||
|
||||
|
||||
helpFunc()
|
||||
{
|
||||
helpFunc() {
|
||||
echo "::: Immediately whitelists one or more domains in the hosts file"
|
||||
echo ":::"
|
||||
echo "::: Usage: pihole -w domain1 [domain2 ...]"
|
||||
@@ -71,7 +70,7 @@ if [[ -f ${piholeIPv6file} ]];then
|
||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||
fi
|
||||
|
||||
HandleOther(){
|
||||
HandleOther() {
|
||||
#check validity of domain
|
||||
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
||||
if [ -z "$validDomain" ]; then
|
||||
@@ -81,7 +80,7 @@ HandleOther(){
|
||||
fi
|
||||
}
|
||||
|
||||
PopWhitelistFile(){
|
||||
PopWhitelistFile() {
|
||||
#check whitelist file exists, and if not, create it
|
||||
if [[ ! -f ${whitelist} ]];then
|
||||
touch ${whitelist}
|
||||
@@ -96,7 +95,7 @@ PopWhitelistFile(){
|
||||
done
|
||||
}
|
||||
|
||||
AddDomain(){
|
||||
AddDomain() {
|
||||
#| sed 's/\./\\./g'
|
||||
bool=false
|
||||
|
||||
@@ -118,7 +117,7 @@ AddDomain(){
|
||||
fi
|
||||
}
|
||||
|
||||
RemoveDomain(){
|
||||
RemoveDomain() {
|
||||
|
||||
bool=false
|
||||
grep -Ex -q "$1" ${whitelist} || bool=true
|
||||
@@ -137,7 +136,7 @@ RemoveDomain(){
|
||||
fi
|
||||
}
|
||||
|
||||
ModifyHostFile(){
|
||||
ModifyHostFile() {
|
||||
if ${addmode}; then
|
||||
#remove domains in from hosts file
|
||||
if [[ -r ${whitelist} ]];then
|
||||
@@ -245,4 +244,4 @@ fi
|
||||
|
||||
if ${reload}; then
|
||||
Reload
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user