40 register long i, i_match, l;
45 if (mode & WILDCARD_MATCH) {
46 for (i = 0; i < n_options; i++)
52 if (!(mode & MATCH_WHOLE_STRING)) {
55 if (mode & CASE_SENSITIVE) {
56 for (i = 0; i < n_options; i++) {
57 if (strncmp(
string, option[i], l) == 0) {
58 if (mode & RETURN_FIRST_MATCH)
67 for (i = 0; i < n_options; i++) {
69 if (mode & RETURN_FIRST_MATCH)
80 if (mode & MATCH_WHOLE_STRING) {
82 if (mode & CASE_SENSITIVE) {
83 for (i = 0; i < n_options; i++) {
84 if (strcmp(
string, option[i]) == 0) {
85 if (mode & RETURN_FIRST_MATCH)
94 for (i = 0; i < n_options; i++) {
96 if (mode & RETURN_FIRST_MATCH)
108 puts(
"error: unknown flag combination in match_string()");
109 puts(
" contact programmer!");
long match_string(char *string, char **option, long n_options, long mode)
Matches a given string against an array of option strings based on specified modes.