1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-04 12:52:15 +00:00

Move f_sprintf() above f_snprintf()

Ordering functions by appearance of use
This commit is contained in:
Devin Teske 2016-01-31 21:30:02 +00:00
parent 0cb8bea7ed
commit 3c8cd13bf1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295103

View File

@ -139,21 +139,6 @@ f_substr()
setvar "$__var_to_set" "$__tmp"
}
# f_snprintf $var_to_set $size $format [$arguments ...]
#
# Similar to snprintf(3), write at most $size number of bytes into $var_to_set
# using printf(1) syntax (`$format [$arguments ...]').
#
f_snprintf()
{
local __var_to_set="$1" __size="$2"
shift 2 # var_to_set size
local __f_snprintf_tmp
f_sprintf __f_snprintf_tmp "$@"
f_substr "$__var_to_set" "$__f_snprintf_tmp" 1 "$__size"
}
# f_sprintf $var_to_set $format [$arguments ...]
#
# Similar to sprintf(3), write a string into $var_to_set using printf(1) syntax
@ -174,6 +159,21 @@ f_sprintf()
esac
}
# f_snprintf $var_to_set $size $format [$arguments ...]
#
# Similar to snprintf(3), write at most $size number of bytes into $var_to_set
# using printf(1) syntax (`$format [$arguments ...]').
#
f_snprintf()
{
local __var_to_set="$1" __size="$2"
shift 2 # var_to_set size
local __f_snprintf_tmp
f_sprintf __f_snprintf_tmp "$@"
f_substr "$__var_to_set" "$__f_snprintf_tmp" 1 "$__size"
}
# f_vsnprintf $var_to_set $size $format $format_args
#
# Similar to vsnprintf(3), write at most $size number of bytes into $var_to_set