lib-mini.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  4. *
  5. * This file is part of GNU Mes.
  6. *
  7. * GNU Mes is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * GNU Mes is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef __MES_LIB_MINI_H
  21. #define __MES_LIB_MINI_H
  22. #if HAVE_CONFIG_H
  23. #include <mes/config.h>
  24. #endif
  25. #ifndef STDIN
  26. #define STDIN 0
  27. #endif
  28. #ifndef STDOUT
  29. #define STDOUT 1
  30. #endif
  31. #ifndef STDERR
  32. #define STDERR 2
  33. #endif
  34. extern char **environ;
  35. extern int __stdin;
  36. extern int __stdout;
  37. extern int __stderr;
  38. int eputs (char const *s);
  39. int puts (char const *s);
  40. int oputs (char const *s);
  41. #if SYSTEM_LIBC
  42. #include <sys/types.h>
  43. #include <unistd.h>
  44. #else //!SYSTEM_LIBC
  45. #ifndef _SIZE_T
  46. #define _SIZE_T
  47. #ifndef __SIZE_T
  48. #define __SIZE_T
  49. #ifndef __MES_SIZE_T
  50. #define __MES_SIZE_T
  51. #undef size_t
  52. typedef unsigned long size_t;
  53. #endif
  54. #endif
  55. #endif
  56. #ifndef _SSIZE_T
  57. #define _SSIZE_T
  58. #ifndef __SSIZE_T
  59. #define __SSIZE_T
  60. #ifndef __MES_SSIZE_T
  61. #define __MES_SSIZE_T
  62. #undef ssize_t
  63. #if __i386__
  64. typedef int ssize_t;
  65. #else
  66. typedef long ssize_t;
  67. #endif
  68. #endif
  69. #endif
  70. #endif
  71. #ifndef __MES_ERRNO_T
  72. #define __MES_ERRNO_T 1
  73. typedef int error_t;
  74. extern int errno;
  75. #endif // !__MES_ERRNO_T
  76. size_t strlen (char const *s);
  77. ssize_t _write ();
  78. ssize_t write (int filedes, void const *buffer, size_t size);
  79. #endif // !SYSTEM_LIBC
  80. #endif //__MES_LIB_MINI_H