Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
93e7c6b2
Commit
93e7c6b2
authored
Aug 26, 2009
by
Austin English
Committed by
Alexandre Julliard
Aug 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxdiag: Add basic command line parsing.
Based on a patch by Dan Kegel.
parent
1b5167f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
main.c
programs/dxdiag/main.c
+68
-0
No files found.
programs/dxdiag/main.c
View file @
93e7c6b2
...
...
@@ -20,9 +20,77 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
dxdiag
);
/*
Process options [/WHQL:ON|OFF][/X outfile][/T outfile]
Returns TRUE if options were present, FALSE otherwise
FIXME: Native behavior seems to be:
Only one of /X and /T is allowed, /WHQL must come before /X and /T,
quotes are optional around the filename, even if it contains spaces.
*/
static
BOOL
ProcessCommandLine
(
LPWSTR
cmdline
)
{
const
WCHAR
*
s
=
cmdline
;
WCHAR
outfile
[
MAX_PATH
+
1
];
int
opt_t
=
FALSE
;
int
opt_x
=
FALSE
;
int
opt_help
=
FALSE
;
int
opt_given
=
FALSE
;
int
want_arg
=
FALSE
;
outfile
[
0
]
=
0
;
while
(
*
s
)
{
/* Skip whitespace before arg */
while
(
*
s
==
' '
)
s
++
;
/* Check for option */
if
(
*
s
!=
'-'
&&
*
s
!=
'/'
)
return
FALSE
;
s
++
;
switch
(
*
s
++
)
{
case
'T'
:
case
't'
:
opt_t
=
TRUE
;
want_arg
=
TRUE
;
opt_given
=
TRUE
;
break
;
case
'X'
:
case
'x'
:
opt_x
=
TRUE
;
want_arg
=
TRUE
;
opt_given
=
TRUE
;
break
;
case
'W'
:
case
'w'
:
opt_given
=
TRUE
;
while
(
isalphaW
(
*
s
)
||
*
s
==
':'
)
s
++
;
break
;
default:
opt_help
=
TRUE
;
opt_given
=
TRUE
;
break
;
}
/* Skip any spaces before next option or filename */
while
(
*
s
==
' '
)
s
++
;
if
(
want_arg
)
{
int
i
;
if
(
*
s
==
'"'
)
s
++
;
for
(
i
=
0
;
i
<
MAX_PATH
&&
*
s
&&
*
s
!=
'"'
;
i
++
,
s
++
)
outfile
[
i
]
=
*
s
;
outfile
[
i
]
=
0
;
break
;
}
}
if
(
opt_help
)
WINE_FIXME
(
"help unimplemented
\n
"
);
if
(
opt_t
)
WINE_FIXME
(
"/t unimplemented
\n
"
);
if
(
opt_x
)
WINE_FIXME
(
"/x unimplemented
\n
"
);
return
opt_given
;
}
int
WINAPI
wWinMain
(
HINSTANCE
hInst
,
HINSTANCE
hPrevInst
,
LPWSTR
cmdline
,
int
cmdshow
)
{
if
(
ProcessCommandLine
(
cmdline
))
return
0
;
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment