* scheme used here.
*/
#include "config.h"
+#include "fetchmail.h"
#include <ctype.h>
static const char base64digits[] =
#include "fetchmail.h"
#include "tunable.h"
-RETSIGTYPE
+static RETSIGTYPE
sigchld_handler (int sig)
/* process SIGCHLD to obtain the exit code of the terminating process */
{
return(PS_SUCCESS);
}
-static int do_session(ctl, proto, maxfetch)
/* retrieve messages from server using given protocol method table */
-struct query *ctl; /* parsed options with merged-in defaults */
-const struct method *proto; /* protocol method table */
-const int maxfetch; /* maximum number of messages to fetch */
+static int do_session(
+ /* parsed options with merged-in defaults */
+ struct query *ctl,
+ /* protocol method table */
+ const struct method *proto,
+ /* maximum number of messages to fetch */
+ const int maxfetch)
{
- int js;
-#ifdef HAVE_VOLATILE
+ static int *msgsizes;
volatile int err, mailserver_socket = -1; /* pacifies -Wall */
-#else
- int err, mailserver_socket = -1;
-#endif /* HAVE_VOLATILE */
+ int deletions = 0, js;
const char *msg;
SIGHANDLERTYPE pipesave;
SIGHANDLERTYPE alrmsave;
ctl->server.base_protocol = proto;
+ msgsizes = NULL;
pass = 0;
err = 0;
init_transact(proto);
else
{
char buf[MSGBUFSIZE+1], *realhost;
- int count, new, bytes, deletions = 0;
- int *msgsizes = (int *)NULL;
+ int count, new, bytes;
#if INET6_ENABLE
int fetches, dispatches, oldphase;
#else /* INET6_ENABLE */
#include <locale.h>
#endif
-extern char *getenv(); /* needed on sysV68 R3V7.1. */
+extern char *getenv(const char *); /* needed on sysV68 R3V7.1. */
extern char *program_name;
#endif /* OPIE_ENABLE */
#ifndef strstr /* glibc-2.1 declares this as a macro */
-extern char *strstr(); /* needed on sysV68 R3V7.1. */
+extern char *strstr(const char *, const char *); /* needed on sysV68 R3V7.1. */
#endif /* strstr */
/* imap_version values */
#include <errno.h>
-int
-main (argc, argv)
- int argc;
- char **argv;
+int main (int argc, char **argv)
{
struct stat sb;
char *program_name, *file, *host, *login;
#endif /* OPIE_ENABLE */
#ifndef strstr /* glibc-2.1 declares this as a macro */
-extern char *strstr(); /* needed on sysV68 R3V7.1. */
+extern char *strstr(const char *, const char *); /* needed on sysV68 R3V7.1. */
#endif /* strstr */
static int last;
#include <string.h>
#include <stdlib.h>
-#ifndef MAIN
#include "fetchmail.h"
+
+#ifndef MAIN
#include "i18n.h"
#else
+#include <unistd.h>
static int verbose;
char *program_name = "rfc822";
#endif /* MAIN */
#define HEADER_END(p) ((p)[0] == '\n' && ((p)[1] != ' ' && (p)[1] != '\t'))
-unsigned char *reply_hack(buf, host, length)
+unsigned char *reply_hack(
+ unsigned char *buf /* header to be hacked */,
+ const unsigned char *host /* server hostname */,
+ int *length)
/* hack message headers so replies will work properly */
-unsigned char *buf; /* header to be hacked */
-const unsigned char *host; /* server hostname */
-int *length;
{
unsigned char *from, *cp, last_nws = '\0', *parens_from = NULL;
int parendepth, state, has_bare_name_part, has_host_part;
return(buf);
}
-unsigned char *nxtaddr(hdr)
+unsigned char *nxtaddr(const unsigned char *hdr /* header to be parsed, NUL to continue previous hdr */)
/* parse addresses in succession out of a specified RFC822 header */
-const unsigned char *hdr; /* header to be parsed, NUL to continue previous hdr */
{
static unsigned char address[BUFSIZ];
static int tp;
static void parsebuf(unsigned char *longbuf, int reply)
{
unsigned char *cp;
+ int dummy;
if (reply)
{
- reply_hack(longbuf, "HOSTNAME.NET");
+ reply_hack(longbuf, "HOSTNAME.NET", &dummy);
printf("Rewritten buffer: %s", longbuf);
}
else
-main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
unsigned char buf[BUFSIZ], longbuf[BUFSIZ];
int ch, reply;
fputs(longbuf, stdout);
parsebuf(longbuf, reply);
}
+ exit(0);
}
#endif /* MAIN */
#endif /* NET_SECURITY */
#ifdef HAVE_SOCKETPAIR
-char *const *parse_plugin(const char *plugin, const char *host, const char *service)
+static char *const *parse_plugin(const char *plugin, const char *host, const char *service)
{ const char **argvec;
const char *c, *p;
char *cp, *plugin_copy;
}
-int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
+static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
{
char buf[257];
X509 *x509_cert;
return (ok_return);
}
-int SSL_nock_verify_callback( int ok_return, X509_STORE_CTX *ctx )
+static int SSL_nock_verify_callback( int ok_return, X509_STORE_CTX *ctx )
{
return SSL_verify_callback(ok_return, ctx, 0);
}
-int SSL_ck_verify_callback( int ok_return, X509_STORE_CTX *ctx )
+static int SSL_ck_verify_callback( int ok_return, X509_STORE_CTX *ctx )
{
return SSL_verify_callback(ok_return, ctx, 1);
}
#include "fetchmail.h"
#ifndef strstr /* glibc-2.1 declares this as a macro */
-extern char *strstr(); /* needed on sysV68 R3V7.1. */
+extern char *strstr(const char *, const char *); /* needed on sysV68 R3V7.1. */
#endif /* strstr */
int mytimeout; /* value of nonreponse timeout */
{
char *cp;
- for (cp = nxtaddr(hdr);
+ for (cp = nxtaddr((const unsigned char *)hdr);
cp != NULL;
cp = nxtaddr(NULL))
{
{
int sl = strlen(ctl->server.qvirtual);
- if (!strncasecmp(cp, ctl->server.qvirtual, sl))
+ if (!strncasecmp((char *)cp, ctl->server.qvirtual, sl))
cp += sl;
}
- if ((atsign = strchr(cp, '@'))) {
+ if ((atsign = strchr((char *)cp, '@'))) {
struct idlist *idp;
/*
for (idp = ctl->server.localdomains; idp; idp = idp->next) {
char *rhs;
- rhs = atsign + (strlen(atsign) - strlen(idp->id));
+ rhs = atsign + (strlen(atsign) - strlen((char *)idp->id));
if (rhs > atsign &&
(rhs[-1] == '.' || rhs[-1] == '@') &&
- strcasecmp(rhs, idp->id) == 0)
+ strcasecmp(rhs, (char *)idp->id) == 0)
{
if (outlevel >= O_DEBUG)
report(stdout, GT_("passed through %s matching %s\n"),
cp, idp->id);
- save_str(xmit_names, cp, XMIT_ACCEPT);
+ save_str(xmit_names, (const char *)cp, XMIT_ACCEPT);
accept_count++;
goto nomap;
}
/* return a pointer to the last element of the list to help the quick,
* constant-time addition to the list, NOTE: this function does not dup
* the string, the caller must do that. */
-/*@shared@*/ struct idlist **save_str_quick(/*@shared@*/ struct idlist **idl,
+/*@shared@*/ static struct idlist **save_str_quick(/*@shared@*/ struct idlist **idl,
/*@only@*/ char *str, flag status)
/* save a number/UID pair on the given UID list */
{
}
-int CheckContentType(char *CntType)
+static int CheckContentType(char *CntType)
{
/*
* Static array of Content-Type's for which we will do