summaryrefslogtreecommitdiffstats
path: root/win/winMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/winMain.c')
-rw-r--r--win/winMain.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/win/winMain.c b/win/winMain.c
index 8e98168..1be6561 100644
--- a/win/winMain.c
+++ b/win/winMain.c
@@ -11,11 +11,11 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: winMain.c,v 1.34 2010/10/11 21:50:46 nijtmans Exp $
+ * RCS: @(#) $Id: winMain.c,v 1.35 2010/11/16 14:05:36 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
@@ -33,8 +33,8 @@ extern Tcl_PackageInitProc Tktest_Init;
#endif /* TK_TEST */
#if defined(__CYGWIN__)
-static void setargv(int *argcPtr, TCHAR ***argvPtr);
-#endif /* __CYGWIN__ */
+static void setargv(int *argcPtr, char ***argvPtr);
+#endif
/*
* Forward declarations for procedures defined later in this file:
@@ -85,7 +85,7 @@ int APIENTRY
_tWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
- LPTSTR lpszCmdLine,
+ LPWSTR lpszCmdLine,
int nCmdShow)
{
TCHAR **argv;
@@ -279,7 +279,7 @@ WishPanic(
ExitProcess(1);
}
-#if !defined(__GNUC__) || defined(TK_TEST)
+#if !defined(TCL_BROKEN_MAINARGS) || defined(TK_TEST)
/*
*----------------------------------------------------------------------
*
@@ -359,10 +359,10 @@ _tmain(
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();
@@ -373,30 +373,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;
}
@@ -404,14 +404,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 {
@@ -422,13 +422,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) {
@@ -437,7 +437,7 @@ setargv(
}
p++;
}
- *arg = TEXT('\0');
+ *arg = '\0';
argSpace = arg + 1;
}
argv[argc] = NULL;