1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-03 20:48:31 +00:00

Fix buildproblems introduced by 3f4127080e0577c71c42ad487f8a9435c761329c . inet.h is used by read_tcp and timeout is renamed to prevent clashes with timeout in ncurses

This commit is contained in:
Nikolas Garofil 2009-08-06 15:28:07 +02:00
parent 3f4127080e
commit 157537fc30
3 changed files with 27 additions and 25 deletions

View File

@ -64,9 +64,6 @@
#include <netdb.h> #include <netdb.h>
#include <fcntl.h> #include <fcntl.h>
#include <getopt.h> #include <getopt.h>
#ifdef NCURSES
#include <ncurses.h>
#endif
#ifdef XOAP #ifdef XOAP
#include <libxml/parser.h> #include <libxml/parser.h>
#endif /* XOAP */ #endif /* XOAP */

View File

@ -35,6 +35,7 @@
#include "config.h" /* defines */ #include "config.h" /* defines */
#include "common.h" /* at least for struct dns_data */ #include "common.h" /* at least for struct dns_data */
#include <sys/utsname.h> /* struct uname_s */ #include <sys/utsname.h> /* struct uname_s */
#include <arpa/inet.h>
#if defined(HAS_MCHECK_H) #if defined(HAS_MCHECK_H)
#include <mcheck.h> #include <mcheck.h>
@ -126,6 +127,10 @@ char *strndup(const char *s, size_t n);
#include "apcupsd.h" #include "apcupsd.h"
#endif #endif
#ifdef NCURSES
#include <ncurses.h>
#endif
/* sony support */ /* sony support */
#include "sony.h" #include "sony.h"

View File

@ -383,18 +383,18 @@ struct mail_s *parse_mail_args(char type, const char *arg)
int imap_command(int sockfd, const char *command, char *response, const char *verify) int imap_command(int sockfd, const char *command, char *response, const char *verify)
{ {
struct timeval timeout; struct timeval fetchtimeout;
fd_set fdset; fd_set fdset;
int res, numbytes = 0; int res, numbytes = 0;
if (send(sockfd, command, strlen(command), 0) == -1) { if (send(sockfd, command, strlen(command), 0) == -1) {
perror("send"); perror("send");
return -1; return -1;
} }
timeout.tv_sec = 60; // 60 second timeout i guess fetchtimeout.tv_sec = 60; // 60 second timeout i guess
timeout.tv_usec = 0; fetchtimeout.tv_usec = 0;
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout); res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
if (res > 0) { if (res > 0) {
if ((numbytes = recv(sockfd, response, MAXDATASIZE - 1, 0)) == -1) { if ((numbytes = recv(sockfd, response, MAXDATASIZE - 1, 0)) == -1) {
perror("recv"); perror("recv");
@ -471,7 +471,7 @@ void *imap_thread(void *arg)
} }
#endif /* HAVE_GETHOSTBYNAME_R */ #endif /* HAVE_GETHOSTBYNAME_R */
while (fail < mail->retries) { while (fail < mail->retries) {
struct timeval timeout; struct timeval fetchtimeout;
int res; int res;
fd_set fdset; fd_set fdset;
@ -501,11 +501,11 @@ void *imap_thread(void *arg)
break; break;
} }
timeout.tv_sec = 60; // 60 second timeout i guess fetchtimeout.tv_sec = 60; // 60 second timeout i guess
timeout.tv_usec = 0; fetchtimeout.tv_usec = 0;
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout); res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
if (res > 0) { if (res > 0) {
if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) { if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
perror("recv"); perror("recv");
@ -576,8 +576,8 @@ void *imap_thread(void *arg)
* RFC 2177 says we have to re-idle every 29 minutes. * RFC 2177 says we have to re-idle every 29 minutes.
* We'll do it every 20 minutes to be safe. * We'll do it every 20 minutes to be safe.
*/ */
timeout.tv_sec = 1200; fetchtimeout.tv_sec = 1200;
timeout.tv_usec = 0; fetchtimeout.tv_usec = 0;
DBGP2("idling..."); DBGP2("idling...");
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
@ -642,7 +642,7 @@ void *imap_thread(void *arg)
* something other than 0, or we had a timeout * something other than 0, or we had a timeout
*/ */
buf = recvbuf; buf = recvbuf;
if (recent > 0 || (buf && strstr(buf, " FETCH ")) || timeout.tv_sec == 0 || force_check) { if (recent > 0 || (buf && strstr(buf, " FETCH ")) || fetchtimeout.tv_sec == 0 || force_check) {
// re-check messages and unseen // re-check messages and unseen
if (imap_command(sockfd, "DONE\r\n", recvbuf, "a5 OK")) { if (imap_command(sockfd, "DONE\r\n", recvbuf, "a5 OK")) {
fail++; fail++;
@ -691,11 +691,11 @@ void *imap_thread(void *arg)
fail++; fail++;
break; break;
} }
timeout.tv_sec = 60; // 60 second timeout i guess fetchtimeout.tv_sec = 60; // 60 second timeout i guess
timeout.tv_usec = 0; fetchtimeout.tv_usec = 0;
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout); res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
if (res > 0) { if (res > 0) {
if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) { if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
perror("recv a3"); perror("recv a3");
@ -727,18 +727,18 @@ void *imap_thread(void *arg)
int pop3_command(int sockfd, const char *command, char *response, const char *verify) int pop3_command(int sockfd, const char *command, char *response, const char *verify)
{ {
struct timeval timeout; struct timeval fetchtimeout;
fd_set fdset; fd_set fdset;
int res, numbytes = 0; int res, numbytes = 0;
if (send(sockfd, command, strlen(command), 0) == -1) { if (send(sockfd, command, strlen(command), 0) == -1) {
perror("send"); perror("send");
return -1; return -1;
} }
timeout.tv_sec = 60; // 60 second timeout i guess fetchtimeout.tv_sec = 60; // 60 second timeout i guess
timeout.tv_usec = 0; fetchtimeout.tv_usec = 0;
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout); res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
if (res > 0) { if (res > 0) {
if ((numbytes = recv(sockfd, response, MAXDATASIZE - 1, 0)) == -1) { if ((numbytes = recv(sockfd, response, MAXDATASIZE - 1, 0)) == -1) {
perror("recv"); perror("recv");
@ -780,7 +780,7 @@ void *pop3_thread(void *arg)
} }
#endif /* HAVE_GETHOSTBYNAME_R */ #endif /* HAVE_GETHOSTBYNAME_R */
while (fail < mail->retries) { while (fail < mail->retries) {
struct timeval timeout; struct timeval fetchtimeout;
int res; int res;
fd_set fdset; fd_set fdset;
@ -810,11 +810,11 @@ void *pop3_thread(void *arg)
break; break;
} }
timeout.tv_sec = 60; // 60 second timeout i guess fetchtimeout.tv_sec = 60; // 60 second timeout i guess
timeout.tv_usec = 0; fetchtimeout.tv_usec = 0;
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout); res = select(sockfd + 1, &fdset, NULL, NULL, &fetchtimeout);
if (res > 0) { if (res > 0) {
if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) { if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
perror("recv"); perror("recv");