pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS

Difference between
modified post c9e1a by Anonymous on Fri 19th Jul 2024 00:31
original post 16b43bb by Anonymous on Fri 19th Jul 2024 00:01
Download diff
Show old version | new version | both versions

    
11
#!/bin/ksh93
22
33
#
44
# make_numtree1.ksh93 - build makefile to generate number sequence
55
# The resulting Makefile is intended to be used with $ make -j128 all #
66
# as filesystem test
77
#
88
# Written by Roland Mainz <roland.mainz@nrubsig.org>
99
#
1010
1111
function make_number_seq
1212
{
1313
#	set -o nounset
1414
1515
	nameref out_maketarget=$1
1616
	integer start_i=$2
1717
	integer stop_i=$3
1818
	integer i
1919
	typeset -a make_targets
2020
21-
	if (( (stop_i - start_i) > 100 ; then
21+
	if (( (stop_i - start_i) > 10 )) ; then
2222
		(( i=(stop_i - start_i)/2 ))
2323
		make_number_seq make_targets[0] $start_i $(( start_i+i ))
24-
		make_number_seq make_targets[1] $(( start_i+i+1 )) $stop_i
24+
		make_number_seq make_targets[1] $(( start_i+i )) $stop_i
2525
	else
2626
		for ((i=start_i ; i < stop_i ; i++ )) ; do
2727
			printf 'i_%d:\n' i
28-
			printf '\tprintf "%d\\n" >"i_%d"\n' i i
28+
			printf '\t@printf "%d\\n" >"i_%d"\n' i i
2929
			make_targets+=( "i_$i" )
3030
		done
3131
	fi
3232
3333
	out_maketarget="i_${start_i}_${stop_i}"
3434
	printf 'i_%d_%d: %s\n' start_i stop_i "${make_targets[*]}"
3535
3636
	printf '\tcat '
3737
	printf '%q ' "${make_targets[@]}"
3838
	printf ' >"%s"\n' "$out_maketarget"
3939
4040
	return 0
4141
}
4242
4343
typeset make_target
4444
45-
make_number_seq make_target 0 100
45+
make_number_seq make_target 0 1000
4646
4747
printf 'all: %s\n' "$make_target"
4848
# EOF.
4949

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at