honor filepath while searching for a unused window and try the -do macro
[nedit-bw.git] / remote-nc.patch
blobb7ec780df64beb296259b99cbd90ab58ffecffeb
1 ---
3 source/nc.c | 86 +++++++++++++++++++++++++++++++----------
4 source/server.c | 49 +++++++++++++++--------
5 source/server_common.c | 22 +++++-----
6 source/windowTitle.c | 8 ++-
7 util/utils.c | 101 ++++++++++++++++++++++++++++++++-----------------
8 util/utils.h | 6 +-
9 6 files changed, 183 insertions(+), 89 deletions(-)
11 diff --quilt old/source/nc.c new/source/nc.c
12 --- old/source/nc.c
13 +++ new/source/nc.c
14 @@ -36,6 +36,7 @@ static const char CVSID[] = "$Id: nc.c,v
15 #include "../util/utils.h"
16 #include "../util/prefFile.h"
17 #include "../util/system.h"
18 +#include "../util/misc.h"
20 #include <stdio.h>
21 #include <stdlib.h>
22 @@ -181,7 +182,7 @@ static void setPropertyValue(Atom atom)
25 /* Add another entry to the file entry list, if it doesn't exist yet. */
26 -static void addToFileList(const char *path)
27 +static void addToFileList(long prefixLen, const char *prefix, const char *path)
29 FileListEntry *item;
31 @@ -196,8 +197,9 @@ static void addToFileList(const char *pa
32 item = malloc(sizeof(item[0]));
33 item->waitForFileOpenAtom = None;
34 item->waitForFileClosedAtom = None;
35 - item->path = (char*)malloc(strlen(path)+1);
36 - strcpy(item->path, path);
37 + item->path = (char*)malloc(prefixLen+strlen(path)+1);
38 + strcpy(item->path, prefix);
39 + strcpy(item->path + prefixLen, path);
40 item->next = fileListHead.fileList;
41 fileListHead.fileList = item;
43 @@ -233,6 +235,8 @@ int main(int argc, char **argv)
44 Atom serverExistsAtom, serverRequestAtom;
45 XrmDatabase prefDB;
46 Boolean serverExists;
47 + int xt_argc;
48 + char **xt_argv;
50 /* Initialize toolkit and get an application context */
51 XtToolkitInitialize();
52 @@ -251,21 +255,26 @@ int main(int argc, char **argv)
53 don't support the .nc file anymore) */
54 prefDB = CreatePreferencesDatabase(NULL, APP_CLASS,
55 OpTable, XtNumber(OpTable), (unsigned *)&argc, argv);
57 + /* copy argv/argc because XtOpenDisplay consumes arguments we may need
58 + for the server command line */
59 + xt_argv = (char**)XtMalloc(sizeof(char*) * (argc + 1));
60 + memcpy(xt_argv, argv, sizeof(char*) * (argc + 1));
61 + xt_argc = argc;
63 - /* Process the command line before calling XtOpenDisplay, because the
64 - latter consumes certain command line arguments that we still need
65 - (-icon, -geometry ...) */
66 - commandLine = processCommandLine(argc, argv);
68 /* Open the display and find the root window */
69 TheDisplay = XtOpenDisplay (context, NULL, APP_NAME, APP_CLASS, NULL,
70 - 0, &argc, argv);
71 + 0, &xt_argc, xt_argv);
72 if (!TheDisplay) {
73 XtWarning ("nc: Can't open display\n");
74 exit(EXIT_FAILURE);
76 + XtFree((char*)xt_argv);
77 rootWindow = RootWindow(TheDisplay, DefaultScreen(TheDisplay));
79 + /* Process the command line, with original arguments */
80 + commandLine = processCommandLine(argc, argv);
82 /* Read the application resources into the Preferences data structure */
83 RestorePreferences(prefDB, XtDatabase(TheDisplay), APP_NAME,
84 APP_CLASS, PrefDescrip, XtNumber(PrefDescrip));
85 @@ -503,7 +512,8 @@ static int startServer(const char *messa
87 /* prompt user whether to start server */
88 if (!Preferences.autoStart) {
89 - printf(message);
90 + printf("%s", message);
91 + fflush(stdout);
92 do {
93 c = getc(stdin);
94 } while (c == ' ' || c == '\t');
95 @@ -605,19 +615,35 @@ static CommandLine processCommandLine(in
97 static void parseCommandLine(int argc, char **argv, CommandLine *commandLine)
99 -#define MAX_RECORD_HEADER_LENGTH 38
100 +#define MAX_RECORD_HEADER_LENGTH 64
101 char name[MAXPATHLEN], path[MAXPATHLEN];
102 const char *toDoCommand = "", *langMode = "", *geometry = "";
103 char *commandString, *outPtr;
104 int lineNum = 0, read = 0, create = 0, iconic = 0, tabbed = -1, length = 0;
105 int i, lineArg, nRead, charsWritten, opts = True;
106 int fileCount = 0, group = 0, isTabbed;
107 + long currentDesktop = QueryCurrentDesktop(TheDisplay,
108 + RootWindow(TheDisplay, DefaultScreen(TheDisplay)));
110 + char *filePrefix = "";
111 + long filePrefixLen = 0;
112 +#ifndef VMS
113 + if (strcmp(GetNameOfHost(LOCAL_NAME), GetNameOfHost(NEDIT_NAME)))
115 + filePrefixLen = strlen(GetNameOfHost(LOCAL_NAME)) + 1
116 + + strlen(GetUserName(LOCAL_NAME)) + 1;
117 + filePrefix = XtMalloc(filePrefixLen + 1);
118 + sprintf(filePrefix, "%s@%s:",
119 + GetUserName(LOCAL_NAME), GetNameOfHost(LOCAL_NAME));
121 +#endif
123 /* Allocate a string for output, for the maximum possible length. The
124 maximum length is calculated by assuming every argument is a file,
125 and a complete record of maximum length is created for it */
126 for (i=1; i<argc; i++) {
127 - length += MAX_RECORD_HEADER_LENGTH + strlen(argv[i]) + MAXPATHLEN;
128 + length += MAX_RECORD_HEADER_LENGTH + strlen(argv[i]) + MAXPATHLEN
129 + + filePrefixLen;
131 /* In case of no arguments, must still allocate space for one record header */
132 if (length < MAX_RECORD_HEADER_LENGTH)
133 @@ -735,16 +761,19 @@ static void parseCommandLine(int argc, c
136 /* See below for casts */
137 - sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n%s\n%s\n%s\n%s\n%n",
138 - lineNum, read, create, iconic, tabbed, (long) strlen(path),
139 + sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n"
140 + "%s%s\n%s\n%s\n%s\n%n",
141 + lineNum, read, create, iconic, tabbed, currentDesktop,
142 + filePrefixLen + (long) strlen(path),
143 (long) strlen(toDoCommand), (long) strlen(langMode),
144 (long) strlen(geometry),
145 - path, toDoCommand, langMode, geometry, &charsWritten);
146 + filePrefix, path, toDoCommand, langMode, geometry,
147 + &charsWritten);
148 outPtr += charsWritten;
149 free(nameList[j]);
151 /* Create the file open atoms for the paths supplied */
152 - addToFileList(path);
153 + addToFileList(filePrefixLen, filePrefix, path);
154 fileCount++;
156 if (nameList != NULL)
157 @@ -777,11 +806,14 @@ static void parseCommandLine(int argc, c
158 The "long" cast on strlen() is necessary because size_t
159 is 64 bit on Alphas, and 32-bit on most others. There is
160 no printf format specifier for "size_t", thanx, ANSI. */
161 - sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld\n%n", lineNum,
162 - read, create, iconic, isTabbed, (long) strlen(path),
163 + sprintf(outPtr, "%d %d %d %d %d %ld %ld %ld %ld %ld\n%n", lineNum,
164 + read, create, iconic, isTabbed, currentDesktop,
165 + filePrefixLen + (long) strlen(path),
166 (long) strlen(toDoCommand), (long) strlen(langMode),
167 (long) strlen(geometry), &charsWritten);
168 outPtr += charsWritten;
169 + strcpy(outPtr, filePrefix);
170 + outPtr += filePrefixLen;
171 strcpy(outPtr, path);
172 outPtr += strlen(path);
173 *outPtr++ = '\n';
174 @@ -797,7 +829,7 @@ static void parseCommandLine(int argc, c
175 toDoCommand = "";
177 /* Create the file open atoms for the paths supplied */
178 - addToFileList(path);
179 + addToFileList(filePrefixLen, filePrefix, path);
180 fileCount++;
181 #endif /* VMS */
183 @@ -812,10 +844,17 @@ static void parseCommandLine(int argc, c
184 * iconic state (and optional language mode and geometry).
186 if (toDoCommand[0] != '\0' || fileCount == 0) {
187 - sprintf(outPtr, "0 0 0 %d %d 0 %ld %ld %ld\n\n%n", iconic, tabbed,
188 - (long) strlen(toDoCommand),
189 - (long) strlen(langMode), (long) strlen(geometry), &charsWritten);
190 + const char *current = GetCurrentDir();
191 + sprintf(outPtr, "0 0 0 %d %d %ld %ld %ld %ld %ld\n%n", iconic, tabbed,
192 + currentDesktop, -(filePrefixLen + (long) strlen(current)),
193 + (long) strlen(toDoCommand), (long) strlen(langMode),
194 + (long) strlen(geometry), &charsWritten);
195 outPtr += charsWritten;
196 + strcpy(outPtr, filePrefix);
197 + outPtr += filePrefixLen;
198 + strcpy(outPtr, current);
199 + outPtr += strlen(current);
200 + *outPtr++ = '\n';
201 strcpy(outPtr, toDoCommand);
202 outPtr += strlen(toDoCommand);
203 *outPtr++ = '\n';
204 @@ -826,6 +865,9 @@ static void parseCommandLine(int argc, c
205 outPtr += strlen(geometry);
206 *outPtr++ = '\n';
209 + if (filePrefixLen > 0)
210 + XtFree(filePrefix);
212 *outPtr = '\0';
213 commandLine->serverRequest = commandString;
214 diff --quilt old/source/server.c new/source/server.c
215 --- old/source/server.c
216 +++ new/source/server.c
217 @@ -374,16 +374,26 @@ static void processServerCommandString(c
218 command both followed by newlines. This bit of code reads the
219 header, and converts the newlines following the filename and do
220 command to nulls to terminate the filename and doCommand strings */
221 - itemsRead = sscanf(inPtr, "%d %d %d %d %d %d %d %d %d%n", &lineNum,
222 - &readFlag, &createFlag, &iconicFlag, &tabbed, &fileLen,
223 - &doLen, &lmLen, &geomLen, &charsRead);
224 - if (itemsRead != 9)
225 + itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d%n", &lineNum,
226 + &readFlag, &createFlag, &iconicFlag, &tabbed, &currentDesktop,
227 + &fileLen, &doLen, &lmLen, &geomLen, &charsRead);
228 + if (itemsRead == 9) {
229 + /* backward compatibility, without currentDesktop */
230 + geomLen = lmLen;
231 + lmLen = doLen;
232 + doLen = fileLen;
233 + fileLen = currentDesktop;
234 + currentDesktop = QueryCurrentDesktop(TheDisplay,
235 + RootWindow(TheDisplay, DefaultScreen(TheDisplay)));
236 + } else if (itemsRead != 10)
237 goto readError;
238 inPtr += charsRead + 1;
239 - if (inPtr - string + fileLen > stringLen)
240 + if (fileLen >= 0 && inPtr - string + fileLen > stringLen)
241 + goto readError;
242 + if (fileLen < 0 && inPtr - string - fileLen > stringLen)
243 goto readError;
244 requestname = inPtr;
245 - inPtr += fileLen;
246 + inPtr += fileLen < 0 ? -fileLen : fileLen;
247 *inPtr++ = '\0';
248 if (inPtr - string + doLen > stringLen)
249 goto readError;
250 @@ -410,13 +420,15 @@ static void processServerCommandString(c
251 if (fileLen <= 0) {
252 for (window=WindowList; window!=NULL; window=window->next)
253 if (!window->filenameSet && !window->fileChanged &&
254 - isLocatedOnDesktop(window, currentDesktop))
255 + isLocatedOnDesktop(window, currentDesktop) &&
256 + (fileLen < 0 ? !strcmp(window->path, fullname) : True))
257 break;
259 if (*doCommand == '\0') {
260 if (window == NULL) {
261 EditNewFile(findWindowOnDesktop(tabbed, currentDesktop),
262 - NULL, iconicFlag, lmLen==0?NULL:langMode, NULL,
263 + NULL, iconicFlag, lmLen==0?NULL:langMode,
264 + fileLen < 0 ? fullname : NULL,
265 False);
266 } else {
267 if (iconicFlag)
268 @@ -425,22 +437,23 @@ static void processServerCommandString(c
269 RaiseDocumentWindow(window);
271 } else {
272 - WindowInfo *win = WindowList;
273 - /* Starting a new command while another one is still running
274 - in the same window is not possible (crashes). */
275 - while (win != NULL && win->macroCmdData != NULL) {
276 - win = win->next;
278 + if (window == NULL || window->macroCmdData != NULL) {
279 + /* Starting a new command while another one is still running
280 + in the same window is not possible (crashes). */
281 + while (window != NULL && window->macroCmdData != NULL) {
282 + window = window->next;
286 - if (!win) {
287 + if (!window) {
288 XBell(TheDisplay, 0);
289 } else {
290 /* Raise before -do (macro could close window). */
291 if (iconicFlag)
292 - RaiseDocument(win);
293 + RaiseDocument(window);
294 else
295 - RaiseDocumentWindow(win);
296 - DoMacro(win, doCommand, "-do macro");
297 + RaiseDocumentWindow(window);
298 + DoMacro(window, doCommand, "-do macro");
301 CheckCloseDim();
302 diff --quilt old/util/utils.c new/util/utils.c
303 --- old/util/utils.c
304 +++ new/util/utils.c
305 @@ -119,38 +119,60 @@ const char* GetHomeDir(void)
306 ** allocated string.
308 const char
309 -*GetUserName(void)
310 +*GetUserName(enum nameType name)
312 + static char userName[2][MAXUSERNAMELEN+1];
313 + static int userNameFound = False;
315 + if (!userNameFound) {
316 + const char *user;
318 #ifdef VMS
319 - return cuserid(NULL);
320 + user = cuserid(NULL);
321 #else
322 - /* cuserid has apparently been dropped from the ansi C standard, and if
323 - strict ansi compliance is turned on (on Sun anyhow, maybe others), calls
324 - to cuserid fail to compile. Older versions of nedit try to use the
325 - getlogin call first, then if that fails, use getpwuid and getuid. This
326 - results in the user-name of the original terminal being used, which is
327 - not correct when the user uses the su command. Now, getpwuid only: */
329 - const struct passwd *passwdEntry;
330 - static char *userName=NULL;
332 - if (userName)
333 - return userName;
335 - passwdEntry = getpwuid(getuid());
336 - if (!passwdEntry) {
337 - /* This is really serious, but sometimes username service
338 - is misconfigured through no fault of the user. Be nice
339 - and let the user start nc anyway. */
340 - perror("nedit: getpwuid() failed - reverting to $USER");
341 - return getenv("USER");
343 - else {
344 - userName=malloc(strlen(passwdEntry->pw_name)+1);
345 - strcpy(userName, passwdEntry->pw_name);
346 - return userName;
348 + /* cuserid has apparently been dropped from the ansi C standard,
349 + and if strict ansi compliance is turned on (on Sun anyhow,
350 + maybe others), calls to cuserid fail to compile. Older
351 + versions of nedit try to use the getlogin call first, then if
352 + that fails, use getpwuid and getuid. This results in the
353 + user-name of the original terminal being used, which is not
354 + correct when the user uses the su command. Now, getpwuid only: */
356 + const struct passwd *passwdEntry = getpwuid(getuid());
357 + if (!passwdEntry || !passwdEntry->pw_name) {
358 + /* This is really serious, but sometimes username service
359 + is misconfigured through no fault of the user. Be nice
360 + and let the user start nc anyway. */
361 + perror("nedit: getpwuid() failed - reverting to $USER");
362 + user = getenv("USER");
364 + else {
365 + user = passwdEntry->pw_name;
367 #endif /* VMS */
369 + if (!user) {
370 + fprintf(stderr, "nedit: failed to determine user name.");
371 + exit(EXIT_FAILURE);
373 + if (strlen(user) > MAXUSERNAMELEN)
374 + fprintf(stderr, "nedit: Username to long, need to truncate.\n");
375 + strncpy(userName[LOCAL_NAME], user, MAXUSERNAMELEN);
376 + userName[LOCAL_NAME][MAXUSERNAMELEN] = '\0';
378 + /* set nedit user to $NEDIT_USER,
379 + but only if it fits into the buffer */
380 + if ((user = getenv("NEDIT_USER")) && (strlen(user) <= MAXUSERNAMELEN)) {
381 + strcpy(userName[NEDIT_NAME], user);
382 + } else {
383 + strcpy(userName[NEDIT_NAME], userName[LOCAL_NAME]);
386 + userNameFound = True;
389 + return userName[name];
393 @@ -162,12 +184,13 @@ const char
394 ** VMS links case-insensitively.
396 const char
397 -*GetNameOfHost(void)
398 +*GetNameOfHost(enum nameType name)
400 - static char hostname[MAXNODENAMELEN+1];
401 + static char hostname[2][MAXNODENAMELEN+1];
402 static int hostnameFound = False;
404 if (!hostnameFound) {
405 + const char *host;
406 #ifdef VMS
407 /* This should be simple, but uname is not supported in the DEC C RTL and
408 gethostname on VMS depends either on Multinet or UCX. So use uname
409 @@ -179,12 +202,12 @@ const char
410 unsigned long int unused = 0;
411 unsigned short int hostnameLen = MAXNODENAMELEN+1;
413 - hostnameDesc = NulStrWrtDesc(hostname, MAXNODENAMELEN+1);
414 + hostnameDesc = NulStrWrtDesc(hostname[LOCAL_NAME], MAXNODENAMELEN+1);
415 syi_status = lib$getsyi(&syiItemCode, &unused, hostnameDesc, &hostnameLen,
416 0, 0);
417 if (syi_status != SS$_NORMAL) {
418 fprintf(stderr, "nedit: Error return from lib$getsyi: %d", syi_status);
419 - strcpy(hostname, "VMS");
420 + strcpy(hostname[LOCAL_NAME], "VMS");
421 } else
422 hostname[hostnameLen] = '\0';
423 FreeStrDesc(hostnameDesc);
424 @@ -196,11 +219,23 @@ const char
425 perror("nedit: uname() failed ");
426 exit(EXIT_FAILURE);
428 - strcpy(hostname, nameStruct.nodename);
429 + if (strlen(nameStruct.nodename) > MAXNODENAMELEN)
430 + fprintf(stderr, "nedit: hostname to long, need to truncate.\n");
431 + strcpy(hostname[LOCAL_NAME], nameStruct.nodename);
432 + hostname[LOCAL_NAME][MAXNODENAMELEN] = '\0';
433 #endif /* VMS */
435 + /* set remote hostname to $NEDIT_HOST,
436 + but only if it fits into the buffer */
437 + if ((host = getenv("NEDIT_HOST")) && (strlen(host) <= MAXNODENAMELEN)) {
438 + strcpy(hostname[NEDIT_NAME], host);
439 + } else {
440 + strcpy(hostname[NEDIT_NAME], hostname[LOCAL_NAME]);
443 hostnameFound = True;
445 - return hostname;
446 + return hostname[name];
450 diff --quilt old/source/server_common.c new/source/server_common.c
451 --- old/source/server_common.c
452 +++ new/source/server_common.c
453 @@ -57,8 +57,8 @@ void CreateServerPropertyAtoms(const cha
454 Atom *serverRequestAtomReturn)
456 char propName[24+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN];
457 - const char *userName = GetUserName();
458 - const char *hostName = GetNameOfHost();
459 + const char *userName = GetUserName(NEDIT_NAME);
460 + const char *hostName = GetNameOfHost(NEDIT_NAME);
462 sprintf(propName, "NEDIT_5.7_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName);
463 *serverExistsAtomReturn = XInternAtom(TheDisplay, propName, False);
464 @@ -86,9 +86,9 @@ void CreateServerPropertyAtoms(const cha
465 Atom CreateServerFileOpenAtom(const char *serverName,
466 const char *path)
468 - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7];
469 - const char *userName = GetUserName();
470 - const char *hostName = GetNameOfHost();
471 + char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7+1];
472 + const char *userName = GetUserName(NEDIT_NAME);
473 + const char *hostName = GetNameOfHost(NEDIT_NAME);
474 Atom atom;
476 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path);
477 @@ -100,9 +100,9 @@ Atom CreateServerFileClosedAtom(const ch
478 const char *path,
479 Bool only_if_exist)
481 - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9];
482 - const char *userName = GetUserName();
483 - const char *hostName = GetNameOfHost();
484 + char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9+1];
485 + const char *userName = GetUserName(NEDIT_NAME);
486 + const char *hostName = GetNameOfHost(NEDIT_NAME);
487 Atom atom;
489 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path);
490 @@ -116,9 +116,9 @@ Atom CreateServerFileClosedAtom(const ch
492 void DeleteServerFileAtoms(const char* serverName, Window rootWindow)
494 - char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1];
495 - const char *userName = GetUserName();
496 - const char *hostName = GetNameOfHost();
497 + char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+1];
498 + const char *userName = GetUserName(NEDIT_NAME);
499 + const char *hostName = GetNameOfHost(NEDIT_NAME);
500 int length = sprintf(propNamePrefix, "NEDIT_5.7_FILE_%s_%s_%s_", hostName, userName, serverName);
502 int nProperties;
503 diff --quilt old/util/utils.h new/util/utils.h
504 --- old/util/utils.h
505 +++ new/util/utils.h
506 @@ -37,11 +37,13 @@
507 #include <sys/param.h>
508 #endif /*VMS*/
510 +enum nameType {LOCAL_NAME, NEDIT_NAME};
512 const char *GetCurrentDir(void);
513 const char *GetHomeDir(void);
514 char *PrependHome(const char *filename, char *buf, size_t buflen);
515 -const char *GetUserName(void);
516 -const char *GetNameOfHost(void);
517 +const char *GetUserName(enum nameType name);
518 +const char *GetNameOfHost(enum nameType name);
519 int Min(int i1, int i2);
520 const char* GetRCFileName(int type);
521 const char* GetNEditHome(void);
522 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
523 --- old/source/windowTitle.c
524 +++ new/source/windowTitle.c
525 @@ -352,7 +352,7 @@ char *FormatWindowTitle(const char* file
527 } else if (*titleFormat == 'h') {
528 int comps = c - '0';
529 - char* hostname = strdup(GetNameOfHost());
530 + char* hostname = strdup(GetNameOfHost(NEDIT_NAME));
531 char *p, *n;
532 hostNamePresent = True;
533 titleFormat++; /* delete the argument */
534 @@ -380,7 +380,8 @@ char *FormatWindowTitle(const char* file
536 case 'h': /* host name */
537 hostNamePresent = True;
538 - titlePtr = safeStrCpy(titlePtr, titleEnd, GetNameOfHost());
539 + titlePtr = safeStrCpy(titlePtr, titleEnd,
540 + GetNameOfHost(NEDIT_NAME));
541 break;
543 case 'S': /* file status */
544 @@ -401,7 +402,8 @@ char *FormatWindowTitle(const char* file
546 case 'u': /* user name */
547 userNamePresent = True;
548 - titlePtr = safeStrCpy(titlePtr, titleEnd, GetUserName());
549 + titlePtr = safeStrCpy(titlePtr, titleEnd,
550 + GetUserName(NEDIT_NAME));
551 break;
553 case '%': /* escaped % */