On Wed, 2004-01-07 at 02:25, Oliver Jones wrote: > On Wed, 2004-01-07 at 12:24, Kjetil Torgrim Homme wrote: > > I added a small patch which makes Cyrus' utilities add $CYRUS_PATH to > > the front when looking for its configuration files. > > Is this patch in the Cyrus 2.2.2 BETA codebase?
(please don't top post) no, it's just used locally. since it's so small, I'll include it here. this is actually against 2.1.9, but I imagine it will apply to 2.1.x with little fuzz. -- Kjetil T.
diff -ru orig/cyrus-imapd-2.1.9/imap/config.c cyrus-imapd-2.1.9/imap/config.c --- orig/cyrus-imapd-2.1.9/imap/config.c Tue Aug 13 18:46:32 2002 +++ cyrus-imapd-2.1.9/imap/config.c Tue Nov 12 07:24:10 2002 @@ -216,7 +216,11 @@ infile = fopen(alt_config ? alt_config : CONFIG_FILENAME, "r"); if (!infile) { - strcpy(buf, CYRUS_PATH); + char *cyrus_path = getenv("CYRUS_PATH"); + if (cyrus_path && strlen(cyrus_path) < 1024) + strcpy(buf, cyrus_path); + else + strcpy(buf, CYRUS_PATH); strcat(buf, alt_config ? alt_config : CONFIG_FILENAME); infile = fopen(buf, "r"); } diff -ru orig/cyrus-imapd-2.1.9/master/masterconf.c cyrus-imapd-2.1.9/master/masterconf.c --- orig/cyrus-imapd-2.1.9/master/masterconf.c Wed Jul 24 21:30:53 2002 +++ cyrus-imapd-2.1.9/master/masterconf.c Tue Nov 12 07:50:48 2002 @@ -197,8 +197,19 @@ int level = 0; int lineno = 0; char buf[4096]; + char *cyrus_path = NULL; - infile = fopen(CONFIG_FILENAME, "r"); + strcpy(buf, CONFIG_FILENAME); +retry: + infile = fopen(buf, "r"); + if (!infile && !cyrus_path) { + cyrus_path = getenv("CYRUS_PATH"); + if (cyrus_path && strlen(cyrus_path) < 1024) { + strcpy (buf, cyrus_path); + strcat (buf, CONFIG_FILENAME); + goto retry; + } + } if (!infile) { snprintf(buf, sizeof(buf), "can't open configuration file %s: %s", CONFIG_FILENAME, strerror(errno));