This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate cfgperl contents into mainline; merge conflicts
[perl5.git] / win32 / perlglob.c
CommitLineData
0a753a76
PP
1/*
2 * Globbing for NT. Relies on the expansion done by the library
3 * startup code.
4 */
5
6#include <stdio.h>
7#include <io.h>
8#include <fcntl.h>
9#include <string.h>
10#include <windows.h>
11
12int
13main(int argc, char *argv[])
14{
15 int i;
16 int len;
17 char root[MAX_PATH];
18 char *dummy;
19 char volname[MAX_PATH];
20 DWORD serial, maxname, flags;
21 BOOL downcase = TRUE;
22
23 /* check out the file system characteristics */
0a753a76 24 if (GetFullPathName(".", MAX_PATH, root, &dummy)) {
161b471a
NIS
25 dummy = strchr(root,'\\');
26 if (dummy)
0a753a76
PP
27 *++dummy = '\0';
28 if (GetVolumeInformation(root, volname, MAX_PATH,
29 &serial, &maxname, &flags, 0, 0)) {
30 downcase = !(flags & FS_CASE_IS_PRESERVED);
31 }
32 }
33
3e3baf6d 34 setmode(fileno(stdout), O_BINARY);
0a753a76
PP
35 for (i = 1; i < argc; i++) {
36 len = strlen(argv[i]);
37 if (downcase)
38 strlwr(argv[i]);
39 if (i > 1) fwrite("\0", sizeof(char), 1, stdout);
40 fwrite(argv[i], sizeof(char), len, stdout);
41 }
42 return 0;
43}
161b471a 44