[PATCH 5/5] [cmd] Display 'set' sort ordering correctly
Ann and Jason Edmeades
jason at edmeades.me.uk
Tue Sep 25 18:07:53 CDT 2012
Fix a simple todo in the testsuite, in that environment variables
may contain spaces and if they do may not sort correctly if you
include the '=value' in the compare
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120926/a4d10f73/attachment.html>
-------------- next part --------------
From 0c85b342aa1c2f4ae41c196ff868e62eb5dd9cb7 Mon Sep 17 00:00:00 2001
From: Jason Edmeades <jason at edmeades.me.uk>
Date: Tue, 25 Sep 2012 23:16:54 +0100
Subject: [PATCH 5/5] [cmd] Display 'set' sort ordering correctly
Fix a simple todo in the testsuite, in that environment variables
may contain spaces and if they do may not sort correctly if you
include the '=value' in the compare
---
programs/cmd/builtins.c | 5 ++++-
programs/cmd/tests/test_builtins.cmd.exp | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index ad9d40c..8421194 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2234,13 +2234,16 @@ void WCMD_setshow_date (void) {
/****************************************************************************
* WCMD_compare
+ * Note: Native displays 'fred' before 'fred ', so need to only compare up to
+ * the equals sign.
*/
static int WCMD_compare( const void *a, const void *b )
{
int r;
const WCHAR * const *str_a = a, * const *str_b = b;
+ static const WCHAR eqW[] = {'=','\0'};
r = CompareStringW( LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
- *str_a, -1, *str_b, -1 );
+ *str_a, strcspnW(*str_a, eqW), *str_b, strcspnW(*str_b, eqW) );
if( r == CSTR_LESS_THAN ) return -1;
if( r == CSTR_GREATER_THAN ) return 1;
return 0;
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index d2938ce..57bc82a 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -235,8 +235,8 @@ FOOBAR = baz
baz2
0
bar
- at todo_wine@FOOBAR= bar
- at todo_wine@FOOBAR = baz2
+FOOBAR= bar
+FOOBAR = baz2
FOOBAR = baz2
FOOBAR not defined
1
--
1.7.9.5
More information about the wine-patches
mailing list