From 05e0003555e2b681cb80b1f855468641c96e376f Mon Sep 17 00:00:00 2001
From: Promofaux <adzjwarner@gmail.com>
Date: Sun, 10 Apr 2016 21:17:58 +0100
Subject: [PATCH] Fixes issue #453

---
 advanced/Scripts/blacklist.sh   | 24 ++++++++++++------------
 advanced/Scripts/chronometer.sh |  2 +-
 advanced/Scripts/whitelist.sh   | 14 +++++++-------
 pihole                          | 22 +++++++++++-----------
 4 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh
index 04d4d60f..7d4edb95 100755
--- a/advanced/Scripts/blacklist.sh
+++ b/advanced/Scripts/blacklist.sh
@@ -53,15 +53,15 @@ function helpFunc()
 {
 	  echo "::: Immediately blacklists one or more domains in the hosts file"
     echo ":::"
-    echo "::: Usage: sudo pihole.sh -b domain1 [domain2 ...]"
+    echo "::: Usage: sudo pihole -b domain1 [domain2 ...]"
     echo ":::"
     echo "::: Options:"
-    echo ":::  -d, --delmode		Remove domains from the blacklist"
+    echo ":::  -d, --delmode			Remove domains from the blacklist"
     echo ":::  -nr, --noreload		Update blacklist without refreshing dnsmasq"
-    echo ":::  -f, --force			Force updating of the hosts files, even if there are no changes"
-    echo ":::  -q, --quiet			output is less verbose"
-    echo ":::  -h, --help			Show this help dialog"
-    echo ":::  -l, --list			Display your blacklisted domains"
+    echo ":::  -f, --force				Force updating of the hosts files, even if there are no changes"
+    echo ":::  -q, --quiet				output is less verbose"
+    echo ":::  -h, --help					Show this help dialog"
+    echo ":::  -l, --list					Display your blacklisted domains"
     exit 1
 }
 
@@ -70,7 +70,7 @@ function HandleOther(){
 	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
 		echo "::: $1 is not a valid argument or domain name"
-	else	  
+	else
 	  domList=("${domList[@]}" $validDomain)
 	fi
 }
@@ -134,12 +134,12 @@ function ModifyHostFile(){
 	      numberOf=$(cat $blacklist | sed '/^\s*$/d' | wc -l)
         plural=; [[ "$numberOf" != "1" ]] && plural=s
         echo ":::"
-        echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..."	   		    
-	    	if [[ -n $piholeIPv6 ]];then	    	  
+        echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..."
+	    	if [[ -n $piholeIPv6 ]];then
 				cat $blacklist | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> $adList
-	      	else	        
+	      	else
 				cat $blacklist | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >>$adList
-	      	fi		    
+	      	fi
 	  	fi
 	  else
 		echo ":::"
@@ -148,7 +148,7 @@ function ModifyHostFile(){
 	      #we need to remove the domains from the blacklist file and the host file
 			echo "::: $dom"
 			echo -n ":::    removing from HOSTS file..."
-	      	echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' $adList  
+	      	echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /[^.]'{}'(?!.)/;' $adList
 	      	echo " done!"
 	      	echo -n ":::    removing from blackist.txt..."
 	      	echo "$dom" | sed 's/\./\\./g' | xargs -I {} perl -i -ne'print unless /'{}'(?!.)/;' $blacklist
diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh
index 58bf300b..1c8a53c9 100755
--- a/advanced/Scripts/chronometer.sh
+++ b/advanced/Scripts/chronometer.sh
@@ -120,7 +120,7 @@ function normalChrono(){
 function displayHelp(){
  	echo "::: Displays stats about your piHole!"
     echo ":::"
-    echo "::: Usage: sudo pihole.sh -c [optional:-j]"
+    echo "::: Usage: sudo pihole -c [optional:-j]"
     echo "::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds"
     echo ":::"
     echo "::: Options:"
diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh
index 00556476..b6901249 100755
--- a/advanced/Scripts/whitelist.sh
+++ b/advanced/Scripts/whitelist.sh
@@ -52,15 +52,15 @@ function helpFunc()
 {
 	  echo "::: Immediately whitelists one or more domains in the hosts file"
     echo ":::"
-    echo "::: Usage: sudo pihole.sh -w domain1 [domain2 ...]"
+    echo "::: Usage: sudo pihole -w domain1 [domain2 ...]"
     echo ":::"
     echo "::: Options:"
-    echo ":::  -d, --delmode		Remove domains from the whitelist"
+    echo ":::  -d, --delmode			Remove domains from the whitelist"
     echo ":::  -nr, --noreload		Update Whitelist without refreshing dnsmasq"
-    echo ":::  -f, --force			Force updating of the hosts files, even if there are no changes"
-    echo ":::  -q, --quiet			output is less verbose"
-    echo ":::  -h, --help			Show this help dialog"
-    echo ":::  -l, --list			Display your whitelisted domains"
+    echo ":::  -f, --force				Force updating of the hosts files, even if there are no changes"
+    echo ":::  -q, --quiet				output is less verbose"
+    echo ":::  -h, --help					Show this help dialog"
+    echo ":::  -l, --list					Display your whitelisted domains"
     exit 1
 }
 
@@ -220,7 +220,7 @@ if $modifyHost || $force; then
 else
   if $verbose; then
 	  echo ":::"
-		echo "::: No changes need to be made"		
+		echo "::: No changes need to be made"
 	fi
 	exit 1
 fi
diff --git a/pihole b/pihole
index 5ff26246..d9d52e0c 100755
--- a/pihole
+++ b/pihole
@@ -77,20 +77,20 @@ function uninstallFunc {
 function helpFunc {
     echo "::: Control all PiHole specific functions!"
     echo ":::"
-    echo "::: Usage: pihole.sh [options]"
+    echo "::: Usage: pihole [options]"
     printf ":::\tAdd -h after -w (whitelist), -b (blacklist), or -c (chronometer)  for more information on usage\n"
     echo ":::"
     echo "::: Options:"
-    echo ":::  -w, whitelist 			Whitelist domains"
-    echo ":::  -b, blacklist 			Blacklist domains"
-    echo ":::  -d, debug 				Start a debugging session if having trouble"
-    echo ":::  -f, flush 				Flush the pihole.log file"
-    echo ":::  -u, updateDashboard		Update the web dashboard manually"
-    echo ":::  -g, updateGravity		Update the list of ad-serving domains"
-   	echo ":::  -s, setupLCD 			Automatically configures the Pi to use the 2.8 LCD screen to display stats on it"
-	echo ":::  -c, chronometer 			Calculates stats and displays to an LCD"
-	echo ":::  -h, help 				Show this help dialog"
-	echo ":::  uninstall				Uninstall Pi-Hole from your system!"
+    echo ":::  -w, whitelist           Whitelist domains"
+    echo ":::  -b, blacklist 		   	   Blacklist domains"
+    echo ":::  -d, debug 				       Start a debugging session if having trouble"
+    echo ":::  -f, flush 				       Flush the pihole.log file"
+    echo ":::  -u, updateDashboard     Update the web dashboard manually"
+    echo ":::  -g, updateGravity		   Update the list of ad-serving domains"
+   	echo ":::  -s, setupLCD            Automatically configures the Pi to use the 2.8 LCD screen to display stats on it"
+	echo ":::  -c, chronometer           Calculates stats and displays to an LCD"
+	echo ":::  -h, help 				         Show this help dialog"
+	echo ":::  uninstall				         Uninstall Pi-Hole from your system!"
     exit 1
 }