--- main.cpp.old 2023-12-20 14:58:28.000000000 +0100 +++ main.cpp 2023-12-21 15:13:14.931502001 +0100 @@ -154,6 +154,31 @@ void parseCommandLineArguments() { +#ifndef Q_OS_WIN + + #define INDENT " " + #define BREAK "" + +#else + + #define INDENT "\n" + #define BREAK "\n " + +#endif // Q_OS_WIN + + const char* const usage = + "Usage: qpdfview [options] [--] [file[#page]] [file[#src:name:line:column]] ...\n" + "\n" + "Available options:\n" + INDENT "--help " BREAK "Show this information\n" + INDENT "--quiet " BREAK "Suppress warning messages when opening files\n" + INDENT "--search text " BREAK "Search for text in the current tab\n" + INDENT "--unique " BREAK "Open files as tabs in unique window\n" + INDENT "--unique --instance name " BREAK "Open files as tabs in named instance\n" + INDENT "--unique --choose-instance " BREAK "Open files as tabs after choosing an instance name\n" + "\n" + "Please report bugs at \"https://launchpad.net/qpdfview\".\n"; + bool instanceNameIsNext = false; bool searchTextIsNext = false; bool noMoreOptions = false; @@ -193,6 +218,13 @@ searchTextIsNext = false; searchText = argument; } +#ifdef Q_OS_WIN + else if(!noMoreOptions && (argument == QLatin1String("/help") || argument == QLatin1String("/?"))) + { + qInfo() << usage; + exit(ExitOk); + } +#endif // Q_OS_WIN else if(!noMoreOptions && argument.startsWith("--")) { if(argument == QLatin1String("--unique")) @@ -221,41 +253,8 @@ instanceName = chosenInstanceName; } } -#ifndef Q_OS_WIN - else if(argument == QLatin1String("--help")) - -#else - - else if(argument == QLatin1String("--help") || argument == QLatin1String("/help") || argument == QLatin1String("/?")) - -#endif // Q_OS_WIN { -#ifndef Q_OS_WIN - - #define INDENT " " - #define BREAK "" - -#else - - #define INDENT "\n" - #define BREAK "\n " - -#endif // Q_OS_WIN - - const char* const usage = - "Usage: qpdfview [options] [--] [file[#page]] [file[#src:name:line:column]] ...\n" - "\n" - "Available options:\n" - INDENT "--help " BREAK "Show this information\n" - INDENT "--quiet " BREAK "Suppress warning messages when opening files\n" - INDENT "--search text " BREAK "Search for text in the current tab\n" - INDENT "--unique " BREAK "Open files as tabs in unique window\n" - INDENT "--unique --instance name " BREAK "Open files as tabs in named instance\n" - INDENT "--unique --choose-instance " BREAK "Open files as tabs after choosing an instance name\n" - "\n" - "Please report bugs at \"https://launchpad.net/qpdfview\".\n"; - qInfo() << usage; exit(ExitOk); }