diff options
-rw-r--r-- | include/wheel.h | 5 | ||||
-rw-r--r-- | src/wheel.c | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/wheel.h b/include/wheel.h index 94cf46a..619e0f7 100644 --- a/include/wheel.h +++ b/include/wheel.h @@ -6,6 +6,9 @@ #include <stdio.h> #include "str.h" +#define WHEEL_MATCH_EXACT 0 +#define WHEEL_MATCH_ANY 1 + struct Wheel { char *distribution; char *version; @@ -17,5 +20,5 @@ struct Wheel { char *file_name; }; -struct Wheel *get_wheel_file(const char *basepath, const char *name, char *to_match[]); +struct Wheel *get_wheel_file(const char *basepath, const char *name, char *to_match[], unsigned match_mode); #endif //STASIS_WHEEL_H diff --git a/src/wheel.c b/src/wheel.c index 8f48828..b96df57 100644 --- a/src/wheel.c +++ b/src/wheel.c @@ -1,6 +1,6 @@ #include "wheel.h" -struct Wheel *get_wheel_file(const char *basepath, const char *name, char *to_match[]) { +struct Wheel *get_wheel_file(const char *basepath, const char *name, char *to_match[], unsigned match_mode) { DIR *dp; struct dirent *rec; struct Wheel *result = NULL; @@ -38,7 +38,11 @@ struct Wheel *get_wheel_file(const char *basepath, const char *name, char *to_ma } } - if (!startswith(rec->d_name, name) || match != pattern_count) { + if (!startswith(rec->d_name, name)) { + continue; + } + + if (match_mode == WHEEL_MATCH_EXACT && match != pattern_count) { continue; } |