mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-16 03:19:54 +08:00
4e04fa902a
* testsuite/newlib.stdlib/atexit.c: New file. * testsuite/newlib.stdlib/atexit.exp: Ditto. * testsuite/newlib.string/tstring.c: Change default start size to something more reasonable for embedded platforms.
49 lines
541 B
C
49 lines
541 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
void a(void);
|
|
void b(void);
|
|
void c(int, void *);
|
|
static void newline(void);
|
|
|
|
void a (void)
|
|
{
|
|
printf("a");
|
|
}
|
|
|
|
void b (void)
|
|
{
|
|
printf("b");
|
|
}
|
|
|
|
void c (int code, void *k)
|
|
{
|
|
char *x = (char *)k;
|
|
printf("%d%c",code,x[0]);
|
|
}
|
|
|
|
static void newline (void)
|
|
{
|
|
printf("\n");
|
|
}
|
|
|
|
int main()
|
|
{
|
|
if (atexit(newline) != 0)
|
|
abort();
|
|
|
|
if (atexit(a) != 0)
|
|
abort();
|
|
|
|
if (atexit(b) != 0)
|
|
abort();
|
|
|
|
if (on_exit(c,(void *)"c") != 0)
|
|
abort();
|
|
|
|
if (atexit(a) != 0)
|
|
abort();
|
|
|
|
exit(0);
|
|
}
|