reactos/lib/msvcrt/misc
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
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
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
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;
}