Ticket #44811: imapuw-patch-env_unix.diff

File imapuw-patch-env_unix.diff, 2.3 KB (added by RJVB (René Bertin), 10 years ago)
  • mail/imap-uw/files/patch-env_unix.c.diff

    old new  
    1 --- src/osdep/unix/env_unix.c-orig      Wed Nov  5 17:09:13 2003
    2 +++ src/osdep/unix/env_unix.c   Wed Nov  5 17:11:16 2003
    3 @@ -68,7 +68,7 @@
     1--- src/osdep/unix/env_unix.c.orig      2011-07-23 02:20:10.000000000 +0200
     2+++ src/osdep/unix/env_unix.c   2014-08-29 22:53:25.000000000 +0200
     3@@ -28,6 +28,10 @@
     4 #include <signal.h>
     5 #include <sys/wait.h>
     6 
     7+#include <stdio.h>
     8+#include <string.h>
     9+#include <sys/param.h>
     10+
     11 
     12 /* in case stat.h is ancient */
     13 
     14@@ -66,7 +70,7 @@
    415 static char *myServerName = NIL;/* server name */
    516 static char *myLocalHost = NIL;        /* local host name */
    617 static char *myNewsrc = NIL;   /* newsrc file name */
    718-static char *mailsubdir = NIL; /* mailbox subdirectory name */
    8 +static char *mailsubdir = "Mail";      /* mailbox subdirectory name */
     19+static char *mailsubdir = ((char*)-1); /* mailbox subdirectory name */
    920 static char *sysInbox = NIL;   /* system inbox name */
    1021 static char *newsActive = NIL; /* news active file */
    1122 static char *newsSpool = NIL;  /* news spool */
     23@@ -965,7 +969,32 @@
     24   char *home = myhomedir ();
     25                                /* initialize if first time */
     26   if (!myMailboxDir && myHomeDir) {
     27-    if (mailsubdir) {
     28+    if (mailsubdir == ((char*)-1) ) {
     29+      char *rcfile = NULL;
     30+      FILE *fp;
     31+      asprintf( &rcfile, "%s/.imap/MailboxDir.rc", home );
     32+      if( rcfile && (fp = fopen( rcfile, "r" )) ){
     33+        char dirnm[MAXPATHLEN];
     34+        if( fgets( dirnm, MAXPATHLEN, fp ) > 0 ){
     35+          if( dirnm[strlen(dirnm)-1] == '\n' ){
     36+              dirnm[strlen(dirnm)-1] = '\0';
     37+          }
     38+          myMailboxDir = cpystr(dirnm);
     39+          snprintf( dirnm, MAXPATHLEN, "Mailbox dir set to %s", myMailboxDir );
     40+          MM_LOG( dirnm, WARN );
     41+        }
     42+        fclose(fp);
     43+      }
     44+      if( rcfile ){
     45+        free(rcfile);
     46+      }
     47+      if( !myMailboxDir ){
     48+        mailsubdir = "Mail";
     49+        goto useMail;
     50+      }
     51+    }
     52+    else if (mailsubdir) {
     53+useMail:;
     54       char tmp[MAILTMPLEN];
     55       sprintf (tmp,"%s/%s",home,mailsubdir);
     56       myMailboxDir = cpystr (tmp);/* use pre-defined subdirectory of home */