+/*
+ * Given one keyword, find the first one that
+ * is in the argument list.
+ * Returns: argk index (always gt 0)
+ * -1 if not found
+ */
+int find_arg(UAContext *ua, char *keyword)
+{
+ for (int i=1; i<ua->argc; i++) {
+ if (strcasecmp(keyword, ua->argk[i]) == 0) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+/*
+ * Given a single keyword, find it in the argument list, but
+ * it must have a value
+ * Returns: -1 if not found or no value
+ * list index (base 0) on success
+ */
+int find_arg_with_value(UAContext *ua, char *keyword)
+{
+ for (int i=1; i<ua->argc; i++) {
+ if (strcasecmp(keyword, ua->argk[i]) == 0) {
+ if (ua->argv[i]) {
+ return i;
+ } else {
+ return -1;
+ }
+ }
+ }
+ return -1;
+}
+