Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Oct 2014 03:22:38 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273068 - in head/usr.sbin/bsdconfig: includes share share/packages
Message-ID:  <201410140322.s9E3Mc2w048838@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Tue Oct 14 03:22:37 2014
New Revision: 273068
URL: https://svnweb.freebsd.org/changeset/base/273068

Log:
  Rename awk(1) implementation of GNU awk's built-in asorti() function to
  prevent fatal conflict should one-true-awk ever be replaced -- e.g., in
  an appliance -- with GNU awk. NB: Renamed my implementation to _asorti()
  
  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	Tue Oct 14 03:11:46 2014	(r273067)
+++ head/usr.sbin/bsdconfig/includes/includes	Tue Oct 14 03:22:37 2014	(r273068)
@@ -69,7 +69,7 @@ show_include()
 		-v use_color=${USE_COLOR:-0} \
 		-v re="$pattern" \
 		-v show_desc=${SHOW_DESC:-0} '
-        function asorti(src, dest)
+        function _asorti(src, dest)
         {
 		k = nitems = 0;
 
@@ -120,7 +120,7 @@ show_include()
 		}
 	}
 	END {
-		n = asorti(syntax, sorted_indices)
+		n = _asorti(syntax, sorted_indices)
 		for (i = 1; i <= n; i++)
 			printf "%s", syntax[sorted_indices[i]]
 	}' "$file" )

Modified: head/usr.sbin/bsdconfig/share/device.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/device.subr	Tue Oct 14 03:11:46 2014	(r273067)
+++ head/usr.sbin/bsdconfig/share/device.subr	Tue Oct 14 03:22:37 2014	(r273068)
@@ -1116,7 +1116,7 @@ f_device_shutdown()
 f_device_sort_by_awk='
 # Variables that should be defined on the invocation line:
 # 	-v prop="property"
-function asorti(src, dest)
+function _asorti(src, dest)
 {
 	k = nitems = 0
 	for (i in src) dest[++nitems] = i
@@ -1137,7 +1137,7 @@ function asorti(src, dest)
 	}
 }
 END {
-	nitems = asorti(devices, devices_sorted)
+	nitems = _asorti(devices, devices_sorted)
 	for (i = 1; i <= nitems; i++) print devices[devices_sorted[i]]
 }
 '

Modified: head/usr.sbin/bsdconfig/share/packages/index.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/packages/index.subr	Tue Oct 14 03:11:46 2014	(r273067)
+++ head/usr.sbin/bsdconfig/share/packages/index.subr	Tue Oct 14 03:22:37 2014	(r273068)
@@ -241,7 +241,7 @@ f_index_read()
 	export msg_packages
 
 	eval "$( debug= f_getvar "$var_to_get" | awk -F'|' '
-	function asorti(src, dest)
+	function _asorti(src, dest)
 	{
 		k = nitems = 0
 
@@ -292,7 +292,7 @@ f_index_read()
 	END {
 		print "_npkgs=" tpkgs # For convenience, total package count
 
-		n = asorti(categories, categories_sorted)
+		n = _asorti(categories, categories_sorted)
 
 		# Produce package counts for each category
 		for (i = 1; i <= n; i++)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410140322.s9E3Mc2w048838>