[PATCH] xinput: Assume 'list' by default if no args given.
Bryce Harrington
bryce at canonical.com
Tue Nov 29 17:40:46 PST 2011
On Tue, Nov 29, 2011 at 05:11:16PM -0800, Chase Douglas wrote:
> On 11/29/2011 04:57 PM, Bryce Harrington wrote:
> > xrandr lists all outputs by default when run with no args. So, make
> > xinput list all inputs by default when run the same way, so the tools
> > are consistent.
> >
> > Signed-off-by: Bryce Harrington <bryce at canonical.com>
>
> I'm ok with this. It's not necessary, but I don't see any reason not to
> do this either.
Yeah it doesn't change anything functionally, it's pretty minor.
It does make bug reporting guidelines one word shorter.
> > ---
> > src/xinput.c | 11 +++++------
> > 1 files changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/xinput.c b/src/xinput.c
> > index 9ca3832..4451b82 100644
> > --- a/src/xinput.c
> > +++ b/src/xinput.c
> > @@ -327,14 +327,13 @@ main(int argc, char * argv[])
> > char *func;
> > int event, error;
> >
> > - if (argc < 2) {
> > - usage();
> > - return EXIT_FAILURE;
> > + if (argc > 1) {
> > + func = argv[1];
> > + while((*func) == '-') func++;
>
> Perhaps now would be a great time to change this to:
>
> while(func[0] == '-') func++;
>
> It seems silly to me to dereference an array to get at the first element.
Alright; will respin patch with this.
> > + } else {
> > + func = "list";
> > }
> >
> > - func = argv[1];
> > - while((*func) == '-') func++;
> > -
> > if (strcmp("version", func) == 0) {
> > return print_version(argv[0]);
> > }
>
> Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
Thanks,
Bryce
More information about the xorg-devel
mailing list