diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2006-10-12 17:16:14 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2006-10-12 17:16:14 +0000 |
commit | 9b91c915774e2a9500cef3e694ca526d26d76cb0 (patch) | |
tree | a9349a205e561de7d3dfd6dede6ef40e9a81e201 | |
parent | 481e6f8e7f1c2cfdcbcc95e4b2c9dc3eaa243852 (diff) | |
download | weechat-9b91c915774e2a9500cef3e694ca526d26d76cb0.zip |
Fixed some portability bugs (patch #5271)
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/common/log.c | 4 | ||||
-rw-r--r-- | src/common/weeconfig.c | 6 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-main.c | 5 | ||||
-rw-r--r-- | src/irc/irc-recv.c | 6 | ||||
-rw-r--r-- | src/irc/irc-send.c | 3 | ||||
-rw-r--r-- | src/irc/irc.h | 4 | ||||
-rw-r--r-- | src/plugins/plugins-config.c | 4 | ||||
-rw-r--r-- | weechat/ChangeLog | 1 | ||||
-rw-r--r-- | weechat/src/common/log.c | 4 | ||||
-rw-r--r-- | weechat/src/common/weeconfig.c | 6 | ||||
-rw-r--r-- | weechat/src/gui/curses/gui-curses-main.c | 5 | ||||
-rw-r--r-- | weechat/src/irc/irc-recv.c | 6 | ||||
-rw-r--r-- | weechat/src/irc/irc-send.c | 3 | ||||
-rw-r--r-- | weechat/src/irc/irc.h | 4 | ||||
-rw-r--r-- | weechat/src/plugins/plugins-config.c | 4 |
16 files changed, 38 insertions, 28 deletions
@@ -5,6 +5,7 @@ ChangeLog - 2006-10-12 Version 0.2.2 (under dev!): + * fixed some portability bugs (patch #5271) * fixed iconv detection for BSD (patch #5456) * fixed typo in configure.in (bash specific test) (patch #5450) * mode changes with /op, /deop, /voice, /devoice, /halfop, /dehalfop are diff --git a/src/common/log.c b/src/common/log.c index 16adbda28..5788f2717 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -28,7 +28,11 @@ #include <unistd.h> #include <string.h> #include <stdarg.h> + +#ifdef HAVE_FLOCK #include <sys/file.h> +#endif + #include <sys/types.h> #include <time.h> diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index 4ec0ad2f8..e6f2461cf 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -1873,7 +1873,7 @@ config_read () return -2; snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "rt")) == NULL) + if ((file = fopen (filename, "r")) == NULL) { gui_printf (NULL, _("%s config file \"%s\" not found.\n"), WEECHAT_WARNING, filename); @@ -2158,7 +2158,7 @@ config_create_default () return -2; snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "wt")) == NULL) + if ((file = fopen (filename, "w")) == NULL) { gui_printf (NULL, _("%s cannot create file \"%s\"\n"), WEECHAT_ERROR, filename); @@ -2365,7 +2365,7 @@ config_write (char *config_name) weechat_home, DIR_SEPARATOR); } - if ((file = fopen (filename, "wt")) == NULL) + if ((file = fopen (filename, "w")) == NULL) { gui_printf (NULL, _("%s cannot create file \"%s\"\n"), WEECHAT_ERROR, filename); diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 2e6306a3b..d1d28d92c 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -67,7 +67,6 @@ gui_main_loop () { fd_set read_fd; static struct timeval timeout, tv; - static struct timezone tz; t_irc_server *ptr_server; t_gui_buffer *ptr_buffer; int old_day, old_min, old_sec, diff; @@ -219,14 +218,14 @@ gui_main_loop () && (new_time >= ptr_server->lag_next_check)) { server_sendf (ptr_server, "PING %s\r\n", ptr_server->address); - gettimeofday (&(ptr_server->lag_check_time), &tz); + gettimeofday (&(ptr_server->lag_check_time), NULL); } /* lag timeout => disconnect */ if ((ptr_server->lag_check_time.tv_sec != 0) && (cfg_irc_lag_disconnect > 0)) { - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); diff = (int) get_timeval_diff (&(ptr_server->lag_check_time), &tv); if (diff / 1000 > cfg_irc_lag_disconnect * 60) { diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index c49240f01..ade984343 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -856,7 +856,6 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen { char *host2, *pos, *pos2, *pos_usec; struct timeval tv; - struct timezone tz; long sec1, usec1, sec2, usec2, difftime; t_irc_channel *ptr_channel; int highlight; @@ -922,7 +921,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen { pos2[0] = '\0'; - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); sec1 = atol (pos); usec1 = atol (pos_usec); sec2 = tv.tv_sec; @@ -1191,7 +1190,6 @@ int irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments) { struct timeval tv; - struct timezone tz; int old_lag; /* make gcc happy */ @@ -1203,7 +1201,7 @@ irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments { /* calculate lag (time diff with lag check) */ old_lag = server->lag; - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); server->lag = (int) get_timeval_diff (&(server->lag_check_time), &tv); if (old_lag != server->lag) gui_status_draw (gui_current_window->buffer, 1); diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c index 887238d77..06b8ad5fc 100644 --- a/src/irc/irc-send.c +++ b/src/irc/irc-send.c @@ -458,7 +458,6 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, { char *pos_type, *pos_args, *pos; struct timeval tv; - struct timezone tz; /* make gcc happy */ (void) channel; @@ -500,7 +499,7 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args)) { - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n", arguments, tv.tv_sec, tv.tv_usec); gui_printf (server->buffer, " %s%d %d\n", diff --git a/src/irc/irc.h b/src/irc/irc.h index 9fe042806..dbb61fd22 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -36,6 +36,10 @@ #include "../gui/gui.h" +#ifndef NI_MAXHOST +#define NI_MAXHOST 256 +#endif + /* prefixes for chat window */ #define PREFIX_SERVER "-@-" diff --git a/src/plugins/plugins-config.c b/src/plugins/plugins-config.c index 20688eecb..e609f4422 100644 --- a/src/plugins/plugins-config.c +++ b/src/plugins/plugins-config.c @@ -240,7 +240,7 @@ plugin_config_read () return; snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "rt")) == NULL) + if ((file = fopen (filename, "r")) == NULL) return; line_number = 0; @@ -347,7 +347,7 @@ plugin_config_write () snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "wt")) == NULL) + if ((file = fopen (filename, "w")) == NULL) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); gui_printf (NULL, _("%s cannot create file \"%s\"\n"), diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 25161cc04..7ff111468 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2006-10-12 Version 0.2.2 (under dev!): + * fixed some portability bugs (patch #5271) * fixed iconv detection for BSD (patch #5456) * fixed typo in configure.in (bash specific test) (patch #5450) * mode changes with /op, /deop, /voice, /devoice, /halfop, /dehalfop are diff --git a/weechat/src/common/log.c b/weechat/src/common/log.c index 16adbda28..5788f2717 100644 --- a/weechat/src/common/log.c +++ b/weechat/src/common/log.c @@ -28,7 +28,11 @@ #include <unistd.h> #include <string.h> #include <stdarg.h> + +#ifdef HAVE_FLOCK #include <sys/file.h> +#endif + #include <sys/types.h> #include <time.h> diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c index 4ec0ad2f8..e6f2461cf 100644 --- a/weechat/src/common/weeconfig.c +++ b/weechat/src/common/weeconfig.c @@ -1873,7 +1873,7 @@ config_read () return -2; snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "rt")) == NULL) + if ((file = fopen (filename, "r")) == NULL) { gui_printf (NULL, _("%s config file \"%s\" not found.\n"), WEECHAT_WARNING, filename); @@ -2158,7 +2158,7 @@ config_create_default () return -2; snprintf (filename, filename_length, "%s%s" WEECHAT_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "wt")) == NULL) + if ((file = fopen (filename, "w")) == NULL) { gui_printf (NULL, _("%s cannot create file \"%s\"\n"), WEECHAT_ERROR, filename); @@ -2365,7 +2365,7 @@ config_write (char *config_name) weechat_home, DIR_SEPARATOR); } - if ((file = fopen (filename, "wt")) == NULL) + if ((file = fopen (filename, "w")) == NULL) { gui_printf (NULL, _("%s cannot create file \"%s\"\n"), WEECHAT_ERROR, filename); diff --git a/weechat/src/gui/curses/gui-curses-main.c b/weechat/src/gui/curses/gui-curses-main.c index 2e6306a3b..d1d28d92c 100644 --- a/weechat/src/gui/curses/gui-curses-main.c +++ b/weechat/src/gui/curses/gui-curses-main.c @@ -67,7 +67,6 @@ gui_main_loop () { fd_set read_fd; static struct timeval timeout, tv; - static struct timezone tz; t_irc_server *ptr_server; t_gui_buffer *ptr_buffer; int old_day, old_min, old_sec, diff; @@ -219,14 +218,14 @@ gui_main_loop () && (new_time >= ptr_server->lag_next_check)) { server_sendf (ptr_server, "PING %s\r\n", ptr_server->address); - gettimeofday (&(ptr_server->lag_check_time), &tz); + gettimeofday (&(ptr_server->lag_check_time), NULL); } /* lag timeout => disconnect */ if ((ptr_server->lag_check_time.tv_sec != 0) && (cfg_irc_lag_disconnect > 0)) { - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); diff = (int) get_timeval_diff (&(ptr_server->lag_check_time), &tv); if (diff / 1000 > cfg_irc_lag_disconnect * 60) { diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c index c49240f01..ade984343 100644 --- a/weechat/src/irc/irc-recv.c +++ b/weechat/src/irc/irc-recv.c @@ -856,7 +856,6 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen { char *host2, *pos, *pos2, *pos_usec; struct timeval tv; - struct timezone tz; long sec1, usec1, sec2, usec2, difftime; t_irc_channel *ptr_channel; int highlight; @@ -922,7 +921,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen { pos2[0] = '\0'; - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); sec1 = atol (pos); usec1 = atol (pos_usec); sec2 = tv.tv_sec; @@ -1191,7 +1190,6 @@ int irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments) { struct timeval tv; - struct timezone tz; int old_lag; /* make gcc happy */ @@ -1203,7 +1201,7 @@ irc_cmd_recv_pong (t_irc_server *server, char *host, char *nick, char *arguments { /* calculate lag (time diff with lag check) */ old_lag = server->lag; - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); server->lag = (int) get_timeval_diff (&(server->lag_check_time), &tv); if (old_lag != server->lag) gui_status_draw (gui_current_window->buffer, 1); diff --git a/weechat/src/irc/irc-send.c b/weechat/src/irc/irc-send.c index 887238d77..06b8ad5fc 100644 --- a/weechat/src/irc/irc-send.c +++ b/weechat/src/irc/irc-send.c @@ -458,7 +458,6 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, { char *pos_type, *pos_args, *pos; struct timeval tv; - struct timezone tz; /* make gcc happy */ (void) channel; @@ -500,7 +499,7 @@ irc_cmd_send_ctcp (t_irc_server *server, t_irc_channel *channel, if ((ascii_strcasecmp (pos_type, "ping") == 0) && (!pos_args)) { - gettimeofday (&tv, &tz); + gettimeofday (&tv, NULL); server_sendf (server, "PRIVMSG %s :\01PING %d %d\01\r\n", arguments, tv.tv_sec, tv.tv_usec); gui_printf (server->buffer, " %s%d %d\n", diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h index 9fe042806..dbb61fd22 100644 --- a/weechat/src/irc/irc.h +++ b/weechat/src/irc/irc.h @@ -36,6 +36,10 @@ #include "../gui/gui.h" +#ifndef NI_MAXHOST +#define NI_MAXHOST 256 +#endif + /* prefixes for chat window */ #define PREFIX_SERVER "-@-" diff --git a/weechat/src/plugins/plugins-config.c b/weechat/src/plugins/plugins-config.c index 20688eecb..e609f4422 100644 --- a/weechat/src/plugins/plugins-config.c +++ b/weechat/src/plugins/plugins-config.c @@ -240,7 +240,7 @@ plugin_config_read () return; snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "rt")) == NULL) + if ((file = fopen (filename, "r")) == NULL) return; line_number = 0; @@ -347,7 +347,7 @@ plugin_config_write () snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME, weechat_home, DIR_SEPARATOR); - if ((file = fopen (filename, "wt")) == NULL) + if ((file = fopen (filename, "w")) == NULL) { irc_display_prefix (NULL, NULL, PREFIX_ERROR); gui_printf (NULL, _("%s cannot create file \"%s\"\n"), |