device.subr (264840) | device.subr (273067) |
---|---|
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: head/usr.sbin/bsdconfig/share/device.subr 264840 2014-04-23 22:04:04Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/device.subr 273067 2014-10-14 03:11:46Z 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 --- |