From 334cb452bfee4d0511f9591292903d01f58efaf9 Mon Sep 17 00:00:00 2001
From: Matthias Andree <matthias.andree@gmx.de>
Date: Wed, 20 Oct 2004 09:14:04 +0000
Subject: Fix miscellaneous warnings.

svn path=/trunk/; revision=3953
---
 daemon.c    |  1 -
 driver.c    |  5 +++--
 env.c       |  2 --
 fetchmail.c | 11 ++++-------
 fetchmail.h | 14 ++++----------
 imap.c      |  7 -------
 pop3.c      |  8 ++------
 rcfile_y.y  |  8 +++-----
 report.c    |  2 +-
 sink.c      |  1 +
 socket.c    |  8 +++++++-
 transact.c  |  6 +-----
 12 files changed, 26 insertions(+), 47 deletions(-)

diff --git a/daemon.c b/daemon.c
index 3dcb55c3..83de920d 100644
--- a/daemon.c
+++ b/daemon.c
@@ -57,7 +57,6 @@ static RETSIGTYPE
 sigchld_handler (int sig)
 /* process SIGCHLD to obtain the exit code of the terminating process */
 {
-    extern volatile int lastsig;		/* last signal received */
     pid_t pid;
 
 #if 	defined(HAVE_WAITPID)				/* the POSIX way */
diff --git a/driver.c b/driver.c
index 95ff5b91..625f9edc 100644
--- a/driver.c
+++ b/driver.c
@@ -35,6 +35,8 @@
 #include <hesiod.h>
 #endif
 
+#include <langinfo.h>
+
 #if defined(HAVE_RES_SEARCH) || defined(HAVE_GETHOSTBYNAME)
 #include <netdb.h>
 #include "mx.h"
@@ -312,7 +314,6 @@ static void send_size_warnings(struct query *ctl)
     int msg_to_send = FALSE;
     struct idlist *head=NULL, *current=NULL;
     int max_warning_poll_count;
-    char *tmp;
 
     head = ctl->skipped;
     if (!head)
@@ -333,7 +334,7 @@ static void send_size_warnings(struct query *ctl)
     if (open_warning_by_mail(ctl, (struct msgblk *)NULL))
 	return;
     stuff_warning(ctl,
-	    tmp = rfc2047e(
+	    rfc2047e(
 	   GT_("Subject: Fetchmail oversized-messages warning"), nl_langinfo(CODESET)));
     stuff_warning(ctl, "");
     stuff_warning(ctl,
diff --git a/env.c b/env.c
index ae658bcd..d832811d 100644
--- a/env.c
+++ b/env.c
@@ -32,8 +32,6 @@
 
 extern char *getenv(const char *);	/* needed on sysV68 R3V7.1. */
 
-extern char *program_name;
-
 void envquery(int argc, char **argv)
 /* set up basic stuff from the environment (including the rc file name) */
 {
diff --git a/fetchmail.c b/fetchmail.c
index de5215a9..1756c73f 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -116,7 +116,6 @@ static char *timestamp (void)
 
 static RETSIGTYPE donothing(int sig) 
 {
-    extern volatile int lastsig;	/* declared in idle.c */
     set_signal_handler(sig, donothing);
     lastsig = sig;
 }
@@ -124,7 +123,7 @@ static RETSIGTYPE donothing(int sig)
 int main(int argc, char **argv)
 {
     int bkgd = FALSE;
-    int parsestatus, implicitmode = FALSE;
+    int implicitmode = FALSE;
     struct query *ctl;
     netrc_entry *netrc_list;
     char *netrc_file, *tmpbuf;
@@ -180,7 +179,7 @@ int main(int argc, char **argv)
     }
 #endif
 
-    if ((parsestatus = parsecmdline(argc,argv, &cmd_run, &cmd_opts)) < 0)
+    if ((parsecmdline(argc,argv, &cmd_run, &cmd_opts)) < 0)
 	exit(PS_SYNTAX);
 
     if (versioninfo)
@@ -461,10 +460,8 @@ int main(int argc, char **argv)
 			GT_("fetchmail: can't find a password for %s@%s.\n"),
 			ctl->remotename, ctl->server.pollname);
 		return(PS_AUTHFAIL);
-	    }
-	    else
-	    {
-		char* password_prompt = GT_("Enter password for %s@%s: ");
+	    } else {
+		const char* password_prompt = GT_("Enter password for %s@%s: ");
 
 		xalloca(tmpbuf, char *, strlen(password_prompt) +
 			strlen(ctl->remotename) +
diff --git a/fetchmail.h b/fetchmail.h
index 6de7cf8a..a42dafa5 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -22,16 +22,9 @@
 
 #include <stdio.h>
 
-/* We need this for time_t */
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
+/* We need this for strstr */
+#if !defined(HAVE_STRSTR) && !defined(strstr)
+char *strstr(const char *, const char *);
 #endif
 
 /* constants designating the various supported protocols */
@@ -518,6 +511,7 @@ extern int mytimeout;
 
 /* idle.c */
 int interruptible_idle(int interval);
+extern volatile int lastsig;
 
 /* sink.c: forwarding */
 void smtp_close(struct query *, int);
diff --git a/imap.c b/imap.c
index ff727e7e..4395129f 100644
--- a/imap.c
+++ b/imap.c
@@ -19,13 +19,6 @@
 
 #include  "i18n.h"
 
-#ifdef OPIE_ENABLE
-#endif /* OPIE_ENABLE */
-
-#ifndef strstr		/* glibc-2.1 declares this as a macro */
-extern char *strstr(const char *, const char *);	/* needed on sysV68 R3V7.1. */
-#endif /* strstr */
-
 /* imap_version values */
 #define IMAP2		-1	/* IMAP2 or IMAP2BIS, RFC1176 */
 #define IMAP4		0	/* IMAP4 rev 0, RFC1730 */
diff --git a/pop3.c b/pop3.c
index ee2b9d40..826309c3 100644
--- a/pop3.c
+++ b/pop3.c
@@ -25,10 +25,6 @@
 #include <opie.h>
 #endif /* OPIE_ENABLE */
 
-#ifndef strstr		/* glibc-2.1 declares this as a macro */
-extern char *strstr(const char *, const char *);	/* needed on sysV68 R3V7.1. */
-#endif /* strstr */
-
 static int last;
 #ifdef SDPS_ENABLE
 char *sdps_envfrom;
@@ -46,12 +42,12 @@ static char lastok[POPBUFSIZE+1];
 #if defined(KERBEROS_V4) || defined(KERBEROS_V5)
     flag has_kerberos = FALSE;
 #endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */
-    flag has_cram = FALSE;
+    static flag has_cram = FALSE;
 #ifdef OPIE_ENABLE
     flag has_otp = FALSE;
 #endif /* OPIE_ENABLE */
 #ifdef SSL_ENABLE
-    flag has_ssl = FALSE;
+    static flag has_ssl = FALSE;
 #endif /* SSL_ENABLE */
 
 #ifdef NTLM_ENABLE
diff --git a/rcfile_y.y b/rcfile_y.y
index 95fc4f69..e11a3687 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -157,7 +157,7 @@ serv_option	: AKA alias_list
 #else
 		    				current.server.authenticate = A_KERBEROS_V4;
 #endif /* KERBEROS_V5 */
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
 					    current.server.service = KPOP_PORT;
 #else /* INET6_ENABLE */
 					    current.server.port = KPOP_PORT;
@@ -179,12 +179,12 @@ serv_option	: AKA alias_list
 		| CHECKALIAS            {current.server.checkalias = FLAG_TRUE;}
 		| NO CHECKALIAS         {current.server.checkalias  = FLAG_FALSE;}
 		| SERVICE STRING	{
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
 					current.server.service = $2;
 #endif /* INET6_ENABLE */
 					}
 		| PORT NUMBER		{
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
 					int port = $2;
 					char buf[10];
 					sprintf(buf, "%d", port);
@@ -603,5 +603,3 @@ char *prependdir (const char *file, const char *dir)
 int yywrap(void) {return 1;}
 
 /* rcfile_y.y ends here */
-
-
diff --git a/report.c b/report.c
index 32e98577..cdded484 100644
--- a/report.c
+++ b/report.c
@@ -41,7 +41,7 @@
 /* If NULL, report will flush stderr, then print on stderr the program
    name, a colon and a space.  Otherwise, report will call this
    function without parameters instead.  */
-void (*report_print_progname) (
+static void (*report_print_progname) (
 #if __STDC__ - 0
 			      void
 #endif
diff --git a/sink.c b/sink.c
index 54db4029..11763a54 100644
--- a/sink.c
+++ b/sink.c
@@ -30,6 +30,7 @@
 #include  <varargs.h>
 #endif
 #include  <ctype.h>
+#include  <langinfo.h>
 
 /* for W* macros after pclose() */
 #define _USE_BSD
diff --git a/socket.c b/socket.c
index 15598272..5c3861bc 100644
--- a/socket.c
+++ b/socket.c
@@ -507,7 +507,7 @@ va_dcl {
 static	SSL_CTX *_ctx = NULL;
 static	SSL *_ssl_context[FD_SETSIZE];
 
-SSL	*SSLGetContext( int );
+static SSL	*SSLGetContext( int );
 #endif /* SSL_ENABLE */
 
 int SockWrite(int sock, char *buf, int len)
@@ -538,7 +538,9 @@ int SockRead(int sock, char *buf, int len)
 {
     char *newline, *bp = buf;
     int n;
+#ifdef	FORCE_STUFFING
     int maxavailable = 0;
+#endif
 #ifdef	SSL_ENABLE
     SSL *ssl;
 #endif
@@ -578,7 +580,9 @@ int SockRead(int sock, char *buf, int len)
 			(void)SSL_get_error(ssl, n);
 			return(-1);
 		}
+#ifdef FORCE_STUFFING
 		maxavailable = n;
+#endif
 		if( 0 == n ) {
 			/* SSL_peek says no data...  Does he mean no data
 			or did the connection blow up?  If we got an error
@@ -622,7 +626,9 @@ int SockRead(int sock, char *buf, int len)
 	    if ((n = fm_peek(sock, bp, len)) <= 0)
 #endif
 		return (-1);
+#ifdef FORCE_STUFFING
 	    maxavailable = n;
+#endif
 	    if ((newline = memchr(bp, '\n', n)) != NULL)
 		n = newline - bp + 1;
 #ifndef __BEOS__
diff --git a/transact.c b/transact.c
index 0c246a1d..901e3d3d 100644
--- a/transact.c
+++ b/transact.c
@@ -35,10 +35,6 @@
 #include "socket.h"
 #include "fetchmail.h"
 
-#ifndef strstr		/* glibc-2.1 declares this as a macro */
-extern char *strstr(const char *, const char *);	/* needed on sysV68 R3V7.1. */
-#endif /* strstr */
-
 int mytimeout;		/* value of nonreponse timeout */
 int suppress_tags;	/* emit tags? */
 char shroud[PASSWORDLEN*2+3];	/* string to shroud in debug output */
@@ -422,7 +418,7 @@ int readheaders(int sock,
     for (remaining = fetchlen; remaining > 0 || protocol->delimited; )
     {
 	char *line, *rline;
-	int overlong = FALSE;
+	int overlong = FALSE; /* XXX FIXME: this is unused */
 
 	line = xmalloc(sizeof(buf));
 	linelen = 0;
-- 
cgit v1.2.3