From 4287ed1ecbe21e7e90b9420b267edf8fe1482b71 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Thu, 23 Apr 2009 03:01:21 +1000 Subject: mingw.c: make fopen support /dev/null (needed for cmp iirc) --- include/mingw.h | 3 +++ libbb/mingw.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/include/mingw.h b/include/mingw.h index eae6a7d3a..763606e51 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -141,6 +141,9 @@ int link(const char *oldpath, const char *newpath); int mingw_open (const char *filename, int oflags, ...); #define open mingw_open +FILE* mingw_fopen (const char *filename, const char *mode); +#define fopen mingw_fopen + int mingw_close (int fd); #define close mingw_close diff --git a/libbb/mingw.c b/libbb/mingw.c index eb239bbd6..62aad5d7e 100644 --- a/libbb/mingw.c +++ b/libbb/mingw.c @@ -150,6 +150,14 @@ int mingw_open (const char *filename, int oflags, ...) return fd; } +#undef fopen +FILE *mingw_fopen (const char *filename, const char *mode) +{ + if (!strcmp(filename, "/dev/null")) + filename = "nul"; + return fopen(filename, mode); +} + #undef close int mingw_close (int fd) { -- cgit v1.2.3-55-g6feb