+ int c;
+ int digit_optind = 0;
+
+ opts->cmd = NULL;
+ opts->pids = NULL;
+ opts->take_reply = 0;
+
+ while (1) {
+ int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"start-trace", 0, 0, 1000},
+ {"stop-trace", 0, 0, 1001},
+ {"destroy-trace", 0, 0, 1002},
+ {"list-markers", 0, 0, 1004},
+ {"print-markers", 0, 0, 1005},
+ {"pid", 1, 0, 1006},
+ {"enable-marker", 1, 0, 1007},
+ {"disable-marker", 1, 0, 1008},
+ {"start", 0, 0, 1009},
+ {0, 0, 0, 0}
+ };
+
+ c = getopt_long(argc, argv, "", long_options, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 0:
+ printf("option %s", long_options[option_index].name);
+ if (optarg)
+ printf(" with arg %s", optarg);
+ printf("\n");
+ break;
+
+ case 1000:
+ opts->cmd = strdup("trace_start");
+ break;
+ case 1001:
+ opts->cmd = strdup("trace_stop");
+ break;
+ case 1009:
+ opts->cmd = strdup("start");
+ break;
+ case 1002:
+ opts->cmd = strdup("trace_destroy");
+ break;
+ case 1004:
+ opts->cmd = strdup("list_markers");
+ opts->take_reply = 1;
+ break;
+ case 1007:
+ asprintf(&opts->cmd, "enable_marker %s", optarg);
+ break;
+ case 1008:
+ asprintf(&opts->cmd, "disable_marker %s", optarg);
+ break;
+
+ default:
+ /* unknown option or other error; error is printed by getopt, just return */
+ return 1;