summaryrefslogtreecommitdiffstats
path: root/usr.bin/ctfconv
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2019-05-27 09:31:08 +0000
committerjca <jca@openbsd.org>2019-05-27 09:31:08 +0000
commit3103aebcd907549fd5b2297db150da0140dde37f (patch)
tree2d26f78acc774265ba915c18ebdb5f469fa02307 /usr.bin/ctfconv
parentSwitch the peer TAILQ to a RB tree indexed by the peer id. This way (diff)
downloadwireguard-openbsd-3103aebcd907549fd5b2297db150da0140dde37f.tar.xz
wireguard-openbsd-3103aebcd907549fd5b2297db150da0140dde37f.zip
Use getopts instead of getopt(1)
getopts is a standard shell builtin (POSIX) and lets you handle whitespace in parameters. ok mpi@ sunil@
Diffstat (limited to 'usr.bin/ctfconv')
-rw-r--r--usr.bin/ctfconv/ctfstrip21
1 files changed, 9 insertions, 12 deletions
diff --git a/usr.bin/ctfconv/ctfstrip b/usr.bin/ctfconv/ctfstrip
index 95fb369def0..f02dc86c37e 100644
--- a/usr.bin/ctfconv/ctfstrip
+++ b/usr.bin/ctfconv/ctfstrip
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: ctfstrip,v 1.10 2019/02/18 11:05:43 sunil Exp $
+# $OpenBSD: ctfstrip,v 1.11 2019/05/27 09:31:08 jca Exp $
#
# Copyright (c) 2017 Martin Pieuchot
#
@@ -30,19 +30,16 @@ usage() {
trap "cleanup" 1 2 3 13 15
-args=$(getopt So: $*)
-if [ $? -ne 0 ]; then
- usage
-fi
-set -- $args
-while [ $# -ne 0 ]; do
- case "$1" in
- -S) STRIPFLAG=-g; shift;;
- -o) OUTFILE="$2"; shift; shift;;
- --) shift; break;;
- esac
+while getopts So: opt; do
+ case $opt in
+ S) STRIPFLAG=-g;;
+ o) OUTFILE="$OPTARG";;
+ \?) usage;;
+ esac
done
+shift $((OPTIND - 1))
+
if [ $# -ne 1 ]; then
usage
fi