2017-05-02 21:30:46 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-05-02 21:30:46 +00:00
|
|
|
*
|
|
|
|
* This file is part of Mes.
|
|
|
|
*
|
|
|
|
* Mes 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 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* Mes 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 Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-05-23 05:16:08 +00:00
|
|
|
#ifndef __MES_STDLIB_H
|
|
|
|
#define __MES_STDLIB_H 1
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2018-06-02 09:41:06 +00:00
|
|
|
#if WITH_GLIBC
|
2017-05-02 21:30:46 +00:00
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#endif
|
2017-07-23 13:49:03 +00:00
|
|
|
#undef __MES_STDLIB_H
|
2017-05-02 21:30:46 +00:00
|
|
|
#include_next <stdlib.h>
|
2018-06-02 09:41:06 +00:00
|
|
|
#else // ! WITH_GLIBC
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2018-06-19 18:23:38 +00:00
|
|
|
#include <sys/types.h>
|
2018-06-20 22:27:27 +00:00
|
|
|
#include <alloca.h>
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2017-05-23 05:16:08 +00:00
|
|
|
int atoi (char const *s);
|
2018-06-07 16:02:21 +00:00
|
|
|
int atexit (void (*function) (void));
|
2017-07-25 18:55:45 +00:00
|
|
|
void * calloc (size_t nmemb, size_t size);
|
2018-06-07 16:02:21 +00:00
|
|
|
void _exit (int status);
|
|
|
|
void exit (int status);
|
2017-07-24 16:24:51 +00:00
|
|
|
void free (void *ptr);
|
2017-07-24 11:10:27 +00:00
|
|
|
char* getenv (char const* s);
|
2018-04-29 10:02:23 +00:00
|
|
|
int setenv (char const* s, char const* v, int overwrite_p);
|
2018-06-06 17:43:32 +00:00
|
|
|
void unsetenv (char const *name);
|
2017-05-02 21:30:46 +00:00
|
|
|
void *malloc (size_t);
|
2017-07-24 15:04:11 +00:00
|
|
|
void qsort (void *base, size_t nmemb, size_t size, int (*compar)(void const *, void const *));
|
2017-05-23 05:16:08 +00:00
|
|
|
void *realloc (void *p, size_t size);
|
2018-06-06 20:39:57 +00:00
|
|
|
double strtod (char const *string, char **tailptr);
|
|
|
|
float strtof (char const *string, char **tailptr);
|
|
|
|
long double strtold (char const *string, char **tailptr);
|
|
|
|
long strtol (char const *string, char **tailptr, int base);
|
|
|
|
long long strtoll (char const *string, char **tailptr, int base);
|
|
|
|
unsigned long strtoul (char const *string, char **tailptr, int base);
|
|
|
|
unsigned long long strtoull (char const *string, char **tailptr, int base);
|
2017-05-23 05:16:08 +00:00
|
|
|
|
2017-11-19 13:05:33 +00:00
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
|
2018-06-19 18:23:38 +00:00
|
|
|
#ifndef __MES_COMPARISON_FN_T
|
|
|
|
#define __MES_COMPARISON_FN_T
|
2018-06-06 11:16:25 +00:00
|
|
|
typedef int (*comparison_fn_t) (void const *, void const *);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void * bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
|
|
|
|
|
2018-06-02 09:41:06 +00:00
|
|
|
#endif // ! WITH_GLIBC
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2017-05-23 05:16:08 +00:00
|
|
|
#endif // __MES_STDLIB_H
|