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

Re: [PATCH] simple help for glxgears.c



On 05/12/06 16:36, Brian Paul wrote:
> Jeff Carr wrote:
>> I can't ever remember -printfps for glxgears. -h and --help options
>> would be helpful.
> 
> Which version of glxgears is this against?  It doesn't apply to the
> version in Mesa CVS head:
> 
> http://webcvs.freedesktop.org/mesa/Mesa/progs/xdemos/glxgears.c?rev=1.13&view=markup

My bad. It's from debian sid. I see now, the packagers of mesa-utils
changed the behavior so that -printfps is required with a comment about
it being a meaningless benchmark. That's not true for me; it's a very
useful way to tell approximately how things are working. Like bogomips.

Either way, here is a simple patch to add usage() like you have in glxinfo.c

Sorry about the noise,
Jeff
--- old/glxgears.c	2006-05-12 18:20:59.000000000 -0700
+++ new/glxgears.c	2006-05-12 18:20:36.000000000 -0700
@@ -539,6 +539,15 @@
    }
 }
 
+static void
+usage(void)
+{
+   printf("Usage: glxgears [-fullscreen] [-stereo] [-display <dname>]\n");
+   printf("\t-fullscreen: run in fullscreen mode.\n");
+   printf("\t-stereo: run in stereo mode.\n");
+   printf("\t-display <dname>: Print GLX visuals on specified server.\n");
+   printf("\t-h: This information.\n");
+}
 
 int
 main(int argc, char *argv[])
@@ -564,8 +573,15 @@
       else if (strcmp(argv[i], "-fullscreen") == 0) {
          fullscreen = GL_TRUE;
       }
-      else
-	 printf("Warrning: unknown parameter: %s\n", argv[i]);
+      else if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
+         usage();
+         return 0;
+      }
+      else {
+         printf("Unknown option `%s'\n", argv[i]);
+         usage();
+         return 0;
+      }
    }
 
    dpy = XOpenDisplay(dpyName);

Reply to: