[cs631apue] sorting files containing a dot

Jan Schaumann jschauma at stevens.edu
Thu Sep 22 09:34:22 EDT 2016


Patrick Murray <pmurray1 at stevens.edu> wrote:
 
> The strange output you've encountered is the result of strcmp(3) performing a
> case-sensitive comparison. Since uppercase characters appear first in the ASCII
> table, they will appear first in your output. [0]
> 
> To my knowledge, C does not come shipped with a case-insensitive comparison
> function; as a result, you'll have to implement your own using tolower(3) or a
> similar tool.

I don't think you need to implement a case-insensitive comparison.
Case-sensitive sorting is entirely sufficient and actually more correct.

I don't know why the GNU ls(1) chooses to sort in a case-insensitive
manner.

-Jan


More information about the cs631apue mailing list