=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/etc/netstart,v retrieving revision 1.197 retrieving revision 1.198 diff -u -r1.197 -r1.198 --- src/etc/netstart 2018/03/04 10:12:26 1.197 +++ src/etc/netstart 2018/04/28 22:38:32 1.198 @@ -1,10 +1,16 @@ #!/bin/sh - # -# $OpenBSD: netstart,v 1.197 2018/03/04 10:12:26 jmc Exp $ +# $OpenBSD: netstart,v 1.198 2018/04/28 22:38:32 rpe Exp $ # Turn off Strict Bourne shell mode. set +o sh +# Show usage of the netstart script and exit. +usage() { + print -u2 "usage: ${0##*/} [[-n] interface ...]" + exit 1 +} + # Echo file $1 to stdout. Skip comment lines and delete everything # after the first '#' from other lines. Strip leading and trailing # whitespace if IFS is set. @@ -200,23 +206,19 @@ _rc_parse_conf PRINT_ONLY=false -USAGE="usage: ${0##*/} [[-n] interface ...]" V4_DHCPCONF=false V6_AUTOCONF=false while getopts ":n" opt; do case $opt in n) PRINT_ONLY=true;; - *) print -u2 "$USAGE"; exit 1;; + *) usage;; esac done shift $((OPTIND-1)) # Option -n is only supported if interface names are specified as parameters. -if $PRINT_ONLY && (($# == 0)); then - print -u2 "$USAGE" - exit 1 -fi +$PRINT_ONLY && (($# == 0)) && usage # Load key material for the generation of IPv6 Semantically Opaque Interface # Identifiers (SOII) used for link local and SLAAC addresses.