glibc/string/string.h

187 lines
6.9 KiB
C
Raw Normal View History

1993-08-31 00:10:32 +00:00
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
1992-02-26 03:24:33 +00:00
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
1992-05-22 07:51:58 +00:00
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
1992-02-26 03:24:33 +00:00
Cambridge, MA 02139, USA. */
/*
* ANSI Standard: 4.11 STRING HANDLING <string.h>
*/
#ifndef _STRING_H
#define _STRING_H 1
#include <features.h>
1992-05-22 07:51:58 +00:00
__BEGIN_DECLS
1992-05-12 05:07:31 +00:00
1992-02-26 03:24:33 +00:00
/* Get size_t and NULL from <stddef.h>. */
#define __need_size_t
#define __need_NULL
#include <stddef.h>
/* Copy N bytes of SRC to DEST. */
1992-05-24 04:40:47 +00:00
extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,
size_t __n));
1992-02-26 03:24:33 +00:00
/* Copy N bytes of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
1992-05-24 04:40:47 +00:00
extern __ptr_t memmove __P ((__ptr_t __dest, __const __ptr_t __src,
size_t __n));
1992-02-26 03:24:33 +00:00
/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
Return the position in DEST one byte past where C was copied,
or NULL if C was not found in the first N bytes of SRC. */
1992-05-22 07:51:58 +00:00
extern __ptr_t __memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
int __c, size_t __n));
1992-05-14 07:35:48 +00:00
#if defined (__USE_SVID) || defined (__USE_BSD)
1992-05-22 07:51:58 +00:00
extern __ptr_t memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
int __c, size_t __n));
1992-02-26 03:24:33 +00:00
#ifdef __OPTIMIZE__
#define memccpy(dest, src, c, n) __memccpy((dest), (src), (c), (n))
1992-05-22 07:51:58 +00:00
#endif /* Optimizing. */
#endif /* SVID. */
1992-02-26 03:24:33 +00:00
/* Set N bytes of S to C. */
1992-05-22 07:51:58 +00:00
extern __ptr_t memset __P ((__ptr_t __s, int __c, size_t __n));
1992-02-26 03:24:33 +00:00
/* Compare N bytes of S1 and S2. */
1992-05-24 04:40:47 +00:00
extern int memcmp __P ((__const __ptr_t __s1, __const __ptr_t __s2,
size_t __n));
1992-02-26 03:24:33 +00:00
/* Search N bytes of S for C. */
1992-05-22 07:51:58 +00:00
extern __ptr_t memchr __P ((__const __ptr_t __s, int __c, size_t __n));
1992-02-26 03:24:33 +00:00
/* Copy SRC to DEST. */
1992-05-22 07:51:58 +00:00
extern char *strcpy __P ((char *__dest, __const char *__src));
1992-02-26 03:24:33 +00:00
/* Copy no more than N characters of SRC to DEST. */
1992-05-22 07:51:58 +00:00
extern char *strncpy __P ((char *__dest, __const char *__src, size_t __n));
1992-02-26 03:24:33 +00:00
/* Append SRC onto DEST. */
1992-05-22 07:51:58 +00:00
extern char *strcat __P ((char *__src, __const char *__dest));
1992-02-26 03:24:33 +00:00
/* Append no more than N characters from SRC onto DEST. */
1992-05-22 07:51:58 +00:00
extern char *strncat __P ((char *__dest, __const char *__src, size_t __n));
1992-02-26 03:24:33 +00:00
/* Compare S1 and S2. */
1992-05-22 07:51:58 +00:00
extern int strcmp __P ((__const char *__s1, __const char *__s2));
1992-02-26 03:24:33 +00:00
/* Compare N characters of S1 and S2. */
1992-05-22 07:51:58 +00:00
extern int strncmp __P ((__const char *__s1, __const char *__s2, size_t __n));
1992-02-26 03:24:33 +00:00
/* Compare the collated forms of S1 and S2. */
1992-05-22 07:51:58 +00:00
extern int strcoll __P ((__const char *__s1, __const char *__s2));
1992-02-26 03:24:33 +00:00
/* Put a transformation of SRC into no more than N bytes of DEST. */
1992-05-22 07:51:58 +00:00
extern size_t strxfrm __P ((char *__dest, __const char *__src, size_t __n));
1992-02-26 03:24:33 +00:00
1992-05-14 07:35:48 +00:00
#if defined (__USE_SVID) || defined (__USE_BSD)
1992-02-26 03:24:33 +00:00
/* Duplicate S, returning an identical malloc'd string. */
1992-05-22 07:51:58 +00:00
extern char *strdup __P ((__const char *__s));
1992-02-26 03:24:33 +00:00
#endif
/* Find the first occurrence of C in S. */
1992-05-22 07:51:58 +00:00
extern char *strchr __P ((__const char *__s, int __c));
1992-02-26 03:24:33 +00:00
/* Find the last occurrence of C in S. */
1992-05-22 07:51:58 +00:00
extern char *strrchr __P ((__const char *__s, int __c));
1992-02-26 03:24:33 +00:00
/* Return the length of the initial segment of S which
consists entirely of characters not in REJECT. */
1992-05-22 07:51:58 +00:00
extern size_t strcspn __P ((__const char *__s, __const char *__reject));
1992-02-26 03:24:33 +00:00
/* Return the length of the initial segment of S which
consists entirely of characters in ACCEPT. */
1992-05-22 07:51:58 +00:00
extern size_t strspn __P ((__const char *__s, __const char *__accept));
1992-02-26 03:24:33 +00:00
/* Find the first occurence in S of any character in ACCEPT. */
1992-05-22 07:51:58 +00:00
extern char *strpbrk __P ((__const char *__s, __const char *__accept));
1992-02-26 03:24:33 +00:00
/* Find the first occurence of NEEDLE in HAYSTACK. */
1992-05-22 07:51:58 +00:00
extern char *strstr __P ((__const char *__haystack, __const char *__needle));
1992-02-26 03:24:33 +00:00
/* Divide S into tokens separated by characters in DELIM. */
1992-05-22 07:51:58 +00:00
extern char *strtok __P ((char *__s, __const char *__delim));
1992-02-26 03:24:33 +00:00
#ifdef __USE_GNU
/* Find the first occurence of NEEDLE in HAYSTACK.
1992-09-03 21:53:07 +00:00
NEEDLE is NEEDLELEN bytes long;
HAYSTACK is HAYSTACKLEN bytes long. */
1993-08-31 00:10:32 +00:00
extern __ptr_t memmem __P ((__const __ptr_t __haystack, size_t __haystacklen,
__const __ptr_t __needle, size_t __needlelen));
1992-02-26 03:24:33 +00:00
#endif
/* Return the length of S. */
1992-05-22 07:51:58 +00:00
extern size_t strlen __P ((__const char *__s));
1992-02-26 03:24:33 +00:00
/* Return a string describing the meaning of the errno code in ERRNUM. */
1992-05-22 07:51:58 +00:00
extern char *strerror __P ((int __errnum));
1992-02-26 03:24:33 +00:00
#ifdef __USE_BSD
1992-05-14 07:35:48 +00:00
/* Find the first occurrence of C in S (same as strchr). */
1992-05-22 07:51:58 +00:00
extern char *index __P ((__const char *__s, int __c));
1992-05-14 07:35:48 +00:00
/* Find the last occurrence of C in S (same as strrchr). */
1992-05-22 07:51:58 +00:00
extern char *rindex __P ((__const char *__s, int __c));
1992-05-14 07:35:48 +00:00
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
1992-05-22 07:51:58 +00:00
extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
1992-05-14 07:35:48 +00:00
/* Set N bytes of S to 0. */
1992-05-22 07:51:58 +00:00
extern void bzero __P ((__ptr_t __s, size_t __n));
1992-05-14 07:35:48 +00:00
/* Compare N bytes of S1 and S2 (same as memcmp). */
1992-05-22 07:51:58 +00:00
extern int bcmp __P ((__const __ptr_t __s1, __const __ptr_t __s2, size_t __n));
1992-05-14 07:35:48 +00:00
/* Return the position of the first bit set in I, or 0 if none are set.
The least-significant bit is position 1, the most-significant 32. */
1992-05-22 07:51:58 +00:00
extern int ffs __P ((int __i));
1992-05-14 07:35:48 +00:00
1992-02-26 03:24:33 +00:00
/* Compare S1 and S2, ignoring case. */
1992-05-22 07:51:58 +00:00
extern int strcasecmp __P ((__const char *__s1, __const char *__s2));
1992-05-13 03:05:29 +00:00
/* Return the next DELIM-delimited token from *STRINGP,
terminating it with a '\0', and update *STRINGP to point past it. */
1992-05-22 07:51:58 +00:00
extern char *strsep __P ((char **__stringp, __const char *__delim));
1992-02-26 03:24:33 +00:00
#endif
1993-10-29 21:36:39 +00:00
/* Copy no more than N characters of SRC to DEST, returning the address of
the last character written into DEST. */
extern char *__stpncpy __P ((char *__dest, __const char *__src, size_t __n));
1992-02-26 03:24:33 +00:00
#ifdef __USE_GNU
1992-04-14 20:57:39 +00:00
/* Compare no more than N chars of S1 and S2, ignoring case. */
1992-05-22 07:51:58 +00:00
extern int strncasecmp __P ((__const char *__s1, __const char *__s2,
size_t __n));
1992-04-14 20:57:39 +00:00
1992-02-26 03:24:33 +00:00
/* Return a string describing the meaning of the signal number in SIG. */
1992-05-22 07:51:58 +00:00
extern char *strsignal __P ((int __sig));
1992-02-26 03:24:33 +00:00
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
1992-05-22 07:51:58 +00:00
extern char *stpcpy __P ((char *__dest, __const char *__src));
1993-10-29 21:36:39 +00:00
/* Copy no more than N characters of SRC to DEST, returning the address of
the last character written into DEST. */
extern char *stpncpy __P ((char *__dest, __const char *__src, size_t __n));
#ifdef __OPTIMIZE__
#define stpncpy(dest, src, n) __stpncpy ((dest), (src), (n))
#endif
1992-05-22 07:51:58 +00:00
/* Sautee STRING briskly. */
extern char *strfry __P ((char *__string));
1992-02-26 03:24:33 +00:00
1992-05-22 07:51:58 +00:00
/* Frobnicate N bytes of S. */
1992-05-24 04:40:47 +00:00
extern __ptr_t memfrob __P ((__ptr_t __s, size_t __n));
1992-05-12 05:07:31 +00:00
#endif
1992-05-22 07:51:58 +00:00
__END_DECLS
#endif /* string.h */