lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sun, May 20, 2007 at 02:09:37AM +0000, duck wrote:
> Perfect. I'd suggest that "mode" return exactly what it does now, namely
> the _first_ mode flag which matches. Here is the current code:
>   if      ( S_ISREG(mode) )  return "file";
>   else if ( S_ISDIR(mode) )  return "directory";
>   else if ( S_ISLNK(mode) )  return "link";
>   else if ( S_ISSOCK(mode) ) return "socket";
>   else if ( S_ISFIFO(mode) ) return "named pipe";
>   else if ( S_ISCHR(mode) )  return "char device";
>   else if ( S_ISBLK(mode) )  return "block device";
>   else                       return "other";
> There is no point in changing the semantics of "mode". Indeed, it ought
> not to be changed.
> OTOH, "modes" should return an associative table of _all_ the above strings 
> which match (except "other", of course, which would be denoted by an empty
> table). 

But its impossible for more than one of the above modes to match!