return pakfire_string_endswith(what, ".pfm");
}
-static int pakfire_request_is_url(const char* what) {
- static const char* known_schemas[] = {
- "https://",
- "http://",
- "file://",
- NULL,
- };
-
- for (const char** schema = known_schemas; *schema; schema++) {
- if (pakfire_string_startswith(what, *schema))
- return 1;
- }
-
- return 0;
-}
-
static int pakfire_request_add_package(struct pakfire_request* request, int action,
struct pakfire_package* pkg, int flags) {
// Get the solvable ID
what++;
// Download and add any remote files
- if (pakfire_request_is_url(what))
+ if (pakfire_string_is_url(what))
return pakfire_request_add_url(request, action, what, extra_flags);
// Add any local files
errno = EINVAL;
return 0;
}
+
+int pakfire_string_is_url(const char* s) {
+ static const char* known_schemas[] = {
+ "https://",
+ "http://",
+ "file://",
+ NULL,
+ };
+
+ for (const char** schema = known_schemas; *schema; schema++) {
+ if (pakfire_string_startswith(s, *schema))
+ return 1;
+ }
+
+ return 0;
+}