summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-03 02:08:44 -0500
committerJune McEnroe <june@causal.agency>2020-03-03 02:08:44 -0500
commit513579b749e260d3451bfae57bcb6f17526b4e82 (patch)
treeb58a406a1006b88009632a968ab7e23d306f2865
parentCall fopencookie with a+ (diff)
downloadimbox-513579b749e260d3451bfae57bcb6f17526b4e82.tar.gz
imbox-513579b749e260d3451bfae57bcb6f17526b4e82.zip
Use getopts
-rw-r--r--git-fetch-email.sh23
1 files changed, 10 insertions, 13 deletions
diff --git a/git-fetch-email.sh b/git-fetch-email.sh
index 704651b..80b3bb7 100644
--- a/git-fetch-email.sh
+++ b/git-fetch-email.sh
@@ -26,22 +26,19 @@ from=$(git config fetchemail.from)
 to=$(git config fetchemail.to)
 cc=$(git config fetchemail.cc)
 
-args=$(getopt 'C:F:S:T:h:m:p:' $*)
-[ $? -ne 0 ] && exit 1
-set -- $args
-for opt; do
-	shift;
+while getopts 'C:F:S:T:h:m:p:' opt; do
 	case "$opt" in
-		(-C) cc=$1; shift;;
-		(-F) from=$1; shift;;
-		(-S) subject=$1; shift;;
-		(-T) to=$1; shift;;
-		(-h) host=$1; shift;;
-		(-m) mailbox=$1; shift;;
-		(-p) port=$1; shift;;
-		(--) break;;
+		(C) cc=$OPTARG;;
+		(F) from=$OPTARG;;
+		(S) subject=$OPTARG;;
+		(T) to=$OPTARG;;
+		(h) host=$OPTARG;;
+		(m) mailbox=$OPTARG;;
+		(p) port=$OPTARG;;
+		(?) exit 1;;
 	esac
 done
+shift $(($OPTIND - 1))
 [ $# -ne 0 ] && user=$1
 if [ -z "${user:-}" ]; then
 	echo "$0: username required"
bc2dfd988a60a&follow=1'>Add buymeacoffee linkJune McEnroe Can't hurt, I guess? I don't expect to get anything... 2019-07-27Use braces in MakefileJune McEnroe 2019-07-08Remove NetHack from indexJune McEnroe 2019-04-08Don't install rc.kfcgi eitherJune McEnroe 2019-03-28Remove rc.kfcgiJune McEnroe I sent a better version of it to the port maintainer and it is now in the ports tree. 2019-01-16Reformat index.html with explore linkJune McEnroe 2019-01-16Return false from keydown handler in exploreJune McEnroe 2019-01-08Draw lines to tile edgeJune McEnroe 2019-01-08Factor out default pathsJune McEnroe 2019-01-08Remove incorrect default coordinatesJune McEnroe 2019-01-07Set img src when explore fragment changesJune McEnroe 2019-01-07Compress PNG data in imageJune McEnroe kcgi never enables compression for FastCGI. 2019-01-07madvise MADV_NOCORE in imageJune McEnroe 2019-01-07Add license notice to explore JavaScriptJune McEnroe 2019-01-07Add Q/Home binding in exploreJune McEnroe 2019-01-07Fix explore image URLJune McEnroe 2019-01-07Add HOME button, ssh link, AGPL notice to exploreJune McEnroe 2019-01-06Add meta viewport to exploreJune McEnroe 2019-01-06Set background and max-width in exploreJune McEnroe 2019-01-06Swallow writes after the connection is closedJune McEnroe It was not okay. 2019-01-06Handle KCGI_HUPJune McEnroe I hope it's okay that I keep writing to the fwopen stream after streamWrite returns -1. 2019-01-06Install html filesJune McEnroe