2 * Globbing for NT. Relies on the expansion done by the library
3 * startup code (provided by Visual C++ by linking in setargv.obj).
6 /* Enable wildcard expansion for gcc's C-runtime library if not enabled by
7 * default (currently necessary with the automated build of the mingw-w64
8 * cross-compiler, but there's no harm in making sure for others too). */
11 #if defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR)
29 main(int argc, char *argv[])
35 char volname[MAX_PATH];
36 DWORD serial, maxname, flags;
40 /* check out the file system characteristics */
41 if (GetFullPathName(".", MAX_PATH, root, &dummy)) {
42 dummy = strchr(root,'\\');
45 if (GetVolumeInformation(root, volname, MAX_PATH,
46 &serial, &maxname, &flags, 0, 0)) {
47 downcase = !(flags & FS_CASE_IS_PRESERVED);
52 /* rare VC linker bug causes uninit global FILE *s
53 fileno() implementation in VC 2003 is 2 blind pointer derefs so it will
54 never return -1 error as POSIX says, to be compliant fail for -1 and
55 for absurdly high FDs which are actually pointers */
56 assert(fd >= 0 && fd < SHRT_MAX);
57 setmode(fd, O_BINARY);
58 for (i = 1; i < argc; i++) {
59 len = strlen(argv[i]);
62 if (i > 1) fwrite("\0", sizeof(char), 1, stdout);
63 fwrite(argv[i], sizeof(char), len, stdout);