mirror of
https://github.com/reactos/reactos.git
synced 2024-11-01 12:26:32 +00:00
2c11c41115
This finally fixes our duplicated getopt functions from different sources and gives us an up to date and the most compatible implementation. isohybrid actually relies on a glibc-specific getopt behavior that we previously hacked into the reactos_support_code.c implementation derived from BSD/mingw-w64. widl also needs getopt and previously used an even older BSD-derived code.
43 lines
746 B
C
43 lines
746 B
C
#include "reactos_support_code.h"
|
|
|
|
void
|
|
isohybrid_error(int eval, const char* fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
fprintf(stderr, "isohybrid: ");
|
|
vfprintf(stderr, fmt, ap);
|
|
va_end(ap);
|
|
exit(eval);
|
|
}
|
|
|
|
void
|
|
isohybrid_warning(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
fprintf(stderr, "isohybrid: ");
|
|
vfprintf(stderr, fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
#ifdef _WIN32
|
|
int
|
|
fsync(int fd)
|
|
{
|
|
HANDLE hFile = (HANDLE)_get_osfhandle(fd);
|
|
if (hFile == INVALID_HANDLE_VALUE)
|
|
return 1;
|
|
|
|
return !FlushFileBuffers(hFile);
|
|
}
|
|
|
|
int
|
|
getppid(void)
|
|
{
|
|
// Just return any nonzero value under Windows to enable isohybrid's usage
|
|
// as a part of srand initialization.
|
|
return 1;
|
|
}
|
|
#endif
|