Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2dacd3c5
Commit
2dacd3c5
authored
Jan 23, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Properly implemented strerror and perror (based on a patch by
Uwe Bonnes).
parent
401ead5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
errno.c
dlls/msvcrt/errno.c
+34
-6
main.c
dlls/msvcrt/main.c
+1
-0
msvcrt.h
dlls/msvcrt/msvcrt.h
+1
-0
No files found.
dlls/msvcrt/errno.c
View file @
2dacd3c5
...
...
@@ -199,17 +199,36 @@ unsigned long* MSVCRT___doserrno(void)
*/
char
*
MSVCRT_strerror
(
int
err
)
{
return
strerror
(
err
);
/* FIXME */
thread_data_t
*
data
=
msvcrt_get_thread_data
();
if
(
!
data
->
strerror_buffer
)
if
(
!
(
data
->
strerror_buffer
=
MSVCRT_malloc
(
256
)))
return
NULL
;
if
(
err
<
0
||
err
>
MSVCRT__sys_nerr
)
err
=
MSVCRT__sys_nerr
;
strcpy
(
data
->
strerror_buffer
,
MSVCRT__sys_errlist
[
err
]
);
return
data
->
strerror_buffer
;
}
/**********************************************************************
* _strerror (MSVCRT.@)
*/
char
*
_strerror
(
const
char
*
er
r
)
char
*
_strerror
(
const
char
*
st
r
)
{
static
char
strerrbuff
[
256
];
/* FIXME: Per thread, nprintf */
sprintf
(
strerrbuff
,
"%s: %s
\n
"
,
err
,
MSVCRT_strerror
(
msvcrt_get_thread_data
()
->
thread_errno
));
return
strerrbuff
;
thread_data_t
*
data
=
msvcrt_get_thread_data
();
int
err
;
if
(
!
data
->
strerror_buffer
)
if
(
!
(
data
->
strerror_buffer
=
MSVCRT_malloc
(
256
)))
return
NULL
;
err
=
data
->
thread_errno
;
if
(
err
<
0
||
err
>
MSVCRT__sys_nerr
)
err
=
MSVCRT__sys_nerr
;
if
(
str
&&
*
str
)
sprintf
(
data
->
strerror_buffer
,
"%s: %s
\n
"
,
str
,
MSVCRT__sys_errlist
[
err
]
);
else
sprintf
(
data
->
strerror_buffer
,
"%s
\n
"
,
MSVCRT__sys_errlist
[
err
]
);
return
data
->
strerror_buffer
;
}
/*********************************************************************
...
...
@@ -217,7 +236,16 @@ char* _strerror(const char* err)
*/
void
MSVCRT_perror
(
const
char
*
str
)
{
_cprintf
(
"%s: %s
\n
"
,
str
,
MSVCRT_strerror
(
msvcrt_get_thread_data
()
->
thread_errno
));
int
err
=
*
MSVCRT__errno
();
if
(
err
<
0
||
err
>
MSVCRT__sys_nerr
)
err
=
MSVCRT__sys_nerr
;
if
(
str
&&
*
str
)
{
_write
(
2
,
str
,
strlen
(
str
)
);
_write
(
2
,
": "
,
2
);
}
_write
(
2
,
MSVCRT__sys_errlist
[
err
],
strlen
(
MSVCRT__sys_errlist
[
err
])
);
_write
(
2
,
"
\n
"
,
1
);
}
/******************************************************************************
...
...
dlls/msvcrt/main.c
View file @
2dacd3c5
...
...
@@ -75,6 +75,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
efcvt_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
asctime_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
wasctime_buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
tls
->
strerror_buffer
);
}
HeapFree
(
GetProcessHeap
(),
0
,
tls
);
TRACE
(
"finished thread free
\n
"
);
...
...
dlls/msvcrt/msvcrt.h
View file @
2dacd3c5
...
...
@@ -101,6 +101,7 @@ struct __thread_data {
char
*
asctime_buffer
;
/* buffer for asctime */
MSVCRT_wchar_t
*
wasctime_buffer
;
/* buffer for wasctime */
struct
MSVCRT_tm
time_buffer
;
/* buffer for localtime/gmtime */
char
*
strerror_buffer
;
/* buffer for strerror */
int
fpecode
;
MSVCRT_terminate_function
terminate_handler
;
MSVCRT_unexpected_function
unexpected_handler
;
...
...
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