diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/main.c | 8 | ||||
-rw-r--r-- | 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 <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); |