#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin

stop=0
args=$@

set -- $(getopt s $@ 2> /dev/null)
while [ $# -gt 0 ]; do
	[ "$1" == "-s" ] && stop=1
	shift
done

if [ "$stop" -eq 0 -a -z "$(pidof dnsmasq)" ]; then
	/mod/etc/init.d/rc.dnsmasq >> /var/log/mod_net.log
fi

multid $args

if [ "$stop" -ne 0 -a ! -z "$(pidof dnsmasq)" ]; then
	/mod/etc/init.d/rc.dnsmasq stop >> /var/log/mod_net.log
fi
