Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
6.3 KiB

  1. /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */
  2. /*-
  3. * Copyright (c) 1990 The Regents of the University of California.
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by the University of
  17. * California, Berkeley and its contributors.
  18. * 4. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * @(#)stdlib.h 5.13 (Berkeley) 6/4/91
  35. */
  36. #ifndef _STDLIB_H_
  37. #define _STDLIB_H_
  38. #include <machine/ansi.h>
  39. #if !defined(_ANSI_SOURCE) /* for quad_t, etc. */
  40. #include <sys/types.h>
  41. #endif
  42. #ifdef _BSD_SIZE_T_
  43. typedef _BSD_SIZE_T_ size_t;
  44. #undef _BSD_SIZE_T_
  45. #endif
  46. #ifdef _BSD_WCHAR_T_
  47. typedef _BSD_WCHAR_T_ wchar_t;
  48. #undef _BSD_WCHAR_T_
  49. #endif
  50. typedef struct {
  51. int quot; /* quotient */
  52. int rem; /* remainder */
  53. } div_t;
  54. typedef struct {
  55. long quot; /* quotient */
  56. long rem; /* remainder */
  57. } ldiv_t;
  58. #if !defined(_ANSI_SOURCE)
  59. typedef struct {
  60. quad_t quot; /* quotient */
  61. quad_t rem; /* remainder */
  62. } qdiv_t;
  63. #endif
  64. #ifndef NULL
  65. #define NULL 0
  66. #endif
  67. #define EXIT_FAILURE 1
  68. #define EXIT_SUCCESS 0
  69. #define RAND_MAX 0x7fffffff
  70. #define MB_CUR_MAX 1 /* XXX */
  71. #include <sys/cdefs.h>
  72. __BEGIN_DECLS
  73. __dead void abort __P((void));
  74. int abs __P((int));
  75. int atexit __P((void (*)(void)));
  76. double atof __P((const char *));
  77. int atoi __P((const char *));
  78. long atol __P((const char *));
  79. void *bsearch __P((const void *, const void *, size_t,
  80. size_t, int (*)(const void *, const void *)));
  81. void *calloc __P((size_t, size_t));
  82. div_t div __P((int, int));
  83. __dead void exit __P((int));
  84. void free __P((void *));
  85. char *getenv __P((const char *));
  86. long labs __P((long));
  87. ldiv_t ldiv __P((long, long));
  88. void *malloc __P((size_t));
  89. void qsort __P((void *, size_t, size_t,
  90. int (*)(const void *, const void *)));
  91. int rand __P((void));
  92. void *realloc __P((void *, size_t));
  93. void srand __P((unsigned));
  94. double strtod __P((const char *, char **));
  95. long strtol __P((const char *, char **, int));
  96. unsigned long
  97. strtoul __P((const char *, char **, int));
  98. int system __P((const char *));
  99. /* these are currently just stubs */
  100. int mblen __P((const char *, size_t));
  101. size_t mbstowcs __P((wchar_t *, const char *, size_t));
  102. int wctomb __P((char *, wchar_t));
  103. int mbtowc __P((wchar_t *, const char *, size_t));
  104. size_t wcstombs __P((char *, const wchar_t *, size_t));
  105. #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  106. #if defined(alloca) && (alloca == __builtin_alloca) && (__GNUC__ < 2)
  107. void *alloca __P((int)); /* built-in for gcc */
  108. #else
  109. void *alloca __P((size_t));
  110. #endif /* __GNUC__ */
  111. char *getbsize __P((int *, long *));
  112. char *cgetcap __P((char *, char *, int));
  113. int cgetclose __P((void));
  114. int cgetent __P((char **, char **, char *));
  115. int cgetfirst __P((char **, char **));
  116. int cgetmatch __P((char *, char *));
  117. int cgetnext __P((char **, char **));
  118. int cgetnum __P((char *, char *, long *));
  119. int cgetset __P((char *));
  120. int cgetstr __P((char *, char *, char **));
  121. int cgetustr __P((char *, char *, char **));
  122. int daemon __P((int, int));
  123. char *devname __P((int, int));
  124. int getloadavg __P((double [], int));
  125. long a64l __P((const char *));
  126. char *l64a __P((long));
  127. void cfree __P((void *));
  128. int getopt __P((int, char * const *, const char *));
  129. extern char *optarg; /* getopt(3) external variables */
  130. extern int opterr;
  131. extern int optind;
  132. extern int optopt;
  133. extern int optreset;
  134. int getsubopt __P((char **, char * const *, char **));
  135. extern char *suboptarg; /* getsubopt(3) external variable */
  136. int heapsort __P((void *, size_t, size_t,
  137. int (*)(const void *, const void *)));
  138. int mergesort __P((void *, size_t, size_t,
  139. int (*)(const void *, const void *)));
  140. int radixsort __P((const unsigned char **, int, const unsigned char *,
  141. unsigned));
  142. int sradixsort __P((const unsigned char **, int, const unsigned char *,
  143. unsigned));
  144. char *initstate __P((unsigned, char *, int));
  145. long random __P((void));
  146. char *realpath __P((const char *, char *));
  147. char *setstate __P((char *));
  148. void srandom __P((unsigned));
  149. int putenv __P((const char *));
  150. int setenv __P((const char *, const char *, int));
  151. void unsetenv __P((const char *));
  152. void setproctitle __P((const char *, ...));
  153. quad_t qabs __P((quad_t));
  154. qdiv_t qdiv __P((quad_t, quad_t));
  155. quad_t strtoq __P((const char *, char **, int));
  156. u_quad_t strtouq __P((const char *, char **, int));
  157. double drand48 __P((void));
  158. double erand48 __P((unsigned short[3]));
  159. long jrand48 __P((unsigned short[3]));
  160. void lcong48 __P((unsigned short[7]));
  161. long lrand48 __P((void));
  162. long mrand48 __P((void));
  163. long nrand48 __P((unsigned short[3]));
  164. unsigned short *seed48 __P((unsigned short[3]));
  165. void srand48 __P((long));
  166. u_int32_t arc4random __P((void));
  167. void arc4random_stir __P((void));
  168. void arc4random_addrandom __P((u_char *, int));
  169. #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
  170. __END_DECLS
  171. #endif /* _STDLIB_H_ */