fix nc -do ""
[nedit-bw.git] / remote-nc.patch
blob2fed33cdd75be8aa1813d41f9970215460bfd35c
1 ---
3 source/nc.c | 86 +++++++++++++++++++++++++++++++----------
4 source/server.c | 50 +++++++++++++++---------
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, 184 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,24 @@ 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 + window = WindowList;
282 + while (window != NULL && window->macroCmdData != NULL) {
283 + window = window->next;
287 - if (!win) {
288 + if (!window) {
289 XBell(TheDisplay, 0);
290 } else {
291 /* Raise before -do (macro could close window). */
292 if (iconicFlag)
293 - RaiseDocument(win);
294 + RaiseDocument(window);
295 else
296 - RaiseDocumentWindow(win);
297 - DoMacro(win, doCommand, "-do macro");
298 + RaiseDocumentWindow(window);
299 + DoMacro(window, doCommand, "-do macro");
302 CheckCloseDim();
303 diff --quilt old/util/utils.c new/util/utils.c
304 --- old/util/utils.c
305 +++ new/util/utils.c
306 @@ -119,38 +119,60 @@ const char* GetHomeDir(void)
307 ** allocated string.
309 const char
310 -*GetUserName(void)
311 +*GetUserName(enum nameType name)
313 + static char userName[2][MAXUSERNAMELEN+1];
314 + static int userNameFound = False;
316 + if (!userNameFound) {
317 + const char *user;
319 #ifdef VMS
320 - return cuserid(NULL);
321 + user = cuserid(NULL);
322 #else
323 - /* cuserid has apparently been dropped from the ansi C standard, and if
324 - strict ansi compliance is turned on (on Sun anyhow, maybe others), calls
325 - to cuserid fail to compile. Older versions of nedit try to use the
326 - getlogin call first, then if that fails, use getpwuid and getuid. This
327 - results in the user-name of the original terminal being used, which is
328 - not correct when the user uses the su command. Now, getpwuid only: */
330 - const struct passwd *passwdEntry;
331 - static char *userName=NULL;
333 - if (userName)
334 - return userName;
336 - passwdEntry = getpwuid(getuid());
337 - if (!passwdEntry) {
338 - /* This is really serious, but sometimes username service
339 - is misconfigured through no fault of the user. Be nice
340 - and let the user start nc anyway. */
341 - perror("nedit: getpwuid() failed - reverting to $USER");
342 - return getenv("USER");
344 - else {
345 - userName=malloc(strlen(passwdEntry->pw_name)+1);
346 - strcpy(userName, passwdEntry->pw_name);
347 - return userName;
349 + /* cuserid has apparently been dropped from the ansi C standard,
350 + and if strict ansi compliance is turned on (on Sun anyhow,
351 + maybe others), calls to cuserid fail to compile. Older
352 + versions of nedit try to use the getlogin call first, then if
353 + that fails, use getpwuid and getuid. This results in the
354 + user-name of the original terminal being used, which is not
355 + correct when the user uses the su command. Now, getpwuid only: */
357 + const struct passwd *passwdEntry = getpwuid(getuid());
358 + if (!passwdEntry || !passwdEntry->pw_name) {
359 + /* This is really serious, but sometimes username service
360 + is misconfigured through no fault of the user. Be nice
361 + and let the user start nc anyway. */
362 + perror("nedit: getpwuid() failed - reverting to $USER");
363 + user = getenv("USER");
365 + else {
366 + user = passwdEntry->pw_name;
368 #endif /* VMS */
370 + if (!user) {
371 + fprintf(stderr, "nedit: failed to determine user name.");
372 + exit(EXIT_FAILURE);
374 + if (strlen(user) > MAXUSERNAMELEN)
375 + fprintf(stderr, "nedit: Username to long, need to truncate.\n");
376 + strncpy(userName[LOCAL_NAME], user, MAXUSERNAMELEN);
377 + userName[LOCAL_NAME][MAXUSERNAMELEN] = '\0';
379 + /* set nedit user to $NEDIT_USER,
380 + but only if it fits into the buffer */
381 + if ((user = getenv("NEDIT_USER")) && (strlen(user) <= MAXUSERNAMELEN)) {
382 + strcpy(userName[NEDIT_NAME], user);
383 + } else {
384 + strcpy(userName[NEDIT_NAME], userName[LOCAL_NAME]);
387 + userNameFound = True;
390 + return userName[name];
394 @@ -162,12 +184,13 @@ const char
395 ** VMS links case-insensitively.
397 const char
398 -*GetNameOfHost(void)
399 +*GetNameOfHost(enum nameType name)
401 - static char hostname[MAXNODENAMELEN+1];
402 + static char hostname[2][MAXNODENAMELEN+1];
403 static int hostnameFound = False;
405 if (!hostnameFound) {
406 + const char *host;
407 #ifdef VMS
408 /* This should be simple, but uname is not supported in the DEC C RTL and
409 gethostname on VMS depends either on Multinet or UCX. So use uname
410 @@ -179,12 +202,12 @@ const char
411 unsigned long int unused = 0;
412 unsigned short int hostnameLen = MAXNODENAMELEN+1;
414 - hostnameDesc = NulStrWrtDesc(hostname, MAXNODENAMELEN+1);
415 + hostnameDesc = NulStrWrtDesc(hostname[LOCAL_NAME], MAXNODENAMELEN+1);
416 syi_status = lib$getsyi(&syiItemCode, &unused, hostnameDesc, &hostnameLen,
417 0, 0);
418 if (syi_status != SS$_NORMAL) {
419 fprintf(stderr, "nedit: Error return from lib$getsyi: %d", syi_status);
420 - strcpy(hostname, "VMS");
421 + strcpy(hostname[LOCAL_NAME], "VMS");
422 } else
423 hostname[hostnameLen] = '\0';
424 FreeStrDesc(hostnameDesc);
425 @@ -196,11 +219,23 @@ const char
426 perror("nedit: uname() failed ");
427 exit(EXIT_FAILURE);
429 - strcpy(hostname, nameStruct.nodename);
430 + if (strlen(nameStruct.nodename) > MAXNODENAMELEN)
431 + fprintf(stderr, "nedit: hostname to long, need to truncate.\n");
432 + strcpy(hostname[LOCAL_NAME], nameStruct.nodename);
433 + hostname[LOCAL_NAME][MAXNODENAMELEN] = '\0';
434 #endif /* VMS */
436 + /* set remote hostname to $NEDIT_HOST,
437 + but only if it fits into the buffer */
438 + if ((host = getenv("NEDIT_HOST")) && (strlen(host) <= MAXNODENAMELEN)) {
439 + strcpy(hostname[NEDIT_NAME], host);
440 + } else {
441 + strcpy(hostname[NEDIT_NAME], hostname[LOCAL_NAME]);
444 hostnameFound = True;
446 - return hostname;
447 + return hostname[name];
451 diff --quilt old/source/server_common.c new/source/server_common.c
452 --- old/source/server_common.c
453 +++ new/source/server_common.c
454 @@ -57,8 +57,8 @@ void CreateServerPropertyAtoms(const cha
455 Atom *serverRequestAtomReturn)
457 char propName[24+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN];
458 - const char *userName = GetUserName();
459 - const char *hostName = GetNameOfHost();
460 + const char *userName = GetUserName(NEDIT_NAME);
461 + const char *hostName = GetNameOfHost(NEDIT_NAME);
463 sprintf(propName, "NEDIT_5.7_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName);
464 *serverExistsAtomReturn = XInternAtom(TheDisplay, propName, False);
465 @@ -86,9 +86,9 @@ void CreateServerPropertyAtoms(const cha
466 Atom CreateServerFileOpenAtom(const char *serverName,
467 const char *path)
469 - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7];
470 - const char *userName = GetUserName();
471 - const char *hostName = GetNameOfHost();
472 + char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7+1];
473 + const char *userName = GetUserName(NEDIT_NAME);
474 + const char *hostName = GetNameOfHost(NEDIT_NAME);
475 Atom atom;
477 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path);
478 @@ -100,9 +100,9 @@ Atom CreateServerFileClosedAtom(const ch
479 const char *path,
480 Bool only_if_exist)
482 - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9];
483 - const char *userName = GetUserName();
484 - const char *hostName = GetNameOfHost();
485 + char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9+1];
486 + const char *userName = GetUserName(NEDIT_NAME);
487 + const char *hostName = GetNameOfHost(NEDIT_NAME);
488 Atom atom;
490 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path);
491 @@ -116,9 +116,9 @@ Atom CreateServerFileClosedAtom(const ch
493 void DeleteServerFileAtoms(const char* serverName, Window rootWindow)
495 - char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1];
496 - const char *userName = GetUserName();
497 - const char *hostName = GetNameOfHost();
498 + char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+1];
499 + const char *userName = GetUserName(NEDIT_NAME);
500 + const char *hostName = GetNameOfHost(NEDIT_NAME);
501 int length = sprintf(propNamePrefix, "NEDIT_5.7_FILE_%s_%s_%s_", hostName, userName, serverName);
503 int nProperties;
504 diff --quilt old/util/utils.h new/util/utils.h
505 --- old/util/utils.h
506 +++ new/util/utils.h
507 @@ -37,11 +37,13 @@
508 #include <sys/param.h>
509 #endif /*VMS*/
511 +enum nameType {LOCAL_NAME, NEDIT_NAME};
513 const char *GetCurrentDir(void);
514 const char *GetHomeDir(void);
515 char *PrependHome(const char *filename, char *buf, size_t buflen);
516 -const char *GetUserName(void);
517 -const char *GetNameOfHost(void);
518 +const char *GetUserName(enum nameType name);
519 +const char *GetNameOfHost(enum nameType name);
520 int Min(int i1, int i2);
521 const char* GetRCFileName(int type);
522 const char* GetNEditHome(void);
523 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
524 --- old/source/windowTitle.c
525 +++ new/source/windowTitle.c
526 @@ -352,7 +352,7 @@ char *FormatWindowTitle(const char* file
528 } else if (*titleFormat == 'h') {
529 int comps = c - '0';
530 - char* hostname = strdup(GetNameOfHost());
531 + char* hostname = strdup(GetNameOfHost(NEDIT_NAME));
532 char *p, *n;
533 hostNamePresent = True;
534 titleFormat++; /* delete the argument */
535 @@ -380,7 +380,8 @@ char *FormatWindowTitle(const char* file
537 case 'h': /* host name */
538 hostNamePresent = True;
539 - titlePtr = safeStrCpy(titlePtr, titleEnd, GetNameOfHost());
540 + titlePtr = safeStrCpy(titlePtr, titleEnd,
541 + GetNameOfHost(NEDIT_NAME));
542 break;
544 case 'S': /* file status */
545 @@ -401,7 +402,8 @@ char *FormatWindowTitle(const char* file
547 case 'u': /* user name */
548 userNamePresent = True;
549 - titlePtr = safeStrCpy(titlePtr, titleEnd, GetUserName());
550 + titlePtr = safeStrCpy(titlePtr, titleEnd,
551 + GetUserName(NEDIT_NAME));
552 break;
554 case '%': /* escaped % */