From 3c40a1819c3d9e02ba7a387a75f9b4144e8f5264 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 14 Apr 2010 00:39:09 +0200 Subject: win32: ash: openredirect(): support /dev/null --- shell/ash.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/shell/ash.c b/shell/ash.c index 3380e573e..dcf6fcbcb 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -5044,6 +5044,31 @@ openredirect(union node *redir) char *fname; int f; +#if ENABLE_PLATFORM_MINGW32 + /* Support for /dev/null */ + switch (redir->nfile.type) { + case NFROM: + if (!strcmp(redir->nfile.expfname, "/dev/null")) + return open("nul",O_RDWR); + if (!strncmp(redir->nfile.expfname, "/dev/", 5)) { + ash_msg("Unhandled device %s\n", redir->nfile.expfname); + return -1; + } + break; + + case NFROMTO: + case NTO: + case NCLOBBER: + case NAPPEND: + if (!strcmp(redir->nfile.expfname, "/dev/null")) + return open("nul",O_RDWR); + if (!strncmp(redir->nfile.expfname, "/dev/", 5)) { + ash_msg("Unhandled device %s\n", redir->nfile.expfname); + return -1; + } + break; + } +#endif switch (redir->nfile.type) { case NFROM: fname = redir->nfile.expfname; -- cgit v1.2.3-55-g6feb