summaryrefslogtreecommitdiff
path: root/src/stdlib/_stdlib.h
blob: 929981a66b609bd3782b8976d2c2d880a6991154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef ___STDLIB_H__
#define ___STDLIB_H__

#include <stdlib.h>
#include <limits.h>

#define _rand(_n) \
	(((_n) = (_n) * 1103515245 + 12345) ? (_n) / UINT_MAX % RAND_MAX : 0)

struct __stdlib {
	struct atexit {
        	int nfns;
        	void (*fns[32])(void);
        	struct atexit *next;
        	struct atexit *prev;
	} atexit;
	unsigned int rand;
	char **environ;
};

extern struct __stdlib __stdlib;

#ifdef _POSIX_SOURCE
extern char **environ;
#else
#define environ __stdlib.environ
#endif

#endif