[Feature request] `ls -g'

Denis Vlasenko vda.linux at googlemail.com
Fri Mar 30 20:35:10 UTC 2007


On Thursday 29 March 2007 03:49, Meihui Fan wrote:
> 
> Currently `-g' option is ignored in ls command, that make it doesn't
> work for ftpd.

ls prints user/group names (or ids) here:

                case LIST_ID_NAME:
#if ENABLE_FEATURE_LS_USERNAME
                        printf("%-8.8s %-8.8s",
                                get_cached_username(dn->dstat.st_uid),
                                get_cached_groupname(dn->dstat.st_gid));
                        column += 17;
                        break;
#endif
                case LIST_ID_NUMERIC:
                        column += printf("%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid);
                        break;


Here is where -g option handling is specified:

        LIST_LONG | STYLE_LONG,     /* l - remember LS_DISP_HR in mask! */
        LIST_SHORT | STYLE_SINGLE,  /* 1 */
        0,                          /* g - ingored */
        LIST_ID_NUMERIC,            /* n */

In order to make -g work, LIST_ID_NAME and LIST_ID_NUMERIC
should be split into LIST_UID_NAME / LIST_GID_NAME (and same for NUMERIC),
printing code should be modified accordingly.

Then replace 0 above with appropriate mask.
--
vda



More information about the busybox mailing list