diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-26 01:50:32 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-26 01:50:32 +0800 |
commit | 6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79 (patch) | |
tree | c44469c8d2c3339e76045aeecd0ed7123399a773 | |
parent | 07f873d107539a4357c69e1f3ce8cef17cc6277f (diff) | |
download | gsoc2013-evolution-6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79.tar.gz gsoc2013-evolution-6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79.tar.zst gsoc2013-evolution-6b3f6b3bf0a40bdd33da63ca89416d9af1f29f79.zip |
Fix user name computation -mig
svn path=/trunk/; revision=195
-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); |