correctly use tchar.h again and build a unicode version by default
Modified: trunk/reactos/subsys/system/cmd/cmd.h
Modified: trunk/reactos/subsys/system/cmd/dir.c
Modified: trunk/reactos/subsys/system/cmd/internal.c
Modified: trunk/reactos/subsys/system/cmd/locale.c
Modified: trunk/reactos/subsys/system/cmd/makefile

Modified: trunk/reactos/subsys/system/cmd/cmd.h
--- trunk/reactos/subsys/system/cmd/cmd.h	2005-05-04 21:23:13 UTC (rev 14978)
+++ trunk/reactos/subsys/system/cmd/cmd.h	2005-05-04 22:18:43 UTC (rev 14979)
@@ -288,10 +288,9 @@
 extern INT   nDateFormat;
 extern TCHAR cTimeSeparator;
 extern INT   nTimeFormat;
-extern TCHAR aszDayNames[7][8];
 extern TCHAR cThousandSeparator;
 extern TCHAR cDecimalSeparator;
-extern INT   nNumberGroups;
+extern INT nNumberGroups;
 
 VOID InitLocale (VOID);
 VOID PrintDate (VOID);

Modified: trunk/reactos/subsys/system/cmd/dir.c
--- trunk/reactos/subsys/system/cmd/dir.c	2005-05-04 21:23:13 UTC (rev 14978)
+++ trunk/reactos/subsys/system/cmd/dir.c	2005-05-04 22:18:43 UTC (rev 14979)
@@ -917,7 +917,7 @@
 		{
 			if ((((c + 1) % (nNumberGroups + 1)) == 0) && (bPutSeperator))
 				temp[30 - c++] = cThousandSeparator;
-			temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
+   temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
 			num.QuadPart /= 10;
 		}
 
@@ -1107,9 +1107,9 @@
  */
 TCHAR* getExt(const TCHAR* file)
 {
-	
-	TCHAR* tmp = _tcsrchr(file, _T('.'));
-	return tmp?tmp+1:"";
+        static TCHAR *NoExt = _T("");
+        TCHAR* lastdot = _tcsrchr(file, _T('.'));
+	return (lastdot != NULL ? lastdot + 1 : NoExt);
 }
 
 /*
@@ -1394,12 +1394,12 @@
 			/* at recursive mode we print full path of file */
 			_tcscpy(szFullName, lpCurPath);
 			_tcscat(szFullName, ptrFiles[i]->cFileName);
-			ConOutPrintf("%s\n", szFullName);
+			ConOutPrintf(_T("%s\n"), szFullName);
 		}
 		else
 		{
 			/* if we are not in recursive mode we print the file names */
-			ConOutPrintf("%s\n",ptrFiles[i]->cFileName);
+			ConOutPrintf(_T("%s\n"),ptrFiles[i]->cFileName);
 		}
 	}
 }
@@ -1507,11 +1507,11 @@
 			break;
 
 		case ORDER_EXTENSION:	/* Order by extension name /o:e */
-			iComp = _stricmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
+			iComp = _tcsicmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
 			break;
 
 		case ORDER_NAME:		/* Order by filename /o:n */
-			iComp = _stricmp(lpFile1->cFileName, lpFile2->cFileName);
+			iComp = _tcsicmp(lpFile1->cFileName, lpFile2->cFileName);
 			break;
 
 		case ORDER_TIME:		/* Order by file's time /o:t */

Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c	2005-05-04 21:23:13 UTC (rev 14978)
+++ trunk/reactos/subsys/system/cmd/internal.c	2005-05-04 22:18:43 UTC (rev 14979)
@@ -317,7 +317,7 @@
 	if (!dir)
 	{
 		LoadString( GetModuleHandle(NULL), STRING_PARAM_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
-		ConErrPrintf (_T((LPTSTR)szMsg));
+		ConErrPrintf (szMsg);
 		return 1;
 	}
 

Modified: trunk/reactos/subsys/system/cmd/locale.c
--- trunk/reactos/subsys/system/cmd/locale.c	2005-05-04 21:23:13 UTC (rev 14978)
+++ trunk/reactos/subsys/system/cmd/locale.c	2005-05-04 22:18:43 UTC (rev 14979)
@@ -21,157 +21,54 @@
 TCHAR cDecimalSeparator;
 INT   nDateFormat;
 INT   nTimeFormat;
-TCHAR aszDayNames[7][8];
 INT   nNumberGroups;
 
 
 VOID InitLocale (VOID)
 {
-#ifdef LOCALE_WINDOWS
 	TCHAR szBuffer[256];
-	INT i;
 
 	/* date settings */
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, 256);
-	CharToOem (szBuffer, szBuffer);
+	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
 	cDateSeparator = szBuffer[0];
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE, szBuffer, 256);
-	nDateFormat = _ttoi (szBuffer);
+	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE | LOCALE_RETURN_NUMBER, (LPTSTR)&nDateFormat, sizeof(nDateFormat) / sizeof(TCHAR));
 
 	/* time settings */
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, 256);
-	CharToOem (szBuffer, szBuffer);
+	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
 	cTimeSeparator = szBuffer[0];
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME, szBuffer, 256);
-	nTimeFormat = _ttoi (szBuffer);
+	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME | LOCALE_RETURN_NUMBER, (LPTSTR)&nTimeFormat, sizeof(nTimeFormat) / sizeof(TCHAR));
 
 	/* number settings */
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, 256);
-	CharToOem (szBuffer, szBuffer);
+	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
 	cThousandSeparator = szBuffer[0];
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, 256);
-	CharToOem (szBuffer, szBuffer);
+	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
 	cDecimalSeparator  = szBuffer[0];
