+print_usage()
+{
+ echo "${PROG_NAME} -- U-Boot/kernel compile script"
+ echo "Usage: ${PROG_NAME} [OPTIONS...] [IP ADDRESS]"
+ echo
+ echo "Options:"
+ echo " -h display this help and exit"
+ echo " -r reboot after deploying files"
+ echo
+}
+
+reboot=0
+
+while getopts "hr" flag ;do
+ case ${flag} in
+ h)
+ print_usage
+ exit 0
+ ;;
+ r)
+ reboot=1
+ ;;
+ ?)
+ echo "${PROG_NAME}: Invalid option: ${OPTARG}."
+ echo "Try \`${PROG_NAME} -h' for more information."
+ exit 1
+ ;;
+ esac
+done
+shift `expr "${OPTIND}" - 1`
+
+# `$#' now represents the number of arguments after the options.
+# `$1' is the first argument, etc.
+if [ $# -gt 1 ]; then
+ echo "${PROG_NAME}: Too many arguments."
+ echo "Try \`${PROG_NAME} -h' for more information."
+ exit 1
+fi
+