xref: /illumos-gate/usr/src/common/util/string.h (revision d8109ce4330e1b8ad6c29f9fccacec969066bb9d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Copyright (c) 2016 by Delphix. All rights reserved.
29  */
30 
31 #ifndef	_COMMON_UTIL_STRING_H
32 #define	_COMMON_UTIL_STRING_H
33 
34 #include <sys/types.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #if !defined(_KMDB) && (!defined(_BOOT) || defined(__sparc))
41 
42 extern size_t vsnprintf(char *, size_t, const char *, va_list);
43 /*PRINTFLIKE3*/
44 extern size_t snprintf(char *, size_t, const char *, ...);
45 
46 #if defined(_BOOT) && defined(__sparc)
47 
48 /*PRINTFLIKE2*/
49 extern int sprintf(char *, const char *, ...);
50 extern int vsprintf(char *, const char *, va_list);
51 
52 #endif /* _BOOT && __sparc */
53 #endif /* !_KMDB && (!_BOOT || __sparc) */
54 
55 extern char *strcat(char *, const char *);
56 extern char *strchr(const char *, int);
57 extern int strcmp(const char *, const char *);
58 extern int strncmp(const char *, const char *, size_t);
59 extern int strcasecmp(const char *, const char *);
60 extern int strncasecmp(const char *, const char *, size_t);
61 extern char *strcpy(char *, const char *);
62 extern char *strncpy(char *, const char *, size_t);
63 extern char *strrchr(const char *, int c);
64 extern char *strstr(const char *, const char *);
65 extern char *strpbrk(const char *, const char *);
66 extern char *strsep(char **, const char *);
67 extern char *strncat(char *, const char *, size_t);
68 extern size_t strlcat(char *, const char *, size_t);
69 extern size_t strlcpy(char *, const char *, size_t);
70 extern size_t strspn(const char *, const char *);
71 extern size_t strnlen(const char *, size_t);
72 
73 #if defined(_BOOT) || defined(_KMDB)
74 
75 extern char *strtok(char *, const char *);
76 extern size_t strlen(const char *);
77 
78 #endif /* _BOOT || _KMDB */
79 
80 #ifdef _KERNEL
81 
82 extern int strident_valid(const char *);
83 extern void strident_canon(char *, size_t);
84 
85 #endif	/* _KERNEL */
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif	/* _COMMON_UTIL_STRING_H */
92