aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-01-03 00:59:59 +0100
committerUlrich Sibiller <uli42@gmx.de>2018-01-07 01:27:07 +0100
commitcac1af52d93222e3705ea20f999ba7178010963e (patch)
tree5d340022a4e1011ea3ece4df8be40402ddc2f8dc /nx-X11/programs
parent74c21e9e2dee66dcc3b5224081440fb2351e4d4c (diff)
downloadnx-libs-cac1af52d93222e3705ea20f999ba7178010963e.tar.gz
nx-libs-cac1af52d93222e3705ea20f999ba7178010963e.tar.bz2
nx-libs-cac1af52d93222e3705ea20f999ba7178010963e.zip
Args.c: simplify nxagentGetDialogName()
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index ee18f3b0d..14f696e2d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -2098,31 +2098,24 @@ void ddxUseMsg()
static int nxagentGetDialogName()
{
- snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX");
-
if (*nxagentSessionId != '\0')
{
int length = strlen(nxagentSessionId);
- strcpy(nxagentDialogName, "NX - ");
-
/* if the session id contains an MD5 hash in a well-known format cut it off */
if (length > (MD5_LENGTH * 2 + 1) &&
*(nxagentSessionId + (length - (MD5_LENGTH * 2 + 1))) == '-')
{
- strncat(nxagentDialogName, nxagentSessionId,
- MIN(NXAGENTDIALOGNAMELENGTH - strlen(nxagentDialogName), length - (MD5_LENGTH * 2 + 1)) - 1);
- }
- else
- {
- strncat(nxagentDialogName, nxagentSessionId, NXAGENTDIALOGNAMELENGTH - strlen(nxagentDialogName) - 1);
+ length -= (MD5_LENGTH * 2 + 1);
}
- nxagentDialogName[NXAGENTDIALOGNAMELENGTH - 1] = '\0';
+ snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX - %.*s", length, nxagentSessionId);
return 1;
}
+ snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX");
+
return 0;
}