summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/cat.c11
-rwxr-xr-xwin/configure2
-rw-r--r--win/tcl.m42
-rw-r--r--win/tclAppInit.c56
4 files changed, 39 insertions, 32 deletions
diff --git a/win/cat.c b/win/cat.c
index c91e0d2..528a4bf 100644
--- a/win/cat.c
+++ b/win/cat.c
@@ -8,9 +8,15 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: cat.c,v 1.5 2010/01/13 06:46:56 nijtmans Exp $
+ * RCS: @(#) $Id: cat.c,v 1.6 2010/11/16 14:03:34 nijtmans Exp $
*/
+#ifdef TCL_BROKEN_MAINARGS
+/* On mingw32 and cygwin this doesn't work */
+# undef UNICODE
+# undef _UNICODE
+#endif
+
#include <stdio.h>
#ifdef __CYGWIN__
# include <unistd.h>
@@ -18,9 +24,10 @@
# include <io.h>
#endif
#include <string.h>
+#include <tchar.h>
int
-main(void)
+_tmain(void)
{
char buf[1024];
int n;
diff --git a/win/configure b/win/configure
index f6f8b81..46e66af 100755
--- a/win/configure
+++ b/win/configure
@@ -4029,7 +4029,7 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;}
MAKE_EXE="\${CC} -o \$@"
LIBPREFIX="lib"
- extra_cflags="-pipe"
+ extra_cflags="-pipe -DTCL_BROKEN_MAINARGS"
extra_ldflags="-pipe"
if test "$ac_cv_cygwin" = "yes"; then
diff --git a/win/tcl.m4 b/win/tcl.m4
index ff07c34..ff61263 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -477,7 +477,7 @@ file for information about building with Mingw.])
MAKE_EXE="\${CC} -o \[$]@"
LIBPREFIX="lib"
- extra_cflags="-pipe"
+ extra_cflags="-pipe -DTCL_BROKEN_MAINARGS"
extra_ldflags="-pipe"
if test "$ac_cv_cygwin" = "yes"; then
diff --git a/win/tclAppInit.c b/win/tclAppInit.c
index d92109c..2189238 100644
--- a/win/tclAppInit.c
+++ b/win/tclAppInit.c
@@ -12,11 +12,11 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAppInit.c,v 1.34 2010/11/04 21:48:23 nijtmans Exp $
+ * RCS: @(#) $Id: tclAppInit.c,v 1.35 2010/11/16 14:03:34 nijtmans Exp $
*/
-#ifndef _MSC_VER
-/* On mingw and cygwin this doesn't work yet */
+#ifdef TCL_BROKEN_MAINARGS
+/* On mingw32 and cygwin this doesn't work */
# undef UNICODE
# undef _UNICODE
#endif
@@ -34,9 +34,9 @@ extern Tcl_PackageInitProc Tcltest_Init;
extern Tcl_PackageInitProc Tcltest_SafeInit;
#endif /* TCL_TEST */
-#if defined(__GNUC__)
-static void setargv(int *argcPtr, TCHAR ***argvPtr);
-#endif /* __GNUC__ */
+#ifdef TCL_BROKEN_MAINARGS
+static void setargv(int *argcPtr, char ***argvPtr);
+#endif
/*
* The following #if block allows you to change the AppInit function by using
@@ -94,7 +94,7 @@ _tmain(
* Get our args from the c-runtime. Ignore lpszCmdLine.
*/
-#if defined(__GNUC__)
+#ifdef TCL_BROKEN_MAINARGS
setargv(&argc, &argv);
#endif
@@ -223,14 +223,14 @@ Tcl_AppInit(
*--------------------------------------------------------------------------
*/
-#if defined(__GNUC__)
+#ifdef TCL_BROKEN_MAINARGS
static void
setargv(
int *argcPtr, /* Filled with number of argument strings. */
- TCHAR ***argvPtr) /* Filled with argument strings (malloc'd). */
+ char ***argvPtr) /* Filled with argument strings (malloc'd). */
{
- TCHAR *cmdLine, *p, *arg, *argSpace;
- TCHAR **argv;
+ char *cmdLine, *p, *arg, *argSpace;
+ char **argv;
int argc, size, inquote, copy, slashes;
cmdLine = GetCommandLine();
@@ -241,30 +241,30 @@ setargv(
*/
size = 2;
- for (p = cmdLine; *p != TEXT('\0'); p++) {
- if ((*p == TEXT(' ')) || (*p == TEXT('\t'))) { /* INTL: ISO space. */
+ for (p = cmdLine; *p != '\0'; p++) {
+ if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */
size++;
- while ((*p == TEXT(' ')) || (*p == TEXT('\t'))) { /* INTL: ISO space. */
+ while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */
p++;
}
- if (*p == TEXT('\0')) {
+ if (*p == '\0') {
break;
}
}
}
- argSpace = (TCHAR *) ckalloc(
- (unsigned) (size * sizeof(TCHAR *) + (_tcslen(cmdLine) * sizeof(TCHAR)) + 1));
- argv = (TCHAR **) argSpace;
- argSpace += size * sizeof(TCHAR *);
+ argSpace = (char *) ckalloc(
+ (unsigned) (size * sizeof(char *) + (strlen(cmdLine)) + 1));
+ argv = (char **) argSpace;
+ argSpace += size;
size--;
p = cmdLine;
for (argc = 0; argc < size; argc++) {
argv[argc] = arg = argSpace;
- while ((*p == TEXT(' ')) || (*p == TEXT('\t'))) { /* INTL: ISO space. */
+ while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */
p++;
}
- if (*p == TEXT('\0')) {
+ if (*p == '\0') {
break;
}
@@ -272,14 +272,14 @@ setargv(
slashes = 0;
while (1) {
copy = 1;
- while (*p == TEXT('\\')) {
+ while (*p == '\\') {
slashes++;
p++;
}
- if (*p == TEXT('"')) {
+ if (*p == '"') {
if ((slashes & 1) == 0) {
copy = 0;
- if ((inquote) && (p[1] == TEXT('"'))) {
+ if ((inquote) && (p[1] == '"')) {
p++;
copy = 1;
} else {
@@ -290,13 +290,13 @@ setargv(
}
while (slashes) {
- *arg = TEXT('\\');
+ *arg = '\\';
arg++;
slashes--;
}
- if ((*p == TEXT('\0')) || (!inquote &&
- ((*p == TEXT(' ')) || (*p == TEXT('\t'))))) { /* INTL: ISO space. */
+ if ((*p == '\0') || (!inquote &&
+ ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */
break;
}
if (copy != 0) {
@@ -305,7 +305,7 @@ setargv(
}
p++;
}
- *arg = TEXT('\0');
+ *arg = '\0';
argSpace = arg + 1;
}
argv[argc] = NULL;