strings.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Copyright (C) 1991,92,96,97,99,2000,2001 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _STRINGS_H
  16. #define _STRINGS_H 1
  17. /* We don't need and should not read this file if <string.h> was already
  18. read. The one exception being that if __USE_BSD isn't defined, then
  19. these aren't defined in string.h, so we need to define them here. */
  20. /* keep this file in sync w/ string.h, the glibc version is out of date */
  21. #if !defined _STRING_H || !defined __USE_BSD
  22. # include <features.h>
  23. # define __need_size_t
  24. # include <stddef.h>
  25. __BEGIN_DECLS
  26. /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
  27. extern void bcopy (__const void *__src, void *__dest, size_t __n)
  28. __THROW __nonnull ((1, 2));
  29. /* Set N bytes of S to 0. */
  30. extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
  31. /* Compare N bytes of S1 and S2 (same as memcmp). */
  32. extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
  33. __THROW __attribute_pure__ __nonnull ((1, 2));
  34. /* Find the first occurrence of C in S (same as strchr). */
  35. extern char *index (__const char *__s, int __c)
  36. __THROW __attribute_pure__ __nonnull ((1));
  37. /* Find the last occurrence of C in S (same as strrchr). */
  38. extern char *rindex (__const char *__s, int __c)
  39. __THROW __attribute_pure__ __nonnull ((1));
  40. /* Return the position of the first bit set in I, or 0 if none are set.
  41. The least-significant bit is position 1, the most-significant 32. */
  42. extern int ffs (int __i) __THROW __attribute__ ((__const__));
  43. /* The following two functions are non-standard but necessary for non-32 bit
  44. platforms. */
  45. #if 0 /*def __USE_GNU*/
  46. extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
  47. # ifdef __GNUC__
  48. __extension__ extern int ffsll (long long int __ll)
  49. __THROW __attribute__ ((__const__));
  50. # endif
  51. # endif
  52. /* Compare S1 and S2, ignoring case. */
  53. extern int strcasecmp (__const char *__s1, __const char *__s2)
  54. __THROW __attribute_pure__ __nonnull ((1, 2));
  55. /* Compare no more than N chars of S1 and S2, ignoring case. */
  56. extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
  57. __THROW __attribute_pure__ __nonnull ((1, 2));
  58. __END_DECLS
  59. #endif /* string.h */
  60. #endif /* strings.h */