source: trunk/minix/include/stdlib.h@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 3.3 KB
RevLine 
[9]1/* The <stdlib.h> header defines certain common macros, types, and functions.*/
2
3#ifndef _STDLIB_H
4#define _STDLIB_H
5
6#ifndef _ANSI_H
7#include <ansi.h>
8#endif
9
10/* The macros are NULL, EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, and MB_CUR_MAX.*/
11#define NULL ((void *)0)
12
13#define EXIT_FAILURE 1 /* standard error return using exit() */
14#define EXIT_SUCCESS 0 /* successful return using exit() */
15#define RAND_MAX 32767 /* largest value generated by rand() */
16#define MB_CUR_MAX 1 /* max value of multibyte character in MINIX */
17
18typedef struct { int quot, rem; } div_t;
19typedef struct { long quot, rem; } ldiv_t;
20
21/* The types are size_t, wchar_t, div_t, and ldiv_t. */
22#ifndef _SIZE_T
23#define _SIZE_T
24typedef unsigned int size_t; /* type returned by sizeof */
25#endif
26
27#ifndef _WCHAR_T
28#define _WCHAR_T
29typedef char wchar_t; /* type expanded character set */
30#endif
31
32/* Function Prototypes. */
33_PROTOTYPE( void abort, (void) );
34_PROTOTYPE( int abs, (int _j) );
35_PROTOTYPE( int atexit, (void (*_func)(void)) );
36_PROTOTYPE( double atof, (const char *_nptr) );
37_PROTOTYPE( int atoi, (const char *_nptr) );
38_PROTOTYPE( long atol, (const char *_nptr) );
39_PROTOTYPE( void *calloc, (size_t _nmemb, size_t _size) );
40_PROTOTYPE( div_t div, (int _numer, int _denom) );
41_PROTOTYPE( void exit, (int _status) );
42_PROTOTYPE( void free, (void *_ptr) );
43_PROTOTYPE( char *getenv, (const char *_name) );
44_PROTOTYPE( long labs, (long _j) );
45_PROTOTYPE( ldiv_t ldiv, (long _numer, long _denom) );
46_PROTOTYPE( void *malloc, (size_t _size) );
47_PROTOTYPE( int mblen, (const char *_s, size_t _n) );
48_PROTOTYPE( size_t mbstowcs, (wchar_t *_pwcs, const char *_s, size_t _n));
49_PROTOTYPE( int mbtowc, (wchar_t *_pwc, const char *_s, size_t _n) );
50_PROTOTYPE( int rand, (void) );
51_PROTOTYPE( void *realloc, (void *_ptr, size_t _size) );
52_PROTOTYPE( void srand, (unsigned int _seed) );
53_PROTOTYPE( double strtod, (const char *_nptr, char **_endptr) );
54_PROTOTYPE( long strtol, (const char *_nptr, char **_endptr, int _base) );
55_PROTOTYPE( int system, (const char *_string) );
56_PROTOTYPE( size_t wcstombs, (char *_s, const wchar_t *_pwcs, size_t _n));
57_PROTOTYPE( int wctomb, (char *_s, wchar_t _wchar) );
58_PROTOTYPE( void *bsearch, (const void *_key, const void *_base,
59 size_t _nmemb, size_t _size,
60 int (*compar) (const void *, const void *)) );
61_PROTOTYPE( void qsort, (void *_base, size_t _nmemb, size_t _size,
62 int (*compar) (const void *, const void *)) );
63_PROTOTYPE( unsigned long int strtoul,
64 (const char *_nptr, char **_endptr, int _base) );
65
66#ifdef _POSIX_SOURCE
67/* Open Group Base Specifications Issue 6 */
68_PROTOTYPE( int mkstemp, (char *_fmt) );
69_PROTOTYPE( char *initstate, (unsigned _seed, char *_state,
70 size_t _size) );
71_PROTOTYPE( long random, (void) );
72_PROTOTYPE( char *setstate, (const char *state) );
73_PROTOTYPE( void srandom, (unsigned seed) );
74_PROTOTYPE( int getloadavg, (double *, int) );
75#endif
76
77#ifdef _MINIX
78_PROTOTYPE( int putenv, (char *_name) );
79_PROTOTYPE( int setenv, (const char *name, const char *val, const int f));
80
81/* According to POSIX, getopt should be in unistd.h. What do we do with
82 * this?
83 */
84_PROTOTYPE(int getopt, (int _argc, char * const _argv[], const char *_opts));
85extern char *optarg;
86extern int optind, opterr, optopt;
87#endif /* _MINIX */
88
89#endif /* STDLIB_H */
Note: See TracBrowser for help on using the repository browser.