add interface for multiple options with the same name
This commit is contained in:
@@ -863,7 +863,7 @@ static void ApplyLogPreferences()
|
|||||||
* --foo; short arguments (-x) are not supported. (As commandline arguments
|
* --foo; short arguments (-x) are not supported. (As commandline arguments
|
||||||
* are not intended for common, general use, having short options isn't
|
* are not intended for common, general use, having short options isn't
|
||||||
* needed.) If argument is non-NULL, accept an argument. */
|
* needed.) If argument is non-NULL, accept an argument. */
|
||||||
bool GetCommandlineArgument( const CString &option, CString *argument )
|
bool GetCommandlineArgument( const CString &option, CString *argument, int iIndex )
|
||||||
{
|
{
|
||||||
const CString optstr = "--" + option;
|
const CString optstr = "--" + option;
|
||||||
|
|
||||||
@@ -877,6 +877,12 @@ bool GetCommandlineArgument( const CString &option, CString *argument )
|
|||||||
continue; /* no match */
|
continue; /* no match */
|
||||||
|
|
||||||
/* Found it. */
|
/* Found it. */
|
||||||
|
if( iIndex )
|
||||||
|
{
|
||||||
|
--iIndex;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( argument )
|
if( argument )
|
||||||
{
|
{
|
||||||
if( i != CString::npos )
|
if( i != CString::npos )
|
||||||
|
|||||||
@@ -31,6 +31,6 @@ extern HWND g_hWndMain;
|
|||||||
|
|
||||||
extern int g_argc;
|
extern int g_argc;
|
||||||
extern char **g_argv;
|
extern char **g_argv;
|
||||||
bool GetCommandlineArgument( const CString &option, CString *argument=NULL );
|
bool GetCommandlineArgument( const CString &option, CString *argument=NULL, int iIndex=0 );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user