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