From 075f69840cbaa149a9d01c5ffe60a4d4b1302252 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Sat, 14 Nov 2009 13:13:00 +0100 Subject: [PATCH] add -host/-user options to nc to override env --- remote-nc-options.patch | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ series | 1 + 2 files changed, 76 insertions(+) create mode 100644 remote-nc-options.patch diff --git a/remote-nc-options.patch b/remote-nc-options.patch new file mode 100644 index 0000000..9b8598c --- /dev/null +++ b/remote-nc-options.patch @@ -0,0 +1,75 @@ +--- + + source/nc.c | 28 +++++++++++++++++++++++----- + 1 file changed, 23 insertions(+), 5 deletions(-) + +diff --quilt old/source/nc.c new/source/nc.c +--- old/source/nc.c ++++ new/source/nc.c +@@ -132,6 +132,8 @@ static struct { + char serverName[MAXPATHLEN]; + int waitForClose; + int timeOut; ++ char neditHost[MAXNODENAMELEN+1]; ++ char neditUser[MAXUSERNAMELEN+1]; + } Preferences; + + /* Application resources */ +@@ -145,7 +147,11 @@ static PrefDescripRec PrefDescrip[] = { + {"waitForClose", "WaitForClose", PREF_BOOLEAN, "False", + &Preferences.waitForClose, NULL, False}, + {"timeOut", "TimeOut", PREF_INT, "10", +- &Preferences.timeOut, NULL, False} ++ &Preferences.timeOut, NULL, False}, ++ {"neditHost", "NEditHost", PREF_STRING, "", ++ Preferences.neditHost, (void *)sizeof(Preferences.neditHost), False}, ++ {"neditUser", "NEditUser", PREF_STRING, "", ++ Preferences.neditUser, (void *)sizeof(Preferences.neditUser), False}, + }; + + /* Resource related command line options */ +@@ -155,7 +161,9 @@ static XrmOptionDescRec OpTable[] = { + {"-svrname", ".serverName", XrmoptionSepArg, (caddr_t)NULL}, + {"-svrcmd", ".serverCommand", XrmoptionSepArg, (caddr_t)NULL}, + {"-wait", ".waitForClose", XrmoptionNoArg, (caddr_t)"True"}, +- {"-timeout", ".timeOut", XrmoptionSepArg, (caddr_t)NULL} ++ {"-timeout", ".timeOut", XrmoptionSepArg, (caddr_t)NULL}, ++ {"-host", ".neditHost", XrmoptionSepArg, (caddr_t)NULL}, ++ {"-user", ".neditUser", XrmoptionSepArg, (caddr_t)NULL} + }; + + /* Struct to hold info about files being opened and edited. */ +@@ -272,13 +280,20 @@ int main(int argc, char **argv) + XtFree((char*)xt_argv); + rootWindow = RootWindow(TheDisplay, DefaultScreen(TheDisplay)); + +- /* Process the command line, with original arguments */ +- commandLine = processCommandLine(argc, argv); +- + /* Read the application resources into the Preferences data structure */ + RestorePreferences(prefDB, XtDatabase(TheDisplay), APP_NAME, + APP_CLASS, PrefDescrip, XtNumber(PrefDescrip)); + ++ /* overwrite environment NEDIT_HOST/NEDIT_USER with -host/-user ++ * TODO: I think you can now set nc.neditHost and nc.neditUser in the ++ * .Xresource file, but than you can not overwrite these with the ++ * NEDIT_HOST/NEDIT_USER variables. ++ */ ++ if (Preferences.neditHost[0] != '\0') ++ setenv("NEDIT_HOST", Preferences.neditHost, True); ++ if (Preferences.neditUser[0] != '\0') ++ setenv("NEDIT_USER", Preferences.neditUser, True); ++ + /* Make sure that the time out unit is at least 1 second and not too + large either (overflow!). */ + if (Preferences.timeOut < 1) { +@@ -300,6 +315,9 @@ int main(int argc, char **argv) + } + #endif /* VMS */ + ++ /* Process the command line, with original arguments */ ++ commandLine = processCommandLine(argc, argv); ++ + /* Create the wait properties for the various files. */ + createWaitProperties(); + diff --git a/series b/series index 2f229b1..c869c7d 100644 --- a/series +++ b/series @@ -156,6 +156,7 @@ undo-all-in-macro-context.patch listDialogKeyWords.diff newTabTab.patch remote-nc.patch +remote-nc-options.patch motifless-nc.patch macro_backtrace.patch catch-ArrayCopy-error.patch -- 2.11.4.GIT