changes to build cmd again
authorEric Kohl <eric.kohl@reactos.org>
Thu, 15 Apr 1999 17:40:56 +0000 (17:40 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Thu, 15 Apr 1999 17:40:56 +0000 (17:40 +0000)
svn path=/trunk/; revision=388

24 files changed:
reactos/apps/utils/cmd/makefile
reactos/apps/utils/cmd/ros.c
reactos/lib/kernel32/kernel32.def
reactos/lib/kernel32/makefile
reactos/lib/kernel32/string/lstring.c
reactos/lib/ntdll/def/ntdll.def
reactos/lib/ntdll/makefile
reactos/lib/ntdll/stdlib/atoi.c [new file with mode: 0644]
reactos/lib/ntdll/stdlib/atol.c [new file with mode: 0644]
reactos/lib/ntdll/stdlib/splitp.c [new file with mode: 0644]
reactos/lib/ntdll/stdlib/strtol.c [new file with mode: 0644]
reactos/lib/ntdll/stdlib/strtoul.c [new file with mode: 0644]
reactos/lib/ntdll/string/ctype.c
reactos/lib/ntdll/string/memmove.c [new file with mode: 0644]
reactos/lib/ntdll/string/strchr.c [new file with mode: 0644]
reactos/lib/ntdll/string/strcspn.c [new file with mode: 0644]
reactos/lib/ntdll/string/stricmp.c
reactos/lib/ntdll/string/strncat.c [new file with mode: 0644]
reactos/lib/ntdll/string/strnicmp.c [new file with mode: 0644]
reactos/lib/ntdll/string/strstr.c [new file with mode: 0644]
reactos/lib/ntdll/string/strupr.c [new file with mode: 0644]
reactos/lib/ntdll/stubs/stubs.c
rosapps/cmd/makefile
rosapps/cmd/ros.c

index 1041824..bce95a6 100644 (file)
@@ -12,10 +12,10 @@ OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
         chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
         del.o dir.o dirstack.o echo.o error.o filecomp.o for.o goto.o \
         history.o if.o internal.o label.o locale.o misc.o move.o path.o \
-        pause.o prompt.o redir.o ren.o set.o shift.o time.o title.o type.o \
+        pause.o prompt.o redir.o ren.o ros.o set.o shift.o time.o title.o type.o \
         ver.o verify.o vol.o where.o
 
-LIBS= ../../lib/kernel32/kernel32.a ../../lib/crtdll/crtdll.a 
+LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a 
 
 CLEAN_FILES = cmd.o attrib.o alias.o batch.o beep.o call.o \
         chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
index c8c02e2..e5000c6 100644 (file)
@@ -1,11 +1,12 @@
 
+#include "config.h"
+
 #ifdef __REACTOS__
 
 #include <windows.h>
 #include <stdlib.h>
 #include <string.h>
-//#include <types.h>
-//#include <ddk/ntddk.h>
+
 
 void* malloc(size_t _size)
 {
@@ -14,6 +15,7 @@ void* malloc(size_t _size)
                    _size));
 }
 
+
 void free(void* _ptr)
 {
    HeapFree(GetProcessHeap(),
@@ -21,14 +23,6 @@ void free(void* _ptr)
            _ptr);
 }
 
-#if 0
-void* calloc(size_t _nmemb, size_t _size)
-{
-   return(HeapAlloc(GetProcessHeap(),
-                      HEAP_ZERO_MEMORY,
-                      _nmemb*_size));
-}
-#endif
 
 void* realloc(void* _ptr, size_t _size)
 {
@@ -38,8 +32,8 @@ void* realloc(void* _ptr, size_t _size)
                      _size));
 }
 
-char *
-_strdup(const char *_s)
+
+char *_strdup(const char *_s)
 {
   char *rv;
   if (_s == 0)
@@ -51,20 +45,8 @@ _strdup(const char *_s)
   return rv;
 }
 
