Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/build.sh,v rcsdiff: /ftp/cvs/cvsroot/src/build.sh,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.284 retrieving revision 1.285 diff -u -p -r1.284 -r1.285 --- src/build.sh 2014/07/06 17:49:20 1.284 +++ src/build.sh 2014/07/06 18:04:44 1.285 @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.284 2014/07/06 17:49:20 apb Exp $ +# $NetBSD: build.sh,v 1.285 2014/07/06 18:04:44 apb Exp $ # # Copyright (c) 2001-2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -278,6 +278,29 @@ ERRORMESSAGE exit 1 } +# Quote args to make them safe in the shell. +# Usage: quotedlist="$(shell_quote args...)" +# +# After building up a quoted list, use it by evaling it inside +# double quotes, like this: +# eval "set -- $quotedlist" +# or like this: +# eval "\$command $quotedlist \$filename" +shell_quote() +{ + local result='' + local arg + for arg in "$@" ; do + # Append a space if necessary + result="${result}${result:+ }" + # Convert each embedded ' to '\'', + # then insert ' at the beginning of the first line, + # and append ' at the end of the last line. + result="${result}$(printf "%s\n" "$arg" | \ + sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/")" + done + printf "%s\n" "$result" +} statusmsg() { @@ -1750,27 +1773,30 @@ createmakewrapper() eval cat <