functions/seq: Stop using bc in the fallback

Just to remove the dependency - performance is probably about the
same.

This is used, AFAICT, exclusively on OpenBSD (not Free or Net).

CC @zanchey.
This commit is contained in:
Fabian Homborg 2019-03-07 14:02:26 +01:00
parent 1cd5b2f4e1
commit b5b0e68044

View file

@ -39,10 +39,18 @@ if not command -sq seq
end
end
if [ $step -ge 0 ]
echo "for( i=$from; i<=$to ; i+=$step ) i;" | bc
if test $step -ge 0
set -l i $from
while test $i -le $to
echo $i
set i (math $i + $step)
end
else
echo "for( i=$from; i>=$to ; i+=$step ) i;" | bc
set -l i $from
while test $i -ge $to
echo $i
set i (math $i + $step)
end
end
end
end