ls(1) on System V
Alan Fargusson
alan at drivax.UUCP
Wed Apr 3 16:09:40 AEST 1985
> ls(1) has two options to produce multi-column output,
> -C for sorted down the columns
> -x for sorted across the rows
>
> if *any* file in a directory has a full-length (14-char) name,
> then these options fail, and a single-column output results.
I thought I would try out 14 character names with ls on System V/iAPX286
and The result on the 286 was 2 column output, while the VAX produced 5
column output. In looking at the source I found that the directory
structure is declared as follows:
struct {
short inode;
char name[14];
} directory;
Or something like that. The problem is that strlen(3) is called with
the name as an argument. When the name is 14 characters long, strlen
falls off the end of the name, and returns a large number. By dumb
luck the VAX has a null after the name. The VME/10s around here do not
have the version of ls with the -C and -x flags.
I can't think of any way around this problem without fixing the source,
since a null has to be added to the end of the name for strlen to work.
--
Alan Fargusson.
{ ihnp4, sftig, amdahl, ucscc, ucbvax!unisoft }!drivax!alan
More information about the Comp.unix.wizards
mailing list