Hallo Herr tom ehlert,

am Sonntag, 2. Januar 2022 um 10:57 schrieben Sie:

> Hi Paul,

>>> Here is the result of one "dir /od" that I did with
>>> Freedos 1.5 RC5. As you can see, it didn't get
>>> into sorted order.

>> Apologies for the typo, should have been 1.3.

>> Anyway, I do not have DIRCMD set, and I have produced
>> the image I am using so that the result can be reproduced.

>> http://pdos.org/temp2.zip

>> qemu-system-i386 -drive file=cut.vhd

don't bother.

I reproduced the bug.

I fixed the bug.

in CMD\DIR.C, line 972+ change

static int orderFunction(const void *p1, const void *p2)
{
 ...
          case ORDER_BY_NAME:
                rv = strcmp(f1.ff_name,f2.ff_name);
                break;
          }
          if (opt & ORDER_INVERSE) rv = - rv;
        }  

+ if (rv == 0)
+    rv = strcmp(f1.ff_name,f2.ff_name);

  return rv;
}       


probably first semester in informatics, introduction to searching and
sorting:

NEVER EVER return 0 to a compare  function.

the problem occurs only when sorting by date AND time AND date are
identical.

(and it was probably I myself who made the error 20 years ago ;)

I still wonder why this wasn't detected many years ago...

Tom



_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to