-	GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, 256);
-	nNumberGroups = _ttoi (szBuffer);
-
+        GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+        nNumberGroups = _ttoi(szBuffer);
+#if 0
 	/* days of week */
 	for (i = 0; i < 7; i++)
 	{
-		GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, 256);
-		CharToOem (szBuffer, szBuffer);
+		GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
 		_tcscpy (aszDayNames[(i+1)%7], szBuffer); /* little hack */
 	}
 #endif
-
-#ifdef LOCALE_GERMAN
-	LPTSTR names [7] = {_T("So"), _T("Mo"), _T("Di"), _T("Mi"), _T("Do"), _T("Fr"), _T("Sa")};
-	INT i;
-
-	/* date settings */
-	cDateSeparator = '.';
-	nDateFormat    = 1;			/* ddmmyy */
-
-	/* time settings */
-	cTimeSeparator = ':';
-	nTimeFormat    = 1;			/* 24 hour */
-
-	/* number settings */
-	cThousandSeparator = '.';
-	cDecimalSeparator  = ',';
-	nNumberGroups      = 3;
-
-	/* days of week */
-	for (i = 0; i < 7; i++)
-		_tcscpy(aszDayNames[i], names[i]);
-#endif
-
-#ifdef LOCALE_DEFAULT
-	LPTSTR names [7] = {_T("Sun"), _T("Mon"), _T("Tue"), _T("Wed"), _T("Thu"), _T("Fri"), _T("Sat")};
-	INT i;
-
-	/* date settings */
-	cDateSeparator = '-';
-	nDateFormat = 0;		/* mmddyy */
-
-	/* time settings */
-	cTimeSeparator = ':';
-	nTimeFormat = 0;		/* 12 hour */
-
-	/* number settings */
-	cThousandSeparator = ',';
-	cDecimalSeparator  = '.';
-	nNumberGroups      = 3;
-
-	/* days of week */
-	for (i = 0; i < 7; i++)
-		_tcscpy (aszDayNames[i], names[i]);
-#endif
 }
 
 
 VOID PrintDate (VOID)
 {
-#ifdef __REACTOS__
-	SYSTEMTIME st;
-
-	GetLocalTime (&st);
-
-	switch (nDateFormat)
-	{
-		case 0: /* mmddyy */
-		default:
-			ConOutPrintf(_T("%s %02d%c%02d%c%04d"),
-			             aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
-			break;
-
-		case 1: /* ddmmyy */
-			ConOutPrintf(_T("%s %02d%c%02d%c%04d"),
-			             aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
-			break;
-
-		case 2: /* yymmdd */
-			ConOutPrintf(_T("%s %04d%c%02d%c%02d"),
-			             aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
-			break;
-	}
-#else
 	TCHAR szDate[32];
 
 	GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
 	              szDate, sizeof (szDate));
 	ConOutPrintf(_T("%s"), szDate);
-#endif
 }
 
 
 VOID PrintTime (VOID)
 {
 	TCHAR szMsg[RC_STRING_MAX_SIZE];
-#ifdef __REACTOS__
-	SYSTEMTIME st;
-
-	GetLocalTime(&st);
-
-	LoadString(GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE);
-
-	switch (nTimeFormat)
-	{
-		case 0: /* 12 hour format */
-		default:
-			ConOutPrintf(_T("%s %2d%c%02d%c%02d%c%02d%c\n"), szMsg,
-			             (st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
-			             cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
-			             st.wMilliseconds / 10, (st.wHour <= 11 ? _T('a') : _T('p')));
-			break;
-
-		case 1: /* 24 hour format */
-			ConOutPrintf(_T("%s %2d%c%02d%c%02d%c%02d\n"), szMsg,
-			             st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
-			             st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
-			break;
-	}
-#else
 	TCHAR szTime[32];
 
 	GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL,
@@ -179,5 +76,4 @@
 
 	LoadString(GetModuleHandle(NULL), STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE);
 	ConOutPrintf(_T("%s: %s\n"), szMsg, szTime);
-#endif
 }

Modified: trunk/reactos/subsys/system/cmd/makefile
--- trunk/reactos/subsys/system/cmd/makefile	2005-05-04 21:23:13 UTC (rev 14978)
+++ trunk/reactos/subsys/system/cmd/makefile	2005-05-04 22:18:43 UTC (rev 14979)
@@ -18,7 +18,7 @@
 TARGET_INSTALLDIR = system32
 
 TARGET_CFLAGS = -D__USE_W32API -DANONYMOUSUNIONS -Wall -Werror \
-                -I$(PATH_TO_TOP)/include/wine -D_WIN32_WINNT=0x0501 #-DUNICODE -D_UNICODE
+                -I$(PATH_TO_TOP)/include/wine -D_WIN32_WINNT=0x0501 -DUNICODE -D_UNICODE
 
 TARGET_OBJECTS = \
 	cmd.o attrib.o alias.o batch.o beep.o call.o chcp.o choice.o \