/* * Select the appropriate protocol for the URL scheme, and return a * list of files in the directory pointed to by the URL. */ struct url_ent * fetchList(struct url *URL, const char *flags) { if (strcasecmp(URL->scheme, SCHEME_FILE) == 0) return (fetchListFile(URL, flags)); else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) return (fetchListFTP(URL, flags)); else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0) return (fetchListHTTP(URL, flags)); else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0) return (fetchListHTTP(URL, flags)); url_seterr(URL_BAD_SCHEME); return (NULL); }
/* * Select the appropriate protocol for the URL scheme, and return a * list of files in the directory pointed to by the URL. */ int fetchList(struct url_list *ue, struct url *URL, const char *pattern, const char *flags) { if (strcasecmp(URL->scheme, SCHEME_FILE) == 0) return (fetchListFile(ue, URL, pattern, flags)); else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) return (fetchListFTP(ue, URL, pattern, flags)); else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0) return (fetchListHTTP(ue, URL, pattern, flags)); else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0) return (fetchListHTTP(ue, URL, pattern, flags)); url_seterr(URL_BAD_SCHEME); return -1; }