-size_t
-strlen(const char *str)
-{
-  const char *s;
 
-  if (str == 0)
-    return 0;
-  for (s = str; *s; ++s);
-  return s-str;
-}
-
-
-void
-_makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
+void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
 {
        int dir_len;
        if ( drive != NULL ) {
@@ -90,4 +72,4 @@ _makepath( char *path, const char *drive, const char *dir, const char *fname, co
        }
 }
 
-#endif
\ No newline at end of file
+#endif
index aa2f1d8..5a6a540 100644 (file)
@@ -127,7 +127,8 @@ DeleteFileW = DeleteFileW@4
 ;DisconnectNamedPipe@4
 ;DosDateTimeToFileTime@12
 ;DuplicateConsoleHandle@16
-;DuplicateHandle@28
+DuplicateHandle@28
+DuplicateHandle = DuplicateHandle@28
 ;EndUpdateResourceA@8
 ;EndUpdateResourceW@8
 ;EnterCriticalSection@4
@@ -164,8 +165,10 @@ ExitProcess = ExitProcess@4
 ;FileTimeToDosDateTime@12
 ;FileTimeToLocalFileTime@8
 ;FileTimeToSystemTime@8
-;FillConsoleOutputAttribute@20
-;FillConsoleOutputCharacterA@20
+FillConsoleOutputAttribute@20
+FillConsoleOutputAttribute = FillConsoleOutputAttribute@20
+FillConsoleOutputCharacterA@20
+FillConsoleOutputCharacterA = FillConsoleOutputCharacterA@20
 ;FillConsoleOutputCharacterW@20
 ;FindAtomA@4
 ;FindAtomW@4
@@ -196,8 +199,10 @@ FlushFileBuffers = FlushFileBuffers@4
 ;FoldStringW@20
 ;FormatMessageA@28
 ;FormatMessageW@28
-;FreeConsole@0
-;FreeEnvironmentStringsA@4
+FreeConsole@0
+FreeConsole = FreeConsole@0
+FreeEnvironmentStringsA@4
+FreeEnvironmentStringsA = FreeEnvironmentStringsA@4
 ;FreeEnvironmentStringsW@4
 FreeLibrary@4
 FreeLibrary = FreeLibrary@4
@@ -238,7 +243,8 @@ GetCompressedFileSizeW = GetCompressedFileSizeW@8
 ;GetConsoleAliasesLengthA@4
 ;GetConsoleAliasesLengthW@4
 ;GetConsoleAliasesW@12
-;GetConsoleCP@0
+GetConsoleCP@0
+GetConsoleCP = GetConsoleCP@0
 ;GetConsoleCommandHistoryA@12
 ;GetConsoleCommandHistoryLengthA@4
 ;GetConsoleCommandHistoryLengthW@4
@@ -249,9 +255,12 @@ GetCompressedFileSizeW = GetCompressedFileSizeW@8
 ;GetConsoleFontSize@8
 ;GetConsoleHardwareState@12
 ;GetConsoleInputWaitHandle@0
-;GetConsoleMode@8
-;GetConsoleOutputCP@0
-;GetConsoleScreenBufferInfo@8
+GetConsoleMode@8
+GetConsoleMode = GetConsoleMode@8
+GetConsoleOutputCP@0
+GetConsoleOutputCP = GetConsoleOutputCP@0
+GetConsoleScreenBufferInfo@8
+GetConsoleScreenBufferInfo = GetConsoleScreenBufferInfo@8
 ;GetConsoleTitleA@8
 ;GetConsoleTitleW@8
 ;GetCurrencyFormatA@24
@@ -310,7 +319,8 @@ GetFullPathNameW = GetFullPathNameW@16
 ;GetLargestConsoleWindowSize@4
 GetLastError@0
 GetLastError = GetLastError@0
-;GetLocalTime@4
+GetLocalTime@4
+GetLocalTime = GetLocalTime@4
 ;GetLocaleInfoA@16
 ;GetLocaleInfoW@16
 ;GetLogicalDriveStringsA@8
@@ -406,10 +416,14 @@ GetTempPathW = GetTempPathW@8
 ;GetVDMCurrentDirectories@8
 GetVersion@0
 GetVersion = GetVersion@0
-;GetVersionExA@4
-;GetVersionExW@4
-;GetVolumeInformationA@32
-;GetVolumeInformationW@32
+GetVersionExA@4
+GetVersionExA = GetVersionExA@4
+GetVersionExW@4
+GetVersionExW = GetVersionExW@4
+GetVolumeInformationA@32
+GetVolumeInformationA = GetVolumeInformationA@32
+GetVolumeInformationW@32
+GetVolumeInformationW = GetVolumeInformationW@32
 ;GetWindowsDirectoryA@8
 ;GetWindowsDirectoryW@8
 ;GlobalAddAtomA@4
@@ -544,7 +558,8 @@ PulseEvent = PulseEvent@4
 ;RaiseException@16
 ReadConsoleA@20
 ReadConsoleA = ReadConsoleA@20
-;ReadConsoleInputA@16
+ReadConsoleInputA@16
+ReadConsoleInputA = ReadConsoleInputA@16
 ;ReadConsoleInputW@16
 ;ReadConsoleOutputA@20
 ;ReadConsoleOutputAttribute@20
@@ -588,26 +603,32 @@ SearchPathW = SearchPathW@24
 ;SetComputerNameA@4
 ;SetComputerNameW@4
 ;SetConsoleActiveScreenBuffer@4
-;SetConsoleCP@4
+SetConsoleCP@4
+SetConsoleCP = SetConsoleCP@4
 ;SetConsoleCommandHistoryMode@4
 ;SetConsoleCtrlHandler@8
 ;SetConsoleCursor@8
 ;SetConsoleCursorInfo@8
-;SetConsoleCursorPosition@8
+SetConsoleCursorPosition@8
+SetConsoleCursorPosition = SetConsoleCursorPosition@8
 ;SetConsoleDisplayMode@12
 ;SetConsoleFont@8
 ;SetConsoleHardwareState@12
 ;SetConsoleKeyShortcuts@16
 ;SetConsoleMaximumWindowSize@8
 ;SetConsoleMenuClose@4
-;SetConsoleMode@8
+SetConsoleMode@8
+SetConsoleMode = SetConsoleMode@8
 ;SetConsoleNumberOfCommandsA@8
 ;SetConsoleNumberOfCommandsW@8
-;SetConsoleOutputCP@4
+SetConsoleOutputCP@4
+SetConsoleOutputCP = SetConsoleOutputCP@4
 ;SetConsolePalette@12
 ;SetConsoleScreenBufferSize@8
-;SetConsoleTextAttribute@8
-;SetConsoleTitleA@4
+SetConsoleTextAttribute@8
+SetConsoleTextAttribute = SetConsoleTextAttribute@8
+SetConsoleTitleA@4
+SetConsoleTitleA = SetConsoleTitleA@4
 ;SetConsoleTitleW@4
 ;SetConsoleWindowInfo@12
 SetCurrentDirectoryA@4
@@ -634,14 +655,16 @@ SetFileAttributesA@8
 SetFileAttributesA = SetFileAttributesA@8
 SetFileAttributesW@8
 SetFileAttributesW = SetFileAttributesW@8
-;SetFilePointer@16
+SetFilePointer@16
+SetFilePointer = SetFilePointer@16
 SetFileTime@16
 SetFileTime = SetFileTime@16
 ;SetHandleCount@4
 ;SetHandleInformation@12
 ;SetLastConsoleEventActive@0
 ;SetLastError@4
-;SetLocalTime@4
+SetLocalTime@4
+SetLocalTime = SetLocalTime@4
 ;SetLocaleInfoA@12
 ;SetLocaleInfoW@12
 ;SetMailslotInfo@8
@@ -649,7 +672,8 @@ SetFileTime = SetFileTime@16
 ;SetPriorityClass@8
 ;SetProcessShutdownParameters@8
 ;SetProcessWorkingSetSize@12
-;SetStdHandle@8
+SetStdHandle@8
+SetStdHandle = SetStdHandle@8
 ;SetSystemPowerState@8
 ;SetSystemTime@4
 ;SetSystemTimeAdjustment@8
@@ -664,7 +688,8 @@ SetFileTime = SetFileTime@16
 SetUnhandledExceptionFilter@4
 SetUnhandledExceptionFilter = SetUnhandledExceptionFilter@4
 ;SetVDMCurrentDirectories@8
-;SetVolumeLabelA@8
+SetVolumeLabelA@8
+SetVolumeLabelA = SetVolumeLabelA@8
 ;SetVolumeLabelW@8
 ;SetupComm@12
 ;ShowConsoleCursor@8
index 7b2bd13..f65230f 100644 (file)
@@ -58,7 +58,7 @@ EXCEPT_OBJECTS = except/except.o
 
 OBJECTS = $(MISC_OBJECTS) $(FILE_OBJECTS) $(THREAD_OBJECTS) \
           $(PROCESS_OBJECTS) $(STRING_OBJECTS) $(MEM_OBJECTS) \
-         $(INTERNAL_OBJECTS) $(SYNCH_OBJECTS) $(EXCEPT_OBJECTS)
+          $(INTERNAL_OBJECTS) $(SYNCH_OBJECTS) $(EXCEPT_OBJECTS)
 
 ifeq ($(DOSCLI),yes)
 CLEAN_FILES = except\*.o file\*.o internal\*.o mem\*.o misc\*.o nls\*.o  \
index ea8252d..b8f72bf 100644 (file)
@@ -30,7 +30,7 @@ lstrcmpiA(
          LPCSTR lpString2
          )
 {
-       return stricmp(lpString1,lpString2); 
+        return _stricmp(lpString1,lpString2); 
 }
 LPSTR
 STDCALL
index 08480c4..b7769a9 100644 (file)
@@ -438,23 +438,47 @@ RtlLargeIntegerDivide
 RtlEnlargedIntegerMultiply
 RtlEnlargedUnsignedMultiply
 RtlExtendedIntegerMultiply
+_splitpath
+_strcmpi
+_stricmp
+_strnicmp
+_strupr
+atoi
+atol
 isalpha
+isalnum
+iscntrl
+isdigit
+isgraph
+isprint
+ispunct
+isspace
+isupper
 iswlower
 memcpy
+memmove
 memset
+sprintf
 strcat
+strchr
 strcmp
-stricmp
 strcpy
+strcspn
+strncat
+strncmp
 strncpy
 strlen
 strrchr
+strstr
+strtol
+strtoul
+tolower
 toupper
 towupper
-wcscpy
-wcschr
 wcscat
+wcschr
 wcscmp
+wcscpy
 wcsncpy
 wcslen
 wcsrchr
index ebe6834..0305b87 100644 (file)
@@ -14,12 +14,22 @@ endif
 
 all: $(DLLTARGET)
 
+STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \
+                 stdlib/strtol.o stdlib/strtoul.o
+
+STRING_OBJECTS = string/ctype.o string/memcpy.o string/memmove.o \
+                 string/memset.o string/strcat.o string/strchr.o \
+                 string/strcmp.o string/strcspn.o \
+                 string/strcpy.o string/stricmp.o string/strlen.o \
+                 string/strncat.o string/strncmp.o string/strncpy.o \
+                 string/strnicmp.o string/strnlen.o string/strrchr.o \
+                 string/strstr.o string/strupr.o string/wstring.o
+
 OBJECTS = napi.o ldr/startup.o rtl/largeint.o rtl/namespc.o rtl/unicode.o \
-          stdio/vsprintf.o string/ctype.o string/memcpy.o string/memset.o \
-          string/strcat.o string/strcmp.o string/strcpy.o string/stricmp.o \
-          string/strlen.o string/strncmp.o string/strncpy.o string/strnlen.o \
-          string/strrchr.o string/wstring.o stubs/stubs.o rtl/heap.o \
-         rtl/critical.o rtl/mem.o ldr/utils.o
+          stdio/vsprintf.o $(STDLIB_OBJECTS) $(STRING_OBJECTS) \
+          stubs/stubs.o rtl/heap.o rtl/critical.o rtl/mem.o \
+          ldr/utils.o
+
 ifeq ($(DOSCLI),yes)
 CLEAN_FILES = napi.o ldr\*.o rtl\*.o stdio\*.o string\*.o stubs\*.o ntdll.a  \
               main\dllmain.o ntdll.o ntdll.dll junk.tmp base.tmp temp.exp ntdll.sym
diff --git a/reactos/lib/ntdll/stdlib/atoi.c b/reactos/lib/ntdll/stdlib/atoi.c
new file mode 100644 (file)
index 0000000..ba4e2df
--- /dev/null
@@ -0,0 +1,8 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <stdlib.h>
+
+int
+atoi(const char *str)
+{
+  return (int)strtol(str, 0, 10);
+}
diff --git a/reactos/lib/ntdll/stdlib/atol.c b/reactos/lib/ntdll/stdlib/atol.c
new file mode 100644 (file)
index 0000000..2680abd
--- /dev/null
@@ -0,0 +1,8 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <stdlib.h>
+
+long
+atol(const char *str)
+{
+  return strtol(str, 0, 10);
+}
diff --git a/reactos/lib/ntdll/stdlib/splitp.c b/reactos/lib/ntdll/stdlib/splitp.c
new file mode 100644 (file)
index 0000000..8dbe18b
--- /dev/null
@@ -0,0 +1,42 @@
+#include <stdlib.h>
+#include <string.h>
+
+void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext )
+{
+       char *tmp_drive;
+       char *tmp_dir;
+       char *tmp_ext;
+
+       tmp_drive = (char *)strchr(path,':');
+       if ( tmp_drive != (char *)NULL ) {
+               strncpy(drive,tmp_drive-1,1);
+               *(drive+1) = 0;
+       }
+       else {
+               *drive = 0; 
+               tmp_drive = (char *)path;
+       }
+
+       tmp_dir = (char *)strrchr(path,'\\');
+       if( tmp_dir != NULL && tmp_dir != tmp_drive + 1 ) {
+               strncpy(dir,tmp_drive+1,tmp_dir - tmp_drive);
+               *(dir + (tmp_dir - tmp_drive)) = 0;
+       }
+       else    
+               *dir =0;
+
+       tmp_ext = ( char *)strrchr(path,'.');
+       if ( tmp_ext != NULL ) {
+               strcpy(ext,tmp_ext);
+       }
+       else
+               *ext = 0; 
+    if ( tmp_dir != NULL ) {
+               strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
+               *(fname + (tmp_ext - tmp_dir -1)) = 0;
+       }
+       else
+               strncpy(fname,path,tmp_ext - path);
+
+}
+
diff --git a/reactos/lib/ntdll/stdlib/strtol.c b/reactos/lib/ntdll/stdlib/strtol.c
new file mode 100644 (file)
index 0000000..c1130ef
--- /dev/null
@@ -0,0 +1,91 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <limits.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+//#include <crtdll/internal/file.h>
+
+long
+strtol(const char *nptr, char **endptr, int base)
+{
+  const char *s = nptr;
+  unsigned long acc;
+  int c;
+  unsigned long cutoff;
+  int neg = 0, any, cutlim;
+
+  /*
+   * Skip white space and pick up leading +/- sign if any.
+   * If base is 0, allow 0x for hex and 0 for octal, else
+   * assume decimal; if base is already 16, allow 0x.
+   */
+  do {
+    c = *s++;
+  } while (isspace(c));
+  if (c == '-')
+  {
+    neg = 1;
+    c = *s++;
+  }
+  else if (c == '+')
+    c = *s++;
+  if ((base == 0 || base == 16) &&
+      c == '0' && (*s == 'x' || *s == 'X'))
+  {
+    c = s[1];
+    s += 2;
+    base = 16;
+  }
+  if (base == 0)
+    base = c == '0' ? 8 : 10;
+
+  /*
+   * Compute the cutoff value between legal numbers and illegal
+   * numbers.  That is the largest legal value, divided by the
+   * base.  An input number that is greater than this value, if
+   * followed by a legal input character, is too big.  One that
+   * is equal to this value may be valid or not; the limit
+   * between valid and invalid numbers is then based on the last
+   * digit.  For instance, if the range for longs is
+   * [-2147483648..2147483647] and the input base is 10,
+   * cutoff will be set to 214748364 and cutlim to either
+   * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
+   * a value > 214748364, or equal but the next digit is > 7 (or 8),
+   * the number is too big, and we will return a range error.
+   *
+   * Set any if any `digits' consumed; make it negative to indicate
+   * overflow.
+   */
+  cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
+  cutlim = cutoff % (unsigned long)base;
+  cutoff /= (unsigned long)base;
+  for (acc = 0, any = 0;; c = *s++)
+  {
+    if (isdigit(c))
+      c -= '0';
+    else if (isalpha(c))
+      c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+    else
+      break;
+    if (c >= base)
+      break;
+    if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+      any = -1;
+    else
+    {
+      any = 1;
+      acc *= base;
+      acc += c;
+    }
+  }
+  if (any < 0)
+  {
+    acc = neg ? LONG_MIN : LONG_MAX;
+//    __set_errno(ERANGE);
+  }
+  else if (neg)
+    acc = -acc;
+  if (endptr != 0)
+    *endptr = any ? (char *)s - 1 : (char *)nptr;
+  return acc;
+}
diff --git a/reactos/lib/ntdll/stdlib/strtoul.c b/reactos/lib/ntdll/stdlib/strtoul.c
new file mode 100644 (file)
index 0000000..be7305e
--- /dev/null
@@ -0,0 +1,76 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <limits.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+//#include <internal/file.h>
+
+
+/*
+ * Convert a string to an unsigned long integer.
+ *
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+unsigned long
+strtoul(const char *nptr, char **endptr, int base)
+{
+  const char *s = nptr;
+  unsigned long acc;
+  int c;
+  unsigned long cutoff;
+  int neg = 0, any, cutlim;
+
+  /*
+   * See strtol for comments as to the logic used.
+   */
+  do {
+    c = *s++;
+  } while (isspace(c));
+  if (c == '-')
+  {
+    neg = 1;
+    c = *s++;
+  }
+  else if (c == '+')
+    c = *s++;
+  if ((base == 0 || base == 16) &&
+      c == '0' && (*s == 'x' || *s == 'X'))
+  {
+    c = s[1];
+    s += 2;
+    base = 16;
+  }
+  if (base == 0)
+    base = c == '0' ? 8 : 10;
+  cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
+  cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
+  for (acc = 0, any = 0;; c = *s++)
+  {
+    if (isdigit(c))
+      c -= '0';
+    else if (isalpha(c))
+      c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+    else
+      break;
+    if (c >= base)
+      break;
+    if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+      any = -1;
+    else {
+      any = 1;
+      acc *= base;
+      acc += c;
+    }
+  }
+  if (any < 0)
+  {
+    acc = ULONG_MAX;
+//    __set_errno(ERANGE);
+  }
+  else if (neg)
+    acc = -acc;
+  if (endptr != 0)
+    *endptr = any ? (char *)s - 1 : (char *)nptr;
+  return acc;
+}
index 871e54c..24565d1 100644 (file)
@@ -6,50 +6,68 @@ int isalpha(char c)
    return(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
 }
 
