Commit in reactos/lib/msvcrt on MAIN
misc/initterm.c-191.6 -> 1.7
stdio/vsprintf.c+1-11.7 -> 1.8
     /vsscanf.c+1-11.4 -> 1.5
stdlib/atexit.c+44-61.6 -> 1.7
+46-27
4 modified files
- Implement _onexit.
- Port __dllonexit from Wine.
- Fix vsscanf stream initialization.

reactos/lib/msvcrt/misc
initterm.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- initterm.c	14 Nov 2003 17:13:31 -0000	1.6
+++ initterm.c	27 Dec 2004 16:43:49 -0000	1.7
@@ -18,22 +18,3 @@
 	i++;
      }
 }
-
-
-typedef int (* _onexit_t)(void);
-
-/*
- * @unimplemented
- */
-_onexit_t __dllonexit(_onexit_t func, void (** fStart[])(void),	void (** fEnd[])(void))
-{
-	return 0;
-}
-
-/*
- * @unimplemented
- */
-_onexit_t _onexit(_onexit_t x)
-{
-    return x;
-}

reactos/lib/msvcrt/stdio
vsprintf.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- vsprintf.c	7 Aug 2003 09:08:45 -0000	1.7
+++ vsprintf.c	27 Dec 2004 16:43:49 -0000	1.8
@@ -13,7 +13,7 @@
   FILE f;
   int len;
 
-  f._flag = _IOWRT|_IOSTRG|_IOBINARY;;
+  f._flag = _IOWRT|_IOSTRG|_IOBINARY;
   f._ptr = str;
   f._cnt = INT_MAX;
   f._file = -1;

reactos/lib/msvcrt/stdio
vsscanf.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- vsscanf.c	8 Sep 2002 10:22:57 -0000	1.4
+++ vsscanf.c	27 Dec 2004 16:43:49 -0000	1.5
@@ -39,7 +39,7 @@
 
   memset((void *) &f, 0, sizeof (f));
 
-  f._flag = _IOREAD;
+  f._flag = _IOREAD|_IOSTRG|_IOBINARY;
   f._ptr = (char *)s;
   f._base = (char *)s;
   f._bufsiz = strlen(s);

reactos/lib/msvcrt/stdlib
atexit.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- atexit.c	11 Jul 2003 21:58:09 -0000	1.6
+++ atexit.c	27 Dec 2004 16:43:49 -0000	1.7
@@ -2,20 +2,58 @@
 #include <msvcrt/stdlib.h>
 #include <msvcrt/internal/atexit.h>
 
+typedef int (* _onexit_t)(void);
+
 /*
  * @implemented
+ *
+ * Ported from WINE
+ * Copyright (C) 2000 Jon Griffiths
  */
-int
-atexit(void (*a)(void))
+_onexit_t __dllonexit(_onexit_t func, _onexit_t **start, _onexit_t **end)
+{
+   _onexit_t *tmp;
+   int len;
+
+   if (!start || !*start || !end || !*end)
+      return NULL;
+
+   len = (*end - *start);
+   if (++len <= 0)
+      return NULL;
+
+   tmp = (_onexit_t *)realloc(*start, len * sizeof(tmp));
+   if (!tmp)
+      return NULL;
+
+   *start = tmp;
+   *end = tmp + len;
+   tmp[len - 1] = func;
+
+   return func;
+}
+
+/*
+ * @implemented
+ */
+_onexit_t _onexit(_onexit_t a)
 {
   struct __atexit *ap;
   if (a == 0)
-    return -1;
+    return NULL;
   ap = (struct __atexit *)malloc(sizeof(struct __atexit));
   if (!ap)
-    return -1;
+    return NULL;
   ap->__next = __atexit_ptr;
-  ap->__function = a;
+  ap->__function = (void (*)(void))a;
   __atexit_ptr = ap;
-  return 0;
+  return a;
+}
+
+/*
+ * @implemented
+ */
+int atexit(void (*a)(void))
+{
+  return _onexit((_onexit_t)a) == (_onexit_t)a ? 0 : -1;
 }
CVSspam 0.2.8