Listing 2

/*
 * stdlib.h - general utilities (for UNIX 4.2 BSD)
 */
#ifndef _STDLIB_H_INCLUDED

#include <quirks.h>

#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1

#define MB_CUR_MAX 1

#define NULL ((void_star)0)

#define RAND_MAX 2147483647

typedef struct {int quot, rem} div_t;
typedef struct {long quot, rem} ldiv_t;

#ifndef _SIZE_T_DEFINED
typedef unsigned size_t;
#define _SIZE_T_DEFINED
#endif

#ifndef _WCHAR_T_DEFINED
typedef char wchar_t;
#define _WCHAR_T_DEFINED
#endif

void abort();
double atof();
int atoi();
long atol();
void_star calloc();
void exit();
void free();
char *getenv();
void_star malloc();
void qsort();
int rand();
void_star realloc();
void srand();
int system();

/*
 * interim macro definitions for functions
 */
#define abs(j) ((j) >= 0 ? (j) : -(j))
#define labs(j) abs((long)(j))

/*
 * missing functions
 */
int atexit();
void_star bsearch();
div_t div();
ldiv_t ldiv();
int mblen();
int wctomb();
int mbtowc();
double strtod();
long strtol();
unsigned long strtoul();

#define _STDLIB_H_INCLUDED
#endif