[cs631apue] sorting files containing a dot

mseaton mseaton at stevens.edu
Thu Sep 22 10:37:05 EDT 2016


Hi Prof Schaumann,
I wish I saw your email earlier, I already began implementing such a 
sort. I pretty much spent a good deal of time last night doing so, it's 
all good, good practice for myself and also good to perhaps follow what 
the standard ls does.

Marlon
On 09/22/2016 9:34 AM, Jan Schaumann wrote:
> 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
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue


More information about the cs631apue mailing list