return send_sb(ct, 0, command, len, SBD_COMMAND, false);
}
+/* Find out if the given string is contained in the features vector. */
static bool has_feature(const char *feature, struct client_task *ct)
{
- return find_arg(feature, ct->features) >= 0? true : false;
+ if (!ct->features)
+ return false;
+ for (int i = 0; ct->features[i]; i++)
+ if (strcmp(feature, ct->features[i]) == 0)
+ return i;
+ return false;
}
/*
PARA_ERROR(AO_OPEN_LIVE, "ao: could not open audio device"), \
PARA_ERROR(AO_PLAY, "ao_play() failed"), \
PARA_ERROR(AO_PTHREAD, "pthread error"), \
- PARA_ERROR(ARG_NOT_FOUND, "argument not found in arg vector"), \
PARA_ERROR(ASN1_PARSE, "could not parse ASN.1 key"), \
PARA_ERROR(ATOI_JUNK_AT_END, "further characters after number"), \
PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
return create_argv_offset(1, buf, delim, result);
}
-/**
- * Find out if the given string is contained in the arg vector.
- *
- * \param arg The string to look for.
- * \param argv The array to search.
- *
- * \return The first index whose value equals \a arg, or \p -E_ARG_NOT_FOUND if
- * arg was not found in \a argv.
- */
-int find_arg(const char *arg, char **argv)
-{
- int i;
-
- if (!argv)
- return -E_ARG_NOT_FOUND;
- for (i = 0; argv[i]; i++)
- if (strcmp(arg, argv[i]) == 0)
- return i;
- return -E_ARG_NOT_FOUND;
-}
-
/**
* Compile a regular expression.
*
int read_size_header(const char *buf);
int create_argv(const char *buf, const char *delim, char ***result);
int create_shifted_argv(const char *buf, const char *delim, char ***result);
-int find_arg(const char *arg, char **argv);
void free_argv(char **argv);
int para_regcomp(regex_t *preg, const char *regex, int cflags);
void freep(void *arg);