]> diplodocus.org Git - nmh/blobdiff - uip/inc.c
Alter HasSuffixC()'s char * to be const.
[nmh] / uip / inc.c
index 8a71eb22aab4ccd0eaa8c55c295401643efd3fe9..069e3ce53ea3890d9fbd8d25819359b7d18dfb35 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -176,10 +176,9 @@ maildir_srt(const void *va, const void *vb)
     const struct Maildir_entry *a = va, *b = vb;
     if (a->mtime > b->mtime)
       return 1;
     const struct Maildir_entry *a = va, *b = vb;
     if (a->mtime > b->mtime)
       return 1;
-    else if (a->mtime < b->mtime)
+    if (a->mtime < b->mtime)
       return -1;
       return -1;
-    else
-      return 0;
+    return 0;
 }
 
 int
 }
 
 int
@@ -413,25 +412,21 @@ main (int argc, char **argv)
      * a POP server?
      */
     if (inc_type == INC_POP) {
      * a POP server?
      */
     if (inc_type == INC_POP) {
-       struct nmh_creds creds = { 0, 0, 0 };
-
        if (auth_svc == NULL) {
            if (saslmech  &&  ! strcasecmp(saslmech, "xoauth2")) {
                adios (NULL, "must specify -authservice with -saslmech xoauth2");
            }
        if (auth_svc == NULL) {
            if (saslmech  &&  ! strcasecmp(saslmech, "xoauth2")) {
                adios (NULL, "must specify -authservice with -saslmech xoauth2");
            }
-           nmh_get_credentials (host, user, sasl, &creds);
        } else {
            if (user == NULL) {
                adios (NULL, "must specify -user with -saslmech xoauth2");
            }
        } else {
            if (user == NULL) {
                adios (NULL, "must specify -user with -saslmech xoauth2");
            }
-           creds.user = user;
        }
 
        /*
         * initialize POP connection
         */
        }
 
        /*
         * initialize POP connection
         */
-       if (pop_init (host, port, creds.user, creds.password, proxy, snoop,
-                     sasl, saslmech, tls, auth_svc) == NOTOK)
+       if (pop_init (host, port, user, proxy, snoop, sasl, saslmech,
+                     tls, auth_svc) == NOTOK)
            adios (NULL, "%s", response);
 
        /* Check if there are any messages */
            adios (NULL, "%s", response);
 
        /* Check if there are any messages */
@@ -511,7 +506,7 @@ main (int argc, char **argv)
            qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
        }
 
            qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
        }
 
-       if ((cp = strdup(newmail)) == (char *)0)
+       if ((cp = strdup(newmail)) == NULL)
            adios (NULL, "error allocating memory to copy newmail");
 
        newmail = cp;
            adios (NULL, "error allocating memory to copy newmail");
 
        newmail = cp;
@@ -527,7 +522,7 @@ main (int argc, char **argv)
        folder = getfolder (0);
     maildir = m_maildir (folder);
 
        folder = getfolder (0);
     maildir = m_maildir (folder);
 
-    if ((maildir_copy = strdup(maildir)) == (char *)0)
+    if ((maildir_copy = strdup(maildir)) == NULL)
         adios (maildir, "error allocating memory to copy maildir");
 
     if (!folder_exists(maildir)) {
         adios (maildir, "error allocating memory to copy maildir");
 
     if (!folder_exists(maildir)) {
@@ -634,12 +629,14 @@ go_to_it:
 
            msgnum++;
            if (packfile) {
 
            msgnum++;
            if (packfile) {
+                size_t len;
+
                fseek (pf, 0L, SEEK_CUR);
                pos = ftell (pf);
                size = 0;
                fseek (pf, 0L, SEEK_CUR);
                pos = ftell (pf);
                size = 0;
-               if (fwrite (mmdlm1, 1, strlen (mmdlm1), pf) < strlen (mmdlm1)) {
+                len = strlen(mmdlm1);
+               if (fwrite(mmdlm1, 1, len, pf) < len)
                    advise (mmdlm1, "fwrite");
                    advise (mmdlm1, "fwrite");
-               }
                start = ftell (pf);
 
                if (pop_retr (i, pop_pack) == NOTOK)
                start = ftell (pf);
 
                if (pop_retr (i, pop_pack) == NOTOK)
@@ -651,7 +648,7 @@ go_to_it:
                    adios (packfile, "write error on");
                fseek (pf, start, SEEK_SET);
            } else {
                    adios (packfile, "write error on");
                fseek (pf, start, SEEK_SET);
            } else {
-               cp = getcpy (m_name (msgnum));
+               cp = mh_xstrdup(m_name (msgnum));
                if ((pf = fopen (cp, "w+")) == NULL)
                    adios (cp, "unable to write");
                chmod (cp, m_gmprot ());
                if ((pf = fopen (cp, "w+")) == NULL)
                    adios (cp, "unable to write");
                chmod (cp, m_gmprot ());
@@ -693,10 +690,12 @@ go_to_it:
            charstring_free (scanl);
 
            if (packfile) {
            charstring_free (scanl);
 
            if (packfile) {
+                size_t len;
+
                fseek (pf, stop, SEEK_SET);
                fseek (pf, stop, SEEK_SET);
-               if (fwrite (mmdlm2, 1, strlen (mmdlm2), pf) < strlen (mmdlm1)) {
+                len = strlen(mmdlm2);
+               if (fwrite(mmdlm2, 1, len, pf) < len)
                    advise (mmdlm2, "fwrite");
                    advise (mmdlm2, "fwrite");
-               }
                if (fflush (pf) || ferror (pf)) {
                    int e = errno;
                    pop_quit ();
                if (fflush (pf) || ferror (pf)) {
                    int e = errno;
                    pop_quit ();
@@ -767,7 +766,7 @@ go_to_it:
                 */
 
                (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
                 */
 
                (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
-               (void)ext_hook("add-hook", b, (char *)0);
+               (void)ext_hook("add-hook", b, NULL);
 
                if (aud)
                    fputs (charstring_buffer (scanl), aud);
 
                if (aud)
                    fputs (charstring_buffer (scanl), aud);
@@ -796,7 +795,7 @@ go_to_it:
            msgnum++;
 
            sp = Maildir[i].filename;
            msgnum++;
 
            sp = Maildir[i].filename;
-           cp = getcpy (m_name (msgnum));
+           cp = mh_xstrdup(m_name (msgnum));
            pf = NULL;
            if (!trnflag || link(sp, cp) == -1) {
                static char buf[65536];
            pf = NULL;
            if (!trnflag || link(sp, cp) == -1) {
                static char buf[65536];
@@ -848,7 +847,7 @@ go_to_it:
                 */
 
                (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
                 */
 
                (void)snprintf(b, sizeof (b), "%s/%d", maildir_copy, msgnum + 1);
-               (void)ext_hook("add-hook", b, (char *)0);
+               (void)ext_hook("add-hook", b, NULL);
 
                if (aud)
                    fputs (charstring_buffer (scanl), aud);
 
                if (aud)
                    fputs (charstring_buffer (scanl), aud);