strings.subr (250701) | strings.subr (250702) |
---|---|
1if [ ! "$_STRINGS_SUBR" ]; then _STRINGS_SUBR=1 2# 3# Copyright (c) 2006-2013 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 1if [ ! "$_STRINGS_SUBR" ]; then _STRINGS_SUBR=1 2# 3# Copyright (c) 2006-2013 Devin Teske 4# All Rights Reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/strings.subr 250701 2013-05-16 16:46:02Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/strings.subr 250702 2013-05-16 16:51:52Z dteske $ |
28# 29############################################################ GLOBALS 30 31# 32# Valid characters that can appear in an sh(1) variable name 33# 34# Please note that the character ranges A-Z and a-z should be avoided because 35# these can include accent characters (which are not valid in a variable name). --- 163 unchanged lines hidden (view full) --- 199 echo "$1" | awk "$f_uridecode_awk" 200 else 201 awk "$f_uridecode_awk" 202 fi 203} 204 205# f_replaceall $string $find $replace [$var_to_set] 206# | 28# 29############################################################ GLOBALS 30 31# 32# Valid characters that can appear in an sh(1) variable name 33# 34# Please note that the character ranges A-Z and a-z should be avoided because 35# these can include accent characters (which are not valid in a variable name). --- 163 unchanged lines hidden (view full) --- 199 echo "$1" | awk "$f_uridecode_awk" 200 else 201 awk "$f_uridecode_awk" 202 fi 203} 204 205# f_replaceall $string $find $replace [$var_to_set] 206# |
207# Replace all occurrences of $find in $sting with $replace. If $var_to_set is | 207# Replace all occurrences of $find in $string with $replace. If $var_to_set is |
208# either missing or NULL, the variable name is produced on standard out for 209# capturing in a sub-shell (which is less recommended due to performance 210# degradation). 211# 212f_replaceall() 213{ 214 local __left="" __right="$1" 215 local __find="$2" __replace="$3" __var_to_set="$4" --- 76 unchanged lines hidden --- | 208# either missing or NULL, the variable name is produced on standard out for 209# capturing in a sub-shell (which is less recommended due to performance 210# degradation). 211# 212f_replaceall() 213{ 214 local __left="" __right="$1" 215 local __find="$2" __replace="$3" __var_to_set="$4" --- 76 unchanged lines hidden --- |