#!/bin/sh
#GPL3 license (refer /usr/share/doc/legal).
#usage ex: see /usr/local/simple_network_setup/rc.network, sns.
#121118 rerwin: script created.

#Form dropwait argument for dhcpcd, for option to delay abandonment of an intermittant connection.  Returns null or (e.g.) -j 15
DWOPTION="$(dhcpcd --help | grep -o '\--dropwait' | cut -f 1 -d ' ')"
DWSECS="$(grep -o '^[0-9]*' /etc/dhcpcd_dropwait_secs 2>/dev/null)"
[ -n "$DWOPTION" -a -n "$DWSECS" ] \
 && DROPWAIT="${DWOPTION} ${DWSECS}" || DROPWAIT=""
echo -n "$DROPWAIT"
exit 0
