From 6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 25 Apr 1998 17:50:32 +0000 Subject: Fix user name computation -mig svn path=/trunk/; revision=195 --- calendar/gui/main.c | 8 +++++++- calendar/main.c | 8 +++++++- 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 #include #include - +#include #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 #include #include - +#include #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); -- cgit