+int
+main (int argc, char *argv[])
+{
+ const char *wrapper = NULL;
+ int opt;
+
+ /* The initial '+' means that getopt will stop looking for
+ * options after the first non-option argument. This means
+ * that a command such as:
+ *
+ * glaze glenv --renderer=Foo glxgears
+ *
+ * Will do what is intended, (namely, have glaze invoke "glenv
+ * --renderer=Foo glxgears" rather than trying to interpret
+ * --renderer=Foo as an option to glaze itself.
+ */
+ const char *short_options="+h";
+ const struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"wrapper", required_argument, 0, WRAPPER_OPT},
+ {0, 0, 0, 0}
+ };
+
+ while (1)
+ {
+ opt = getopt_long (argc, argv, short_options, long_options, NULL);
+ if (opt == -1)
+ break;
+
+ switch (opt) {
+ case 'h':
+ usage ();
+ return 0;
+ case WRAPPER_OPT:
+ wrapper = optarg;
+ break;
+ default:
+ fprintf (stderr, "Internal error: "
+ "unexpected getopt value: %d\n", opt);
+ exit (1);
+ }