On Tue, Apr 13, 2021 at 11:37 PM Xabier Oneca -- xOneca
<[email protected]> wrote:
> > > +        static const char *time_values ALIGN1 =
> > > +            /* OPT_a: */ "access\0" "atime\0" "use\0"
> > > +            /* OPT_m: */ "modify\0" "mtime\0";
> > > +        int pos = index_in_substrings(time_values, time_arg);
> > > +
> > > +        if (pos >= 3) {
> > > +            opts |= OPT_m;
> > > +        } else if (pos >= 0) {
> > > +            opts |= OPT_a;
> > > +        } else {
> > > +            //bb_error_msg("Invalid value: %s", time_arg);
> > > +            bb_show_usage();
> > > +        }
> >
> > how about this instead? -
> >            opts |= (time_arg[0] == 'm') ? OPT_m : OPT_a;
>
> Your suggestion is pretty smart. But I don't know... If it were a more
> popular option maybe. But I don't like it 'half baked'.
>
> This option being neither popular[citation needed] nor part of the
> standard, if I had to vote I would reject it entirely. I'm guilty of
> featuritis. Sorry. :)

My proposal would make all _valid_ uses of --time XYZ to work
properly, with minimum of code.

It would work incorrectly only for invalid XYZs,
there are far fewer people who would care about that.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to