summaryrefslogtreecommitdiff
path: root/win32/perlglob.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/perlglob.c')
-rw-r--r--win32/perlglob.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/win32/perlglob.c b/win32/perlglob.c
new file mode 100644
index 0000000000..6413b37ddd
--- /dev/null
+++ b/win32/perlglob.c
@@ -0,0 +1,43 @@
+/*
+ * Globbing for NT. Relies on the expansion done by the library
+ * startup code.
+ */
+
+#include <stdio.h>
+#include <io.h>
+#include <fcntl.h>
+#include <string.h>
+#include <windows.h>
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+ int len;
+ char root[MAX_PATH];
+ char *dummy;
+ char volname[MAX_PATH];
+ DWORD serial, maxname, flags;
+ BOOL downcase = TRUE;
+
+ /* check out the file system characteristics */
+
+ if (GetFullPathName(".", MAX_PATH, root, &dummy)) {
+ if (dummy = strchr(root, '\\'))
+ *++dummy = '\0';
+ if (GetVolumeInformation(root, volname, MAX_PATH,
+ &serial, &maxname, &flags, 0, 0)) {
+ downcase = !(flags & FS_CASE_IS_PRESERVED);
+ }
+ }
+
+ _setmode(_fileno(stdout), _O_BINARY);
+ for (i = 1; i < argc; i++) {
+ len = strlen(argv[i]);
+ if (downcase)
+ strlwr(argv[i]);
+ if (i > 1) fwrite("\0", sizeof(char), 1, stdout);
+ fwrite(argv[i], sizeof(char), len, stdout);
+ }
+ return 0;
+}