pkgsrc/mk/buildlink3/quotearg
jlam 197d02376d Factor out some more commonly used bits of the wrapper system into
their own files: buildcmd and quotearg, which are used to build up the
command line and to quote arguments.  Also add the ability to skip
processing the next few arguments and add them directly to the command
line.  Now, either the marshall script or the cache scripts can
request skipping the N arguments by setting skipargs=N.
2003-10-03 19:39:19 +00:00

20 lines
462 B
Text

# $NetBSD: quotearg,v 1.1 2003/10/03 19:39:19 jlam Exp $
#
# Returns $qarg, which contains a correctly-quoted $arg. Also sets
# $quotedarg to "yes" if the $arg needed to be quoted.
#
case $arg in
*[\`\"\$\\]*)
qarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
quotedarg=yes
;;
*)
qarg="$arg"
;;
esac
case $qarg in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
qarg="\"$qarg\""
quotedarg=yes
;;
esac