=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ctfconv/ctfstrip,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/ctfconv/ctfstrip 2017/08/12 16:33:11 1.4 +++ src/usr.bin/ctfconv/ctfstrip 2017/08/12 19:51:17 1.5 @@ -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 @@ 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 @@ # 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}