This is p-stdlib.h in view mode; [Download] [Up]
/*+++* * RCS $Id: p-stdlib.h,v 1.4 1993/02/02 21:00:42 gerben Exp $ * title: p-stdlib.h * abstract: portable Posix-compliant <stdlib.h>. * author: T.R.Hageman, Groningen, The Netherlands * created: November 1992 * modified: (see RCS Log at end) * copyleft: * * Copyright (C) 1992 Tom R. Hageman. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * description: * * This is a Posix-compatible version of <stdlib.h> for both Posix * and non-Posix systems. * * Notes: * o The presence of a prototype here does not guarantee the existence * of the corresponding function in the library. * * o `div_t' and `ldiv_t' are not declared since their declarations * cause conflict on antique compilers with a single struct namespace; * hence div() and ldiv() are not declared either. * * o Some implementations have conflicting (or just plain wrong) * return types of qsort and/or srand. These can be accommodated * by setting the macros _P_QSORT_RETURN_TYPE/_P_SRAND_RETURN_TYPE. *---*/ #ifndef _P_STDLIB_H_ #define _P_STDLIB_H_ 0x100 #ifndef _PORTDEFS_H_ # include "portdefs.h" #endif #if _ANSI_HEADERS_ || _I_STDLIB # include <stdlib.h> #endif #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # define EXIT_FAILURE 1 #endif #if !__STRICT_POSIX__ # ifndef MB_CUR_MAX /* Max.size of "multibyte" character. */ # ifndef _WCHAR_T typedef char wchar_t; /* "multibyte" character type. */ # define _WCHAR_T # endif # endif # ifndef RAND_MAX # if __MSHORT__ /* assume 16 bits, 2's complement. */ # define RAND_MAX 32767 # else /* assume 32 bits, 2's complement. */ # define RAND_MAX 2147483647 # endif # endif #endif /* !__STRICT_POSIX__ */ #if !_ANSI_LIBRARY_ /* {{debatable...}} */ #if !__NO_PROTO__ #if _I_MALLOC /* for {m,c,re}alloc(), free() */ # include <malloc.h> #else # if _I_ALLOC # include <alloc.h> # else extern void_* calloc __(( size_t _(n), size_t _(size) )); extern void_* malloc __(( size_t _(size) )); extern void_* realloc __(( void_*_(buf), size_t _(newsize) )); # if !__NO_TRIV_PROTO__ # ifdef _P_FREE_RETURN_TYPE extern _P_FREE_RETURN_TYPE /* kludg-O-rama */ # else extern void # endif free __(( void_*_(buf) )); # endif # endif #endif # if !__NO_TRIV_PROTO__ extern # if (__GNUC__ && !(2*__STRICT_ANSI__-1==2*0-1) && !(2*__STRICT_BSD__-1==2*0-1)) __volatile # endif # ifdef _P_ABORT_RETURN_TYPE _P_ABORT_RETURN_TYPE /* kludg-O-rama */ # else void # endif abort __(( void )); # ifndef abs extern int abs __(( int _(j) )); # endif # if !__STRICT_POSIX__ extern int atexit __(( void (*_(func))(void) )); # endif # endif extern double atof __(( const char *_(s) )); # if !__NO_TRIV_PROTO__ extern int atoi __(( const char *_(s) )); # endif extern long atol __(( const char *_(s) )); extern void_* bsearch __(( const void_*_(key), const void_*_(base), size_t _(nmemb), size_t _(size), int (*_(compar))(const void_*, const void_*) )); # if !__NO_TRIV_PROTO__ extern # if (__GNUC__ && !(2*__STRICT_ANSI__-1==2*0-1) && !(2*__STRICT_BSD__-1==2*0-1)) __volatile # endif # ifdef _P_EXIT_RETURN_TYPE _P_EXIT_RETURN_TYPE /* kludg-O-rama */ # else void # endif exit __(( int _(status) )); # endif extern char * getenv __(( const char *_(envvar) )); # if !__STRICT_POSIX__ # ifndef labs extern long labs __(( long _(l) )); # endif # if !__NO_TRIV_PROTO__ # ifndef mblen extern int mblen __(( const char *_(s), size_t _(n) )); # endif extern size_t mbstowcs __(( wchar_t *_(pwcs), const char *_(s), size_t _(n) )); extern size_t wcstombs __(( char *_(s), const wchar_t *_(pwcs), size_t _(n) )); extern int mbtowc __(( wchar_t *_(pwc), const char *_(s), size_t _(n) )); extern int wctomb __(( char *_(s), _PI_LIBC_(wchar_t) _(wchar) )); # endif # endif # if !__NO_TRIV_PROTO__ # ifdef _P_QSORT_RETURN_TYPE extern _P_QSORT_RETURN_TYPE /* kludg-O-rama */ # else extern void # endif qsort __(( void_*_(base), size_t _(nmemb), size_t _(size), int (*_(compar))(const void_*, const void_*) )); extern int rand __(( void )); # ifdef _P_SRAND_RETURN_TYPE extern _P_SRAND_RETURN_TYPE /* kludg-O-rama */ # else extern void # endif srand __(( unsigned _(seed) )); # endif # if !__STRICT_POSIX__ extern double strtod __(( const char *_(s), char **_(endptr) )); extern long strtol __(( const char *_(s), char **_(endptr), int base )); extern # if _HAS_UNSIGNED_ || !__MSHORT__ unsigned # endif long strtoul __(( const char *_(s), char **_(endptr), int base )); # endif # if !__STRICT_POSIX__ || 2* _POSIX2_SOURCE -1!=-1 /* ANSI, Posix.2 */ # if !__NO_TRIV_PROTO__ extern int system __(( const char *_(command) )); # endif # endif #endif /* __NO_PROTO__ */ #endif /* _ANSI_LIBRARY_ */ #endif /* _P_STDLIB_H_ */ /*======================================================================* * $Log: p-stdlib.h,v $ * Revision 1.4 1993/02/02 21:00:42 gerben * *** empty log message *** * * Revision 1.3 1992/12/31 00:55:15 tom * add lots of return-type kludges to accommodate traditional non-ANSI C headers. * * Revision 1.2 1992/12/22 01:30:50 tom * add _P_<function>_RETURN_TYPE, _PI_LIBC_ kludges; change order of `volatile' * and `extern' keywords. * * Revision 1.1 1992/12/18 23:08:31 tom * Initial revision * *======================================================================*/
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.