-int isspace(char c)
+int isalnum(char c)
 {
-   return(c==' '||c=='\t');
+   return(isalpha(c)||isdigit(c));
 }
 
-char toupper(char c)
+int iscntrl(char c)
 {
-   if ((c>='a') && (c<='z')) return (c+upalpha);
-   return(c);
+   return((c >=0x00 && c <= 0x1f) || c == 0x7f);
 }
 
-char tolower(char c)
+int isdigit(char c)
 {
-   if (c>='A' && c <= 'Z')
-       return (c - upalpha);
-   return(c);
+   return((c>='0') && (c<='9'));
+}
+
+int isgraph(char c)
+{
+   return(c>=0x21 && c<=0x7e);
 }
 
 int islower(char c)
 {
-   if ((c>='a') && (c<='z')) return 1;
-   return 0;
+   return((c>='a') && (c<='z'));
 }
 
-int isdigit(char c)
+int isprint(char c)
 {
-   if ((c>='0') && (c<='9')) return 1;
-   return 0;
+   return(c>=0x20 && c<=0x7e);
+}
+
+int ispunct(char c)
+{
+   return((c>=0x21 && c<=0x2f)||(c>=0x3a && c<=0x40)||(c>=0x5b && c<=0x60));
+}
+
+int isspace(char c)
+{
+   return(c==' '||c=='\t');
+}
+
+int isupper(char c)
+{
+   return((c>='A') && (c<='Z'));
 }
 
 int isxdigit(char c)
 {
-   if (((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z')))
-     {
-       return 1;
-     }
-   return 0;
+   return(((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z')));
 }
 
-int iscntrl(char c)
+
+char tolower(char c)
 {
-   if ((c >=0x00 && c <= 0x1f) || c == 0x7f);
-    return 1;
-   return 0;
+   if (c>='A' && c <= 'Z')
+       return (c - upalpha);
+   return(c);
 }
 
+char toupper(char c)
+{
+   if ((c>='a') && (c<='z'))
+      return (c+upalpha);
+   return(c);
+}
 
diff --git a/reactos/lib/ntdll/string/memmove.c b/reactos/lib/ntdll/string/memmove.c
new file mode 100644 (file)
index 0000000..11038c6
--- /dev/null
@@ -0,0 +1,18 @@
+#include <string.h>
+
+
+void * memmove(void *dest,const void *src,size_t count)
+{
+       char *char_dest = (char *)dest;
+       char *char_src = (char *)src;
+
+       while(count > 0 )
+       {
+               *char_dest = *char_src;
+               char_dest++;
+               char_src++;
+               count--;
+       }
+
+       return dest;
+}
diff --git a/reactos/lib/ntdll/string/strchr.c b/reactos/lib/ntdll/string/strchr.c
new file mode 100644 (file)
index 0000000..4489403
--- /dev/null
@@ -0,0 +1,21 @@
+/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+
+
+
+char *strchr(const char *s, int c);
+
+char *strchr(const char *s, int c)
+{
+  char cc = c;
+  while (*s)
+  {
+    if (*s == cc)
+      return (char *)s;
+    s++;
+  }
+  if (cc == 0)
+    return (char *)s;
+  return 0;
+}
+
diff --git a/reactos/lib/ntdll/string/strcspn.c b/reactos/lib/ntdll/string/strcspn.c
new file mode 100644 (file)
index 0000000..7e17b21
--- /dev/null
@@ -0,0 +1,20 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+
+size_t
+strcspn(const char *s1, const char *s2)
+{
+  const char *p, *spanp;
+  char c, sc;
+
+  for (p = s1;;)
+  {
+    c = *p++;
+    spanp = s2;
+    do {
+      if ((sc = *spanp++) == c)
+       return p - 1 - s1;
+    } while (sc != 0);
+  }
+  /* NOTREACHED */
+}
index 377414e..913ceef 100644 (file)
@@ -1,9 +1,9 @@
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
-#include <ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
 
 int
-stricmp(const char *s1, const char *s2)
+_stricmp(const char *s1, const char *s2)
 {
   while (toupper(*s1) == toupper(*s2))
   {
@@ -14,3 +14,9 @@ stricmp(const char *s1, const char *s2)
   }
   return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2));
 }
+
+int
+_strcmpi(const char *s1, const char *s2)
+{
+       return _stricmp(s1,s2);
+}
diff --git a/reactos/lib/ntdll/string/strncat.c b/reactos/lib/ntdll/string/strncat.c
new file mode 100644 (file)
index 0000000..75fc9ee
--- /dev/null
@@ -0,0 +1,22 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+
+char *
+strncat(char *dst, const char *src, size_t n)
+{
+  if (n != 0)
+  {
+    char *d = dst;
+    const char *s = src;
+
+    while (*d != 0)
+      d++;
+    do {
+      if ((*d = *s++) == 0)
+       break;
+      d++;
+    } while (--n != 0);
+    *d = 0;
+  }
+  return dst;
+}
diff --git a/reactos/lib/ntdll/string/strnicmp.c b/reactos/lib/ntdll/string/strnicmp.c
new file mode 100644 (file)
index 0000000..40c5e20
--- /dev/null
@@ -0,0 +1,17 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+#include <ctype.h>
+
+int _strnicmp(const char *s1, const char *s2, size_t n)
+{
+
+  if (n == 0)
+    return 0;
+  do {
+    if (toupper(*s1) != toupper(*s2++))
+      return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)--s2);
+    if (*s1++ == 0)
+      break;
+  } while (--n != 0);
+  return 0;
+}
diff --git a/reactos/lib/ntdll/string/strstr.c b/reactos/lib/ntdll/string/strstr.c
new file mode 100644 (file)
index 0000000..10095a1
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+//#include <unconst.h>
+
+char *
+strstr(const char *s, const char *find)
+{
+  char c, sc;
+  size_t len;
+
+  if ((c = *find++) != 0)
+  {
+    len = strlen(find);
+    do {
+      do {
+       if ((sc = *s++) == 0)
+         return 0;
+      } while (sc != c);
+    } while (strncmp(s, find, len) != 0);
+    s--;
+  }
+  return (char *)s;
+}
diff --git a/reactos/lib/ntdll/string/strupr.c b/reactos/lib/ntdll/string/strupr.c
new file mode 100644 (file)
index 0000000..1183e4c
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * The C RunTime DLL
+ * 
+ * Implements C run-time functionality as known from UNIX.
+ *
+ * Copyright 1996,1998 Marcus Meissner
+ * Copyright 1996 Jukka Iivonen
+ * Copyright 1997 Uwe Bonnes
+ */
+
+
+#include <string.h>
+#include <ctype.h>
+
+char *_strupr(char *x)
+{
+       char  *y=x;
+
+       while (*y) {
+               *y=toupper(*y);
+               y++;
+       }
+       return x;
+}
index 921c8eb..a540d87 100644 (file)
@@ -217,12 +217,7 @@ STUB(_memccpy)
 STUB(_memicmp)
 STUB(_snprintf)
 STUB(_snwprintf)
-STUB(_splitpath)
-STUB(_strcmpi)
-STUB(_stricmp)
 STUB(_strlwr)
-STUB(_strnicmp)
-STUB(_strupr)
 STUB(_tolower)
 STUB(_toupper)
 STUB(_ultoa)
@@ -237,17 +232,10 @@ STUB(_wtoi64)
 STUB(_wtol)
 STUB(abs)
 STUB(atan)
-STUB(atoi)
-STUB(atol)
 STUB(ceil)
 STUB(cos)
 STUB(fabs)
 STUB(floor)
-STUB(isalnum)
-STUB(isgraph)
-STUB(isprint)
-STUB(ispunct)
-STUB(isupper)
 STUB(iswalpha)
 STUB(iswctype)
 STUB(labs)
@@ -255,20 +243,13 @@ STUB(log)
 STUB(mbstowcs)
 STUB(memchr)
 STUB(memcmp)
-STUB(memmove)
 STUB(pow)
 STUB(qsort)
 STUB(sin)
 STUB(sqrt)
 STUB(sscanf)
-STUB(strchr)
-STUB(strcspn)
-STUB(strncat)
 STUB(strpbrk)
 STUB(strspn)
-STUB(strstr)
-STUB(strtol)
-STUB(strtoul)
 STUB(swprintf)
 STUB(tan)
 
index 1041824..bce95a6 100644 (file)
@@ -12,10 +12,10 @@ OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
         chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
         del.o dir.o dirstack.o echo.o error.o filecomp.o for.o goto.o \
         history.o if.o internal.o label.o locale.o misc.o move.o path.o \
-        pause.o prompt.o redir.o ren.o set.o shift.o time.o title.o type.o \
+        pause.o prompt.o redir.o ren.o ros.o set.o shift.o time.o title.o type.o \
         ver.o verify.o vol.o where.o
 
-LIBS= ../../lib/kernel32/kernel32.a ../../lib/crtdll/crtdll.a 
+LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a 
 
 CLEAN_FILES = cmd.o attrib.o alias.o batch.o beep.o call.o \
         chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
index c8c02e2..e5000c6 100644 (file)
@@ -1,11 +1,12 @@
 
+#include "config.h"
+
 #ifdef __REACTOS__
 
 #include <windows.h>
 #include <stdlib.h>
 #include <string.h>
-//#include <types.h>
-//#include <ddk/ntddk.h>
+
 
 void* malloc(size_t _size)
 {
@@ -14,6 +15,7 @@ void* malloc(size_t _size)
                    _size));
 }
 
