[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated
From: |
Ken Hornstein |
Subject: |
[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 8eeb81b97870153a57c9dff79540c70d89ef87a4 |
Date: |
Tue, 13 Mar 2012 19:26:20 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".
The branch, master has been updated
via 8eeb81b97870153a57c9dff79540c70d89ef87a4 (commit)
via 21f60122877f22b2545a31aebfb9b78118a50ecd (commit)
from dfa7b4ffa462d4f24016ab4729928dee5ec389bb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=8eeb81b97870153a57c9dff79540c70d89ef87a4
commit 8eeb81b97870153a57c9dff79540c70d89ef87a4
Author: Ken Hornstein <address@hidden>
Date: Tue Mar 13 15:25:41 2012 -0400
Modify getfullname so it performs the same processing that
mts.c:getuserinfo() does.
diff --git a/test/getfullname.c b/test/getfullname.c
index f0c8a2d..3dc221e 100644
--- a/test/getfullname.c
+++ b/test/getfullname.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
@@ -16,12 +17,13 @@
int
main(int argc, char *argv[])
{
+ struct passwd *pwd;
+ char name[BUFSIZ], *p;
+
if (argc > 1) {
fprintf (stderr, "usage: %s\n", argv[0]);
}
- struct passwd *pwd;
-
pwd = getpwuid(getuid());
if (! pwd) {
@@ -30,7 +32,36 @@ main(int argc, char *argv[])
exit(1);
}
- printf("%s\n", pwd->pw_gecos);
+ /*
+ * Perform the same processing that getuserinfo() does.
+ */
+
+ strncpy(name, pwd->pw_gecos, sizeof(name));
+
+ name[sizeof(name) - 1] = '\0';
+
+ /*
+ * Stop at the first comma
+ */
+
+ if ((p = strchr(name, ',')))
+ *p = '\0';
+
+ /*
+ * Quote the entire string if it has a "." in it
+ */
+
+ if (strchr(name, '.')) {
+ char tmp[BUFSIZ];
+
+ snprintf(tmp, sizeof(tmp), "\"%s\"", name);
+ strncpy(name, tmp, sizeof(name));
+
+ name[sizeof(name) - 2] = '"';
+ name[sizeof(name) - 1] = '\0';
+ }
+
+ printf("%s\n", name);
exit(0);
}
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=21f60122877f22b2545a31aebfb9b78118a50ecd
commit 21f60122877f22b2545a31aebfb9b78118a50ecd
Author: Ken Hornstein <address@hidden>
Date: Tue Mar 13 15:15:42 2012 -0400
Create proper prototypes for formataddr() and concataddr().
diff --git a/h/fmt_scan.h b/h/fmt_scan.h
index 9872e09..394b01e 100644
--- a/h/fmt_scan.h
+++ b/h/fmt_scan.h
@@ -91,3 +91,5 @@ struct format {
struct format *fmt_scan (struct format *, char *, int, int *);
char *new_fs (char *, char *, char *);
int fmt_compile (char *, struct format **);
+char *formataddr(char *, char *);
+char *concataddr(char *, char *);
diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c
index f689300..29b87d0 100644
--- a/sbr/fmt_scan.c
+++ b/sbr/fmt_scan.c
@@ -25,9 +25,6 @@
# include <wchar.h>
#endif
-extern char *formataddr (); /* hook for custom address formatting */
-extern char *concataddr (); /* address formatting but allowing duplicates */
-
#ifdef LBL
struct msgs *fmt_current_folder; /* current folder (set by main program) */
#endif
-----------------------------------------------------------------------
Summary of changes:
h/fmt_scan.h | 2 ++
sbr/fmt_scan.c | 3 ---
test/getfullname.c | 37 ++++++++++++++++++++++++++++++++++---
3 files changed, 36 insertions(+), 6 deletions(-)
hooks/post-receive
--
The nmh Mail Handling System
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. 8eeb81b97870153a57c9dff79540c70d89ef87a4,
Ken Hornstein <=