summaryrefslogtreecommitdiff
path: root/imap/src/osdep
diff options
context:
space:
mode:
Diffstat (limited to 'imap/src/osdep')
-rw-r--r--imap/src/osdep/unix/dummy.c16
-rw-r--r--imap/src/osdep/unix/env_unix.c12
-rw-r--r--imap/src/osdep/unix/fdstring.c2
-rw-r--r--imap/src/osdep/unix/mbx.c26
-rw-r--r--imap/src/osdep/unix/mh.c40
-rw-r--r--imap/src/osdep/unix/mix.c68
-rw-r--r--imap/src/osdep/unix/mmdf.c37
-rw-r--r--imap/src/osdep/unix/mtx.c13
-rw-r--r--imap/src/osdep/unix/mx.c34
-rw-r--r--imap/src/osdep/unix/news.c16
-rw-r--r--imap/src/osdep/unix/nl_unix.c2
-rw-r--r--imap/src/osdep/unix/phile.c6
-rw-r--r--imap/src/osdep/unix/tcp_unix.c12
-rw-r--r--imap/src/osdep/unix/tenex.c13
-rw-r--r--imap/src/osdep/unix/unix.c24
15 files changed, 163 insertions, 158 deletions
diff --git a/imap/src/osdep/unix/dummy.c b/imap/src/osdep/unix/dummy.c
index cb3b45bd..07ed4618 100644
--- a/imap/src/osdep/unix/dummy.c
+++ b/imap/src/osdep/unix/dummy.c
@@ -156,7 +156,7 @@ void dummy_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents)
if (!pat || !*pat) { /* empty pattern? */
if (dummy_canonicalize (test,ref,"*")) {
/* tie off name at root */
- if (s = strchr (test,'/')) *++s = '\0';
+ if ((s = strchr (test,'/')) != NULL) *++s = '\0';
else test[0] = '\0';
dummy_listed (stream,'/',test,LATT_NOSELECT,NIL);
}
@@ -164,13 +164,13 @@ void dummy_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents)
/* get canonical form of name */
else if (dummy_canonicalize (test,ref,pat)) {
/* found any wildcards? */
- if (s = strpbrk (test,"%*")) {
+ if ((s = strpbrk (test,"%*")) != NULL) {
/* yes, copy name up to that point */
strncpy (file,test,i = s - test);
file[i] = '\0'; /* tie off */
}
else strcpy (file,test); /* use just that name then */
- if (s = strrchr (file,'/')){/* find directory name */
+ if ((s = strrchr (file,'/')) != NULL){/* find directory name */
*++s = '\0'; /* found, tie off at that point */
s = file;
}
@@ -228,7 +228,7 @@ void dummy_lsub (MAILSTREAM *stream,char *ref,char *pat)
}
}
/* until no more subscriptions */
- while (s = sm_read (tmpx,&sdb));
+ while ((s = sm_read (tmpx,&sdb)) != NULL);
}
@@ -277,7 +277,7 @@ void dummy_list_work (MAILSTREAM *stream,char *dir,char *pat,char *contents,
size_t len = 0;
/* punt if bogus name */
if (!mailboxdir (tmp,dir,NIL)) return;
- if (dp = opendir (tmp)) { /* do nothing if can't open directory */
+ if ((dp = opendir (tmp)) != NULL) { /* do nothing if can't open directory */
/* see if a non-namespace directory format */
for (drivers = (DRIVER *) mail_parameters (NIL,GET_DRIVERS,NIL), dt = NIL;
dir && !dt && drivers; drivers = drivers->next)
@@ -289,7 +289,7 @@ void dummy_list_work (MAILSTREAM *stream,char *dir,char *pat,char *contents,
dummy_listed (stream,'/',dir,dt ? NIL : LATT_NOSELECT,contents);
/* scan directory, ignore . and .. */
- if (!dir || dir[(len = strlen (dir)) - 1] == '/') while (d = readdir (dp))
+ if (!dir || dir[(len = strlen (dir)) - 1] == '/') while ((d = readdir (dp)) != NULL)
if ((!(dt && (*dt) (d->d_name))) &&
((d->d_name[0] != '.') ||
(((long) mail_parameters (NIL,GET_HIDEDOTFILES,NIL)) ? NIL :
@@ -480,7 +480,7 @@ long dummy_create_path (MAILSTREAM *stream,char *path,long dirmode)
int wantdir = t && !t[1];
int mask = umask (0);
if (wantdir) *t = '\0'; /* flush trailing delimiter for directory */
- if (s = strrchr (path,'/')) { /* found superior to this name? */
+ if ((s = strrchr (path,'/')) != NULL) { /* found superior to this name? */
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -798,7 +798,7 @@ long dummy_canonicalize (char *tmp,char *ref,char *pat)
else return NIL; /* unknown namespace */
}
/* count wildcards */
- for (i = 0, s = tmp; *s; *s++) if ((*s == '*') || (*s == '%')) ++i;
+ for (i = 0, s = tmp; *s; s++) if ((*s == '*') || (*s == '%')) ++i;
if (i > MAXWILDCARDS) { /* ridiculous wildcarding? */
MM_LOG ("Excessive wildcards in LIST/LSUB",ERROR);
return NIL;
diff --git a/imap/src/osdep/unix/env_unix.c b/imap/src/osdep/unix/env_unix.c
index d1bb1f02..89e50921 100644
--- a/imap/src/osdep/unix/env_unix.c
+++ b/imap/src/osdep/unix/env_unix.c
@@ -514,7 +514,7 @@ static void do_date (char *date,char *prefix,char *fmt,int suffix)
* -1 local time is 1 day behind UTC, offset -24 hours
* -36x local time is January 1, UTC is December 31, offset +24 hours
*/
- if (julian = t->tm_yday -julian)
+ if ((julian = t->tm_yday -julian) != 0)
zone += ((julian < 0) == (abs (julian) == 1)) ? -24*60 : 24*60;
if (prefix) { /* want day of week? */
sprintf (date,prefix,days[t->tm_wday]);
@@ -672,14 +672,14 @@ static struct passwd *valpwd (char *user,char *pwd,int argc,char *argv[])
struct passwd *pw;
struct passwd *ret = NIL;
if (auth_md5.server) { /* using CRAM-MD5 authentication? */
- if (s = auth_md5_pwd (user)) {
+ if ((s = auth_md5_pwd (user)) != NULL) {
if (!strcmp (s,pwd) || ((*pwd == ' ') && pwd[1] && !strcmp (s,pwd+1)))
ret = pwuser (user); /* validated, get passwd entry for user */
memset (s,0,strlen (s)); /* erase sensitive information */
fs_give ((void **) &s);
}
}
- else if (pw = pwuser (user)) {/* can get user? */
+ else if ((pw = pwuser (user)) != NULL) {/* can get user? */
s = cpystr (pw->pw_name); /* copy returned name in case we need it */
if (*pwd && !(ret = checkpw (pw,pwd,argc,argv)) &&
(*pwd == ' ') && pwd[1] && (ret = pwuser (s)))
@@ -1257,7 +1257,7 @@ long dotlock_lock (char *file,DOTLOCK *base,int fd)
MM_NOCRITICAL (NIL); /* no longer critical */
/* find directory/file delimiter */
- if (s = strrchr (base->lock,'/')) {
+ if ((s = strrchr (base->lock,'/')) != NULL) {
*s = '\0'; /* tie off at directory */
sprintf(tmp, /* generate default message */
"Mailbox vulnerable - directory %.80s must have 1777 protection",
@@ -1588,7 +1588,7 @@ void dorc (char *file,long flag)
if (!compare_cstring (s,"set new-mailbox-format") ||
!compare_cstring (s,"set new-folder-format")) {
if (!compare_cstring (k,"same-as-inbox")) {
- if (d = mail_valid (NIL,"INBOX",NIL)) {
+ if ((d = mail_valid (NIL,"INBOX",NIL)) != NULL) {
if (!compare_cstring (d->name,"mbox"))
d = (DRIVER *) mail_parameters (NIL,GET_DRIVER,
(void *) "unix");
@@ -1601,7 +1601,7 @@ void dorc (char *file,long flag)
else { /* canonicalize mbox to unix */
if (!compare_cstring (k,"mbox")) k = "unix";
/* see if a driver name */
- if (d = (DRIVER *) mail_parameters (NIL,GET_DRIVER,(void *) k))
+ if ((d = (DRIVER *) mail_parameters (NIL,GET_DRIVER,(void *) k)) != NULL)
createProto = (*d->open) (NIL);
else { /* duh... */
sprintf (tmpx,"Unknown new mailbox format in %s: %s",
diff --git a/imap/src/osdep/unix/fdstring.c b/imap/src/osdep/unix/fdstring.c
index 7a491f7d..207e4d0b 100644
--- a/imap/src/osdep/unix/fdstring.c
+++ b/imap/src/osdep/unix/fdstring.c
@@ -91,7 +91,7 @@ static void fd_string_setpos (STRING *s,unsigned long i)
s->offset = i; /* set new offset */
s->curpos = s->chunk; /* reset position */
/* set size of data */
- if (s->cursize = min (s->chunksize,SIZE (s))) {
+ if ((s->cursize = min (s->chunksize,SIZE (s))) != 0L) {
/* move to that position in the file */
lseek ((long) s->data,s->data1 + s->offset,L_SET);
read ((long) s->data,s->curpos,(size_t) s->cursize);
diff --git a/imap/src/osdep/unix/mbx.c b/imap/src/osdep/unix/mbx.c
index dc902b20..18c4fa20 100644
--- a/imap/src/osdep/unix/mbx.c
+++ b/imap/src/osdep/unix/mbx.c
@@ -477,7 +477,7 @@ long mbx_rename (MAILSTREAM *stream,char *old,char *newname)
if (newname) { /* want rename? */
/* found superior to destination name? */
- if (s = strrchr (tmp,'/')) {
+ if ((s = strrchr (tmp,'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* superior name doesn't exist, create it */
@@ -822,11 +822,11 @@ long mbx_ping (MAILSTREAM *stream)
/* reparse header if not flagchecking */
if (!LOCAL->flagcheck) ret = mbx_parse (stream);
/* sweep mailbox for changed message status */
- else if (ret = mbx_parse (stream)) {
+ else if ((ret = mbx_parse (stream)) != 0L) {
unsigned long recent = 0;
LOCAL->filetime = sbuf.st_mtime;
for (i = 1; i <= stream->nmsgs; )
- if (elt = mbx_elt (stream,i,LOCAL->expok)) {
+ if ((elt = mbx_elt (stream,i,LOCAL->expok)) != NULL) {
if (elt->recent) ++recent;
++i;
}
@@ -885,14 +885,14 @@ long mbx_expunge (MAILSTREAM *stream,char *sequence,long options)
{
long ret;
unsigned long nexp,reclaimed;
- if (ret = sequence ? ((options & EX_UID) ?
+ if ((ret = sequence ? ((options & EX_UID) ?
mail_uid_sequence (stream,sequence) :
- mail_sequence (stream,sequence)) : LONGT) {
+ mail_sequence (stream,sequence)) : LONGT) != 0L) {
if (!mbx_ping (stream)); /* do nothing if stream dead */
else if (stream->rdonly) /* won't do on readonly files! */
MM_LOG ("Expunge ignored on readonly mailbox",WARN);
/* if expunged any messages */
- else if (nexp = mbx_rewrite (stream,&reclaimed,sequence ? -1 : 1)) {
+ else if ((nexp = mbx_rewrite (stream,&reclaimed,sequence ? -1 : 1)) != 0L){
sprintf (LOCAL->buf,"Expunged %lu messages",nexp);
MM_LOG (LOCAL->buf,(long) NIL);
}
@@ -935,7 +935,7 @@ void mbx_snarf (MAILSTREAM *stream)
hdr = cpystr (mail_fetchheader_full (sysibx,i,NIL,&hdrlen,NIL));
txt = mail_fetchtext_full (sysibx,i,&txtlen,FT_PEEK);
/* if have a message */
- if (j = hdrlen + txtlen) {
+ if ((j = hdrlen + txtlen) != 0L){
/* build header line */
mail_date (LOCAL->buf,elt = mail_elt (sysibx,i));
sprintf (LOCAL->buf + strlen (LOCAL->buf),
@@ -1032,7 +1032,7 @@ long mbx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
mail_date(LOCAL->buf,elt);/* build target header */
/* get target keyword mask */
for (j = elt->user_flags, k = 0; j; )
- if (s = stream->user_flags[find_rightmost_bit (&j)])
+ if ((s = stream->user_flags[find_rightmost_bit (&j)]) != NULL)
for (m = 0; (m < NUSERFLAGS) && (t = dstream->user_flags[m]); m++)
if (!compare_cstring (s,t) && (k |= 1 << m)) break;
sprintf (LOCAL->buf+strlen(LOCAL->buf),",%lu;%08lx%04x-%08lx\015\012",
@@ -1041,7 +1041,7 @@ long mbx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
(fFLAGGED * elt->flagged) + (fANSWERED * elt->answered) +
(fDRAFT * elt->draft)),cu ? ++dstream->uid_last : 0);
/* write target header */
- if (ret = (write (fd,LOCAL->buf,strlen (LOCAL->buf)) > 0)) {
+ if ((ret = (write (fd,LOCAL->buf,strlen (LOCAL->buf)) > 0)) != 0L) {
for (k = elt->rfc822_size; ret && (j = min (k,LOCAL->buflen)); k -= j){
read (LOCAL->fd,LOCAL->buf,j);
ret = write (fd,LOCAL->buf,j) >= 0;
@@ -1641,7 +1641,7 @@ unsigned long mbx_hdrpos (MAILSTREAM *stream,unsigned long msgno,
elt->private.special.text.size;
if (hdr) *hdr = NIL; /* assume no header returned */
/* is header size known? */
- if (*size = elt->private.msg.header.text.size) return ret;
+ if ((*size = elt->private.msg.header.text.size) != 0L) return ret;
/* paranoia check */
if (LOCAL->buflen < (HDRBUFLEN + SLOP))
fatal ("LOCAL->buf smaller than HDRBUFLEN");
@@ -1733,7 +1733,7 @@ unsigned long mbx_rewrite (MAILSTREAM *stream,unsigned long *reclaimed,
MM_CRITICAL (stream); /* go critical */
for (i = 1,delta = 0,pos = ppos = HDRSIZE; i <= stream->nmsgs; ) {
/* note if message not at predicted location */
- if (m = (elt = mbx_elt (stream,i,NIL))->private.special.offset - ppos) {
+ if ((m = (elt = mbx_elt (stream,i,NIL))->private.special.offset - ppos) != 0L) {
ppos = elt->private.special.offset;
*reclaimed += m; /* note reclaimed message space */
delta += m; /* and as expunge delta */
@@ -1773,7 +1773,7 @@ unsigned long mbx_rewrite (MAILSTREAM *stream,unsigned long *reclaimed,
}
}
/* deltaed file size match position? */
- if (m = (LOCAL->filesize -= delta) - pos) {
+ if ((m = (LOCAL->filesize -= delta) - pos) != 0L) {
*reclaimed += m; /* probably an fEXPUNGED msg */
LOCAL->filesize = pos; /* set correct size */
}
@@ -1792,7 +1792,7 @@ unsigned long mbx_rewrite (MAILSTREAM *stream,unsigned long *reclaimed,
(*bn) (BLOCK_NONE,NIL);
/* do hide-expunge when shared */
if (flags) for (i = 1; i <= stream->nmsgs; ) {
- if (elt = mbx_elt (stream,i,T)) {
+ if ((elt = mbx_elt (stream,i,T)) != NULL) {
/* make the message invisible */
if (elt->deleted && ((flags > 0) || elt->sequence)) {
mbx_update_status (stream,elt->msgno,LONGT);
diff --git a/imap/src/osdep/unix/mh.c b/imap/src/osdep/unix/mh.c
index 005000d6..ac71b6ba 100644
--- a/imap/src/osdep/unix/mh.c
+++ b/imap/src/osdep/unix/mh.c
@@ -251,7 +251,7 @@ char *mh_path (char *tmp)
/* parse profile file */
for (s = strtok_r (t,"\r\n",&r); s && *s; s = strtok_r (NIL,"\r\n",&r)) {
/* found space in line? */
- if (v = strpbrk (s," \t")) {
+ if ((v = strpbrk (s," \t")) != NULL) {
*v++ = '\0'; /* tie off, is keyword "Path:"? */
if (!compare_cstring (s,"Path:")) {
/* skip whitespace */
@@ -324,7 +324,7 @@ long mh_dirfmttest (char *s)
if (strcmp (s,MHSEQUENCE) && strcmp (s,MHSEQUENCES)) {
if (*s == MHCOMMA) ++s; /* else comma + all numeric name */
/* success if all-numeric */
- while (c = *s++) if (!isdigit (c)) return NIL;
+ while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
}
return LONGT;
}
@@ -343,7 +343,7 @@ void mh_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents)
if (!pat || !*pat) { /* empty pattern? */
if (mh_canonicalize (test,ref,"*")) {
/* tie off name at root */
- if (s = strchr (test,'/')) *++s = '\0';
+ if ((s = strchr (test,'/')) != NULL) *++s = '\0';
else test[0] = '\0';
mm_list (stream,'/',test,LATT_NOSELECT);
}
@@ -356,14 +356,14 @@ void mh_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents)
}
if (test[3] == '/') { /* looking down levels? */
/* yes, found any wildcards? */
- if (s = strpbrk (test,"%*")) {
+ if ((s = strpbrk (test,"%*")) != NULL) {
/* yes, copy name up to that point */
strncpy (file,test+4,i = s - (test+4));
file[i] = '\0'; /* tie off */
}
else strcpy (file,test+4);/* use just that name then */
/* find directory name */
- if (s = strrchr (file,'/')) {
+ if ((s = strrchr (file,'/')) != NULL) {
*s = '\0'; /* found, tie off at that point */
s = file;
}
@@ -401,7 +401,7 @@ void mh_lsub (MAILSTREAM *stream,char *ref,char *pat)
/* get canonical form of name */
if (mh_canonicalize (test,ref,pat) && (s = sm_read (tmp,&sdb))) {
do if (pmatch_full (s,test,'/')) mm_lsub (stream,'/',s,NIL);
- while (s = sm_read (tmp,&sdb)); /* until no more subscriptions */
+ while ((s = sm_read (tmp,&sdb)) != NULL); /* until no more subscriptions */
}
}
@@ -425,8 +425,8 @@ void mh_list_work (MAILSTREAM *stream,char *dir,char *pat,long level)
if (!mh_file (curdir,name)) return;
cp = curdir + strlen (curdir);/* end of directory name */
np = name + strlen (name); /* end of MH name */
- if (dp = opendir (curdir)) { /* open directory */
- while (d = readdir (dp)) /* scan, ignore . and numeric names */
+ if ((dp = opendir (curdir)) != NULL) { /* open directory */
+ while ((d = readdir (dp)) != NULL) /* scan, ignore . and numeric names */
if ((d->d_name[0] != '.') && !mh_select (d)) {
strcpy (cp,d->d_name); /* make directory name */
if (!stat (curdir,&sbuf) && ((sbuf.st_mode & S_IFMT) == S_IFDIR)) {
@@ -510,10 +510,10 @@ long mh_delete (MAILSTREAM *stream,char *mailbox)
}
/* get name of directory */
i = strlen (mh_file (tmp,mailbox));
- if (dirp = opendir (tmp)) { /* open directory */
+ if ((dirp = opendir (tmp)) != NULL) { /* open directory */
tmp[i++] = '/'; /* now apply trailing delimiter */
/* massacre all mh owned files */
- while (d = readdir (dirp)) if (mh_dirfmttest (d->d_name)) {
+ while ((d = readdir (dirp)) != NULL) if (mh_dirfmttest (d->d_name)) {
strcpy (tmp + i,d->d_name);
unlink (tmp); /* sayonara */
}
@@ -550,7 +550,7 @@ long mh_rename (MAILSTREAM *stream,char *old,char *newname)
newname);
/* success if can rename the directory */
else { /* found superior to destination name? */
- if (s = strrchr (mh_file (tmp1,newname),'/')) {
+ if ((s = strrchr (mh_file (tmp1,newname),'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -734,7 +734,7 @@ void mh_load_message (MAILSTREAM *stream,unsigned long msgno,long flags)
switch (c = SNX (&bs)) {
case '\015': /* unlikely carriage return */
*t++ = c;
- if ((CHR (&bs) == '\012')) {
+ if (CHR (&bs) == '\012') {
*t++ = SNX (&bs);
i++;
}
@@ -760,7 +760,7 @@ void mh_load_message (MAILSTREAM *stream,unsigned long msgno,long flags)
switch (c = SNX (&bs)) {
case '\015': /* unlikely carriage return */
*t++ = c;
- if ((CHR (&bs) == '\012')) {
+ if (CHR (&bs) == '\012') {
*t++ = SNX (&bs);
i++;
}
@@ -883,7 +883,7 @@ long mh_ping (MAILSTREAM *stream)
fs_give ((void **) &names[i]);
}
/* free directory */
- if (s = (void *) names) fs_give ((void **) &s);
+ if ((s = (void *) names) != NULL) fs_give ((void **) &s);
}
/* if INBOX, snarf from system INBOX */
@@ -934,7 +934,7 @@ long mh_ping (MAILSTREAM *stream)
unlink (LOCAL->buf);/* flush this file */
}
sprintf (tmp,"Message copy to MH mailbox failed: %.80s",
- s,strerror (errno));
+ strerror (errno));
mm_log (tmp,ERROR);
r = 0; /* stop the snarf in its tracks */
}
@@ -977,9 +977,9 @@ long mh_expunge (MAILSTREAM *stream,char *sequence,long options)
unsigned long i = 1;
unsigned long n = 0;
unsigned long recent = stream->recent;
- if (ret = sequence ? ((options & EX_UID) ?
+ if ((ret = sequence ? ((options & EX_UID) ?
mail_uid_sequence (stream,sequence) :
- mail_sequence (stream,sequence)) : LONGT) {
+ mail_sequence (stream,sequence)) : LONGT) != 0L) {
mm_critical (stream); /* go critical */
while (i <= stream->nmsgs) {/* for each message */
elt = mail_elt (stream,i);/* if deleted, need to trash it */
@@ -1132,7 +1132,7 @@ long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
fs_give ((void **) &names[i]);
}
else last = 0; /* no messages here yet */
- if (s = (void *) names) fs_give ((void **) &s);
+ if ((s = (void *) names) != NULL) fs_give ((void **) &s);
mm_critical (stream); /* go critical */
do {
@@ -1195,7 +1195,7 @@ int mh_select (struct direct *name)
{
char c;
char *s = name->d_name;
- while (c = *s++) if (!isdigit (c)) return NIL;
+ while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
return T;
}
@@ -1258,7 +1258,7 @@ long mh_canonicalize (char *pattern,char *ref,char *pat)
else strcpy (pattern,pat); /* just have basic name */
if (mh_isvalid (pattern,tmp,T)) {
/* count wildcards */
- for (i = 0, s = pattern; *s; *s++) if ((*s == '*') || (*s == '%')) ++i;
+ for (i = 0, s = pattern; *s; s++) if ((*s == '*') || (*s == '%')) ++i;
/* success if not too many */
if (i <= MAXWILDCARDS) return LONGT;
mm_log ("Excessive wildcards in LIST/LSUB",ERROR);
diff --git a/imap/src/osdep/unix/mix.c b/imap/src/osdep/unix/mix.c
index 63009bb2..c53cabc0 100644
--- a/imap/src/osdep/unix/mix.c
+++ b/imap/src/osdep/unix/mix.c
@@ -331,7 +331,7 @@ long mix_scan_contents (char *name,char *contents,unsigned long csiz,
fs_give ((void **) &names[i]);
}
/* free directory list */
- if (a = (void *) names) fs_give ((void **) &a);
+ if ((a = (void *) names) != NULL) fs_give ((void **) &a);
return ret;
}
@@ -475,10 +475,10 @@ long mix_delete (MAILSTREAM *stream,char *mailbox)
close (fd); /* close descriptor on deleted metadata */
/* get directory name */
*(s = strrchr (tmp,'/')) = '\0';
- if (dirp = opendir (tmp)) { /* open directory */
+ if ((dirp = opendir (tmp)) != NULL) { /* open directory */
*s++ = '/'; /* restore delimiter */
/* massacre messages */
- while (d = readdir (dirp)) if (mix_dirfmttest (d->d_name)) {
+ while ((d = readdir (dirp)) != NULL) if (mix_dirfmttest (d->d_name)) {
strcpy (s,d->d_name); /* make path */
unlink (tmp); /* sayonara */
}
@@ -526,7 +526,7 @@ long mix_rename (MAILSTREAM *stream,char *old,char *newname)
/* easy if not INBOX */
if (compare_cstring (old,"INBOX")) {
/* found superior to destination name? */
- if (s = strrchr (tmp1,'/')) {
+ if ((s = strrchr (tmp1,'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -564,7 +564,7 @@ long mix_rename (MAILSTREAM *stream,char *old,char *newname)
fs_give ((void **) &names[i]);
}
/* free directory list */
- if (a = (void *) names) fs_give ((void **) &a);
+ if ((a = (void *) names) != NULL) fs_give ((void **) &a);
if (lasterror) errno = lasterror;
else {
close (fd); /* close descriptor on metadata */
@@ -631,7 +631,7 @@ MAILSTREAM *mix_open (MAILSTREAM *stream)
stream->sequence++; /* bump sequence number */
/* parse mailbox */
stream->nmsgs = stream->recent = 0;
- if (silent = stream->silent) LOCAL->internal = T;
+ if ((silent = stream->silent) != 0) LOCAL->internal = T;
stream->silent = T;
if (mix_ping (stream)) { /* do initial ping */
/* try burping in case we are exclusive */
@@ -749,7 +749,7 @@ char *mix_header (MAILSTREAM *stream,unsigned long msgno,unsigned long *length,
else { /* document the problem */
LOCAL->buf[100] = '\0'; /* tie off buffer at no more than 100 octets */
/* or at newline, whichever is first */
- if (s = strpbrk (LOCAL->buf,"\015\012")) *s = '\0';
+ if ((s = strpbrk (LOCAL->buf,"\015\012")) != NULL) *s = '\0';
sprintf (tmp,"Error reading mix message header, uid=%lx, s=%.0lx, h=%s",
elt->private.uid,elt->rfc822_size,LOCAL->buf);
MM_LOG (tmp,ERROR);
@@ -960,7 +960,7 @@ long mix_ping (MAILSTREAM *stream)
flags[0] = '(';
strcat (flags,")");
INIT (&msg,mail_string,message,msglen);
- if (snarfok = mail_append_full (stream,"INBOX",flags,date,&msg)) {
+ if ((snarfok = mail_append_full (stream,"INBOX",flags,date,&msg)) != 0L) {
char sequence[15];
sprintf (sequence,"%lu",i);
mail_flag (sysibx,sequence,"\\Deleted",ST_SET);
@@ -985,8 +985,8 @@ long mix_ping (MAILSTREAM *stream)
/* expunging OK if global flag set */
if (mail_parameters (NIL,GET_EXPUNGEATPING,NIL)) LOCAL->expok = T;
/* process metadata/index/status */
- if (statf = mix_parse (stream,&idxf,LONGT,
- (LOCAL->internal ? NIL : LONGT))) {
+ if ((statf = mix_parse (stream,&idxf,LONGT,
+ (LOCAL->internal ? NIL : LONGT))) != NULL) {
fclose (statf); /* just close the status file */
ret = LONGT; /* declare success */
}
@@ -1033,8 +1033,8 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options)
mail_uid_sequence (stream,sequence) :
mail_sequence (stream,sequence))) || stream->rdonly);
/* read index and open status exclusive */
- else if (statf = mix_parse (stream,&idxf,LONGT,
- LOCAL->internal ? NIL : LONGT)) {
+ else if ((statf = mix_parse (stream,&idxf,LONGT,
+ LOCAL->internal ? NIL : LONGT)) != NULL) {
/* expunge unless just burping */
if (!burponly) for (i = 1; i <= stream->nmsgs;) {
elt = mail_elt (stream,i);/* need to expunge this message? */
@@ -1111,7 +1111,7 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options)
}
else MM_LOG ("No mix message files found during expunge",WARN);
/* free directory list */
- if (a = (void *) names) fs_give ((void **) &a);
+ if ((a = (void *) names) != NULL) fs_give ((void **) &a);
}
/* either way, re-acquire shared lock */
@@ -1120,7 +1120,7 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options)
/* Do this step even if ret is NIL (meaning some burp problem)! */
if (nexp || reclaimed) { /* rewrite index and status if changed */
LOCAL->indexseq = mix_modseq (LOCAL->indexseq);
- if (ret = mix_index_update (stream,idxf,NIL)) {
+ if ((ret = mix_index_update (stream,idxf,NIL)) != 0L){
LOCAL->statusseq = mix_modseq (LOCAL->statusseq);
/* set failure if update fails */
ret = mix_status_update (stream,statf,NIL);
@@ -1237,7 +1237,7 @@ long mix_burp (MAILSTREAM *stream,MIXBURP *burp,unsigned long *reclaimed)
/* if matches range then no burp needed! */
if (burp->set.last == sbuf.st_size) ret = LONGT;
/* just need to remove cruft at end */
- else if (ret = !truncate (LOCAL->buf,burp->set.last))
+ else if ((ret = !truncate (LOCAL->buf,burp->set.last)) != 0L)
*reclaimed += sbuf.st_size - burp->set.last;
else {
sprintf (LOCAL->buf,truncerr,burp->name,strerror (errno));
@@ -1341,7 +1341,7 @@ long mix_burp_check (SEARCHSET *set,size_t size,char *file)
file,size,set->last);
MM_LOG (tmp,ERROR);
return NIL; /* don't burp this file at all */
- } while (set = set->next);
+ } while ((set = set->next) != NULL);
return LONGT;
}
@@ -1379,11 +1379,11 @@ long mix_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
else if (!(ret = ((options & CP_UID) ? mail_uid_sequence (stream,sequence) :
mail_sequence (stream,sequence))));
/* acquire stream to append */
- else if (ret = ((astream = mail_open (NIL,mailbox,OP_SILENT)) &&
+ else if ((ret = ((astream = mail_open (NIL,mailbox,OP_SILENT)) &&
!astream->rdonly &&
(((MIXLOCAL *) astream->local)->expok = T) &&
(statf = mix_parse (astream,&idxf,LONGT,NIL))) ?
- LONGT : NIL) {
+ LONGT : NIL) != 0L) {
int fd;
unsigned long i;
MESSAGECACHE *elt;
@@ -1405,7 +1405,7 @@ long mix_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
if ((elt = mail_elt (stream,i))->sequence)
newsize += hdrsize + elt->rfc822_size;
/* open data file */
- if (msgf = mix_data_open (astream,&fd,&size,newsize)) {
+ if ((msgf = mix_data_open (astream,&fd,&size,newsize)) != NULL) {
char *t;
unsigned long j,uid,uidv;
copyuid_t cu = (copyuid_t) mail_parameters (NIL,GET_COPYUID,NIL);
@@ -1434,7 +1434,7 @@ long mix_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
INIT (&st,fd_string,&d,elt->rfc822_size);
/* init flag string */
tmp[0] = tmp[1] = '\0';
- if (j = elt->user_flags) do
+ if ((j = elt->user_flags) != 0L) do
if ((t = stream->user_flags[find_rightmost_bit (&j)]) && *t)
strcat (strcat (tmp," "),t);
while (j);
@@ -1457,8 +1457,8 @@ long mix_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
fclose (msgf); /* all good, close the msg file now */
/* write new metadata, index, and status */
local->metaseq = local->indexseq = local->statusseq = seq;
- if (ret = (mix_meta_update (astream) &&
- mix_index_update (astream,idxf,LONGT))) {
+ if ((ret = (mix_meta_update (astream) &&
+ mix_index_update (astream,idxf,LONGT))) != 0L){
/* success, delete if doing a move */
if (options & CP_MOVE)
for (i = 1; i <= stream->nmsgs; i++)
@@ -1521,8 +1521,8 @@ long mix_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
if (!stream) stream = user_flags (&mixproto);
if (!ret) switch (errno) { /* if not valid mailbox */
case ENOENT: /* no such file? */
- if (ret = compare_cstring (mailbox,"INBOX") ?
- NIL : mix_create (NIL,"INBOX"))
+ if ((ret = compare_cstring (mailbox,"INBOX") ?
+ NIL : mix_create (NIL,"INBOX")) != 0L)
break;
MM_NOTIFY (stream,"[TRYCREATE] Must create mailbox before append",NIL);
break;
@@ -1538,11 +1538,11 @@ long mix_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
FILE *idxf = NIL;
FILE *msgf = NIL;
FILE *statf = NIL;
- if (ret = ((astream = mail_open (NIL,mailbox,OP_SILENT)) &&
+ if ((ret = ((astream = mail_open (NIL,mailbox,OP_SILENT)) &&
!astream->rdonly &&
(((MIXLOCAL *) astream->local)->expok = T) &&
(statf = mix_parse (astream,&idxf,LONGT,NIL))) ?
- LONGT : NIL) {
+ LONGT : NIL) != 0l) {
int fd;
unsigned long size,hdrsize;
MESSAGECACHE elt;
@@ -1558,7 +1558,7 @@ long mix_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
MM_CRITICAL (astream); /* go critical */
astream->silent = T; /* no events here */
/* open data file */
- if (msgf = mix_data_open (astream,&fd,&size,hdrsize + SIZE (message))) {
+ if ((msgf = mix_data_open (astream,&fd,&size,hdrsize + SIZE (message))) != NULL){
appenduid_t au = (appenduid_t) mail_parameters (NIL,GET_APPENDUID,NIL);
SEARCHSET *dst = au ? mail_newsearchset () : NIL;
while (ret && message) {/* while good to go and have messages */
@@ -1747,14 +1747,14 @@ FILE *mix_parse (MAILSTREAM *stream,FILE **idxf,long iflags,long sflags)
}
/* slurp metadata */
- else if (s = mix_meta_slurp (stream,&i)) {
+ else if ((s = mix_meta_slurp (stream,&i)) != NULL) {
unsigned long j = 0; /* non-zero if UIDVALIDITY/UIDLAST changed */
if (i != LOCAL->metaseq) { /* metadata changed? */
char *t,*k;
LOCAL->metaseq = i; /* note new metadata sequence */
while (s && *s) { /* parse entire metadata file */
/* locate end of line */
- if (s = strstr (t = s,"\015\012")) {
+ if ((s = strstr (t = s,"\015\012")) != NULL) {
*s = '\0'; /* tie off line */
s += 2; /* skip past CRLF */
switch (*t++) { /* parse line */
@@ -1783,7 +1783,7 @@ FILE *mix_parse (MAILSTREAM *stream,FILE **idxf,long iflags,long sflags)
break;
case 'K': /* new keyword list */
for (i = 0; t && *t && (i < NUSERFLAGS); ++i) {
- if (t = strchr (k = t,' ')) *t++ = '\0';
+ if ((t = strchr (k = t,' ')) != NULL) *t++ = '\0';
/* make sure keyword non-empty */
if (*k && (strlen (k) <= MAXUSERFLAG)) {
/* in case value changes (shouldn't happen) */
@@ -2455,7 +2455,7 @@ FILE *mix_data_open (MAILSTREAM *stream,int *fd,long *size,
}
if (*fd >= 0) { /* have a data file? */
/* yes, get stdio and set position */
- if (msgf = fdopen (*fd,"r+b")) fseek (msgf,*size,SEEK_SET);
+ if ((msgf = fdopen (*fd,"r+b")) != NULL)fseek (msgf,*size,SEEK_SET);
else close (*fd); /* fdopen() failed? */
}
return msgf; /* return results */
@@ -2519,7 +2519,7 @@ FILE *mix_sortcache_open (MAILSTREAM *stream)
/* ignore expansion values */
if (*s++ == ':') {
- if (i = mail_msgno (stream,uid)) {
+ if ((i = mail_msgno (stream,uid)) != 0L) {
sc = (SORTCACHE *) (*mc) (stream,i,CH_SORTCACHE);
sc->size = (elt = mail_elt (stream,i))->rfc822_size;
sc->date = sentdate;
@@ -2698,7 +2698,7 @@ long mix_sortcache_update (MAILSTREAM *stream,FILE **sortcache)
SORTCACHE *s = (SORTCACHE *) (*mc) (stream,i,CH_SORTCACHE);
STRINGLIST *sl;
s->dirty = NIL; /* no longer dirty */
- if (sl = s->references) /* count length of references */
+ if ((sl = s->references) != NULL) /* count length of references */
for (j = 1; sl && sl->text.data; sl = sl->next)
j += 10 + sl->text.size;
else j = 0; /* no references yet */
@@ -2753,7 +2753,7 @@ char *mix_read_record (FILE *f,char *buf,unsigned long buflen,char *type)
/* ensure string tied off */
buf[buflen-2] = buf[buflen-1] = '\0';
while (fgets (buf,buflen-1,f)) {
- if (s = strchr (buf,'\012')) {
+ if ((s = strchr (buf,'\012')) != NULL) {
if ((s != buf) && (s[-1] == '\015')) --s;
*s = '\0'; /* tie off buffer */
if (s != buf) return buf; /* return if non-empty buffer */
diff --git a/imap/src/osdep/unix/mmdf.c b/imap/src/osdep/unix/mmdf.c
index e962434e..994c34a3 100644
--- a/imap/src/osdep/unix/mmdf.c
+++ b/imap/src/osdep/unix/mmdf.c
@@ -537,12 +537,13 @@ long mmdf_rename (MAILSTREAM *stream,char *old,char *newname)
MM_CRITICAL (stream); /* get the c-client lock */
if (!dummy_file (file,old) ||
(newname && (!((s = mailboxfile (tmp,newname)) && *s) ||
- ((s = strrchr (tmp,'/')) && !s[1]))))
- sprintf (tmp,newname ?
- "Can't rename mailbox %.80s to %.80s: invalid name" :
- "Can't delete mailbox %.80s: invalid name",
- old,newname);
- /* lock out other c-clients */
+ ((s = strrchr (tmp,'/')) && !s[1])))){
+ if(newname) sprintf (tmp,
+ "Can't rename mailbox %.80s to %.80s: invalid name",
+ old,newname);
+ else
+ sprintf (tmp, "Can't delete mailbox %.80s: invalid name", old);
+ } /* lock out other c-clients */
else if ((ld = lockname (lock,file,LOCK_EX|LOCK_NB,&i)) < 0)
sprintf (tmp,"Mailbox %.80s is in use by another process",old);
@@ -554,7 +555,7 @@ long mmdf_rename (MAILSTREAM *stream,char *old,char *newname)
else {
if (newname) { /* want rename? */
/* found superior to destination name? */
- if (s = strrchr (s,'/')) {
+ if ((s = strrchr (s,'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -981,9 +982,9 @@ long mmdf_expunge (MAILSTREAM *stream,char *sequence,long options)
unsigned long i;
DOTLOCK lock;
char *msg = NIL;
- if (ret = (sequence ? ((options & EX_UID) ?
+ if ((ret = (sequence ? ((options & EX_UID) ?
mail_uid_sequence (stream,sequence) :
- mail_sequence (stream,sequence)) : LONGT) &&
+ mail_sequence (stream,sequence)) : LONGT) != 0L) &&
LOCAL && (LOCAL->ld >= 0) && !stream->lock &&
mmdf_parse (stream,&lock,LOCK_EX)) {
/* check expunged messages if not dirty */
@@ -1391,10 +1392,10 @@ int mmdf_append_msgs (MAILSTREAM *stream,FILE *sf,FILE *df,SEARCHSET *set)
if (i < (j = strlen (tmp))) fatal ("mmdf_append_msgs overrun");
i -= j; /* number of bytes left */
/* squish out ^A and CRs (note copies NUL) */
- for (x = tmp; x = strpbrk (x,"\01\r"); --j) memmove (x,x+1,j-(x-tmp));
+ for (x = tmp; (x = strpbrk (x,"\01\r")) != NULL; --j) memmove (x,x+1,j-(x-tmp));
if (!j) continue; /* do nothing if line emptied */
/* start of line? */
- if ((c == '\n')) switch (tmp[0]) {
+ if (c == '\n') switch (tmp[0]) {
case 'S': case 's': /* possible "Status:" */
if (hdrp && (j > 6) && ((tmp[1] == 't') || (tmp[1] == 'T')) &&
((tmp[2] == 'a') || (tmp[2] == 'A')) &&
@@ -1609,7 +1610,7 @@ int mmdf_parse (MAILSTREAM *stream,DOTLOCK *lock,int op)
}
/* new data? */
- else if (i = sbuf.st_size - LOCAL->filesize) {
+ else if ((i = sbuf.st_size - LOCAL->filesize) != 0L) {
d.fd = LOCAL->fd; /* yes, set up file descriptor */
d.pos = LOCAL->filesize; /* get to that position in the file */
d.chunk = LOCAL->buf; /* initial buffer chunk */
@@ -1931,7 +1932,7 @@ int mmdf_parse (MAILSTREAM *stream,DOTLOCK *lock,int op)
char err[MAILTMPLEN];
sprintf (err,"Discarding bogus continuation in msg %lu: %.80s",
elt->msgno,(char *) s);
- if (u = strpbrk (err,"\r\n")) *u = '\0';
+ if ((u = strpbrk (err,"\r\n")) != NULL) *u = '\0';
MM_LOG (err,WARN);
break; /* different case or something */
}
@@ -2175,7 +2176,7 @@ unsigned long mmdf_xstatus (MAILSTREAM *stream,char *status,MESSAGECACHE *elt,
while (n /= 10);
/* pop UID last digits from stack */
while (t > stack) *s++ = *--t;
- for (n = 0; n < NUSERFLAGS; ++n) if (t = stream->user_flags[n])
+ for (n = 0; n < NUSERFLAGS; ++n) if ((t = stream->user_flags[n]) != NULL)
for (*s++ = ' '; *t; *s++ = *t++);
*s++ = '\n';
pad += 30; /* increased padding if have IMAPbase */
@@ -2197,7 +2198,7 @@ unsigned long mmdf_xstatus (MAILSTREAM *stream,char *status,MESSAGECACHE *elt,
if (sticky) { /* only do this if UIDs sticky */
*s++ = 'X'; *s++ = '-'; *s++ = 'K'; *s++ = 'e'; *s++ = 'y'; *s++ = 'w';
*s++ = 'o'; *s++ = 'r'; *s++ = 'd'; *s++ = 's'; *s++ = ':';
- if (n = elt->user_flags) do {
+ if ((n = elt->user_flags) != 0L) do {
*s++ = ' ';
for (t = stream->user_flags[find_rightmost_bit (&n)]; *t; *s++ = *t++);
} while (n);
@@ -2261,7 +2262,7 @@ long mmdf_rewrite (MAILSTREAM *stream,unsigned long *nexp,DOTLOCK *lock,
size = mmdf_pseudo (stream,LOCAL->buf);
}
/* extend the file as necessary */
- if (ret = mmdf_extend (stream,size)) {
+ if ((ret = mmdf_extend (stream,size)) != 0L){
/* Set up buffered I/O file structure
* curpos current position being written through buffering
* filepos current position being written physically to the disk
@@ -2454,7 +2455,7 @@ void mmdf_write (MMDFFILE *f,char *buf,unsigned long size)
if (buf) { /* doing buffered write? */
i = f->bufpos - f->buf; /* yes, get size of current buffer data */
/* yes, have space in current buffer chunk? */
- if (j = i ? ((f->buflen - i) % OVERFLOWBUFLEN) : f->buflen) {
+ if ((j = i ? ((f->buflen - i) % OVERFLOWBUFLEN) : f->buflen) != 0L) {
/* yes, fill up buffer as much as we can */
memcpy (f->bufpos,buf,k = min (j,size));
f->bufpos += k; /* new buffer position */
@@ -2470,7 +2471,7 @@ void mmdf_write (MMDFFILE *f,char *buf,unsigned long size)
* chunks that will fit in unprotected space.
*/
/* any unprotected space we can write to? */
- if (j = min (i,f->protect - f->filepos)) {
+ if ((j = min (i,f->protect - f->filepos)) != 0L) {
/* yes, filepos not at chunk boundary? */
if ((k = f->filepos % OVERFLOWBUFLEN) && ((k = OVERFLOWBUFLEN - k) < j))
j -= k; /* yes, and can write out partial chunk */
diff --git a/imap/src/osdep/unix/mtx.c b/imap/src/osdep/unix/mtx.c
index 8e6f76e8..4346eceb 100644
--- a/imap/src/osdep/unix/mtx.c
+++ b/imap/src/osdep/unix/mtx.c
@@ -287,10 +287,11 @@ long mtx_rename (MAILSTREAM *stream,char *old,char *newname)
if (!mtx_file (file,old) ||
(newname && (!((s = mailboxfile (tmp,newname)) && *s) ||
((s = strrchr (tmp,'/')) && !s[1])))) {
- sprintf (tmp,newname ?
- "Can't rename mailbox %.80s to %.80s: invalid name" :
- "Can't delete mailbox %.80s: invalid name",
- old,newname);
+ if(newname)
+ sprintf (tmp,
+ "Can't rename mailbox %.80s to %.80s: invalid name", old,newname);
+ else
+ sprintf (tmp, "Can't delete mailbox %.80s: invalid name", old);
MM_LOG (tmp,ERROR);
return NIL;
}
@@ -314,7 +315,7 @@ long mtx_rename (MAILSTREAM *stream,char *old,char *newname)
}
if (newname) { /* want rename? */
- if (s = strrchr (tmp,'/')) {/* found superior to destination name? */
+ if ((s = strrchr (tmp,'/')) != NULL) {/* found superior to destination name? */
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -680,7 +681,7 @@ void mtx_snarf (MAILSTREAM *stream)
hdr = cpystr (mail_fetchheader_full (sysibx,i,NIL,&hdrlen,NIL));
txt = mail_fetchtext_full (sysibx,i,&txtlen,FT_PEEK);
/* if have a message */
- if (j = hdrlen + txtlen) {
+ if ((j = hdrlen + txtlen) != 0L) {
/* calculate header line */
mail_date (LOCAL->buf,elt = mail_elt (sysibx,i));
sprintf (LOCAL->buf + strlen (LOCAL->buf),
diff --git a/imap/src/osdep/unix/mx.c b/imap/src/osdep/unix/mx.c
index 45495279..10d56b0a 100644
--- a/imap/src/osdep/unix/mx.c
+++ b/imap/src/osdep/unix/mx.c
@@ -239,7 +239,7 @@ long mx_dirfmttest (char *name)
int c;
/* success if index name or all-numberic */
if (strcmp (name,MXINDEXNAME+1))
- while (c = *name++) if (!isdigit (c)) return NIL;
+ while ((c = *name++) != '\0') if (!isdigit (c)) return NIL;
return LONGT;
}
@@ -286,7 +286,7 @@ long mx_scan_contents (char *name,char *contents,unsigned long csiz,
fs_give ((void **) &names[i]);
}
/* free directory list */
- if (a = (void *) names) fs_give ((void **) &a);
+ if ((a = (void *) names) != NULL) fs_give ((void **) &a);
return ret;
}
@@ -392,10 +392,10 @@ long mx_delete (MAILSTREAM *stream,char *mailbox)
mailbox,strerror (errno));
else { /* get directory name */
*(s = strrchr (tmp,'/')) = '\0';
- if (dirp = opendir (tmp)) { /* open directory */
+ if ((dirp = opendir (tmp)) != NULL) { /* open directory */
*s++ = '/'; /* restore delimiter */
/* massacre messages */
- while (d = readdir (dirp)) if (mx_select (d)) {
+ while ((d = readdir (dirp)) != NULL) if (mx_select (d)) {
strcpy (s,d->d_name); /* make path */
unlink (tmp); /* sayonara */
}
@@ -438,7 +438,7 @@ long mx_rename (MAILSTREAM *stream,char *old,char *newname)
/* easy if not INBOX */
if (compare_cstring (old,"INBOX")) {
/* found superior to destination name? */
- if (s = strrchr (mx_file (tmp1,newname),'/')) {
+ if ((s = strrchr (mx_file (tmp1,newname),'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -466,7 +466,7 @@ long mx_rename (MAILSTREAM *stream,char *old,char *newname)
fs_give ((void **) &names[i]);
}
/* free directory list */
- if (a = (void *) names) fs_give ((void **) &a);
+ if ((a = (void *) names) != NULL) fs_give ((void **) &a);
if (lasterror || mx_rename_work (tmp,srcl,tmp1,dstl,MXINDEXNAME+1))
errno = lasterror;
else return mx_create (NIL,"INBOX");
@@ -749,7 +749,7 @@ long mx_ping (MAILSTREAM *stream)
fs_give ((void **) &names[i]);
}
/* free directory */
- if (s = (void *) names) fs_give ((void **) &s);
+ if ((s = (void *) names) != NULL) fs_give ((void **) &s);
}
stream->nmsgs = nmsgs; /* don't upset mail_uid() */
@@ -801,7 +801,7 @@ long mx_ping (MAILSTREAM *stream)
unlink (LOCAL->buf);/* flush this file */
}
sprintf (tmp,"Message copy to MX mailbox failed: %.80s",
- s,strerror (errno));
+ strerror (errno));
MM_LOG (tmp,ERROR);
r = 0; /* stop the snarf in its tracks */
}
@@ -844,9 +844,9 @@ long mx_expunge (MAILSTREAM *stream,char *sequence,long options)
unsigned long i = 1;
unsigned long n = 0;
unsigned long recent = stream->recent;
- if (ret = (sequence ? ((options & EX_UID) ?
+ if ((ret = (sequence ? ((options & EX_UID) ?
mail_uid_sequence (stream,sequence) :
- mail_sequence (stream,sequence)) : LONGT) &&
+ mail_sequence (stream,sequence)) : LONGT) != 0L) &&
mx_lockindex (stream)) { /* lock the index */
MM_CRITICAL (stream); /* go critical */
while (i <= stream->nmsgs) {/* for each message */
@@ -936,8 +936,8 @@ long mx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
SEARCHSET *dest = cu ? mail_newsearchset () : NIL;
for (i = 1,uid = uidv = 0; ret && (i <= stream->nmsgs); i++)
if ((elt = mail_elt (stream,i))->sequence) {
- if (ret = ((fd = open (mx_fast_work (stream,elt),O_RDONLY,NIL))
- >= 0)) {
+ if ((ret = ((fd = open (mx_fast_work (stream,elt),O_RDONLY,NIL))
+ >= 0)) != 0L) {
fstat (fd,&sbuf); /* get size of message */
d.fd = fd; /* set up file descriptor */
d.pos = 0; /* start of file */
@@ -946,8 +946,8 @@ long mx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
INIT (&st,fd_string,&d,sbuf.st_size);
/* init flag string */
tmp[0] = tmp[1] = '\0';
- if (j = elt->user_flags) do
- if (t = stream->user_flags[find_rightmost_bit (&j)])
+ if ((j = elt->user_flags) != 0L) do
+ if ((t = stream->user_flags[find_rightmost_bit (&j)]) != NULL)
strcat (strcat (tmp," "),t);
while (j);
if (elt->seen) strcat (tmp," \\Seen");
@@ -957,7 +957,7 @@ long mx_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
if (elt->draft) strcat (tmp," \\Draft");
tmp[0] = '('; /* open list */
strcat (tmp,")"); /* close list */
- if (ret = mx_append_msg (astream,tmp,elt,&st,dest)) {
+ if ((ret = mx_append_msg (astream,tmp,elt,&st,dest)) != 0L) {
/* add to source set if needed */
if (source) mail_append_set (source,mail_uid (stream,i));
/* delete if doing a move */
@@ -1114,7 +1114,7 @@ int mx_select (struct direct *name)
{
char c;
char *s = name->d_name;
- while (c = *s++) if (!isdigit (c)) return NIL;
+ while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
return T;
}
@@ -1186,7 +1186,7 @@ long mx_lockindex (MAILSTREAM *stream)
break;
case 'K': /* keyword */
/* find end of keyword */
- if (s = strchr (t = ++s,'\n')) {
+ if ((s = strchr (t = ++s,'\n')) != NULL) {
*s++ = '\0'; /* tie off keyword */
/* copy keyword */
if ((k < NUSERFLAGS) && !stream->user_flags[k] &&
diff --git a/imap/src/osdep/unix/news.c b/imap/src/osdep/unix/news.c
index 4cf5bb70..1af24273 100644
--- a/imap/src/osdep/unix/news.c
+++ b/imap/src/osdep/unix/news.c
@@ -215,7 +215,7 @@ void news_list (MAILSTREAM *stream,char *ref,char *pat)
if (!pat || !*pat) { /* empty pattern? */
if (news_canonicalize (ref,"*",pattern)) {
/* tie off name at root */
- if (s = strchr (pattern,'.')) *++s = '\0';
+ if ((s = strchr (pattern,'.')) != NULL) *++s = '\0';
else pattern[0] = '\0';
mm_list (stream,'.',pattern,LATT_NOSELECT);
}
@@ -231,7 +231,7 @@ void news_list (MAILSTREAM *stream,char *ref,char *pat)
strcpy (name,"#news."); /* write initial prefix */
i = strlen (pattern); /* length of pattern */
if (pattern[--i] != '%') i = 0;
- if (t = strtok_r (s,"\n",&r)) do if (u = strchr (t,' ')) {
+ if ((t = strtok_r (s,"\n",&r)) != NULL) do if ((u = strchr (t,' ')) != NULL) {
*u = '\0'; /* tie off at end of name */
strcpy (name + 6,t); /* make full form of name */
if (pmatch_full (name,pattern,'.')) mm_list (stream,'.',name,NIL);
@@ -240,7 +240,7 @@ void news_list (MAILSTREAM *stream,char *ref,char *pat)
if (pmatch_full (name,pattern,'.'))
mm_list (stream,'.',name,LATT_NOSELECT);
}
- } while (t = strtok_r (NIL,"\n",&r));
+ } while ((t = strtok_r (NIL,"\n",&r)) != NULL);
fs_give ((void **) &s);
}
}
@@ -283,7 +283,7 @@ long news_canonicalize (char *ref,char *pat,char *pattern)
if ((pattern[0] == '#') && (pattern[1] == 'n') && (pattern[2] == 'e') &&
(pattern[3] == 'w') && (pattern[4] == 's') && (pattern[5] == '.') &&
!strchr (pattern,'/')) { /* count wildcards */
- for (i = 0, s = pattern; *s; *s++) if ((*s == '*') || (*s == '%')) ++i;
+ for (i = 0, s = pattern; *s; s++) if ((*s == '*') || (*s == '%')) ++i;
/* success if not too many */
if (i <= MAXWILDCARDS) return LONGT;
MM_LOG ("Excessive wildcards in LIST/LSUB",ERROR);
@@ -365,7 +365,7 @@ MAILSTREAM *news_open (MAILSTREAM *stream)
/* build directory name */
sprintf (s = tmp,"%s/%s",(char *) mail_parameters (NIL,GET_NEWSSPOOL,NIL),
stream->mailbox + 6);
- while (s = strchr (s,'.')) *s = '/';
+ while ((s = strchr (s,'.')) != NULL) *s = '/';
/* scan directory */
if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) {
mail_exists (stream,nmsgs); /* notify upper level that messages exist */
@@ -406,7 +406,7 @@ int news_select (struct direct *name)
{
char c;
char *s = name->d_name;
- while (c = *s++) if (!isdigit (c)) return NIL;
+ while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
return T;
}
@@ -566,7 +566,7 @@ void news_load_message (MAILSTREAM *stream,unsigned long msgno,long flags)
switch (c = SNX (&bs)) {
case '\015': /* unlikely carriage return */
*t++ = c;
- if ((CHR (&bs) == '\012')) *t++ = SNX (&bs);
+ if (CHR (&bs) == '\012') *t++ = SNX (&bs);
break;
case '\012': /* line feed? */
*t++ = '\015';
@@ -586,7 +586,7 @@ void news_load_message (MAILSTREAM *stream,unsigned long msgno,long flags)
switch (c = SNX (&bs)) {
case '\015': /* unlikely carriage return */
*t++ = c;
- if ((CHR (&bs) == '\012')) *t++ = SNX (&bs);
+ if (CHR (&bs) == '\012') *t++ = SNX (&bs);
break;
case '\012': /* line feed? */
*t++ = '\015';
diff --git a/imap/src/osdep/unix/nl_unix.c b/imap/src/osdep/unix/nl_unix.c
index b2d5616a..5ae96b08 100644
--- a/imap/src/osdep/unix/nl_unix.c
+++ b/imap/src/osdep/unix/nl_unix.c
@@ -46,7 +46,7 @@ unsigned long strcrlfcpy (unsigned char **dst,unsigned long *dstl,
if (i > *dstl) fs_give ((void **) dst);
}
/* make a new buffer if needed */
- if (!*dst) *dst = (char *) fs_get ((*dstl = i) + 1);
+ if (!*dst) *dst = (unsigned char *) fs_get ((*dstl = i) + 1);
d = *dst; /* destination string */
if (srcl) do { /* main copy loop */
if ((c = *src++) < '\016') {
diff --git a/imap/src/osdep/unix/phile.c b/imap/src/osdep/unix/phile.c
index ce72d0a9..85aa8cbb 100644
--- a/imap/src/osdep/unix/phile.c
+++ b/imap/src/osdep/unix/phile.c
@@ -289,7 +289,7 @@ MAILSTREAM *phile_open (MAILSTREAM *stream)
t = localtime(&sbuf.st_mtime);/* get local time */
/* calculate time delta */
i = t->tm_hour * 60 + t->tm_min - i;
- if (k = t->tm_yday - k) i += ((k < 0) == (abs (k) == 1)) ? -24*60 : 24*60;
+ if ((k = t->tm_yday - k) != 0) i += ((k < 0) == (abs (k) == 1)) ? -24*60 : 24*60;
k = abs (i); /* time from UTC either way */
elt->hours = t->tm_hour; elt->minutes = t->tm_min; elt->seconds = t->tm_sec;
elt->day = t->tm_mday; elt->month = t->tm_mon + 1;
@@ -306,7 +306,7 @@ MAILSTREAM *phile_open (MAILSTREAM *stream)
/* fill in From field from file owner */
LOCAL->env->from = mail_newaddr ();
- if (pw = getpwuid (sbuf.st_uid)) strcpy (tmp,pw->pw_name);
+ if ((pw = getpwuid (sbuf.st_uid)) != NULL) strcpy (tmp,pw->pw_name);
else sprintf (tmp,"User-Number-%ld",(long) sbuf.st_uid);
LOCAL->env->from->mailbox = cpystr (tmp);
LOCAL->env->from->host = cpystr (mylocalhost ());
@@ -318,7 +318,7 @@ MAILSTREAM *phile_open (MAILSTREAM *stream)
buf->data[buf->size] = '\0';
close (fd); /* close the file */
/* analyze data type */
- if (i = phile_type (buf->data,buf->size,&j)) {
+ if ((i = phile_type (buf->data,buf->size,&j)) != 0){
LOCAL->body->type = TYPETEXT;
LOCAL->body->subtype = cpystr ("PLAIN");
if (!(i & PTYPECRTEXT)) { /* change Internet newline format as needed */
diff --git a/imap/src/osdep/unix/tcp_unix.c b/imap/src/osdep/unix/tcp_unix.c
index 4fe8194d..339c968c 100644
--- a/imap/src/osdep/unix/tcp_unix.c
+++ b/imap/src/osdep/unix/tcp_unix.c
@@ -176,7 +176,7 @@ TCPSTREAM *tcp_open (char *host,char *service,unsigned long port)
if (host[0] == '[' && host[(strlen (host))-1] == ']') {
strcpy (tmp,host+1); /* yes, copy number part */
tmp[(strlen (tmp))-1] = '\0';
- if (adr = ip_stringtoaddr (tmp,&adrlen,&family)) {
+ if ((adr = ip_stringtoaddr (tmp,&adrlen,&family)) != NULL) {
(*bn) (BLOCK_TCPOPEN,NIL);
/* get an open socket for this system */
sock = tcp_socket_open (family,adr,adrlen,port,tmp,ctrp,
@@ -223,7 +223,7 @@ TCPSTREAM *tcp_open (char *host,char *service,unsigned long port)
/* init sockets */
stream->tcpsi = stream->tcpso = sock;
/* stash in the snuck-in byte */
- if (stream->ictr = ctr) *(stream->iptr = stream->ibuf) = tmp[0];
+ if ((stream->ictr = ctr) != 0) *(stream->iptr = stream->ibuf) = tmp[0];
stream->host = hostname; /* copy official host name */
if (tcpdebug) mm_log ("Stream open and ready for read",TCPDEBUG);
}
@@ -371,7 +371,7 @@ TCPSTREAM *tcp_aopen (NETMBX *mb,char *service,char *usrbuf)
strcpy (host,mb->host+1); /* yes, copy without brackets */
host[i-1] = '\0';
/* validate domain literal */
- if (adr = ip_stringtoaddr (host,&len,&i)) fs_give ((void **) &adr);
+ if ((adr = ip_stringtoaddr (host,&len,&i)) != NULL) fs_give ((void **) &adr);
else {
sprintf (tmp,"Bad format domain-literal: %.80s",host);
mm_log (tmp,ERROR);
@@ -550,7 +550,7 @@ long tcp_getbuffer (TCPSTREAM *stream,unsigned long size,char *s)
/* make sure socket still alive */
if (stream->tcpsi < 0) return NIL;
/* can transfer bytes from buffer? */
- if (n = min (size,stream->ictr)) {
+ if ((n = min (size,stream->ictr)) != 0L) {
memcpy (s,stream->iptr,n); /* yes, slurp as much as we can from it */
s += n; /* update pointer */
stream->iptr +=n;
@@ -871,7 +871,7 @@ char *tcp_clienthost ()
if ((s = getenv (t = "SSH_CLIENT")) ||
(s = getenv (t = "KRB5REMOTEADDR")) ||
(s = getenv (t = "SSH2_CLIENT"))) {
- if (v = strchr (s,' ')) *v = '\0';
+ if ((v = strchr (s,' ')) != NULL) *v = '\0';
sprintf (v = tmp,"%.80s=%.80s",t,s);
}
else v = "UNKNOWN";
@@ -1000,7 +1000,7 @@ char *tcp_name (struct sockaddr *sadr,long flag)
(*bn) (BLOCK_DNSLOOKUP,NIL);/* quell alarms */
data = (*bn) (BLOCK_SENSITIVE,NIL);
/* translate address to name */
- if (t = tcp_name_valid (ip_sockaddrtoname (sadr,buf))) {
+ if ((t = tcp_name_valid (ip_sockaddrtoname (sadr,buf))) != NULL) {
/* produce verbose form if needed */
if (flag) sprintf (ret = tmp,"%s %s",t,adr);
else ret = t;
diff --git a/imap/src/osdep/unix/tenex.c b/imap/src/osdep/unix/tenex.c
index eee61fba..8815fee1 100644
--- a/imap/src/osdep/unix/tenex.c
+++ b/imap/src/osdep/unix/tenex.c
@@ -294,10 +294,13 @@ long tenex_rename (MAILSTREAM *stream,char *old,char *newname)
if (!tenex_file (file,old) ||
(newname && (!((s = mailboxfile (tmp,newname)) && *s) ||
((s = strrchr (tmp,'/')) && !s[1])))) {
- sprintf (tmp,newname ?
- "Can't rename mailbox %.80s to %.80s: invalid name" :
- "Can't delete mailbox %.80s: invalid name",
+ if(newname)
+ sprintf (tmp,
+ "Can't rename mailbox %.80s to %.80s: invalid name",
old,newname);
+ else
+ sprintf (tmp,
+ "Can't delete mailbox %.80s: invalid name", old);
MM_LOG (tmp,ERROR);
return NIL;
}
@@ -321,7 +324,7 @@ long tenex_rename (MAILSTREAM *stream,char *old,char *newname)
}
if (newname) { /* want rename? */
- if (s = strrchr (tmp,'/')) {/* found superior to destination name? */
+ if ((s = strrchr (tmp,'/')) != NULL) {/* found superior to destination name? */
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -769,7 +772,7 @@ void tenex_snarf (MAILSTREAM *stream)
hdr = cpystr (mail_fetchheader_full(sysibx,i,NIL,&hdrlen,FT_INTERNAL));
txt = mail_fetchtext_full (sysibx,i,&txtlen,FT_INTERNAL|FT_PEEK);
/* if have a message */
- if (j = hdrlen + txtlen) {
+ if ((j = hdrlen + txtlen) != 0L) {
/* calculate header line */
mail_date (LOCAL->buf,elt = mail_elt (sysibx,i));
sprintf (LOCAL->buf + strlen (LOCAL->buf),
diff --git a/imap/src/osdep/unix/unix.c b/imap/src/osdep/unix/unix.c
index be3c437b..8bca508c 100644
--- a/imap/src/osdep/unix/unix.c
+++ b/imap/src/osdep/unix/unix.c
@@ -415,7 +415,7 @@ long unix_rename (MAILSTREAM *stream,char *old,char *newname)
else {
if (newname) { /* want rename? */
/* found superior to destination name? */
- if (s = strrchr (s,'/')) {
+ if ((s = strrchr (s,'/')) != NULL) {
c = *++s; /* remember first character of inferior */
*s = '\0'; /* tie off to get just superior */
/* name doesn't exist, create it */
@@ -842,9 +842,9 @@ long unix_expunge (MAILSTREAM *stream,char *sequence,long options)
DOTLOCK lock;
char *msg = NIL;
/* parse and lock mailbox */
- if (ret = (sequence ? ((options & EX_UID) ?
+ if ((ret = (sequence ? ((options & EX_UID) ?
mail_uid_sequence (stream,sequence) :
- mail_sequence (stream,sequence)) : LONGT) &&
+ mail_sequence (stream,sequence)) : LONGT) != 0L) &&
LOCAL && (LOCAL->ld >= 0) && !stream->lock &&
unix_parse (stream,&lock,LOCK_EX)) {
/* check expunged messages if not dirty */
@@ -1254,10 +1254,10 @@ int unix_append_msgs (MAILSTREAM *stream,FILE *sf,FILE *df,SEARCHSET *set)
if (i < (j = strlen (tmp))) fatal ("unix_append_msgs overrun");
i -= j; /* number of bytes left */
/* squish out CRs (note also copies NUL) */
- for (x = tmp; x = strchr (x,'\r'); --j) memmove (x,x+1,j-(x-tmp));
+ for (x = tmp; (x = strchr (x,'\r')) != NULL; --j) memmove (x,x+1,j-(x-tmp));
if (!j) continue; /* do nothing if line emptied */
/* start of line? */
- if ((c == '\n')) switch (tmp[0]) {
+ if (c == '\n') switch (tmp[0]) {
case 'F': /* possible "From " (case counts here) */
if ((j > 4) && (tmp[0] == 'F') && (tmp[1] == 'r') && (tmp[2] == 'o') &&
(tmp[3] == 'm') && (tmp[4] == ' ')) {
@@ -1480,7 +1480,7 @@ int unix_parse (MAILSTREAM *stream,DOTLOCK *lock,int op)
}
/* new data? */
- else if (i = sbuf.st_size - LOCAL->filesize) {
+ else if ((i = sbuf.st_size - LOCAL->filesize) != 0L) {
d.fd = LOCAL->fd; /* yes, set up file descriptor */
d.pos = LOCAL->filesize; /* get to that position in the file */
d.chunk = LOCAL->buf; /* initial buffer chunk */
@@ -1767,7 +1767,7 @@ int unix_parse (MAILSTREAM *stream,DOTLOCK *lock,int op)
char err[MAILTMPLEN];
sprintf (err,"Discarding bogus continuation in msg %lu: %.80s",
elt->msgno,(char *) s);
- if (u = strpbrk (err,"\r\n")) *u = '\0';
+ if ((u = strpbrk (err,"\r\n")) != NULL) *u = '\0';
MM_LOG (err,WARN);
break; /* different case or something */
}
@@ -2012,7 +2012,7 @@ unsigned long unix_xstatus (MAILSTREAM *stream,char *status,MESSAGECACHE *elt,
while (n /= 10);
/* pop UID last digits from stack */
while (t > stack) *s++ = *--t;
- for (n = 0; n < NUSERFLAGS; ++n) if (t = stream->user_flags[n])
+ for (n = 0; n < NUSERFLAGS; ++n) if ((t = stream->user_flags[n]) != NULL)
for (*s++ = ' '; *t; *s++ = *t++);
*s++ = '\n';
pad += 30; /* increased padding if have IMAPbase */
@@ -2034,7 +2034,7 @@ unsigned long unix_xstatus (MAILSTREAM *stream,char *status,MESSAGECACHE *elt,
if (sticky) { /* only do this if UIDs sticky */
*s++ = 'X'; *s++ = '-'; *s++ = 'K'; *s++ = 'e'; *s++ = 'y'; *s++ = 'w';
*s++ = 'o'; *s++ = 'r'; *s++ = 'd'; *s++ = 's'; *s++ = ':';
- if (n = elt->user_flags) do {
+ if ((n = elt->user_flags) != 0L) do {
*s++ = ' ';
for (t = stream->user_flags[find_rightmost_bit (&n)]; *t; *s++ = *t++);
} while (n);
@@ -2098,7 +2098,7 @@ long unix_rewrite (MAILSTREAM *stream,unsigned long *nexp,DOTLOCK *lock,
size = unix_pseudo (stream,LOCAL->buf);
}
/* extend the file as necessary */
- if (ret = unix_extend (stream,size)) {
+ if ((ret = unix_extend (stream,size)) != 0L) {
/* Set up buffered I/O file structure
* curpos current position being written through buffering
* filepos current position being written physically to the disk
@@ -2308,7 +2308,7 @@ void unix_write (UNIXFILE *f,char *buf,unsigned long size)
if (buf) { /* doing buffered write? */
i = f->bufpos - f->buf; /* yes, get size of current buffer data */
/* yes, have space in current buffer chunk? */
- if (j = i ? ((f->buflen - i) % OVERFLOWBUFLEN) : f->buflen) {
+ if ((j = i ? ((f->buflen - i) % OVERFLOWBUFLEN) : f->buflen) != 0L) {
/* yes, fill up buffer as much as we can */
memcpy (f->bufpos,buf,k = min (j,size));
f->bufpos += k; /* new buffer position */
@@ -2324,7 +2324,7 @@ void unix_write (UNIXFILE *f,char *buf,unsigned long size)
* chunks that will fit in unprotected space.
*/
/* any unprotected space we can write to? */
- if (j = min (i,f->protect - f->filepos)) {
+ if ((j = min (i,f->protect - f->filepos)) != 0L) {
/* yes, filepos not at chunk boundary? */
if ((k = f->filepos % OVERFLOWBUFLEN) && ((k = OVERFLOWBUFLEN - k) < j))
j -= k; /* yes, and can write out partial chunk */