device.subr (266290) | device.subr (279609) |
---|---|
1if [ ! "$_DEVICE_SUBR" ]; then _DEVICE_SUBR=1 2# 3# Copyright (c) 2012-2014 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 (INCLUDING, 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 [ ! "$_DEVICE_SUBR" ]; then _DEVICE_SUBR=1 2# 3# Copyright (c) 2012-2014 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 (INCLUDING, 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: stable/10/usr.sbin/bsdconfig/share/device.subr 266290 2014-05-17 03:28:43Z dteske $ | 27# $FreeBSD: stable/10/usr.sbin/bsdconfig/share/device.subr 279609 2015-03-05 00:29:58Z dteske $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." device.subr 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/geom.subr --- 1077 unchanged lines hidden (view full) --- 1113# This function is a two-parter. Below is the awk(1) portion of the function, 1114# afterward is the sh(1) function which utilizes the below awk script. 1115# 1116f_device_sort_by_awk=' 1117# Variables that should be defined on the invocation line: 1118# -v prop="property" 1119function asorti(src, dest) 1120{ | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." device.subr 34f_include $BSDCFG_SHARE/dialog.subr 35f_include $BSDCFG_SHARE/geom.subr --- 1077 unchanged lines hidden (view full) --- 1113# This function is a two-parter. Below is the awk(1) portion of the function, 1114# afterward is the sh(1) function which utilizes the below awk script. 1115# 1116f_device_sort_by_awk=' 1117# Variables that should be defined on the invocation line: 1118# -v prop="property" 1119function asorti(src, dest) 1120{ |
1121 k = nitems = 0 |
|
1121 for (i in src) dest[++nitems] = i 1122 for (i = 1; i <= nitems; k = i++) { 1123 idx = dest[i] 1124 while ((k > 0) && (dest[k] > idx)) { 1125 dest[k+1] = dest[k]; k-- 1126 } 1127 dest[k+1] = idx 1128 } --- 267 unchanged lines hidden --- | 1122 for (i in src) dest[++nitems] = i 1123 for (i = 1; i <= nitems; k = i++) { 1124 idx = dest[i] 1125 while ((k > 0) && (dest[k] > idx)) { 1126 dest[k+1] = dest[k]; k-- 1127 } 1128 dest[k+1] = idx 1129 } --- 267 unchanged lines hidden --- |