From 48b6905c825412f2064339254744b1dfc1955f23 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 6 Sep 2005 17:39:13 +0000 Subject: - scripts/patchfns.in: Rewrite files_in_patch_ordered() so as to not require the awk asort function, which is not available on all versions of awk. - test/sort.test: Add more files to better test the ordering and sorting issues. Original patch by John Vandenberg. --- scripts/patchfns.in | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/patchfns.in b/scripts/patchfns.in index e75e365..98f5c51 100644 --- a/scripts/patchfns.in +++ b/scripts/patchfns.in @@ -492,28 +492,22 @@ files_in_patch_ordered() { local patch=$1 - ( files_in_patch $patch + ( files_in_patch $patch | sort echo "-" filenames_in_patch $patch ) | @AWK@ ' $1 == "-" { out=1 ; next } - !out { files[$0]=1 } + !out { files[$0]=1 + new_files[++n]=$0 } out { if ($0 in files && !($0 in printed)) { print $0 printed[$0]=1 } } END { - i = 1 - for (file in files) { - if (!(file in printed)) { - new_files[i]=file - i++ - } - } - n = asort(new_files) for (i=1; i<=n; i++) - print new_files[i] + if (!(new_files[i] in printed)) + print new_files[i] } ' } -- cgit