'sort' implementation (Bug 27933) - any easy way?

Ann and Jason Edmeades jason at edmeades.me.uk
Thu Sep 27 09:40:05 CDT 2012


Hello,

While working on more of the 'for' processing in the command shell, I've
come across a stumbling block that wildcard expansion 'ordering' is not
guaranteed (findfirst/findnext) meaning I cannot automate tests for some of
the key bits - this is frustrating as we really need tests for the things
I'm looking at as the code is getting complex. Looking in the cmd
testsuite, there's already some commented out tests as well, saying we
really need a 'sort' implementation, and that would also resolve the
problem I have at the moment.

Therefore, I'd like to know if there's any simple way to implement a
command line sort program which we can call from the command shell.  This
has subsequently been raised as bug 27933.

My first thought was to avoid reinventing the wheel and to have a windows
program called sort which parses its parameters and then runs the Unix
'sort' command with an equivalent command line. I think most of the windows
command line parameters have Unix equivalents, and for the majority of
cases it would be a case of transposing a windows path to a Unix path, and
just running the Unix sort.

However, I then started to get concerned about stdin / stdout... Is there
any way to take the windows stdin and 'connect it' to the unix program you
spawn, and vica-versa for the stdout. Whilst I dont accurately need this
for the testsuite, without it the wine implementation would not match the
windows one.

So I think my specific questions are...

1. Is wrappering an existing (Linux) 'sort' program an option for this, or
do we really need a whole unique implementation of sort (which I would have
no idea how to write!)?

If it is an option, the two key questions I have are:

2. How do I handle stdin / stdout, so sort can work in pipes / redirects

3. Is it ok to use wine_get_unix_file_name to convert files and directories
to the unix equivalents when building the unix equivalent command line? (as
per winepath)

Thanks.
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120927/07bf8fa9/attachment.html>


More information about the wine-devel mailing list