make newTabTab patch last
[nedit-bw.git] / remote-nc.patch
blob1a9b4b1cca8ed92a703cfde50dfa529f44feaf37
1 ---
3 source/nc.c | 111 +++++++++++++++++++++++++++++++++++++++----------
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, 209 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,42 @@ 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 + char current[MAXPATHLEN];
191 + long length;
192 + strcpy(current, GetCurrentDir());
193 + length = strlen(current);
195 +#ifndef VMS
196 + /* do we have a "/" at the end? if not, add one */
197 + if (0 < length && current[length - 1] != '/' && length < MAXPATHLEN - 1) {
198 + strcpy(&current[length], "/");
199 + length++;
201 +#else /* VMS */
202 + /* A logical name should be followed by a colon so that the filename can
203 + be added to it to make a full file specification; otherwise a directory
204 + path had the form
205 + device_or_logicalname:[dir.dir.dir]
206 + this requires no separator before the file name.
207 + */
208 + if (0 < length && strchr(":]", current[length - 1]) == NULL) {
209 + strcpy(&current[length], ":"); /* could not find a separator at end */
210 + length++;
212 + /* TODO: is this enough for VMS? what of posix emulation? */
213 + /* TODO: what about other platforms? */
214 +#endif /* VMS */
216 + sprintf(outPtr, "0 0 0 %d %d %ld %ld %ld %ld %ld\n%n", iconic, tabbed,
217 + currentDesktop, -(filePrefixLen + length),
218 + (long) strlen(toDoCommand), (long) strlen(langMode),
219 + (long) strlen(geometry), &charsWritten);
220 outPtr += charsWritten;
221 + strcpy(outPtr, filePrefix);
222 + outPtr += filePrefixLen;
223 + strcpy(outPtr, current);
224 + outPtr += length;
225 + *outPtr++ = '\n';
226 strcpy(outPtr, toDoCommand);
227 outPtr += strlen(toDoCommand);
228 *outPtr++ = '\n';
229 @@ -826,6 +890,9 @@ static void parseCommandLine(int argc, c
230 outPtr += strlen(geometry);
231 *outPtr++ = '\n';
234 + if (filePrefixLen > 0)
235 + XtFree(filePrefix);
237 *outPtr = '\0';
238 commandLine->serverRequest = commandString;
239 diff --quilt old/source/server.c new/source/server.c
240 --- old/source/server.c
241 +++ new/source/server.c
242 @@ -375,16 +375,26 @@ static void processServerCommandString(c
243 command both followed by newlines. This bit of code reads the
244 header, and converts the newlines following the filename and do
245 command to nulls to terminate the filename and doCommand strings */
246 - itemsRead = sscanf(inPtr, "%d %d %d %d %d %d %d %d %d%n", &lineNum,
247 - &readFlag, &createFlag, &iconicFlag, &tabbed, &fileLen,
248 - &doLen, &lmLen, &geomLen, &charsRead);
249 - if (itemsRead != 9)
250 + itemsRead = sscanf(inPtr, "%d %d %d %d %d %ld %d %d %d %d%n", &lineNum,
251 + &readFlag, &createFlag, &iconicFlag, &tabbed, &currentDesktop,
252 + &fileLen, &doLen, &lmLen, &geomLen, &charsRead);
253 + if (itemsRead == 9) {
254 + /* backward compatibility, without currentDesktop */
255 + geomLen = lmLen;
256 + lmLen = doLen;
257 + doLen = fileLen;
258 + fileLen = currentDesktop;
259 + currentDesktop = QueryCurrentDesktop(TheDisplay,
260 + RootWindow(TheDisplay, DefaultScreen(TheDisplay)));
261 + } else if (itemsRead != 10)
262 goto readError;
263 inPtr += charsRead + 1;
264 - if (inPtr - string + fileLen > stringLen)
265 + if (fileLen >= 0 && inPtr - string + fileLen > stringLen)
266 + goto readError;
267 + if (fileLen < 0 && inPtr - string - fileLen > stringLen)
268 goto readError;
269 requestname = inPtr;
270 - inPtr += fileLen;
271 + inPtr += fileLen < 0 ? -fileLen : fileLen;
272 *inPtr++ = '\0';
273 if (inPtr - string + doLen > stringLen)
274 goto readError;
275 @@ -411,13 +421,15 @@ static void processServerCommandString(c
276 if (fileLen <= 0) {
277 for (window=WindowList; window!=NULL; window=window->next)
278 if (!window->filenameSet && !window->fileChanged &&
279 - isLocatedOnDesktop(window, currentDesktop))
280 + isLocatedOnDesktop(window, currentDesktop) &&
281 + (fileLen < 0 ? !strcmp(window->path, fullname) : True))
282 break;
284 if (*doCommand == '\0') {
285 if (window == NULL) {
286 EditNewFile(findWindowOnDesktop(tabbed, currentDesktop),
287 - NULL, iconicFlag, lmLen==0?NULL:langMode, NULL,
288 + NULL, iconicFlag, lmLen==0?NULL:langMode,
289 + fileLen < 0 ? fullname : NULL,
290 False);
291 } else {
292 if (iconicFlag)
293 @@ -426,22 +438,24 @@ static void processServerCommandString(c
294 RaiseDocumentWindow(window);
296 } else {
297 - WindowInfo *win = WindowList;
298 - /* Starting a new command while another one is still running
299 - in the same window is not possible (crashes). */
300 - while (win != NULL && win->macroCmdData != NULL) {
301 - win = win->next;
303 + if (window == NULL || window->macroCmdData != NULL) {
304 + /* Starting a new command while another one is still running
305 + in the same window is not possible (crashes). */
306 + window = WindowList;
307 + while (window != NULL && window->macroCmdData != NULL) {
308 + window = window->next;
312 - if (!win) {
313 + if (!window) {
314 XBell(TheDisplay, 0);
315 } else {
316 /* Raise before -do (macro could close window). */
317 if (iconicFlag)
318 - RaiseDocument(win);
319 + RaiseDocument(window);
320 else
321 - RaiseDocumentWindow(win);
322 - DoMacro(win, doCommand, "-do macro");
323 + RaiseDocumentWindow(window);
324 + DoMacro(window, doCommand, "-do macro");
327 CheckCloseDim();
328 diff --quilt old/util/utils.c new/util/utils.c
329 --- old/util/utils.c
330 +++ new/util/utils.c
331 @@ -119,38 +119,60 @@ const char* GetHomeDir(void)
332 ** allocated string.
334 const char
335 -*GetUserName(void)
336 +*GetUserName(enum nameType name)
338 + static char userName[2][MAXUSERNAMELEN+1];
339 + static int userNameFound = False;
341 + if (!userNameFound) {
342 + const char *user;
344 #ifdef VMS
345 - return cuserid(NULL);
346 + user = cuserid(NULL);
347 #else
348 - /* cuserid has apparently been dropped from the ansi C standard, and if
349 - strict ansi compliance is turned on (on Sun anyhow, maybe others), calls
350 - to cuserid fail to compile. Older versions of nedit try to use the
351 - getlogin call first, then if that fails, use getpwuid and getuid. This
352 - results in the user-name of the original terminal being used, which is
353 - not correct when the user uses the su command. Now, getpwuid only: */
355 - const struct passwd *passwdEntry;
356 - static char *userName=NULL;
358 - if (userName)
359 - return userName;
361 - passwdEntry = getpwuid(getuid());
362 - if (!passwdEntry) {
363 - /* This is really serious, but sometimes username service
364 - is misconfigured through no fault of the user. Be nice
365 - and let the user start nc anyway. */
366 - perror("nedit: getpwuid() failed - reverting to $USER");
367 - return getenv("USER");
369 - else {
370 - userName=malloc(strlen(passwdEntry->pw_name)+1);
371 - strcpy(userName, passwdEntry->pw_name);
372 - return userName;
374 + /* cuserid has apparently been dropped from the ansi C standard,
375 + and if strict ansi compliance is turned on (on Sun anyhow,
376 + maybe others), calls to cuserid fail to compile. Older
377 + versions of nedit try to use the getlogin call first, then if
378 + that fails, use getpwuid and getuid. This results in the
379 + user-name of the original terminal being used, which is not
380 + correct when the user uses the su command. Now, getpwuid only: */
382 + const struct passwd *passwdEntry = getpwuid(getuid());
383 + if (!passwdEntry || !passwdEntry->pw_name) {
384 + /* This is really serious, but sometimes username service
385 + is misconfigured through no fault of the user. Be nice
386 + and let the user start nc anyway. */
387 + perror("nedit: getpwuid() failed - reverting to $USER");
388 + user = getenv("USER");
390 + else {
391 + user = passwdEntry->pw_name;
393 #endif /* VMS */
395 + if (!user) {
396 + fprintf(stderr, "nedit: failed to determine user name.");
397 + exit(EXIT_FAILURE);
399 + if (strlen(user) > MAXUSERNAMELEN)
400 + fprintf(stderr, "nedit: Username to long, need to truncate.\n");
401 + strncpy(userName[LOCAL_NAME], user, MAXUSERNAMELEN);
402 + userName[LOCAL_NAME][MAXUSERNAMELEN] = '\0';
404 + /* set nedit user to $NEDIT_USER,
405 + but only if it fits into the buffer */
406 + if ((user = getenv("NEDIT_USER")) && (strlen(user) <= MAXUSERNAMELEN)) {
407 + strcpy(userName[NEDIT_NAME], user);
408 + } else {
409 + strcpy(userName[NEDIT_NAME], userName[LOCAL_NAME]);
412 + userNameFound = True;
415 + return userName[name];
419 @@ -162,12 +184,13 @@ const char
420 ** VMS links case-insensitively.
422 const char
423 -*GetNameOfHost(void)
424 +*GetNameOfHost(enum nameType name)
426 - static char hostname[MAXNODENAMELEN+1];
427 + static char hostname[2][MAXNODENAMELEN+1];
428 static int hostnameFound = False;
430 if (!hostnameFound) {
431 + const char *host;
432 #ifdef VMS
433 /* This should be simple, but uname is not supported in the DEC C RTL and
434 gethostname on VMS depends either on Multinet or UCX. So use uname
435 @@ -179,12 +202,12 @@ const char
436 unsigned long int unused = 0;
437 unsigned short int hostnameLen = MAXNODENAMELEN+1;
439 - hostnameDesc = NulStrWrtDesc(hostname, MAXNODENAMELEN+1);
440 + hostnameDesc = NulStrWrtDesc(hostname[LOCAL_NAME], MAXNODENAMELEN+1);
441 syi_status = lib$getsyi(&syiItemCode, &unused, hostnameDesc, &hostnameLen,
442 0, 0);
443 if (syi_status != SS$_NORMAL) {
444 fprintf(stderr, "nedit: Error return from lib$getsyi: %d", syi_status);
445 - strcpy(hostname, "VMS");
446 + strcpy(hostname[LOCAL_NAME], "VMS");
447 } else
448 hostname[hostnameLen] = '\0';
449 FreeStrDesc(hostnameDesc);
450 @@ -196,11 +219,23 @@ const char
451 perror("nedit: uname() failed ");
452 exit(EXIT_FAILURE);
454 - strcpy(hostname, nameStruct.nodename);
455 + if (strlen(nameStruct.nodename) > MAXNODENAMELEN)
456 + fprintf(stderr, "nedit: hostname to long, need to truncate.\n");
457 + strcpy(hostname[LOCAL_NAME], nameStruct.nodename);
458 + hostname[LOCAL_NAME][MAXNODENAMELEN] = '\0';
459 #endif /* VMS */
461 + /* set remote hostname to $NEDIT_HOST,
462 + but only if it fits into the buffer */
463 + if ((host = getenv("NEDIT_HOST")) && (strlen(host) <= MAXNODENAMELEN)) {
464 + strcpy(hostname[NEDIT_NAME], host);
465 + } else {
466 + strcpy(hostname[NEDIT_NAME], hostname[LOCAL_NAME]);
469 hostnameFound = True;
471 - return hostname;
472 + return hostname[name];
476 diff --quilt old/source/server_common.c new/source/server_common.c
477 --- old/source/server_common.c
478 +++ new/source/server_common.c
479 @@ -57,8 +57,8 @@ void CreateServerPropertyAtoms(const cha
480 Atom *serverRequestAtomReturn)
482 char propName[24+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN];
483 - const char *userName = GetUserName();
484 - const char *hostName = GetNameOfHost();
485 + const char *userName = GetUserName(NEDIT_NAME);
486 + const char *hostName = GetNameOfHost(NEDIT_NAME);
488 sprintf(propName, "NEDIT_5.7_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName);
489 *serverExistsAtomReturn = XInternAtom(TheDisplay, propName, False);
490 @@ -86,9 +86,9 @@ void CreateServerPropertyAtoms(const cha
491 Atom CreateServerFileOpenAtom(const char *serverName,
492 const char *path)
494 - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7];
495 - const char *userName = GetUserName();
496 - const char *hostName = GetNameOfHost();
497 + char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7+1];
498 + const char *userName = GetUserName(NEDIT_NAME);
499 + const char *hostName = GetNameOfHost(NEDIT_NAME);
500 Atom atom;
502 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path);
503 @@ -100,9 +100,9 @@ Atom CreateServerFileClosedAtom(const ch
504 const char *path,
505 Bool only_if_exist)
507 - char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9];
508 - const char *userName = GetUserName();
509 - const char *hostName = GetNameOfHost();
510 + char propName[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9+1];
511 + const char *userName = GetUserName(NEDIT_NAME);
512 + const char *hostName = GetNameOfHost(NEDIT_NAME);
513 Atom atom;
515 sprintf(propName, "NEDIT_5.7_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path);
516 @@ -116,9 +116,9 @@ Atom CreateServerFileClosedAtom(const ch
518 void DeleteServerFileAtoms(const char* serverName, Window rootWindow)
520 - char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1];
521 - const char *userName = GetUserName();
522 - const char *hostName = GetNameOfHost();
523 + char propNamePrefix[14+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+1];
524 + const char *userName = GetUserName(NEDIT_NAME);
525 + const char *hostName = GetNameOfHost(NEDIT_NAME);
526 int length = sprintf(propNamePrefix, "NEDIT_5.7_FILE_%s_%s_%s_", hostName, userName, serverName);
528 int nProperties;
529 diff --quilt old/util/utils.h new/util/utils.h
530 --- old/util/utils.h
531 +++ new/util/utils.h
532 @@ -37,11 +37,13 @@
533 #include <sys/param.h>
534 #endif /*VMS*/
536 +enum nameType {LOCAL_NAME, NEDIT_NAME};
538 const char *GetCurrentDir(void);
539 const char *GetHomeDir(void);
540 char *PrependHome(const char *filename, char *buf, size_t buflen);
541 -const char *GetUserName(void);
542 -const char *GetNameOfHost(void);
543 +const char *GetUserName(enum nameType name);
544 +const char *GetNameOfHost(enum nameType name);
545 int Min(int i1, int i2);
546 const char* GetRCFileName(int type);
547 const char* GetNEditHome(void);
548 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
549 --- old/source/windowTitle.c
550 +++ new/source/windowTitle.c
551 @@ -352,7 +352,7 @@ char *FormatWindowTitle(const char* file
553 } else if (*titleFormat == 'h') {
554 int comps = c - '0';
555 - char* hostname = strdup(GetNameOfHost());
556 + char* hostname = strdup(GetNameOfHost(NEDIT_NAME));
557 char *p, *n;
558 hostNamePresent = True;
559 titleFormat++; /* delete the argument */
560 @@ -380,7 +380,8 @@ char *FormatWindowTitle(const char* file
562 case 'h': /* host name */
563 hostNamePresent = True;
564 - titlePtr = safeStrCpy(titlePtr, titleEnd, GetNameOfHost());
565 + titlePtr = safeStrCpy(titlePtr, titleEnd,
566 + GetNameOfHost(NEDIT_NAME));
567 break;
569 case 'S': /* file status */
570 @@ -401,7 +402,8 @@ char *FormatWindowTitle(const char* file
572 case 'u': /* user name */
573 userNamePresent = True;
574 - titlePtr = safeStrCpy(titlePtr, titleEnd, GetUserName());
575 + titlePtr = safeStrCpy(titlePtr, titleEnd,
576 + GetUserName(NEDIT_NAME));
577 break;
579 case '%': /* escaped % */