Skip to content

Commit

Permalink
Remove #defines of POSIX functions deprecated by Microsoft.
Browse files Browse the repository at this point in the history
These defines are too wide-reaching in their effects on unrelated code.

Add a replacement for strncasecmp.
  • Loading branch information
qris committed Dec 9, 2015
1 parent 00a5a49 commit 6290daa
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/win32/emu.h
Expand Up @@ -65,17 +65,6 @@

#define ITIMER_REAL 0

#ifdef _MSC_VER
// Microsoft decided to deprecate the standard POSIX functions. Great!
#define open(file,flags,mode) _open(file,flags,mode)
#define close(fd) _close(fd)
#define dup(fd) _dup(fd)
#define read(fd,buf,count) _read(fd,buf,count)
#define write(fd,buf,count) _write(fd,buf,count)
#define lseek(fd,off,whence) _lseek(fd,off,whence)
#define fileno(struct_file) _fileno(struct_file)
#endif

struct passwd {
char *pw_name;
char *pw_passwd;
Expand Down Expand Up @@ -204,7 +193,11 @@ inline int geteuid(void)
#define snprintf _snprintf
inline int strcasecmp(const char *s1, const char *s2)
{
return _stricmp(s1,s2);
return _stricmp(s1, s2);
}
inline int strncasecmp(const char *s1, const char *s2, size_t count)
{
return _strnicmp(s1, s2, count);
}
#endif

Expand Down

0 comments on commit 6290daa

Please sign in to comment.