[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[screen-devel] Correctly format lock message if GECOS data is CSV
From: |
Tore Sinding Bekkedal |
Subject: |
[screen-devel] Correctly format lock message if GECOS data is CSV |
Date: |
Mon, 28 Aug 2017 12:20:46 +0200 |
Hello - long time user, first time contributor.
The screen lock message does not present GECOS data correctly if it -
as is tradition - is a comma-separated string; so rather than:
screen used by Tore Sinding Bekkedal <toresbe> on pascal.
I get:
screen used by Tore Sinding Bekkedal,,, <toresbe> on pascal.
Here's a patch which should fix that. I hope it's been formatted
correctly, sent to the right place, and meets the appropriate
standards - if not, please let me know.
diff --git a/src/socket.c b/src/socket.c
index 804592e..4402016 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1105,8 +1105,19 @@ static void AskPassword(Message *m)
D_processinputdata = (char *)pwdata;
D_processinput = PasswordProcessInput;
- snprintf(prompt, sizeof(prompt), "\ascreen used by %s%s<%s> on
%s.\r\nPassword: ", ppp->pw_gecos,
+ char * gecos_comma = strchr(ppp->pw_gecos, ',');
+ char * realname = 0;
+
+ if (gecos_comma) {
+ realname = malloc(gecos_comma - ppp->pw_gecos);
+ memcpy(realname, ppp->pw_gecos, gecos_comma - ppp->pw_gecos);
+ }
+
+ snprintf(prompt, sizeof(prompt), "\ascreen used by %s%s<%s> on
%s.\r\nPassword: ",
+ gecos_comma ? realname : ppp->pw_gecos,
ppp->pw_gecos[0] ? " " : "", ppp->pw_name, HostName);
+
+ free(realname);
AddStr(prompt);
}
regards,
--
Tore Sinding Bekkedal | http://gunkies.org/ | Mob: +47 91 85 95 08
"I never let my schooling interfere with my education." - Mark Twain
- [screen-devel] Correctly format lock message if GECOS data is CSV,
Tore Sinding Bekkedal <=