# function ---------------------------

# print and logging error message : stderr
#   printe arg1 arg2 ...
printe() {
  echo "$@" >&2
}

# print and logging debug message : stdout
#   printd arg1 arg2 ...
printd() {
  if [  "x${DEBUG}" != "x" ]; then
    echo "$@"
  fi
}

# print and logging message : stdout
#   print arg1 arg2 ...
print() {
  echo "$@"
}

# Network up-link check
#   TRUE : if IP address was acquired on the target device.
check_device_ipaddress() {
  ${IP} a s $1 | ${GREP} inet | ${GREP} "$1" | ${AWK} -F'[ \/\t]*' '{ print $3 }'
}


# delete netowork route
delete_nw_route() {
  if [ $# -ne 1 ]; then
     return
  fi

  ${IP} route | ${GREP} $1 | ${CUT} -d' ' -f 1 | \
  while read line
  do
    if [ "x${line}" = "x" ]; then
      return
    fi
    #echo "${IP} route del ${line}"
    ${IP} route del ${line}
  done
}

