remove currentDesktop from server request but allow -do macros on new Untitled
[nedit-bw.git] / remote-nc-options.patch
blob9b8598cea13bfab168a1b4874cc7e2c3f8e280cb
1 ---
3 source/nc.c | 28 +++++++++++++++++++++++-----
4 1 file changed, 23 insertions(+), 5 deletions(-)
6 diff --quilt old/source/nc.c new/source/nc.c
7 --- old/source/nc.c
8 +++ new/source/nc.c
9 @@ -132,6 +132,8 @@ static struct {
10 char serverName[MAXPATHLEN];
11 int waitForClose;
12 int timeOut;
13 + char neditHost[MAXNODENAMELEN+1];
14 + char neditUser[MAXUSERNAMELEN+1];
15 } Preferences;
17 /* Application resources */
18 @@ -145,7 +147,11 @@ static PrefDescripRec PrefDescrip[] = {
19 {"waitForClose", "WaitForClose", PREF_BOOLEAN, "False",
20 &Preferences.waitForClose, NULL, False},
21 {"timeOut", "TimeOut", PREF_INT, "10",
22 - &Preferences.timeOut, NULL, False}
23 + &Preferences.timeOut, NULL, False},
24 + {"neditHost", "NEditHost", PREF_STRING, "",
25 + Preferences.neditHost, (void *)sizeof(Preferences.neditHost), False},
26 + {"neditUser", "NEditUser", PREF_STRING, "",
27 + Preferences.neditUser, (void *)sizeof(Preferences.neditUser), False},
30 /* Resource related command line options */
31 @@ -155,7 +161,9 @@ static XrmOptionDescRec OpTable[] = {
32 {"-svrname", ".serverName", XrmoptionSepArg, (caddr_t)NULL},
33 {"-svrcmd", ".serverCommand", XrmoptionSepArg, (caddr_t)NULL},
34 {"-wait", ".waitForClose", XrmoptionNoArg, (caddr_t)"True"},
35 - {"-timeout", ".timeOut", XrmoptionSepArg, (caddr_t)NULL}
36 + {"-timeout", ".timeOut", XrmoptionSepArg, (caddr_t)NULL},
37 + {"-host", ".neditHost", XrmoptionSepArg, (caddr_t)NULL},
38 + {"-user", ".neditUser", XrmoptionSepArg, (caddr_t)NULL}
41 /* Struct to hold info about files being opened and edited. */
42 @@ -272,13 +280,20 @@ int main(int argc, char **argv)
43 XtFree((char*)xt_argv);
44 rootWindow = RootWindow(TheDisplay, DefaultScreen(TheDisplay));
46 - /* Process the command line, with original arguments */
47 - commandLine = processCommandLine(argc, argv);
49 /* Read the application resources into the Preferences data structure */
50 RestorePreferences(prefDB, XtDatabase(TheDisplay), APP_NAME,
51 APP_CLASS, PrefDescrip, XtNumber(PrefDescrip));
53 + /* overwrite environment NEDIT_HOST/NEDIT_USER with -host/-user
54 + * TODO: I think you can now set nc.neditHost and nc.neditUser in the
55 + * .Xresource file, but than you can not overwrite these with the
56 + * NEDIT_HOST/NEDIT_USER variables.
57 + */
58 + if (Preferences.neditHost[0] != '\0')
59 + setenv("NEDIT_HOST", Preferences.neditHost, True);
60 + if (Preferences.neditUser[0] != '\0')
61 + setenv("NEDIT_USER", Preferences.neditUser, True);
63 /* Make sure that the time out unit is at least 1 second and not too
64 large either (overflow!). */
65 if (Preferences.timeOut < 1) {
66 @@ -300,6 +315,9 @@ int main(int argc, char **argv)
68 #endif /* VMS */
70 + /* Process the command line, with original arguments */
71 + commandLine = processCommandLine(argc, argv);
73 /* Create the wait properties for the various files. */
74 createWaitProperties();