/bin/ls vs .dotted files

Jeremy C. Reed reed at reedmedia.net
Fri Sep 14 07:30:01 PDT 2012


The ls.c modified by Joy in 1977 included:

        Aflg = getuid() == 0;
...

                case 'A':
                        Aflg = !Aflg;
                        continue;

See that -A didn't enable/disable but simply toggled the behavior.

...

                if (dentry.d_ino==0 ||
                        aflg==0 && dentry.d_name[0]=='.' && (
                        !Aflg ||
                        dentry.d_name[1]=='\0'
                        || dentry.d_name[1]=='.' && 
dentry.d_name[2]=='\0'))
                        continue;

It didn't exist in the 6th or 7th editions (where the code was from).

It was not documented until the code was replaced in 1989 and the 
behaviour changed.

I think the -A documentation regardless of version makes no sense.



More information about the Users mailing list