aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-26 01:50:32 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-26 01:50:32 +0800
commit6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79 (patch)
treec44469c8d2c3339e76045aeecd0ed7123399a773 /calendar
parent07f873d107539a4357c69e1f3ce8cef17cc6277f (diff)
downloadgsoc2013-evolution-6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79.tar.gz
gsoc2013-evolution-6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79.tar.zst
gsoc2013-evolution-6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79.zip
Fix user name computation -mig
svn path=/trunk/; revision=195
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/main.c8
-rw-r--r--calendar/main.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 1d19da236c..f24371d79a 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -11,7 +11,7 @@
#include <gnome.h>
#include <pwd.h>
#include <sys/types.h>
-
+#include <string.h>
#include "alarm.h"
#include "calendar.h"
#include "eventedit.h"
@@ -62,8 +62,14 @@ init_username (void)
passwd = getpwuid (getuid ());
if ((p = passwd->pw_name)) {
+ char *comma;
+
user_name = g_strdup (p);
full_name = g_strdup (passwd->pw_gecos);
+
+ /* Keep only the name from the gecos field */
+ if ((comma = strchr (full_name, ',')) != NULL)
+ *comma = 0;
} else {
if ((p = getenv ("USER"))) {
user_name = g_strdup (p);
diff --git a/calendar/main.c b/calendar/main.c
index 1d19da236c..f24371d79a 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -11,7 +11,7 @@
#include <gnome.h>
#include <pwd.h>
#include <sys/types.h>
-
+#include <string.h>
#include "alarm.h"
#include "calendar.h"
#include "eventedit.h"
@@ -62,8 +62,14 @@ init_username (void)
passwd = getpwuid (getuid ());
if ((p = passwd->pw_name)) {
+ char *comma;
+
user_name = g_strdup (p);
full_name = g_strdup (passwd->pw_gecos);
+
+ /* Keep only the name from the gecos field */
+ if ((comma = strchr (full_name, ',')) != NULL)
+ *comma = 0;
} else {
if ((p = getenv ("USER"))) {
user_name = g_strdup (p);