Mercurial > gftp.yaz
diff lib/protocols.c @ 473:45fb9dc47a2e
2004-5-26 Brian Masney <masneyb@gftp.org>
* lib/protocols.c lib/options.h - added remote_lc_time option. The
value of LC_TIME can now be overridden on a per site basis. This will
fix problems parsing the dates in the remote directory listings
author | masneyb |
---|---|
date | Thu, 27 May 2004 10:11:56 +0000 |
parents | 2ad1916dc611 |
children | 97fd5eb34be0 |
line wrap: on
line diff
--- a/lib/protocols.c Thu May 27 09:54:57 2004 +0000 +++ b/lib/protocols.c Thu May 27 10:11:56 2004 +0000 @@ -344,16 +344,31 @@ int gftp_list_files (gftp_request * request) { + char *remote_lc_time, *locret; int fd; g_return_val_if_fail (request != NULL, GFTP_EFATAL); + gftp_lookup_request_option (request, "remote_lc_time", &remote_lc_time); + if (remote_lc_time != NULL && *remote_lc_time != '\0') + locret = setlocale (LC_TIME, remote_lc_time); + else + locret = setlocale (LC_TIME, NULL); + + if (locret == NULL) + { + locret = setlocale (LC_TIME, NULL); + request->logging_function (gftp_logging_misc, request, + _("Error setting LC_TIME to '%s'. Falling back to '%s'\n"), + remote_lc_time, locret); + } + request->cached = 0; if (request->use_cache && (fd = gftp_find_cache_entry (request)) > 0) { request->logging_function (gftp_logging_misc, request, - _("Loading directory listing %s from cache\n"), - request->directory); + _("Loading directory listing %s from cache (LC_TIME=%s)\n"), + request->directory, locret); request->cachefd = fd; request->cached = 1; @@ -361,12 +376,17 @@ } else if (request->use_cache) { + request->logging_function (gftp_logging_misc, request, + _("Loading directory listing %s from server (LC_TIME=%s)\n"), + request->directory, locret); + request->cachefd = gftp_new_cache_entry (request); request->cached = 0; } if (request->list_files == NULL) return (GFTP_EFATAL); + return (request->list_files (request)); }