Subject: imap-uw mailsubdir patch
To: None <tech-pkg@netbsd.org>
From: Jeff Rizzo <riz@redcrowgroup.com>
List: tech-pkg
Date: 09/30/2004 10:39:05
--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi-

When I use the mail/imap-uw package, I like to set its "mailsubdir" to my
users' "Mail" directory in their home directory, and it seems like others
might like to be able to set this from within the package, too.  With the
attached patch (apply in /usr/pkgsrc), I can set the var "IMAP_UW_MAILSUBDIR"
to change the value.

Is this a worthwhile change?  Should I send-pr it?  I also welcome criticism
of how I handled the fact that the value needs to be quoted *only* if
it's set...

+j
-- 
Jeff Rizzo                                         http://www.redcrowgroup.com/

--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=imap-uw-patch

--- mail/imap-uw/Makefile.orig	2004-09-30 09:54:32.000000000 -0700
+++ mail/imap-uw/Makefile	2004-09-30 10:24:46.000000000 -0700
@@ -112,19 +112,28 @@
 			$${FILE}.broken > $${FILE};			\
 	done
 
-BUILD_DEFS+=	IMAP_UW_MAILSPOOLHOME
+BUILD_DEFS+=	IMAP_UW_MAILSPOOLHOME IMAP_UW_MAILSUBDIR
+
+# Make sure IMAP_UW_MAILSUBDIR is quoted unless it's NIL
+.if defined(IMAP_UW_MAILSUBDIR)
+IMAP_UW_MAILSUBDIR_QUOTED='\"${IMAP_UW_MAILSUBDIR}\"'
+.else
+IMAP_UW_MAILSUBDIR_QUOTED=NIL;
+.endif
 
 post-patch:
 .if defined(IMAP_UW_MAILSPOOLHOME)
 	cd ${WRKSRC}/src/osdep/unix &&					\
 	${SED}	-e 's|@SPOOLDIR@|myhomedir ()|'				\
 		-e 's|@MAILBOX@|"${IMAP_UW_MAILSPOOLHOME}"|'		\
+		-e 's|@MAILSUBDIR@|${IMAP_UW_MAILSUBDIR_QUOTED}|'	\
 		env_unix.c > env_unix.c.new &&				\
 	${MV} -f env_unix.c.new env_unix.c
 .else
 	cd ${WRKSRC}/src/osdep/unix &&					\
 	${SED}	-e 's|@SPOOLDIR@|MAILSPOOL|'				\
 		-e 's|@MAILBOX@|myusername ()|'				\
+		-e 's|@MAILSUBDIR@|${IMAP_UW_MAILSUBDIR_QUOTED}|'	\
 		env_unix.c > env_unix.c.new &&				\
 	${MV} -f env_unix.c.new env_unix.c
 .endif
--- mail/imap-uw/patches/patch-am.orig	2004-08-18 11:33:33.000000000 -0700
+++ mail/imap-uw/patches/patch-am	2004-09-30 10:32:54.000000000 -0700
@@ -1,8 +1,17 @@
 $NetBSD: patch-am,v 1.3 2004/08/12 12:13:54 adam Exp $
 
---- src/osdep/unix/env_unix.c.orig	2004-07-08 20:46:11.000000000 +0000
-+++ src/osdep/unix/env_unix.c
-@@ -830,7 +830,7 @@ char *sysinbox ()
+--- src/osdep/unix/env_unix.c.orig	2004-07-08 13:46:11.000000000 -0700
++++ src/osdep/unix/env_unix.c	2004-09-30 09:52:41.000000000 -0700
+@@ -29,7 +29,7 @@
+ static char *myMailboxDir = NIL;/* mailbox directory name */
+ static char *myLocalHost = NIL;	/* local host name */
+ static char *myNewsrc = NIL;	/* newsrc file name */
+-static char *mailsubdir = NIL;	/* mail subdirectory name */
++static char *mailsubdir = @MAILSUBDIR@;	/* mail subdirectory name */
+ static char *sysInbox = NIL;	/* system inbox name */
+ static char *newsActive = NIL;	/* news active file */
+ static char *newsSpool = NIL;	/* news spool */
+@@ -830,7 +830,7 @@
  {
    char tmp[MAILTMPLEN];
    if (!sysInbox) {		/* initialize if first time */

--7JfCtLOvnd9MIVvH--