libposix: deep refactor; add sys/posixly command
With these changes, libposix (and newlib) can run MirBSD Korn Shell.
This commit is contained in:
27
qa/lib/newlib/002-atexit.c
Normal file
27
qa/lib/newlib/002-atexit.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void
|
||||
bye(void)
|
||||
{
|
||||
printf("That was all, folks\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
// long a;
|
||||
int i;
|
||||
|
||||
// a = sysconf(_SC_ATEXIT_MAX);
|
||||
// printf("ATEXIT_MAX = %ld\n", a);
|
||||
|
||||
i = atexit(bye);
|
||||
if (i != 0) {
|
||||
fprintf(stderr, "cannot set exit function\n");
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
Reference in New Issue
Block a user