Deleted Added
full compact
includes.sh (273067) includes.sh (273068)
1#!/bin/sh
2#-
3# Copyright (c) 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 (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#
1#!/bin/sh
2#-
3# Copyright (c) 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 (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/includes/includes 273067 2014-10-14 03:11:46Z dteske $
27# $FreeBSD: head/usr.sbin/bsdconfig/includes/includes 273068 2014-10-14 03:22:37Z dteske $
28#
29############################################################ INCLUDES
30
31# Prevent common.subr from auto initializing debugging (this is not an inter-
32# active utility that requires debugging; also `-d' has been repurposed).
33#
34DEBUG_SELF_INITIALIZE=NO
35

--- 28 unchanged lines hidden (view full) ---

64{
65 local file="${1#./}"
66
67 local pattern="${FUNC_PATTERN:-.*}"
68 output=$( awk \
69 -v use_color=${USE_COLOR:-0} \
70 -v re="$pattern" \
71 -v show_desc=${SHOW_DESC:-0} '
28#
29############################################################ INCLUDES
30
31# Prevent common.subr from auto initializing debugging (this is not an inter-
32# active utility that requires debugging; also `-d' has been repurposed).
33#
34DEBUG_SELF_INITIALIZE=NO
35

--- 28 unchanged lines hidden (view full) ---

64{
65 local file="${1#./}"
66
67 local pattern="${FUNC_PATTERN:-.*}"
68 output=$( awk \
69 -v use_color=${USE_COLOR:-0} \
70 -v re="$pattern" \
71 -v show_desc=${SHOW_DESC:-0} '
72 function asorti(src, dest)
72 function _asorti(src, dest)
73 {
74 k = nitems = 0;
75
76 # Copy src indices to dest and calculate array length
77 for (i in src) dest[++nitems] = i
78
79 # Sort the array of indices (dest) using insertion sort method
80 for (i = 1; i <= nitems; k = i++)

--- 34 unchanged lines hidden (view full) ---

115 print_more = 0
116 } else while (print_more) {
117 getline
118 syntax[fn] = syntax[fn] " " substr($0, 2) "\n"
119 print_more = substr($0, length($0)) == "\\"
120 }
121 }
122 END {
73 {
74 k = nitems = 0;
75
76 # Copy src indices to dest and calculate array length
77 for (i in src) dest[++nitems] = i
78
79 # Sort the array of indices (dest) using insertion sort method
80 for (i = 1; i <= nitems; k = i++)

--- 34 unchanged lines hidden (view full) ---

115 print_more = 0
116 } else while (print_more) {
117 getline
118 syntax[fn] = syntax[fn] " " substr($0, 2) "\n"
119 print_more = substr($0, length($0)) == "\\"
120 }
121 }
122 END {
123 n = asorti(syntax, sorted_indices)
123 n = _asorti(syntax, sorted_indices)
124 for (i = 1; i <= n; i++)
125 printf "%s", syntax[sorted_indices[i]]
126 }' "$file" )
127 if [ "$output" ]; then
128 if [ ! "$SHOW_FUNCS" ]; then
129 echo "$file"
130 return $SUCCESS
131 fi

--- 74 unchanged lines hidden ---
124 for (i = 1; i <= n; i++)
125 printf "%s", syntax[sorted_indices[i]]
126 }' "$file" )
127 if [ "$output" ]; then
128 if [ ! "$SHOW_FUNCS" ]; then
129 echo "$file"
130 return $SUCCESS
131 fi

--- 74 unchanged lines hidden ---