From 553e011320798af097e8de95a1e2a1d2ed6a1a3e Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 21 Jan 2007 22:47:36 +0000 Subject: 23118: improve sorting to make it work with locales --- Test/B03print.ztst | 17 +++++++++++++++++ Test/D04parameter.ztst | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'Test') diff --git a/Test/B03print.ztst b/Test/B03print.ztst index e36e55caa..c3ba42b18 100644 --- a/Test/B03print.ztst +++ b/Test/B03print.ztst @@ -263,3 +263,20 @@ printf '%b\n' '\0123' 0:printf handles \0... octal escapes in replacement text >S + + print -lO $'a' $'a\0' $'a\0b' $'a\0b\0' $'a\0b\0a' $'a\0b\0b' $'a\0c' | + while read -r line; do + for (( i = 1; i <= ${#line}; i++ )); do + foo=$line[i] + printf "%02x" $(( #foo )) + done + print + done +0:sorting with embedded nulls +>610063 +>6100620062 +>6100620061 +>61006200 +>610062 +>6100 +>61 diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index a2613dc1f..1caed4479 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -886,3 +886,20 @@ >/one >/ >/ + + nully=($'a\0c' $'a\0b\0b' $'a\0b\0a' $'a\0b\0' $'a\0b' $'a\0' $'a') + for string in ${(o)nully}; do + for (( i = 1; i <= ${#string}; i++ )); do + foo=$string[i] + printf "%02x" $(( #foo )) + done + print + done +0:Sorting arrays with embedded nulls +>61 +>6100 +>610062 +>61006200 +>6100620061 +>6100620062 +>610063 -- cgit 1.4.1