]> diplodocus.org Git - nmh/blobdiff - uip/inc.c
Fixed inc(1) and %(me) to not obey Local-Mailbox profile component.
[nmh] / uip / inc.c
index e40b730684e9ba38caca762945e400e3acababa3..c34d28ae9fd1c121d04ecf5aff3631c15e40987f 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -477,55 +477,55 @@ main (int argc, char **argv)
        }
        if (stat (newmail, &s1) == NOTOK || s1.st_size == 0)
            die("no mail to incorporate");
        }
        if (stat (newmail, &s1) == NOTOK || s1.st_size == 0)
            die("no mail to incorporate");
-       if (s1.st_mode & S_IFDIR) {
-           DIR *md;
-           struct dirent *de;
-           struct stat ms;
-           int i;
-           i = 0;
-           cp = concat (newmail, "/new", NULL);
-           if ((md = opendir(cp)) == NULL)
-               die("unable to open %s", cp);
-           while ((de = readdir (md)) != NULL) {
-               if (de->d_name[0] == '.')
-                   continue;
-               if (i >= num_maildir_entries) {
-                   if ((Maildir = realloc(Maildir, sizeof(*Maildir) * (2*i+16))) == NULL)
-                       die("not enough memory for %d messages", 2*i+16);
-                   num_maildir_entries = 2*i+16;
-               }
-               Maildir[i].filename = concat (cp, "/", de->d_name, NULL);
-               if (stat(Maildir[i].filename, &ms) != 0)
-                  adios (Maildir[i].filename, "couldn't get delivery time");
-               Maildir[i].mtime = ms.st_mtime;
-               i++;
-           }
-           free (cp);
-           closedir (md);
-           cp = concat (newmail, "/cur", NULL);
-           if ((md = opendir(cp)) == NULL)
-               die("unable to open %s", cp);
-           while ((de = readdir (md)) != NULL) {
-               if (de->d_name[0] == '.')
-                   continue;
-               if (i >= num_maildir_entries) {
-                   if ((Maildir = realloc(Maildir, sizeof(*Maildir) * (2*i+16))) == NULL)
-                       die("not enough memory for %d messages", 2*i+16);
-                   num_maildir_entries = 2*i+16;
-               }
-               Maildir[i].filename = concat (cp, "/", de->d_name, NULL);
-               if (stat(Maildir[i].filename, &ms) != 0)
-                  adios (Maildir[i].filename, "couldn't get delivery time");
-               Maildir[i].mtime = ms.st_mtime;
-               i++;
-           }
-           free (cp);
-           closedir (md);
-           if (i == 0)
-               die("no mail to incorporate");
-           num_maildir_entries = i;
-           qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
-       }
+       if (s1.st_mode & S_IFDIR) {
+           DIR *md;
+           struct dirent *de;
+           struct stat ms;
+           int i;
+           i = 0;
+           cp = concat (newmail, "/new", NULL);
+           if ((md = opendir(cp)) == NULL)
+               die("unable to open %s", cp);
+           while ((de = readdir (md)) != NULL) {
+               if (de->d_name[0] == '.')
+                   continue;
+               if (i >= num_maildir_entries) {
+                   if ((Maildir = realloc(Maildir, sizeof(*Maildir) * (2*i+16))) == NULL)
+                       die("not enough memory for %d messages", 2*i+16);
+                   num_maildir_entries = 2*i+16;
+               }
+               Maildir[i].filename = concat (cp, "/", de->d_name, NULL);
+               if (stat(Maildir[i].filename, &ms) != 0)
+                  adios (Maildir[i].filename, "couldn't get delivery time");
+               Maildir[i].mtime = ms.st_mtime;
+               i++;
+           }
+           free (cp);
+           closedir (md);
+           cp = concat (newmail, "/cur", NULL);
+           if ((md = opendir(cp)) == NULL)
+               die("unable to open %s", cp);
+           while ((de = readdir (md)) != NULL) {
+               if (de->d_name[0] == '.')
+                   continue;
+               if (i >= num_maildir_entries) {
+                   if ((Maildir = realloc(Maildir, sizeof(*Maildir) * (2*i+16))) == NULL)
+                       die("not enough memory for %d messages", 2*i+16);
+                   num_maildir_entries = 2*i+16;
+               }
+               Maildir[i].filename = concat (cp, "/", de->d_name, NULL);
+               if (stat(Maildir[i].filename, &ms) != 0)
+                  adios (Maildir[i].filename, "couldn't get delivery time");
+               Maildir[i].mtime = ms.st_mtime;
+               i++;
+           }
+           free (cp);
+           closedir (md);
+           if (i == 0)
+               die("no mail to incorporate");
+           num_maildir_entries = i;
+           qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
+       }
 
        cp = mh_xstrdup(newmail);
        newmail = cp;
 
        cp = mh_xstrdup(newmail);
        newmail = cp;
@@ -596,7 +596,7 @@ main (int argc, char **argv)
            fprintf (aud, "<<inc>> %s -ms %s\n", dtimenow(0), from);
        else {
            if (host)
            fprintf (aud, "<<inc>> %s -ms %s\n", dtimenow(0), from);
        else {
            if (host)
-               fprintf (aud, "<<inc>> %s -host %s -user %s\n", dtimenow(0),
+               fprintf (aud, "<<inc>> %s -host %s -user %s\n", dtimenow(0),
                         host, user);
            else
                fprintf (aud, "<<inc>> %s\n", dtimenow (0));
                         host, user);
            else
                fprintf (aud, "<<inc>> %s\n", dtimenow (0));
@@ -655,7 +655,6 @@ main (int argc, char **argv)
                break;
 
            case SCNMSG:
                break;
 
            case SCNMSG:
-           case SCNENC:
            default:
                if (aud)
                    fputs (charstring_buffer (scanl), aud);
            default:
                if (aud)
                    fputs (charstring_buffer (scanl), aud);
@@ -717,7 +716,6 @@ main (int argc, char **argv)
                break;
 
            case SCNMSG:
                break;
 
            case SCNMSG:
-           case SCNENC:
                /*
                 *  Run the external program hook on the message.
                 */
                /*
                 *  Run the external program hook on the message.
                 */
@@ -761,7 +759,7 @@ main (int argc, char **argv)
                size_t nrd;
 
                if ((sf = fopen (sp, "r")) == NULL)
                size_t nrd;
 
                if ((sf = fopen (sp, "r")) == NULL)
-                   adios (sp, "unable to read for copy");
+                   adios (sp, "unable to read for copy");
                if ((pf = fopen (cp, "w+")) == NULL)
                    adios (cp, "unable to write for copy");
                while ((nrd = fread(buf, 1, sizeof(buf), sf)) > 0)
                if ((pf = fopen (cp, "w+")) == NULL)
                    adios (cp, "unable to write for copy");
                while ((nrd = fread(buf, 1, sizeof(buf), sf)) > 0)
@@ -799,7 +797,6 @@ main (int argc, char **argv)
                break;
 
            case SCNMSG:
                break;
 
            case SCNMSG:
-           case SCNENC:
            default:
                /*
                 *  Run the external program hook on the message.
            default:
                /*
                 *  Run the external program hook on the message.
@@ -877,7 +874,7 @@ main (int argc, char **argv)
     if (msgnum == hghnum) {
        inform("no messages incorporated, continuing...");
     } else {
     if (msgnum == hghnum) {
        inform("no messages incorporated, continuing...");
     } else {
-       /*
+       /*
         * Lock the sequence file now, and loop to set the right flags
         * in the folder structure
         */
         * Lock the sequence file now, and loop to set the right flags
         * in the folder structure
         */