[Pkg-wmaker-commits] [wmbiff] 03/09: lots of indent changes and a change to let msglst enable header caching for imap
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:05:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_23
in repository wmbiff.
commit 2ff7fc2e068658b0475b684169373d628cec9c6d
Author: bluehal <bluehal>
Date: Sun Mar 28 00:28:58 2004 +0000
lots of indent changes and a change to let msglst enable header caching for imap
---
wmbiff/Client.h | 13 +++--
wmbiff/Imap4Client.c | 43 +++++++++------
wmbiff/Pop3Client.c | 7 ++-
wmbiff/ShellClient.c | 12 +++--
wmbiff/charutil.c | 7 +--
wmbiff/maildirClient.c | 18 +++----
wmbiff/mboxClient.c | 15 +++---
wmbiff/passwordMgr.c | 39 ++++++++------
wmbiff/regulo.c | 13 +++--
wmbiff/test_tlscomm.c | 15 +++---
wmbiff/tlsComm.c | 24 +++++----
wmbiff/tlsComm.h | 4 +-
wmbiff/wmbiff.c | 141 +++++++++++++++++++++++++++++--------------------
13 files changed, 208 insertions(+), 143 deletions(-)
diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index 7d869d3..8701e5f 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,11 +1,11 @@
-/* $Id: Client.h,v 1.38 2004/01/01 07:47:50 bluehal Exp $ */
+/* $Id: Client.h,v 1.39 2004/03/28 00:28:58 bluehal Exp $ */
/* Author : Scott Holden ( scotth at thezone.net )
Modified : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
*
* Email Checker Pop3/Imap4/Licq/Gicu/mbox/maildir/finger
*
- * Last Updated : $Date: 2004/01/01 07:47:50 $
+ * Last Updated : $Date: 2004/03/28 00:28:58 $
*
*/
@@ -39,9 +39,9 @@ typedef struct _mbox_t {
char path[BUF_BIG]; /* Path to mailbox */
char notify[BUF_BIG]; /* Program to notify mail arrivation */
char action[BUF_BIG]; /* Action to execute on mouse click, reduces to
- * what happens on button1. this is executed after
- * either actionnew or actionnonew (if they are
- * defined in the config file) */
+ * what happens on button1. this is executed after
+ * either actionnew or actionnonew (if they are
+ * defined in the config file) */
char actionnew[BUF_BIG]; /* Action to execute on mouse click when new mail */
char actionnonew[BUF_BIG]; /* Action to execute on mouse click when no new mail */
char actiondc[BUF_BIG]; /* Action to execute when icq is disconnected */
@@ -84,6 +84,9 @@ typedef struct _mbox_t {
unsigned int dossl:1; /* use tls. */
/* prompt the user if we can't login / password is empty */
unsigned int interactive_password:1;
+ /* using the msglst feature, fetch the headers
+ to have them on hand */
+ unsigned int wantCacheHeaders:1;
unsigned char password_len; /* memfrob may shorten passwords */
} pop_imap;
} u;
diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index ba56ac7..a38ef4d 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -328,7 +328,9 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
has occurred; not necessarily complete. */
if (pc->UnreadMsgs != pc->OldUnreadMsgs ||
pc->TotalMsgs != pc->OldMsgs) {
- imap_cacheHeaders(pc);
+ if (PCU.wantCacheHeaders) {
+ imap_cacheHeaders(pc);
+ }
}
} else {
/* something went wrong. bail. */
@@ -338,8 +340,8 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
return 0;
}
-void imap_releaseHeaders(Pop3 pc
- __attribute__ ((unused)), struct msglst *h)
+void
+imap_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h)
{
assert(h != NULL);
/* allow the list to be released next time around */
@@ -418,8 +420,8 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 pc)
} else if (strncasecmp(hdrbuf, "From: ", 5) == 0) {
strncpy(m->from, hdrbuf + 6, FROM_LEN - 1);
m->from[FROM_LEN - 1] = '\0';
- } else if (strncasecmp(hdrbuf, "a04 OK FETCH", 5)
- == 0) {
+ } else if (strncasecmp
+ (hdrbuf, "a04 OK FETCH", 5) == 0) {
/* server says we're done getting this header, which
may occur if the message has no subject */
if (m->from[0] == '\0') {
@@ -438,8 +440,8 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 pc)
strcpy(m->subj, "failure");
}
}
- IMAP_DM(pc, DEBUG_INFO, "From: '%s' Subj: '%s'\n", m->from,
- m->subj);
+ IMAP_DM(pc, DEBUG_INFO, "From: '%s' Subj: '%s'\n",
+ m->from, m->subj);
m->next = pc->headerCache;
pc->headerCache = m;
pc->headerCache->in_use = 0; /* initialize that it isn't locked */
@@ -449,8 +451,9 @@ void imap_cacheHeaders( /*@notnull@ */ Pop3 pc)
if (!fetch_command_done) {
tlscomm_expect(scs, "a04 OK", hdrbuf, 127);
}
- } while ((msgid = strtok(NULL, " \r\n")) != NULL
- && isdigit(msgid[0]));
+ }
+ while ((msgid = strtok(NULL, " \r\n")) != NULL
+ && isdigit(msgid[0]));
tlscomm_printf(scs, "a06 CLOSE\r\n"); /* return to polling state */
/* may be unneeded tlscomm_expect(scs, "a06 OK CLOSE\r\n" ); see if it worked? */
@@ -567,6 +570,13 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
IMAP_DM(pc, DEBUG_INFO, "serverPort= '%d'\n", PCU.serverPort);
IMAP_DM(pc, DEBUG_INFO, "authList= '%s'\n", PCU.authList);
+ if (strcmp(pc->action, "msglst") == 0 ||
+ strcmp(pc->notify, "msglst") == 0 ||
+ strcmp(pc->button2, "msglst") == 0) {
+ PCU.wantCacheHeaders = 1;
+ } else {
+ PCU.wantCacheHeaders = 0;
+ }
pc->checkMail = imap_checkmail;
pc->getHeaders = imap_getHeaders;
pc->releaseHeaders = imap_releaseHeaders;
@@ -617,16 +627,17 @@ static int authenticate_plaintext( /*@notnull@ */ Pop3 pc,
} else {
return (1);
}
- } while (1);
+ }
+ while (1);
plaintext_failed:
return (0);
}
#ifdef HAVE_GCRYPT_H
-static int authenticate_md5(Pop3 pc,
- struct connection_state *scs,
- const char *capabilities)
+static int
+authenticate_md5(Pop3 pc,
+ struct connection_state *scs, const char *capabilities)
{
char buf[BUF_SIZE];
char buf2[BUF_SIZE];
@@ -696,11 +707,11 @@ static void ask_user_for_password( /*@notnull@ */ Pop3 pc, int bFlushCache)
password =
passwordFor(PCU.userName, PCU.serverName, pc, bFlushCache);
if (password != NULL) {
- if (strlen(password)+1 > BUF_SMALL) {
+ if (strlen(password) + 1 > BUF_SMALL) {
DMA(DEBUG_ERROR, "Password is too long.\n");
- memset(PCU.password, 0, BUF_SMALL-1);
+ memset(PCU.password, 0, BUF_SMALL - 1);
} else {
- strncpy(PCU.password, password, BUF_SMALL-1);
+ strncpy(PCU.password, password, BUF_SMALL - 1);
PCU.password_len = strlen(PCU.password);
}
free(password);
diff --git a/wmbiff/Pop3Client.c b/wmbiff/Pop3Client.c
index e29e57e..26d1de9 100644
--- a/wmbiff/Pop3Client.c
+++ b/wmbiff/Pop3Client.c
@@ -1,4 +1,4 @@
-/* $Id: Pop3Client.c,v 1.19 2003/10/29 18:17:08 bluehal Exp $ */
+/* $Id: Pop3Client.c,v 1.20 2004/03/28 00:28:58 bluehal Exp $ */
/* Author : Scott Holden ( scotth at thezone.net )
Modified : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
@@ -254,9 +254,8 @@ int pop3Create(Pop3 pc, const char *str)
#ifdef HAVE_GCRYPT_H
-static FILE *authenticate_md5(Pop3 pc,
- FILE * fp,
- char *apop_str __attribute__ ((unused)))
+static FILE *authenticate_md5(Pop3 pc, FILE * fp, char *apop_str
+ __attribute__ ((unused)))
{
char buf[BUF_SIZE];
char buf2[BUF_SIZE];
diff --git a/wmbiff/ShellClient.c b/wmbiff/ShellClient.c
index e2d681a..5543832 100644
--- a/wmbiff/ShellClient.c
+++ b/wmbiff/ShellClient.c
@@ -245,8 +245,9 @@ struct msglst *shell_getHeaders( /*@notnull@ */ Pop3 pc)
}
return message_list;
}
-void shell_releaseHeaders(Pop3 pc
- __attribute__ ((unused)), struct msglst *h)
+
+void
+shell_releaseHeaders(Pop3 pc __attribute__ ((unused)), struct msglst *h)
{
for (; h != NULL;) {
struct msglst *n = h->next;
@@ -289,11 +290,12 @@ int shellCreate( /*@notnull@ */ Pop3 pc, const char *str)
SH_DM(pc, DEBUG_INFO, "path= '%s'\n", commandline);
{
char *tmp = strdup(commandline);
- if (strlen(tmp)+1 > BUF_BIG) {
- SH_DM(pc, DEBUG_ERROR, "commandline '%s' is too long.\n", commandline);
+ if (strlen(tmp) + 1 > BUF_BIG) {
+ SH_DM(pc, DEBUG_ERROR, "commandline '%s' is too long.\n",
+ commandline);
memset(pc->path, 0, BUF_BIG);
} else {
- strcpy(pc->path, tmp);
+ strcpy(pc->path, tmp);
}
free(tmp);
}
diff --git a/wmbiff/charutil.c b/wmbiff/charutil.c
index 12c5fa7..ba79a78 100644
--- a/wmbiff/charutil.c
+++ b/wmbiff/charutil.c
@@ -1,4 +1,4 @@
-/* $Id: charutil.c,v 1.16 2003/11/08 22:58:54 bluehal Exp $ */
+/* $Id: charutil.c,v 1.17 2004/03/28 00:28:58 bluehal Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -157,8 +157,9 @@ void Decode_Base64(char *src, char *dst)
}
/* helper function for the configuration line parser */
-void copy_substring(char *destination,
- int startidx, int endidx, const char *source)
+void
+copy_substring(char *destination,
+ int startidx, int endidx, const char *source)
{
if (startidx > -1) {
strncpy(destination, source + startidx, endidx - startidx);
diff --git a/wmbiff/maildirClient.c b/wmbiff/maildirClient.c
index f68d0c1..f2e5349 100644
--- a/wmbiff/maildirClient.c
+++ b/wmbiff/maildirClient.c
@@ -1,11 +1,11 @@
-/* $Id: maildirClient.c,v 1.14 2004/01/01 07:47:50 bluehal Exp $ */
+/* $Id: maildirClient.c,v 1.15 2004/03/28 00:28:58 bluehal Exp $ */
/* Author : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
Modified : Dwayne C. Litzenberger ( dlitz at dlitz.net )
*
* Maildir checker.
*
- * Last Updated : $Date: 2004/01/01 07:47:50 $
+ * Last Updated : $Date: 2004/03/28 00:28:58 $
*
*/
@@ -55,7 +55,7 @@ int maildirCheckHistory(Pop3 pc)
struct stat st_new;
struct stat st_cur;
struct utimbuf ut;
- char path_new[BUF_BIG*2], path_cur[BUF_BIG*2];
+ char path_new[BUF_BIG * 2], path_cur[BUF_BIG * 2];
int count_new = 0, count_cur = 0;
@@ -69,7 +69,7 @@ int maildirCheckHistory(Pop3 pc)
if (pc->u.maildir.dircache_flush) {
/* hack to clear directory cache for network-mounted maildirs */
int fd;
- char path_newtmp[BUF_BIG*2+32];
+ char path_newtmp[BUF_BIG * 2 + 32];
strcpy(path_newtmp, path_new);
strcat(path_newtmp, ".wmbiff.dircache_flush.XXXXXX");
if ((fd = mkstemp(path_newtmp)) >= 0) {
@@ -77,8 +77,8 @@ int maildirCheckHistory(Pop3 pc)
unlink(path_newtmp);
} else {
DM(pc, DEBUG_ERROR,
- "Can't create dircache flush file '%s': %s\n", path_newtmp,
- strerror(errno));
+ "Can't create dircache flush file '%s': %s\n",
+ path_newtmp, strerror(errno));
}
}
@@ -164,11 +164,11 @@ int maildirCreate(Pop3 pc, const char *str)
} else {
i = 0;
}
- if (strlen(str+8+i)+1 > BUF_BIG) {
- DM(pc, DEBUG_ERROR, "maildir '%s' is too long.\n", str+8+i);
+ if (strlen(str + 8 + i) + 1 > BUF_BIG) {
+ DM(pc, DEBUG_ERROR, "maildir '%s' is too long.\n", str + 8 + i);
memset(pc->path, 0, BUF_BIG);
} else {
- strncpy(pc->path, str + 8 + i, BUF_BIG-1); /* cut off ``maildir:'' */
+ strncpy(pc->path, str + 8 + i, BUF_BIG - 1); /* cut off ``maildir:'' */
}
DM(pc, DEBUG_INFO, "maildir: str = '%s'\n", str);
diff --git a/wmbiff/mboxClient.c b/wmbiff/mboxClient.c
index f8b907e..febff7f 100644
--- a/wmbiff/mboxClient.c
+++ b/wmbiff/mboxClient.c
@@ -1,4 +1,4 @@
-/* $Id: mboxClient.c,v 1.16 2004/01/01 07:47:50 bluehal Exp $ */
+/* $Id: mboxClient.c,v 1.17 2004/03/28 00:28:58 bluehal Exp $ */
/* Author: Yong-iL Joh <tolkien at mizi.com>
Modified: Jorge Garc�a <Jorge.Garcia at uv.es>
Rob Funk <rfunk at funknet.net>
@@ -6,7 +6,7 @@
*
* MBOX checker.
*
- * Last Updated : $Date: 2004/01/01 07:47:50 $
+ * Last Updated : $Date: 2004/03/28 00:28:58 $
*
*/
@@ -87,8 +87,9 @@ static void countMessages(Pop3 pc, const char *mbox_filename)
/* check file status; hold on to file information used
to restore access time */
-int fileHasChanged(const char *mbox_filename, time_t * atime,
- time_t * mtime, off_t * size)
+int
+fileHasChanged(const char *mbox_filename, time_t * atime,
+ time_t * mtime, off_t * size)
{
struct stat st;
@@ -144,11 +145,11 @@ int mboxCreate(Pop3 pc, const char *str)
/* default boxes are mbox... cut mbox: if it exists */
if (!strncasecmp(pc->path, "mbox:", 5)) {
- if (strlen(str+5)+1 > BUF_BIG) {
- DM(pc, DEBUG_ERROR, "mbox '%s' is too long.\n", str+5);
+ if (strlen(str + 5) + 1 > BUF_BIG) {
+ DM(pc, DEBUG_ERROR, "mbox '%s' is too long.\n", str + 5);
memset(pc->path, 0, BUF_BIG);
} else {
- strncpy(pc->path, str + 5, BUF_BIG-1); /* cut off ``mbox:'' */
+ strncpy(pc->path, str + 5, BUF_BIG - 1); /* cut off ``mbox:'' */
}
}
diff --git a/wmbiff/passwordMgr.c b/wmbiff/passwordMgr.c
index a23ea80..120df4c 100644
--- a/wmbiff/passwordMgr.c
+++ b/wmbiff/passwordMgr.c
@@ -50,7 +50,7 @@ typedef struct password_binding_struct {
struct password_binding_struct *next;
char user[BUF_SMALL];
char server[BUF_BIG];
- char password[BUF_SMALL]; /* may be frobnicated */
+ char password[BUF_SMALL]; /* may be frobnicated */
unsigned char password_len; /* frobnicated *'s are nulls */
} *password_binding;
@@ -73,7 +73,10 @@ int permissions_ok(Pop3 pc, const char *askpass_fname)
if (stat(askpass_fname, &st)) {
DM(pc, DEBUG_ERROR, "Can't stat askpass program: '%s'\n",
askpass_fname);
- DM(pc, DEBUG_ERROR, "For your own good, use a full pathname.\n");
+ if (askpass_fname[0] != '/') {
+ DM(pc, DEBUG_ERROR,
+ "For your own good, use a full pathname.\n");
+ }
return (0);
}
if (st.st_uid != 0 && st.st_uid != getuid()) {
@@ -106,11 +109,12 @@ int permissions_ok(Pop3 pc, const char *askpass_fname)
#include<CoreServices/CoreServices.h>
#include<Security/Security.h>
-static void get_password_from_keychain(Pop3 pc, const char *username,
- const char *servername,
- /*@out@ */ char *password,
- /*@out@ */
- unsigned char *password_len)
+static void
+get_password_from_keychain(Pop3 pc, const char *username,
+ const char *servername,
+ /*@out@ */ char *password,
+ /*@out@ */
+ unsigned char *password_len)
{
SecKeychainRef kc;
OSStatus rc;
@@ -150,11 +154,12 @@ static void get_password_from_keychain(Pop3 pc, const char *username,
#endif /* apple keychain */
-static void get_password_from_command(Pop3 pc, const char *username,
- const char *servername,
- /*@out@ */ char *password,
- /*@out@ */
- unsigned char *password_len)
+static void
+get_password_from_command(Pop3 pc, const char *username,
+ const char *servername,
+ /*@out@ */ char *password,
+ /*@out@ */
+ unsigned char *password_len)
{
password[*password_len - 1] = '\0';
password[0] = '\0';
@@ -197,8 +202,10 @@ static void get_password_from_command(Pop3 pc, const char *username,
password[*password_len - 1] = '\0';
*password_len = strlen(password);
} else {
+ /* consider this error to be particularly troublesome */
DM(pc, DEBUG_ERROR,
"passmgr: permissions check of '%s' failed.", pc->askpass);
+ exit(EXIT_FAILURE);
}
}
@@ -260,17 +267,17 @@ char *passwordFor(const char *username,
}
#endif
retval = strdup(p->password);
- if (strlen(username)+1 > BUF_SMALL) {
+ if (strlen(username) + 1 > BUF_SMALL) {
DM(pc, DEBUG_ERROR, "username is too long.\n");
memset(p->user, 0, BUF_SMALL);
} else {
- strncpy(p->user, username, BUF_SMALL-1);
+ strncpy(p->user, username, BUF_SMALL - 1);
}
- if (strlen(servername)+1 > BUF_BIG) {
+ if (strlen(servername) + 1 > BUF_BIG) {
DM(pc, DEBUG_ERROR, "servername is too long.\n");
memset(p->server, 0, BUF_BIG);
} else {
- strncpy(p->server, servername, BUF_BIG-1);
+ strncpy(p->server, servername, BUF_BIG - 1);
}
ENFROB(p->password);
p->next = pass_list;
diff --git a/wmbiff/regulo.c b/wmbiff/regulo.c
index 6b6342b..507cd19 100644
--- a/wmbiff/regulo.c
+++ b/wmbiff/regulo.c
@@ -24,10 +24,12 @@ void regulo_atoi(void *dest_int, const char *source)
*(int *) dest_int = atoi(source);
}
+
void regulo_strcpy(void *dest, const char *source)
{
strcpy((char *) dest, source);
}
+
void regulo_strcpy_tolower(void *dest, const char *source)
{
unsigned int i;
@@ -36,6 +38,7 @@ void regulo_strcpy_tolower(void *dest, const char *source)
}
((char *) dest)[i] = '\0';
}
+
void regulo_strcpy_skip1(void *dest, const char *source)
{
strcpy((char *) dest, source + 1);
@@ -44,8 +47,9 @@ void regulo_strcpy_skip1(void *dest, const char *source)
#ifdef USE_GNU_REGEX
/* deprecated as unportable */
-int regulo_match(const char *regex,
- const char *string, const struct regulo *instructions)
+int
+regulo_match(const char *regex,
+ const char *string, const struct regulo *instructions)
{
struct re_registers regs;
int ret;
@@ -99,8 +103,9 @@ int compile_and_match_regex_posix(const char *regex, const char *str, /*@out@ */
}
-int regulo_match(const char *regex,
- const char *string, const struct regulo *instructions)
+int
+regulo_match(const char *regex,
+ const char *string, const struct regulo *instructions)
{
regmatch_t regs[20];
int ret;
diff --git a/wmbiff/test_tlscomm.c b/wmbiff/test_tlscomm.c
index a439373..e0a6fa2 100644
--- a/wmbiff/test_tlscomm.c
+++ b/wmbiff/test_tlscomm.c
@@ -12,6 +12,7 @@ int exists(const char *filename __attribute__ ((unused)))
{
return (0);
}
+
int print_info(void *state __attribute__ ((unused)))
{
return (0);
@@ -44,10 +45,11 @@ ssize_t read(int s, void *buf, size_t buflen)
}
}
-int select(int nfds, fd_set * r,
- fd_set * w __attribute__ ((unused)),
- fd_set * x __attribute__ ((unused)),
- struct timeval *tv __attribute__ ((unused)))
+int
+select(int nfds, fd_set * r,
+ fd_set * w __attribute__ ((unused)),
+ fd_set * x __attribute__ ((unused)),
+ struct timeval *tv __attribute__ ((unused)))
{
int i;
int ready = 0;
@@ -75,8 +77,9 @@ struct connection_state {
void *pc; /* mailbox handle for debugging messages */
};
-int main(int argc __attribute__ ((unused)),
- char **argv __attribute__ ((unused)))
+int
+main(int argc __attribute__ ((unused)), char **argv
+ __attribute__ ((unused)))
{
char buf[255];
struct connection_state scs;
diff --git a/wmbiff/tlsComm.c b/wmbiff/tlsComm.c
index 52717a0..272b296 100644
--- a/wmbiff/tlsComm.c
+++ b/wmbiff/tlsComm.c
@@ -70,8 +70,8 @@ struct connection_state {
};
/* gotta do our own line buffering, sigh */
-int
-getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen);
+int getline_from_buffer(char *readbuffer, char *linebuffer,
+ int linebuflen);
void handle_gnutls_read_error(int readbytes, struct connection_state *scs);
void tlscomm_close(struct connection_state *scs)
@@ -110,7 +110,8 @@ static int wait_for_it(int sd, int timeoutseconds)
FD_SET(sd, &readfds);
do {
ready_descriptors = select(sd + 1, &readfds, NULL, NULL, &tv);
- } while (ready_descriptors == -1 && errno == EINTR);
+ }
+ while (ready_descriptors == -1 && errno == EINTR);
if (ready_descriptors == 0) {
DMA(DEBUG_INFO,
"select timed out after %d seconds on socket: %d\n",
@@ -176,8 +177,9 @@ getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen)
/* the correct response to a return value of 0 is almost
certainly tlscomm_close(scs): don't _expect() anything
unless anything else would represent failure */
-int tlscomm_expect(struct connection_state *scs,
- const char *prefix, char *linebuf, int buflen)
+int
+tlscomm_expect(struct connection_state *scs,
+ const char *prefix, char *linebuf, int buflen)
{
int prefixlen = (int) strlen(prefix);
int readbytes = 0;
@@ -208,8 +210,8 @@ int tlscomm_expect(struct connection_state *scs,
read(scs->sd, &scs->unprocessed[readbytes],
BUF_SIZE - 1 - readbytes);
if (thisreadbytes < 0) {
- TDM(DEBUG_ERROR, "%s: error reading: %s\n", scs->name,
- strerror(errno));
+ TDM(DEBUG_ERROR, "%s: error reading: %s\n",
+ scs->name, strerror(errno));
return 0;
}
}
@@ -312,8 +314,9 @@ bad_certificate(const struct connection_state *scs, const char *msg)
gnutls to make this as easy as it should be, or someone
to port Andrew McDonald's gnutls-for-mutt patch.
*/
-int tls_check_certificate(struct connection_state *scs,
- const char *remote_hostname)
+int
+tls_check_certificate(struct connection_state *scs,
+ const char *remote_hostname)
{
GNUTLS_CertificateStatus certstat;
const gnutls_datum *cert_list;
@@ -448,7 +451,8 @@ struct connection_state *initialize_gnutls(int sd, char *name, Pop3 pc,
(gnutls_transport_ptr) sd);
do {
zok = gnutls_handshake(scs->tls_state);
- } while (zok == GNUTLS_E_INTERRUPTED || zok == GNUTLS_E_AGAIN);
+ }
+ while (zok == GNUTLS_E_INTERRUPTED || zok == GNUTLS_E_AGAIN);
tls_check_certificate(scs, remote_hostname);
}
diff --git a/wmbiff/tlsComm.h b/wmbiff/tlsComm.h
index 0ef47d8..eb24f7c 100644
--- a/wmbiff/tlsComm.h
+++ b/wmbiff/tlsComm.h
@@ -55,5 +55,5 @@ int tlscomm_expect(struct connection_state *scs, const char *prefix,
void tlscomm_close( /*@only@ */ struct connection_state *scs);
/* internal function exported for testing */
-int
-getline_from_buffer(char *readbuffer, char *linebuffer, int linebuflen);
+int getline_from_buffer(char *readbuffer, char *linebuffer,
+ int linebuflen);
diff --git a/wmbiff/wmbiff.c b/wmbiff/wmbiff.c
index 80ee84b..1e80124 100644
--- a/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff.c
@@ -1,4 +1,4 @@
-/* $Id: wmbiff.c,v 1.60 2004/01/01 07:47:50 bluehal Exp $ */
+/* $Id: wmbiff.c,v 1.61 2004/03/28 00:28:58 bluehal Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -92,7 +92,8 @@ extern Window iconwin;
Cursor busy_cursor, ready_cursor;
-static __inline /*@out@ */ void *malloc_ordie(size_t len)
+static __inline /*@out@ */ void *
+malloc_ordie(size_t len)
{
void *ret = malloc(len);
if (ret == NULL) {
@@ -303,69 +304,87 @@ static int Read_Config_File(char *filename, int *loopinterval)
/* now only local settings */
if (!strcmp(setting, "label.")) {
- if (strlen(value)+1 > BUF_SMALL) {
- DMA(DEBUG_ERROR, "Mailbox %i label string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_SMALL) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i label string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].label, value, BUF_SMALL-1);
+ strncpy(mbox[mbox_index].label, value, BUF_SMALL - 1);
}
} else if (!strcmp(setting, "path.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i path string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i path string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].path, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].path, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "notify.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i notify string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i notify string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].notify, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].notify, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "action.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i action string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i action string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].action, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].action, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "action_disconnected.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i action_disconnected string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i action_disconnected string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].actiondc, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].actiondc, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "action_new_mail.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i action_new_mail string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i action_new_mail string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].actionnew, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].actionnew, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "action_no_new_mail.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i action_no_new_mail string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i action_no_new_mail string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].actionnonew, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].actionnonew, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "interval.")) {
mbox[mbox_index].loopinterval = atoi(value);
} else if (!strcmp(setting, "buttontwo.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i buttontwo string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i buttontwo string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].button2, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].button2, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "fetchcmd.")) {
- if (strlen(value)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "Mailbox %i fetchcmd string '%s' is too long.\n", mbox_index, value);
- continue;
+ if (strlen(value) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "Mailbox %i fetchcmd string '%s' is too long.\n",
+ mbox_index, value);
+ continue;
} else {
- strncpy(mbox[mbox_index].fetchcmd, value, BUF_BIG-1);
+ strncpy(mbox[mbox_index].fetchcmd, value, BUF_BIG - 1);
}
} else if (!strcmp(setting, "fetchinterval.")) {
mbox[mbox_index].fetchinterval = atoi(value);
@@ -436,20 +455,22 @@ static void init_biff(char *config_file)
/* setup defaults if there's no config */
if ((m = getenv("MAIL")) != NULL) {
/* we are using MAIL environment var. type mbox */
- if (strlen(m)+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "MAIL environment var '%s' is too long.\n", m);
+ if (strlen(m) + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "MAIL environment var '%s' is too long.\n", m);
} else {
- DMA(DEBUG_INFO, "Using MAIL environment var '%s'.\n", m);
- strncpy(mbox[0].path, m, BUF_BIG-1);
+ DMA(DEBUG_INFO, "Using MAIL environment var '%s'.\n", m);
+ strncpy(mbox[0].path, m, BUF_BIG - 1);
}
} else if ((m = getenv("USER")) != NULL) {
/* we are using MAIL environment var. type mbox */
- if (strlen(m)+10+1 > BUF_BIG) {
- DMA(DEBUG_ERROR, "USER environment var '%s' is too long.\n", m);
+ if (strlen(m) + 10 + 1 > BUF_BIG) {
+ DMA(DEBUG_ERROR,
+ "USER environment var '%s' is too long.\n", m);
} else {
- DMA(DEBUG_INFO, "Using /var/mail/%s.\n", m);
- strcpy(mbox[0].path, "/var/mail/");
- strncat(mbox[0].path, m, BUF_BIG-1-10);
+ DMA(DEBUG_INFO, "Using /var/mail/%s.\n", m);
+ strcpy(mbox[0].path, "/var/mail/");
+ strncat(mbox[0].path, m, BUF_BIG - 1 - 10);
}
} else {
DMA(DEBUG_ERROR, "Cannot open config file '%s' nor use the "
@@ -1103,11 +1124,15 @@ static void do_biff(int argc, const char **argv)
}
/* do we need to run an extra action? */
if (mbox[but_released_region].UnreadMsgs == -1) {
- extra_click_action = mbox[but_released_region].actiondc;
- } else if (mbox[but_released_region].UnreadMsgs > 0) {
- extra_click_action = mbox[but_released_region].actionnew;
+ extra_click_action =
+ mbox[but_released_region].actiondc;
+ } else if (mbox[but_released_region].
+ UnreadMsgs > 0) {
+ extra_click_action =
+ mbox[but_released_region].actionnew;
} else {
- extra_click_action = mbox[but_released_region].actionnonew;
+ extra_click_action =
+ mbox[but_released_region].actionnonew;
}
click_action = mbox[but_released_region].action;
break;
@@ -1121,12 +1146,15 @@ static void do_biff(int argc, const char **argv)
click_action = NULL;
break;
}
- if (extra_click_action != NULL && extra_click_action[0] != 0 &&
- strcmp(extra_click_action, "msglst")) {
- DM(&mbox[but_released_region], DEBUG_INFO, "runing: %s", extra_click_action);
+ if (extra_click_action != NULL
+ && extra_click_action[0] != 0
+ && strcmp(extra_click_action, "msglst")) {
+ DM(&mbox[but_released_region], DEBUG_INFO,
+ "runing: %s", extra_click_action);
(void) execCommand(extra_click_action);
}
- if (click_action != NULL && click_action[0] != '\0'
+ if (click_action != NULL
+ && click_action[0] != '\0'
&& strcmp(click_action, "msglst")) {
DM(&mbox[but_released_region], DEBUG_INFO,
"running: %s", click_action);
@@ -1143,7 +1171,8 @@ static void do_biff(int argc, const char **argv)
}
}
XSleep(Sleep_Interval);
- } while (forever); /* forever is usually true,
+ }
+ while (forever); /* forever is usually true,
but not when debugging with -exit */
if (skin_xpm != NULL && skin_xpm != wmbiff_master_xpm) {
free(skin_xpm); // added 3 jul 02, appeasing valgrind
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list