stdlib.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * This file is part of Jehanne.
  3. *
  4. * Copyright (C) 2016 Giacomo Tesio <giacomo@tesio.it>
  5. *
  6. * Jehanne is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, version 2 of the License.
  9. *
  10. * Jehanne is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef _APW_STDLIB_H
  19. #define _APW_STDLIB_H
  20. #ifndef HIDE_JEHANNE_APW
  21. #include "libc.wrapper.h"
  22. #define EXIT_SUCCESS 0
  23. #define EXIT_FAILURE 1 // POSIX
  24. #include <posix.h> // to get __POSIX_EXIT_PREFIX
  25. typedef struct {
  26. int quot;
  27. int rem;
  28. } div_t;
  29. typedef struct {
  30. long quot;
  31. long rem;
  32. } ldiv_t;
  33. extern void exit(int status);
  34. extern int system(const char *command);
  35. extern div_t div(int num, int denom);
  36. extern ldiv_t ldiv(long num, long denom);
  37. extern void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
  38. int (*compar)(const void*, const void*));
  39. #undef abort
  40. extern void abort(void);
  41. #undef L_eprintf
  42. extern void __eprintf(const char *format, const char *file,
  43. unsigned int line, const char *expression);
  44. #endif
  45. #endif