aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-05 22:17:14 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-20 19:14:26 +0200
commitfafa54ebdb7a247dedb404b8825684be5f78e3c4 (patch)
tree6083cd41d667f7c1ea6f553946375dbeddb3d682
parent949d257fa1cd9928b9717e06b299af8e1b03fd7e (diff)
downloadbusybox-w32-fafa54ebdb7a247dedb404b8825684be5f78e3c4.tar.gz
busybox-w32-fafa54ebdb7a247dedb404b8825684be5f78e3c4.tar.bz2
busybox-w32-fafa54ebdb7a247dedb404b8825684be5f78e3c4.zip
win32: test: teach -x about .exe files
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
-rw-r--r--coreutils/test.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/coreutils/test.c b/coreutils/test.c
index 5864c7f32..b523671df 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -599,6 +599,24 @@ static int filstat(char *nm, enum token mode)
599 return 0; 599 return 0;
600 } 600 }
601 601
602#if ENABLE_PLATFORM_MINGW32
603 if (mode == FILEX) {
604 int len = strlen(nm), ret;
605 char *exepath;
606 if (len >= 4 && !strcmp(nm+len-4,".exe"))
607 exepath = nm;
608 else {
609 exepath = malloc(len+5);
610 memcpy(exepath, nm, len);
611 memcpy(exepath+len, ".exe", 5);
612 }
613 ret = stat(exepath, &s);
614 if (exepath != nm)
615 free(exepath);
616 return ret >= 0;
617 }
618#endif
619
602 if (stat(nm, &s) != 0) 620 if (stat(nm, &s) != 0)
603 return 0; 621 return 0;
604 if (mode == FILEXIST) 622 if (mode == FILEXIST)