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
98c554ac
Commit
98c554ac
authored
Jan 29, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Don't duplicate _searchenv_s code in _searchenv.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2e7ad72a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
82 deletions
+8
-82
dir.c
dlls/msvcrt/dir.c
+8
-82
No files found.
dlls/msvcrt/dir.c
View file @
98c554ac
...
...
@@ -1641,88 +1641,6 @@ range:
}
/*********************************************************************
* _searchenv (MSVCRT.@)
*
* Search for a file in a list of paths from an environment variable.
*
* PARAMS
* file [I] Name of the file to search for.
* env [I] Name of the environment variable containing a list of paths.
* buf [O] Destination for the found file path.
*
* RETURNS
* Nothing. If the file is not found, buf will contain an empty string
* and errno is set.
*/
void
CDECL
MSVCRT__searchenv
(
const
char
*
file
,
const
char
*
env
,
char
*
buf
)
{
char
*
envVal
,
*
penv
,
*
end
;
char
path
[
MAX_PATH
];
MSVCRT_size_t
path_len
,
fname_len
=
strlen
(
file
);
*
buf
=
'\0'
;
/* Try CWD first */
if
(
GetFileAttributesA
(
file
)
!=
INVALID_FILE_ATTRIBUTES
)
{
GetFullPathNameA
(
file
,
MAX_PATH
,
buf
,
NULL
);
return
;
}
/* Search given environment variable */
envVal
=
MSVCRT_getenv
(
env
);
if
(
!
envVal
)
{
msvcrt_set_errno
(
ERROR_FILE_NOT_FOUND
);
return
;
}
penv
=
envVal
;
TRACE
(
":searching for %s in paths %s
\n
"
,
file
,
envVal
);
for
(;
*
penv
;
penv
=
(
*
end
?
end
+
1
:
end
))
{
end
=
penv
;
path_len
=
0
;
while
(
*
end
&&
*
end
!=
';'
&&
path_len
<
MAX_PATH
)
{
if
(
*
end
==
'"'
)
{
end
++
;
while
(
*
end
&&
*
end
!=
'"'
&&
path_len
<
MAX_PATH
)
{
path
[
path_len
++
]
=
*
end
;
end
++
;
}
if
(
*
end
==
'"'
)
end
++
;
continue
;
}
path
[
path_len
++
]
=
*
end
;
end
++
;
}
if
(
!
path_len
||
path_len
>=
MAX_PATH
)
continue
;
if
(
path
[
path_len
-
1
]
!=
'/'
&&
path
[
path_len
-
1
]
!=
'\\'
)
path
[
path_len
++
]
=
'\\'
;
if
(
path_len
+
fname_len
>=
MAX_PATH
)
continue
;
memcpy
(
path
+
path_len
,
file
,
fname_len
+
1
);
TRACE
(
"Checking for file %s
\n
"
,
path
);
if
(
GetFileAttributesA
(
path
)
!=
INVALID_FILE_ATTRIBUTES
)
{
memcpy
(
buf
,
path
,
path_len
+
fname_len
+
1
);
return
;
}
}
msvcrt_set_errno
(
ERROR_FILE_NOT_FOUND
);
return
;
}
/*********************************************************************
* _searchenv_s (MSVCRT.@)
*/
int
CDECL
MSVCRT__searchenv_s
(
const
char
*
file
,
const
char
*
env
,
char
*
buf
,
MSVCRT_size_t
count
)
...
...
@@ -1808,6 +1726,14 @@ int CDECL MSVCRT__searchenv_s(const char* file, const char* env, char *buf, MSVC
}
/*********************************************************************
* _searchenv (MSVCRT.@)
*/
void
CDECL
MSVCRT__searchenv
(
const
char
*
file
,
const
char
*
env
,
char
*
buf
)
{
MSVCRT__searchenv_s
(
file
,
env
,
buf
,
MAX_PATH
);
}
/*********************************************************************
* _wsearchenv (MSVCRT.@)
*
* Unicode version of _searchenv
...
...
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