1 --- gftp-2.9.1b/lib/ftp-dir-listing.c.old 2024-07-01 21:03:44.877313412 -0400
2 +++ gftp-2.9.1b/lib/ftp-dir-listing.c 2024-07-01 21:07:51.201734399 -0400
5 struct tm curtime, *loctime;
8 + char *tmppos, *format;
13 /* Jul 06 12:57 or Jul 6 1999 */
14 if (strchr (str, ':') != NULL)
16 - tmppos = strptime (str, "%h %d %H:%M", &curtime);
18 + tmppos = strptime (str, "%h %d %H:%M", &curtime);
21 + format = dcgettext ("SUNW_OST_OSCMD", " %b %e %H:%M", LC_TIME);
22 + if (format && *format == ' ')
24 + tmppos = strptime (str, format, &curtime);
26 + tmppos = strptime (str, "%b %e %H:%M", &curtime);
30 loctime = localtime (&t);
34 //DEBUG_TRACE("LSUNIX: %s\n", str);
35 char *endpos, *startpos, *pos, *attribs;
36 + char *backup_lc_time, *remote_lc_time;
38 ftp_protocol_data * ftpdat = request->protocol_data;
41 while (*startpos == ' ')
44 - fle->datetime = parse_time (startpos, &startpos);
46 + backup_lc_time = setlocale (LC_TIME, NULL);
47 + gftp_lookup_request_option (request, "remote_lc_time", &remote_lc_time);
48 + if (backup_lc_time && remote_lc_time != NULL && *remote_lc_time != '\0')
49 + setlocale (LC_TIME, remote_lc_time);
51 + fle->datetime = parse_time (startpos, &startpos);
53 + if (backup_lc_time && remote_lc_time != NULL && *remote_lc_time != '\0')
54 + setlocale (LC_TIME, backup_lc_time);
57 /* Skip the blanks till we get to the next entry */
58 startpos = goto_next_token (startpos);
59 --- gftp-2.9.1b/lib/protocols.c.old 2024-07-01 21:08:53.175365431 -0400
60 +++ gftp-2.9.1b/lib/protocols.c 2024-07-01 21:12:17.445866678 -0400
62 gftp_list_files (gftp_request * request)
65 - char *remote_lc_time, *locret;
67 + char *backup_lc_time, *remote_lc_time, *locret;
70 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
73 + backup_lc_time = setlocale (LC_TIME, NULL);
74 gftp_lookup_request_option (request, "remote_lc_time", &remote_lc_time);
75 if (remote_lc_time != NULL && *remote_lc_time != '\0')
76 locret = setlocale (LC_TIME, remote_lc_time);
79 request->cachefd = fd;
82 + setlocale (LC_TIME, backup_lc_time);
86 else if (request->use_cache)
90 if (request->list_files == NULL)
91 - return (GFTP_EFATAL);
94 + setlocale (LC_TIME, backup_lc_time);
96 + return (GFTP_EFATAL);
99 - return (request->list_files (request));
100 + ret = request->list_files (request);
102 + setlocale (LC_TIME, backup_lc_time);
109 gftp_set_directory (gftp_request * request, const char *directory)
114 + char *locale_directory = NULL;
118 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
119 g_return_val_if_fail (directory != NULL, GFTP_EFATAL);
125 + else if (request->url_prefix && !strcmp (request->url_prefix, "file"))
129 + gftp_stat_filename (request, directory, &st_mode, &linksize);
130 + if (!S_ISDIR (st_mode))
132 + locale_directory = gftp_filename_from_utf8 (request, directory, &dest_len);
133 + if (locale_directory != NULL &&
134 + (fd = gftp_fd_open (request, locale_directory, O_RDONLY, 0)) != -1)
137 + request->directory = g_strdup (directory);
139 + else if ((fd = gftp_fd_open (request, directory, O_RDONLY, 0)) != -1)
142 + request->directory = g_strdup (directory);
144 + g_free (locale_directory);
148 else if (request->chdir == NULL)
149 return (GFTP_EFATAL);
150 return (request->chdir (request, directory));