- for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
- if (arg[0] != '-')
- break;
- if (!strcmp(arg, "--")) {
- i++;
- break;
- }
- if (!strncmp(arg, "-m", 2)) {
- if (*(arg + 3))
- return -E_GC_SYNTAX;
- switch(*(arg + 2)) {
- case 's':
- gc->mode = GM_SLOPPY;
- continue;
- case 'a':
- gc->mode = GM_AGGRESSIVE;
- continue;
- case 'p':
- gc->mode = GM_PEDANTIC;
- continue;
- default:
- return -E_GC_SYNTAX;
- }
- }
- if (!strcmp(arg, "-o")) {
- gc->flags |= GF_ONE_SHOT;
- continue;
- }
- if (!strncmp(arg, "-p=", 3)) {
- gc->parent = para_strdup(arg + 3);
- continue;
- }
- if (!strncmp(arg, "-n=", 3)) {
- gc->name = para_strdup(arg + 3);
- continue;
- }
- return -E_GC_SYNTAX;
+ r = lls_opt_result(LSG_AUDIOD_CMD_GRAB_OPT_MODE, lpr);
+ if (lls_opt_given(r) > 0) {
+ const char *arg = lls_string_val(0, r);
+ if (strcmp(arg, "s") == 0)
+ gc->mode = GM_SLOPPY;
+ else if (strcmp(arg, "a") == 0)
+ gc->mode = GM_AGGRESSIVE;
+ else if (strcmp(arg, "p") == 0)
+ gc->mode = GM_PEDANTIC;
+ else
+ return -E_GC_SYNTAX;
+ }
+
+ r = lls_opt_result(LSG_AUDIOD_CMD_GRAB_OPT_ONE_SHOT, lpr);
+ if (lls_opt_given(r) > 0)
+ gc->flags |= GF_ONE_SHOT;
+
+ r = lls_opt_result(LSG_AUDIOD_CMD_GRAB_OPT_PARENT, lpr);
+ if (lls_opt_given(r) > 0) {
+ const char *arg = lls_string_val(0, r);
+ gc->parent = para_strdup(arg);
+ }
+
+ r = lls_opt_result(LSG_AUDIOD_CMD_GRAB_OPT_NAME, lpr);
+ if (lls_opt_given(r) > 0) {
+ const char *arg = lls_string_val(0, r);
+ gc->name = para_strdup(arg);