[PATCH 10/11] weston-image --help works. Also help if no filename is given
Jason Ekstrand
jason at jlekstrand.net
Wed Jul 9 18:32:15 PDT 2014
On Jul 9, 2014 6:17 PM, "Jason Ekstrand" <jason at jlekstrand.net> wrote:
>
>
> On Jul 8, 2014 9:18 PM, "Bill Spitzak" <spitzak at gmail.com> wrote:
> >
> > ---
> > clients/image.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/clients/image.c b/clients/image.c
> > index 112b93d..573117c 100644
> > --- a/clients/image.c
> > +++ b/clients/image.c
> > @@ -412,6 +412,11 @@ main(int argc, char *argv[])
> > int i;
> > int image_counter = 0;
> >
> > + if (argc <= 1 || argv[1][0]=='-') {
> > + printf("Usage: %s image...\n", argv[0]);
> > + return 1;
> > + }
> > +
>
> One little nitpick: Should we really be returning 1 if --help is given?
That's not an error.
On second thought, I ran a bunch of little utilities and things and some of
them always given an error with the usage and others don't. However, if
we're going to claim to have a --help or -h option, we shouldn't error on
it. Considering it to be malformed input and printing an error message is
fine.
Perhaps the thing to do in this client is to simply have failing to open
the file dump the usage.
>
> > d = display_create(&argc, argv);
> > if (d == NULL) {
> > fprintf(stderr, "failed to create display: %m\n");
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140709/692f299b/attachment.html>
More information about the wayland-devel
mailing list