Fix ls sorting by name.
POSIX says ls sorts according to the collating sequence in the current
locale. In the en-US.UTF-8 locale, coreutils ls sorts "Config.in" and
"configure" before "LICENSE"; without this patch toybox ls sorts
capitals first.
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index f951198..ca4e172 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -163,7 +163,7 @@ static int compare(void *a, void *b)
if (dta->st.st_mtime > dtb->st.st_mtime) ret = -1;
else if (dta->st.st_mtime < dtb->st.st_mtime) ret = 1;
}
- if (!ret) ret = strcmp(dta->name, dtb->name);
+ if (!ret) ret = strcoll(dta->name, dtb->name);
return ret * reverse;
}
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net