diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-11-14 16:04:32 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-11-14 16:05:40 +0100 |
commit | 8c2a744c23dedcfdf07682949d46cb70c0f076e4 (patch) | |
tree | 3a4c4751eb3f1cdc61294603a3fddf3f1968c5c1 | |
parent | 727a70f03868b1734e73853f2f75a4e9e4aa9b61 (diff) | |
download | tigervnc-8c2a744c23dedcfdf07682949d46cb70c0f076e4.tar.gz tigervnc-8c2a744c23dedcfdf07682949d46cb70c0f076e4.zip |
Handle FLTK arguments at any position
E.g. vncviewer server.example.com:2 -display :2
-rw-r--r-- | vncviewer/vncviewer.cxx | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 67013027..53ff4b0c 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -493,27 +493,32 @@ int main(int argc, char** argv) if (alertOnFatalError) fl_alert("%s", e.str()); } - - int i = 1; - if (!Fl::args(argc, argv, i) || i < argc) - for (; i < argc; i++) { - if (Configuration::setParam(argv[i])) - continue; - - if (argv[i][0] == '-') { - if (i+1 < argc) { - if (Configuration::setParam(&argv[i][1], argv[i+1])) { - i++; - continue; - } + + for (int i = 1; i < argc;) { + if (Fl::arg(argc, argv, i)) + continue; + + if (Configuration::setParam(argv[i])) { + i++; + continue; + } + + if (argv[i][0] == '-') { + if (i+1 < argc) { + if (Configuration::setParam(&argv[i][1], argv[i+1])) { + i += 2; + continue; } - usage(argv[0]); } - strncpy(vncServerName, argv[i], VNCSERVERNAMELEN); - vncServerName[VNCSERVERNAMELEN - 1] = '\0'; + usage(argv[0]); } + strncpy(vncServerName, argv[i], VNCSERVERNAMELEN); + vncServerName[VNCSERVERNAMELEN - 1] = '\0'; + i++; + } + mkvnchomedir(); #if !defined(WIN32) && !defined(__APPLE__) |