svn commit: r273067 - in head/usr.sbin/bsdconfig: includes share share/packages
Devin Teske
dteske at FreeBSD.org
Tue Oct 14 03:11:48 UTC 2014
Author: dteske
Date: Tue Oct 14 03:11:46 2014
New Revision: 273067
URL: https://svnweb.freebsd.org/changeset/base/273067
Log:
Fix awk(1) asorti() implementation to work when called in a loop.
MFC after: 3 days
X-MFC-to: stable/10, stable/9
Modified:
head/usr.sbin/bsdconfig/includes/includes
head/usr.sbin/bsdconfig/share/device.subr
head/usr.sbin/bsdconfig/share/packages/index.subr
Modified: head/usr.sbin/bsdconfig/includes/includes
==============================================================================
--- head/usr.sbin/bsdconfig/includes/includes Mon Oct 13 22:30:08 2014 (r273066)
+++ head/usr.sbin/bsdconfig/includes/includes Tue Oct 14 03:11:46 2014 (r273067)
@@ -71,8 +71,10 @@ show_include()
-v show_desc=${SHOW_DESC:-0} '
function asorti(src, dest)
{
+ k = nitems = 0;
+
# Copy src indices to dest and calculate array length
- nitems = 0; for (i in src) dest[++nitems] = i
+ for (i in src) dest[++nitems] = i
# Sort the array of indices (dest) using insertion sort method
for (i = 1; i <= nitems; k = i++)
Modified: head/usr.sbin/bsdconfig/share/device.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/device.subr Mon Oct 13 22:30:08 2014 (r273066)
+++ head/usr.sbin/bsdconfig/share/device.subr Tue Oct 14 03:11:46 2014 (r273067)
@@ -1118,6 +1118,7 @@ f_device_sort_by_awk='
# -v prop="property"
function asorti(src, dest)
{
+ k = nitems = 0
for (i in src) dest[++nitems] = i
for (i = 1; i <= nitems; k = i++) {
idx = dest[i]
Modified: head/usr.sbin/bsdconfig/share/packages/index.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/packages/index.subr Mon Oct 13 22:30:08 2014 (r273066)
+++ head/usr.sbin/bsdconfig/share/packages/index.subr Tue Oct 14 03:11:46 2014 (r273067)
@@ -243,8 +243,10 @@ f_index_read()
eval "$( debug= f_getvar "$var_to_get" | awk -F'|' '
function asorti(src, dest)
{
+ k = nitems = 0
+
# Copy src indices to dest and calculate array length
- nitems = 0; for (i in src) dest[++nitems] = i
+ for (i in src) dest[++nitems] = i
# Sort the array of indices (dest) using insertion sort method
for (i = 1; i <= nitems; k = i++)
More information about the svn-src-head
mailing list