$NetBSD$

ionice is not available on some platforms.
Patch submitted to upstream, waiting for approval.

--- phpmalwarefinder.orig	2015-07-13 15:46:53.000000000 +0000
+++ phpmalwarefinder
@@ -2,6 +2,8 @@
 
 YARA=$(which yara)
 CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara'
+IONICE_BIN=$(which ionice)
+NICE_BIN=$(which nice)
 
 if [ ! -f "$YARA" ]
 then
@@ -13,6 +15,18 @@ then
 	CONFIG_PATH='./malwares.yara'
 fi
 
+if [ -f "${IONICE_BIN}" ]
+then
+	NICE=${IONICE_BIN}
+	NICE_OPTS="-c 3"
+else
+	if [ -f "${NICE_BIN}" ]
+	then
+		NICE=${NICE_BIN}
+		NICE_OPTS="-n 20"
+	fi
+fi
+
 show_help() {
     cat << EOF
 Usage ${0##*/} [-cfhw] <file|folder> ...
@@ -58,6 +72,12 @@ then
     echo "${CONFIG_PATH} doesn't exist. Please give me a valid file."
     exit 1
 fi
+
+if [ ! -e ${NICE} ]
+then
+	echo "no nice program available. Please install ionice or nice."
+	exit 1
+fi
 
 if [ -z $@ ]
 then
@@ -67,4 +87,4 @@ fi
 
 OPTS="${OPTS} -r ${CONFIG_PATH}"
 
-ionice -c3 $YARA $OPTS $@
+${NICE} ${NICE_OPTS} $YARA $OPTS $@
