summaryrefslogtreecommitdiff
path: root/mail/mutt
diff options
context:
space:
mode:
authorkim <kim@pkgsrc.org>2000-05-20 18:41:36 +0000
committerkim <kim@pkgsrc.org>2000-05-20 18:41:36 +0000
commit233c637b3fecbd43da2dd4291fbc9dffc049a9cd (patch)
tree1842622d3486fa201791edfcc774c3b789c5af8a /mail/mutt
parent0800f709aef01d7356eb5f50ced4e0867604546a (diff)
downloadpkgsrc-233c637b3fecbd43da2dd4291fbc9dffc049a9cd.tar.gz
This is the version of the "& expansion in pw_gecos" fix that will be
in future versions of mutt.
Diffstat (limited to 'mail/mutt')
-rw-r--r--mail/mutt/files/patch-sum12
-rw-r--r--mail/mutt/patches/patch-aa47
-rw-r--r--mail/mutt/patches/patch-ab51
-rw-r--r--mail/mutt/patches/patch-ac36
-rw-r--r--mail/mutt/patches/patch-ad15
-rw-r--r--mail/mutt/patches/patch-ae14
-rw-r--r--mail/mutt/patches/patch-af65
-rw-r--r--mail/mutt/patches/patch-ag12
8 files changed, 191 insertions, 61 deletions
diff --git a/mail/mutt/files/patch-sum b/mail/mutt/files/patch-sum
index bace42b7a6b..3000948189c 100644
--- a/mail/mutt/files/patch-sum
+++ b/mail/mutt/files/patch-sum
@@ -1,5 +1,9 @@
-$NetBSD: patch-sum,v 1.4 2000/05/20 01:08:31 kim Exp $
+$NetBSD: patch-sum,v 1.5 2000/05/20 18:41:36 kim Exp $
-MD5 (patch-aa) = 6bb37ef1e6af29438edcd1e0033d2242
-MD5 (patch-ab) = 2c12d6269e8e691075ca67058e86f74d
-MD5 (patch-ac) = e4742b95887fcfe88c15d685bded7174
+MD5 (patch-aa) = 7d2e9e14bd302e841ed1f2b47f0dfa58
+MD5 (patch-ab) = e7f615cb63a40130edefe8a51aca3593
+MD5 (patch-ac) = dd91a45d708f3a3f3fb238cee4f41c28
+MD5 (patch-ad) = e457f59e7d3c215a54d6d0256fe10439
+MD5 (patch-ae) = 9f7427c1b9477c19e11a748c889174a6
+MD5 (patch-af) = b530bbcd85e85ae7233be82d698a374f
+MD5 (patch-ag) = dab46b2aa2eb5a734a7f833c58bbba14
diff --git a/mail/mutt/patches/patch-aa b/mail/mutt/patches/patch-aa
index aea8a95d5ed..50800884823 100644
--- a/mail/mutt/patches/patch-aa
+++ b/mail/mutt/patches/patch-aa
@@ -1,13 +1,40 @@
-$NetBSD: patch-aa,v 1.3 2000/05/20 01:08:32 kim Exp $
+$NetBSD: patch-aa,v 1.4 2000/05/20 18:41:38 kim Exp $
---- alias.c.orig Sat Mar 4 03:40:52 2000
-+++ alias.c Fri May 19 20:52:33 2000
-@@ -100,6 +100,8 @@
-
- strfcpy (a->personal, pw->pw_gecos + pat_match[0].rm_so,
- pat_match[0].rm_eo - pat_match[0].rm_so + 1);
-+ if (strchr (a->personal, '&'))
-+ a->personal = mutt_expand_realname (a->personal, pw->pw_name);
- }
+--- alias.c 2000/03/04 08:40:52 2.11
++++ alias.c 2000/05/20 07:30:10
+@@ -20,7 +20,6 @@
+ #include "mutt_regex.h"
+ #include "mutt_curses.h"
+-#include <pwd.h>
+ #include <string.h>
+
+ ADDRESS *mutt_lookup_alias (const char *s)
+@@ -86,22 +85,11 @@
+
+ if (pw)
+ {
+- regmatch_t pat_match[1];
+-
+- /* Use regular expression to parse Gecos field. This result of the
+- * parsing will be used as the personal ID string when the alias is
+- * expanded.
+- */
+- if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0)
+- {
+- /* Malloc enough for the matching pattern + terminating NULL */
+- a->personal = safe_malloc ((pat_match[0].rm_eo -
+- pat_match[0].rm_so) + 1);
+-
+- strfcpy (a->personal, pw->pw_gecos + pat_match[0].rm_so,
+- pat_match[0].rm_eo - pat_match[0].rm_so + 1);
+- }
+-
++ char namebuf[STRING];
++
++ mutt_gecos_name (namebuf, sizeof (namebuf), pw);
++ mutt_str_replace (&a->personal, namebuf);
++
#ifdef EXACT_ADDRESS
+ FREE (&a->val);
+ #endif
diff --git a/mail/mutt/patches/patch-ab b/mail/mutt/patches/patch-ab
index aa65aefbb6b..f1416f0b6b7 100644
--- a/mail/mutt/patches/patch-ab
+++ b/mail/mutt/patches/patch-ab
@@ -1,40 +1,13 @@
-$NetBSD: patch-ab,v 1.5 2000/05/20 01:08:32 kim Exp $
+$NetBSD: patch-ab,v 1.6 2000/05/20 18:41:40 kim Exp $
---- init.c.orig Sat Apr 22 05:27:07 2000
-+++ init.c Fri May 19 20:55:47 2000
-@@ -1674,6 +1674,8 @@
- Realname = mutt_substrdup (pw->pw_gecos, p);
- else
- Realname = safe_strdup (pw->pw_gecos);
-+ if (strchr (Realname, '&'))
-+ Realname = mutt_expand_realname (Realname, Username);
- Shell = safe_strdup (pw->pw_shell);
- }
- else
-@@ -1890,4 +1892,26 @@
- if (c->func == mutt_parse_hook && mutt_strcasecmp (c->name, name) == 0)
- return c->data;
- return 0;
-+}
-+
-+char *mutt_expand_realname(char *gecos, const char *login)
-+{
-+ char *buf, *bp, *p;
-+
-+ buf = bp = safe_malloc(strlen(gecos) + strlen(login));
-+
-+ /* copy gecos, interpolating & to be full name */
-+ for (p = gecos; *p != '\0'; p++) {
-+ if (*p == '&') {
-+ sprintf(bp, "%s", login);
-+ *bp = toupper(*bp);
-+ bp += strlen(bp);
-+ }
-+ else
-+ *bp++ = *p;
-+ }
-+ *bp = '\0';
-+
-+ safe_free((void **)&gecos);
-+ return(buf);
- }
+--- browser.c 2000/04/12 16:32:26 2.21
++++ browser.c 2000/05/20 07:30:40
+@@ -34,8 +34,6 @@
+ #include <ctype.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
+-#include <pwd.h>
+-#include <grp.h>
+
+ static struct mapping_t FolderHelp[] = {
+ { N_("Exit"), OP_EXIT },
diff --git a/mail/mutt/patches/patch-ac b/mail/mutt/patches/patch-ac
index 98dbb90221b..e463019fa76 100644
--- a/mail/mutt/patches/patch-ac
+++ b/mail/mutt/patches/patch-ac
@@ -1,10 +1,30 @@
-$NetBSD: patch-ac,v 1.1 2000/05/20 01:08:32 kim Exp $
+$NetBSD: patch-ac,v 1.2 2000/05/20 18:41:41 kim Exp $
---- protos.h.orig Tue Mar 7 06:13:38 2000
-+++ protos.h Fri May 19 20:56:17 2000
-@@ -437,4 +437,4 @@
- void ci_bounce_message (HEADER *, int *);
- int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *);
+--- init.c 2000/05/17 03:35:49 2.29
++++ init.c 2000/05/20 07:30:46
+@@ -42,7 +42,6 @@
+ #include "init.h"
+ #include "mailbox.h"
--
-+char *mutt_expand_realname(char *, const char *);
+-#include <pwd.h>
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -1710,13 +1709,13 @@
+ /* Get some information about the user */
+ if ((pw = getpwuid (getuid ())))
+ {
++ char rnbuf[STRING];
++
+ Username = safe_strdup (pw->pw_name);
+ if (!Homedir)
+ Homedir = safe_strdup (pw->pw_dir);
+- if ((p = strchr (pw->pw_gecos, ',')))
+- Realname = mutt_substrdup (pw->pw_gecos, p);
+- else
+- Realname = safe_strdup (pw->pw_gecos);
++
++ Realname = safe_strdup (mutt_gecos_name (rnbuf, sizeof (rnbuf), pw));
+ Shell = safe_strdup (pw->pw_shell);
+ }
+ else
diff --git a/mail/mutt/patches/patch-ad b/mail/mutt/patches/patch-ad
new file mode 100644
index 00000000000..b419f3df5c6
--- /dev/null
+++ b/mail/mutt/patches/patch-ad
@@ -0,0 +1,15 @@
+$NetBSD: patch-ad,v 1.1 2000/05/20 18:41:41 kim Exp $
+
+--- lib.c 2000/05/16 15:23:02 2.24
++++ lib.c 2000/05/20 07:31:00
+@@ -32,9 +32,9 @@
+ #include <stdlib.h>
+ #include <sys/wait.h>
+ #include <errno.h>
+-#include <pwd.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#include <pwd.h>
+
+ #include "lib.h"
+
diff --git a/mail/mutt/patches/patch-ae b/mail/mutt/patches/patch-ae
new file mode 100644
index 00000000000..a10b6258b52
--- /dev/null
+++ b/mail/mutt/patches/patch-ae
@@ -0,0 +1,14 @@
+$NetBSD: patch-ae,v 1.1 2000/05/20 18:41:42 kim Exp $
+
+--- mutt.h 2000/05/16 19:00:15 2.66
++++ mutt.h 2000/05/20 07:30:32
+@@ -36,6 +36,9 @@
+ #include <posix1_lim.h>
+ #endif
+
++#include <pwd.h>
++#include <grp.h>
++
+ #include "rfc822.h"
+ #include "hash.h"
+
diff --git a/mail/mutt/patches/patch-af b/mail/mutt/patches/patch-af
new file mode 100644
index 00000000000..e2eb53a4cd2
--- /dev/null
+++ b/mail/mutt/patches/patch-af
@@ -0,0 +1,65 @@
+$NetBSD: patch-af,v 1.1 2000/05/20 18:41:43 kim Exp $
+
+--- muttlib.c 2000/05/16 15:23:02 2.19
++++ muttlib.c 2000/05/20 07:46:06
+@@ -33,10 +33,12 @@
+ #include <stdlib.h>
+ #include <sys/wait.h>
+ #include <errno.h>
+-#include <pwd.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+
++#define MIN(a,b) ((a) < (b) ? (a) : (b))
++#define MAX(a,b) ((a) < (b) ? (b) : (a))
++
+ BODY *mutt_new_body (void)
+ {
+ BODY *p = (BODY *) safe_calloc (1, sizeof (BODY));
+@@ -452,6 +454,46 @@
+ return (s);
+ }
+
++
++char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw)
++{
++ regmatch_t pat_match[1];
++ size_t pwnl;
++ int idx;
++ char *p;
++
++ if (!pw || !pw->pw_gecos)
++ return NULL;
++
++ memset (dest, 0, destlen);
++
++ if (GecosMask.rx)
++ {
++ if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0)
++ strfcpy (dest, pw->pw_gecos + pat_match[0].rm_so,
++ MIN (pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen));
++ }
++ else if ((p = strchr (pw->pw_gecos, ',')))
++ strfcpy (dest, pw->pw_gecos, MIN (destlen, p - pw->pw_gecos + 1));
++ else
++ strfcpy (dest, pw->pw_gecos, destlen);
++
++ pwnl = strlen (pw->pw_name);
++
++ for (idx = 0; dest[idx]; idx++)
++ {
++ if (dest[idx] == '&')
++ {
++ memmove (&dest[idx + pwnl], &dest[idx + 1],
++ MAX(destlen - idx - pwnl - 1, 0));
++ memcpy (&dest[idx], pw->pw_name, MIN(destlen - idx - 1, pwnl));
++ dest[idx] = toupper (dest[idx]);
++ }
++ }
++
++ return dest;
++}
++
+
+ char *mutt_get_parameter (const char *s, PARAMETER *p)
+ {
diff --git a/mail/mutt/patches/patch-ag b/mail/mutt/patches/patch-ag
new file mode 100644
index 00000000000..61485ae46df
--- /dev/null
+++ b/mail/mutt/patches/patch-ag
@@ -0,0 +1,12 @@
+$NetBSD: patch-ag,v 1.1 2000/05/20 18:41:43 kim Exp $
+
+--- protos.h 2000/05/16 19:00:15 2.44
++++ protos.h 2000/05/20 07:29:02
+@@ -119,6 +119,7 @@
+ char *mutt_expand_path (char *, size_t);
+ char *_mutt_expand_path (char *, size_t, int);
+ char *mutt_find_hook (int, const char *);
++char *mutt_gecos_name (char *, size_t, struct passwd *);
+ char *mutt_gen_msgid (void);
+ char *mutt_get_name (ADDRESS *);
+ char *mutt_get_parameter (const char *, PARAMETER *);