pkgsrc/mk/buildlink3/quotearg
2004-03-13 03:41:13 +00:00

20 lines
416 B
Text

# $NetBSD: quotearg,v 1.2 2004/03/13 03:41:13 uebayasi 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