Ticket #44811: patch-env_unix.c.diff
File patch-env_unix.c.diff, 1.8 KB (added by RJVB (René Bertin), 10 years ago) |
---|
-
src/osdep/unix/env_unix.c
old new 28 28 #include <signal.h> 29 29 #include <sys/wait.h> 30 30 31 #include <stdio.h> 32 #include <string.h> 33 #include <sys/param.h> 34 31 35 32 36 /* in case stat.h is ancient */ 33 37 … … 66 70 static char *myServerName = NIL;/* server name */ 67 71 static char *myLocalHost = NIL; /* local host name */ 68 72 static char *myNewsrc = NIL; /* newsrc file name */ 69 static char *mailsubdir = NIL; /* mailbox subdirectory name */73 static char *mailsubdir = ((char*)-1); /* mailbox subdirectory name */ 70 74 static char *sysInbox = NIL; /* system inbox name */ 71 75 static char *newsActive = NIL; /* news active file */ 72 76 static char *newsSpool = NIL; /* news spool */ … … 965 969 char *home = myhomedir (); 966 970 /* initialize if first time */ 967 971 if (!myMailboxDir && myHomeDir) { 968 if (mailsubdir) { 972 if (mailsubdir == ((char*)-1) ) { 973 char *rcfile = NULL; 974 FILE *fp; 975 asprintf( &rcfile, "%s/.imap/MailboxDir.rc", home ); 976 if( rcfile && (fp = fopen( rcfile, "r" )) ){ 977 char dirnm[MAXPATHLEN]; 978 if( fgets( dirnm, MAXPATHLEN, fp ) > 0 ){ 979 if( dirnm[strlen(dirnm)-1] == '\n' ){ 980 dirnm[strlen(dirnm)-1] = '\0'; 981 } 982 myMailboxDir = cpystr(dirnm); 983 snprintf( dirnm, MAXPATHLEN, "Mailbox dir set to %s", myMailboxDir ); 984 MM_LOG( dirnm, WARN ); 985 } 986 fclose(fp); 987 } 988 if( rcfile ){ 989 free(rcfile); 990 } 991 if( !myMailboxDir ){ 992 mailsubdir = "Mail"; 993 goto useMail; 994 } 995 } 996 else if (mailsubdir) { 997 useMail:; 969 998 char tmp[MAILTMPLEN]; 970 999 sprintf (tmp,"%s/%s",home,mailsubdir); 971 1000 myMailboxDir = cpystr (tmp);/* use pre-defined subdirectory of home */