1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 23:06:38 +02:00

logger: replace backslashs in name by logger replacement char under Cygwin (bug #41207)

This commit is contained in:
Sebastien Helleu
2014-01-27 16:31:36 +01:00
parent 58c615f33b
commit b8ffa87b5c
2 changed files with 26 additions and 11 deletions
+2
View File
@@ -111,6 +111,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* irc: add option irc.look.notice_welcome_tags
* irc: add server option "default_msg_kick" to customize default kick/kickban
message (task #12777)
* logger: replace backslashs in name by logger replacement char under Cygwin
(bug #41207)
* lua: fix detection of Lua 5.2 in autotools (patch #8270)
* lua: fix crash on calls to callbacks during load of script
* python: fix load of scripts with python >= 3.3
+24 -11
View File
@@ -317,6 +317,7 @@ char *
logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
{
char *mask2, *mask_decoded, *mask_decoded2, *mask_decoded3, *mask_decoded4;
char *mask_decoded5;
const char *dir_separator;
int length;
time_t seconds;
@@ -327,6 +328,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
mask_decoded2 = NULL;
mask_decoded3 = NULL;
mask_decoded4 = NULL;
mask_decoded5 = NULL;
dir_separator = weechat_info_get ("dir_separator", "");
if (!dir_separator)
@@ -351,25 +353,34 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
if (!mask_decoded2)
goto end;
/* restore directory separator */
mask_decoded3 = weechat_string_replace (mask_decoded2,
"\01", dir_separator);
#ifdef __CYGWIN__
mask_decoded3 = weechat_string_replace (mask_decoded2, "\\",
weechat_config_string (logger_config_file_replacement_char));
#else
mask_decoded3 = strdup (mask_decoded2);
#endif
if (!mask_decoded3)
goto end;
/* replace date/time specifiers in mask */
length = strlen (mask_decoded3) + 256 + 1;
mask_decoded4 = malloc (length);
/* restore directory separator */
mask_decoded4 = weechat_string_replace (mask_decoded3,
"\01", dir_separator);
if (!mask_decoded4)
goto end;
/* replace date/time specifiers in mask */
length = strlen (mask_decoded4) + 256 + 1;
mask_decoded5 = malloc (length);
if (!mask_decoded5)
goto end;
seconds = time (NULL);
date_tmp = localtime (&seconds);
mask_decoded4[0] = '\0';
strftime (mask_decoded4, length - 1, mask_decoded3, date_tmp);
mask_decoded5[0] = '\0';
strftime (mask_decoded5, length - 1, mask_decoded4, date_tmp);
/* convert to lower case? */
if (weechat_config_boolean (logger_config_file_name_lower_case))
weechat_string_tolower (mask_decoded4);
weechat_string_tolower (mask_decoded5);
if (weechat_logger_plugin->debug)
{
@@ -379,7 +390,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
"decoded mask = \"%s\"",
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"),
mask, mask_decoded4);
mask, mask_decoded5);
}
end:
@@ -391,8 +402,10 @@ end:
free (mask_decoded2);
if (mask_decoded3)
free (mask_decoded3);
if (mask_decoded4)
free (mask_decoded4);
return mask_decoded4;
return mask_decoded5;
}
/*