+
 void free(void* _ptr)
 {
    HeapFree(GetProcessHeap(),
@@ -21,14 +23,6 @@ void free(void* _ptr)
            _ptr);
 }
 
-#if 0
-void* calloc(size_t _nmemb, size_t _size)
-{
-   return(HeapAlloc(GetProcessHeap(),
-                      HEAP_ZERO_MEMORY,
-                      _nmemb*_size));
-}
-#endif
 
 void* realloc(void* _ptr, size_t _size)
 {
@@ -38,8 +32,8 @@ void* realloc(void* _ptr, size_t _size)
                      _size));
 }
 
-char *
-_strdup(const char *_s)
+
+char *_strdup(const char *_s)
 {
   char *rv;
   if (_s == 0)
@@ -51,20 +45,8 @@ _strdup(const char *_s)
   return rv;
 }
 
-size_t
-strlen(const char *str)
-{
-  const char *s;
 
-  if (str == 0)
-    return 0;
-  for (s = str; *s; ++s);
-  return s-str;
-}
-
-
-void
-_makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
+void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
 {
        int dir_len;
        if ( drive != NULL ) {
@@ -90,4 +72,4 @@ _makepath( char *path, const char *drive, const char *dir, const char *fname, co
        }
 }
 
-#endif
\ No newline at end of file
+#endif