diff options
author | 2017-08-12 19:51:17 +0000 | |
---|---|---|
committer | 2017-08-12 19:51:17 +0000 | |
commit | e4e1d541f25d0d3e2da8d730a9272e89e87c491f (patch) | |
tree | 76cece09cfaf42aeb22fe96afcef2ebce51e5918 | |
parent | Provide a stub implementation for request_irq() and free_irq(). (diff) | |
download | wireguard-openbsd-e4e1d541f25d0d3e2da8d730a9272e89e87c491f.tar.xz wireguard-openbsd-e4e1d541f25d0d3e2da8d730a9272e89e87c491f.zip |
make this properly portable:
- keep track of the argument inside the for loop to determine INFILE
- replace the builtin [[ with [ and adjust the tests
- use echo instead of the print builtin
from tb@
-rwxr-xr-x | usr.bin/ctfconv/ctfstrip | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ctfconv/ctfstrip b/usr.bin/ctfconv/ctfstrip index ebb7cbbbdd4..945286a996e 100755 --- a/usr.bin/ctfconv/ctfstrip +++ b/usr.bin/ctfconv/ctfstrip @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: ctfstrip,v 1.4 2017/08/12 16:33:11 jasper Exp $ +# $OpenBSD: ctfstrip,v 1.5 2017/08/12 19:51:17 jasper Exp $ # # Copyright (c) 2017 Martin Pieuchot # @@ -40,19 +40,19 @@ for arg in "$@"; do esac shift set -- "$@" "$arg" + INFILE="$arg" done -if [[ $# == 0 ]]; then - print -u2 "${USAGE}"; +if [ $# -eq 0 ]; then + echo "${USAGE}" >&2 exit 1 fi LABEL="unknown" TMPFILE=$(mktemp /tmp/.ctf.XXXXXXXXXX) -INFILE=$(eval "echo \${$#}") # Extract kernel version -if [[ "$INFILE" == bsd* ]]; then +if [ -z "${INFILE##bsd*}" ]; then LABEL=`what $INFILE |tr -d '\n'|awk -F"${INFILE} " '{ print $2 '\n' }'` fi @@ -60,7 +60,7 @@ fi # So try to run ctfconv and silently fallback to plain strip(1) if that failed. ctfconv -o ${TMPFILE} -l "${LABEL}" ${INFILE} 2> /dev/null -if [[ $? == 0 ]]; then +if [ $? -eq 0 ]; then objcopy --add-section .SUNW_ctf=${TMPFILE} ${STRIPFLAG} ${INFILE} ${OUTFILE} else strip ${STRIPFLAG} $@ -o ${OUTFILE} ${INFILE} |