remove some uses of $IFS

This is a step towards resolving issue #4156. It replaces uses of `$IFS`
with other solutions.
This commit is contained in:
Kurtis Rader
2017-07-24 20:45:43 -07:00
parent 6f46f6b45a
commit 8e87d595b7
9 changed files with 187 additions and 228 deletions

View File

@@ -14,19 +14,19 @@ function mktemp
set -l opts
while set -q argv[1]
switch $argv[1]
case -d
set opts $opts d
case -t
set opts $opts t
case --
set -e argv[1]
break
case '-*'
echo "mktemp: unknown flag $argv[1]" >&2
_mktemp_help >&2
exit 2
case '*'
break
case -d
set opts $opts d
case -t
set opts $opts t
case --
set -e argv[1]
break
case '-*'
echo "mktemp: unknown flag $argv[1]" >&2
_mktemp_help >&2
exit 2
case '*'
break
end
set -e argv[1]
end
@@ -50,8 +50,7 @@ function mktemp
# So let's outlaw them anywhere besides the end.
# Similarly GNU sed requires at least 3 X's, BSD sed requires none. Let's require 3.
begin
set -l IFS
printf '%s' "$template" | read -la chars
set -l chars (string split '' -- $template)
set -l found_x
for c in $chars
if test $c = X
@@ -75,10 +74,10 @@ function mktemp
end
if contains t $opts
switch $template
case '/*'
echo "mktemp: invalid template '$template' with -t, template must not be absolute" >&2
_mktemp_help >&2
exit 1
case '/*'
echo "mktemp: invalid template '$template' with -t, template must not be absolute" >&2
_mktemp_help >&2
exit 1
end
if set -q TMPDIR[1]