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
8c50936d
Commit
8c50936d
authored
Aug 23, 2010
by
Jerome Leclanche
Committed by
Alexandre Julliard
Aug 24, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winepath: Add a -0 option to use null character as separator.
parent
f756821d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
winepath.c
programs/winepath/winepath.c
+20
-6
No files found.
programs/winepath/winepath.c
View file @
8c50936d
...
...
@@ -34,7 +34,8 @@ enum {
SHORTFORMAT
=
1
,
LONGFORMAT
=
2
,
UNIXFORMAT
=
4
,
WINDOWSFORMAT
=
8
WINDOWSFORMAT
=
8
,
PRINT0
=
16
,
};
static
const
char
progname
[]
=
"winepath"
;
...
...
@@ -53,6 +54,7 @@ static int option(int shortopt, const WCHAR *longopt)
" directory to the long format
\n
"
" -s, --short converts the long Windows path of an existing file or
\n
"
" directory to the short format
\n
"
" -0 separate output with
\\
0 character, instead of a newline
\n
"
" -h, --help output this help message and exit
\n
"
" -v, --version output version information and exit
\n
"
"
\n
"
...
...
@@ -76,6 +78,8 @@ static int option(int shortopt, const WCHAR *longopt)
return
UNIXFORMAT
;
case
'w'
:
return
WINDOWSFORMAT
;
case
'0'
:
return
PRINT0
;
}
fprintf
(
stderr
,
"%s: invalid option "
,
progname
);
...
...
@@ -148,8 +152,18 @@ int wmain(int argc, WCHAR *argv[])
char
path
[
MAX_PATH
];
int
outputformats
;
int
i
;
int
separator
;
outputformats
=
parse_options
(
argv
);
if
(
outputformats
&
PRINT0
)
{
separator
=
'\0'
;
outputformats
^=
PRINT0
;
}
else
separator
=
'\n'
;
if
(
outputformats
==
0
)
outputformats
=
UNIXFORMAT
;
...
...
@@ -181,12 +195,12 @@ int wmain(int argc, WCHAR *argv[])
if
(
outputformats
&
LONGFORMAT
)
{
if
(
GetLongPathNameW
(
argv
[
i
],
dos_pathW
,
MAX_PATH
))
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
dos_pathW
,
-
1
,
path
,
MAX_PATH
,
NULL
,
NULL
);
printf
(
"%s
\n
"
,
path
);
printf
(
"%s
%c"
,
path
,
separator
);
}
if
(
outputformats
&
SHORTFORMAT
)
{
if
(
GetShortPathNameW
(
argv
[
i
],
dos_pathW
,
MAX_PATH
))
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
dos_pathW
,
-
1
,
path
,
MAX_PATH
,
NULL
,
NULL
);
printf
(
"%s
\n
"
,
path
);
printf
(
"%s
%c"
,
path
,
separator
);
}
if
(
outputformats
&
UNIXFORMAT
)
{
WCHAR
*
ntpath
,
*
tail
;
...
...
@@ -205,11 +219,11 @@ int wmain(int argc, WCHAR *argv[])
if
(
tail
)
{
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
tail
+
1
,
-
1
,
path
,
MAX_PATH
,
NULL
,
NULL
);
printf
(
"%s/%s
\n
"
,
unix_name
,
path
);
printf
(
"%s/%s
%c"
,
unix_name
,
path
,
separator
);
}
else
{
printf
(
"%s
\n
"
,
unix_name
);
printf
(
"%s
%c"
,
unix_name
,
separator
);
}
HeapFree
(
GetProcessHeap
(),
0
,
unix_name
);
break
;
...
...
@@ -257,7 +271,7 @@ int wmain(int argc, WCHAR *argv[])
if
((
windows_name
=
wine_get_dos_file_name_ptr
(
unix_name
)))
{
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
windows_name
,
-
1
,
path
,
MAX_PATH
,
NULL
,
NULL
);
printf
(
"%s
\n
"
,
path
);
printf
(
"%s
%c"
,
path
,
separator
);
HeapFree
(
GetProcessHeap
(),
0
,
windows_name
);
}
else
printf
(
"
\n
"
);
...
...
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