xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_string.h (revision 5f82aa32fbc5dc2c59bca6ff315f44a4c4c9ea86)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_STRING_H
28 #define	_MDB_STRING_H
29 
30 #include <sys/types.h>
31 #include <strings.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	NTOS_UPCASE	0x1	/* Use upper-case hexadecimal digits */
38 #define	NTOS_UNSIGNED	0x2	/* Value is meant to be unsigned */
39 #define	NTOS_SIGNPOS	0x4	/* Prefix positive values with sign '+' */
40 #define	NTOS_SHOWBASE	0x8	/* Show base under appropriate circumstances */
41 
42 extern const char *numtostr(uintmax_t, int, uint_t);
43 extern uintmax_t mdb_strtonum(const char *, int);
44 extern ulong_t strntoul(const char *, size_t, int);
45 extern int strisnum(const char *);
46 extern int strisbasenum(const char *);
47 extern int strtoi(const char *);
48 
49 extern char *strdup(const char *);
50 extern char *strndup(const char *, size_t);
51 extern void strfree(char *);
52 
53 extern size_t stresc2chr(char *);
54 extern char *strchr2esc(const char *, size_t);
55 extern char *strchr2adb(const char *, size_t);
56 
57 extern char *strnchr(const char *, int, size_t);
58 
59 extern char *strsplit(char *, char);
60 extern char *strrsplit(char *, char);
61 extern const char *strnpbrk(const char *, const char *, size_t);
62 extern char *strabbr(char *, size_t);
63 
64 extern const char *strbasename(const char *);
65 extern char *strdirname(char *);
66 
67 extern const char *strbadid(const char *);
68 extern int strisprint(const char *);
69 
70 extern char *mdb_inet_ntop(int, const void *, char *, size_t);
71 
72 #ifdef	__cplusplus
73 }
74 #endif
75 
76 #endif	/* _MDB_STRING_H */
77