push up autoload_dotNM_files.patch
[nedit-bw.git] / strip_hostname.patch
blob5a92bdca8da598690011a5ebe0ac72ffa4fce489
1 ---
3 doc/help.etx | 3 ++-
4 source/windowTitle.c | 23 ++++++++++++++++++++++-
5 2 files changed, 24 insertions(+), 2 deletions(-)
7 diff --quilt old/source/windowTitle.c new/source/windowTitle.c
8 --- old/source/windowTitle.c
9 +++ new/source/windowTitle.c
10 @@ -244,11 +244,12 @@ static void compressWindowTitle(char *ti
11 ** %s : server name
12 ** %[n]d : directory, with one optional digit specifying the max number
13 ** of trailing directory components to display. Skipped components are
14 ** replaced by an ellipsis (...).
15 ** %f : file name
16 -** %h : host name
17 +** %[n]h : host name, with one optional digit specifying the max number
18 + of leading hosts components to dispaly.
19 ** %S : file status
20 ** %u : user name
22 ** if the ClearCase view tag and server name are identical, only the first one
23 ** specified in the formatting string will be displayed.
24 @@ -347,10 +348,30 @@ char *FormatWindowTitle(const char* file
25 if (trailingPath > path) {
26 titlePtr = safeStrCpy(titlePtr, titleEnd, "...");
28 titlePtr = safeStrCpy(titlePtr, titleEnd, trailingPath);
30 + } else if (*titleFormat == 'h') {
31 + int comps = c - '0';
32 + char* hostname = strdup(GetNameOfHost());
33 + char *p, *n;
34 + hostNamePresent = True;
35 + titleFormat++; /* delete the argument */
36 + n = p = hostname;
37 + while (comps) {
38 + if ((n = strchr(n, '.'))) {
39 + comps--;
40 + p = n;
41 + while (*n && *n == '.')
42 + n++;
43 + } else
44 + break;
45 + }
46 + if (*p == '.')
47 + *p = '\0';
48 + titlePtr = safeStrCpy(titlePtr, titleEnd, hostname);
49 + free(hostname);
51 break;
53 case 'f': /* file name */
54 fileNamePresent = True;
55 diff --quilt old/doc/help.etx new/doc/help.etx
56 --- old/doc/help.etx
57 +++ new/doc/help.etx
58 @@ -1079,11 +1079,12 @@ Tabs/Emulated Tabs
59 .. %[n]d directory, with one optional numeric digit n
60 .. specifying the maximum number of trailing directory
61 .. components to display. Skipped components are
62 .. replaced by an ellipsis (...).
63 .. %f file name, without the path name
64 -.. %h host name
65 +.. %[n]h host name, with one optional digit specifying the max number
66 +.. of leading hosts components to dispaly.
67 .. %s NEdit server name (server mode only)
68 .. %[*]S file status, either verbose (%S) or brief (%*S).
69 .. In verbose mode the file status is spelled out:
70 .. read-only, locked, and modified. In brief mode,
71 .. abbreviations and an asterisk are used for the