xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_string.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <strings.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	NTOS_UPCASE	0x1	/* Use upper-case hexadecimal digits */
40 #define	NTOS_UNSIGNED	0x2	/* Value is meant to be unsigned */
41 #define	NTOS_SIGNPOS	0x4	/* Prefix positive values with sign '+' */
42 #define	NTOS_SHOWBASE	0x8	/* Show base under appropriate circumstances */
43 
44 extern const char *numtostr(uintmax_t, int, uint_t);
45 extern uintmax_t strtonum(const char *, int);
46 extern ulong_t strntoul(const char *, size_t, int);
47 extern int strisnum(const char *);
48 extern int strisbasenum(const char *);
49 extern int strtoi(const char *);
50 
51 extern char *strdup(const char *);
52 extern char *strndup(const char *, size_t);
53 extern void strfree(char *);
54 
55 extern size_t stresc2chr(char *);
56 extern char *strchr2esc(const char *, size_t);
57 extern char *strchr2adb(const char *, size_t);
58 
59 extern char *strnchr(const char *, int, size_t);
60 
61 extern char *strsplit(char *, char);
62 extern char *strrsplit(char *, char);
63 extern const char *strnpbrk(const char *, const char *, size_t);
64 extern char *strabbr(char *, size_t);
65 
66 extern const char *strbasename(const char *);
67 extern char *strdirname(char *);
68 
69 extern const char *strbadid(const char *);
70 extern int strisprint(const char *);
71 
72 extern char *mdb_inet_ntop(int, const void *, char *, size_t);
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* _MDB_STRING_H */
79