11fcced4cSJordan Brown /*
21fcced4cSJordan Brown  * CDDL HEADER START
31fcced4cSJordan Brown  *
41fcced4cSJordan Brown  * The contents of this file are subject to the terms of the
51fcced4cSJordan Brown  * Common Development and Distribution License (the "License").
61fcced4cSJordan Brown  * You may not use this file except in compliance with the License.
71fcced4cSJordan Brown  *
81fcced4cSJordan Brown  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91fcced4cSJordan Brown  * or http://www.opensolaris.org/os/licensing.
101fcced4cSJordan Brown  * See the License for the specific language governing permissions
111fcced4cSJordan Brown  * and limitations under the License.
121fcced4cSJordan Brown  *
131fcced4cSJordan Brown  * When distributing Covered Code, include this CDDL HEADER in each
141fcced4cSJordan Brown  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151fcced4cSJordan Brown  * If applicable, add the following below this CDDL HEADER, with the
161fcced4cSJordan Brown  * fields enclosed by brackets "[]" replaced with your own identifying
171fcced4cSJordan Brown  * information: Portions Copyright [yyyy] [name of copyright owner]
181fcced4cSJordan Brown  *
191fcced4cSJordan Brown  * CDDL HEADER END
201fcced4cSJordan Brown  */
211fcced4cSJordan Brown 
221fcced4cSJordan Brown /*
23*cb174861Sjoyce mcintosh  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
241fcced4cSJordan Brown  */
251fcced4cSJordan Brown 
261fcced4cSJordan Brown /*
27*cb174861Sjoyce mcintosh  * String helper functions
281fcced4cSJordan Brown  */
291fcced4cSJordan Brown 
30*cb174861Sjoyce mcintosh #include <string.h>
31*cb174861Sjoyce mcintosh #include <sys/types.h>
32*cb174861Sjoyce mcintosh #include <stdio.h>
33*cb174861Sjoyce mcintosh #include <malloc.h>
34*cb174861Sjoyce mcintosh #include <ctype.h>
35*cb174861Sjoyce mcintosh #include "libuutil.h"
36*cb174861Sjoyce mcintosh 
37*cb174861Sjoyce mcintosh /* Return true if strings are equal */
38*cb174861Sjoyce mcintosh boolean_t
uu_streq(const char * a,const char * b)39*cb174861Sjoyce mcintosh uu_streq(const char *a, const char *b)
40*cb174861Sjoyce mcintosh {
41*cb174861Sjoyce mcintosh 	return (strcmp(a, b) == 0);
42*cb174861Sjoyce mcintosh }
431fcced4cSJordan Brown 
44*cb174861Sjoyce mcintosh /* Return true if strings are equal, case-insensitively */
45*cb174861Sjoyce mcintosh boolean_t
uu_strcaseeq(const char * a,const char * b)46*cb174861Sjoyce mcintosh uu_strcaseeq(const char *a, const char *b)
47*cb174861Sjoyce mcintosh {
48*cb174861Sjoyce mcintosh 	return (strcasecmp(a, b) == 0);
491fcced4cSJordan Brown }
501fcced4cSJordan Brown 
51*cb174861Sjoyce mcintosh /* Return true if string a Begins With string b */
52*cb174861Sjoyce mcintosh boolean_t
uu_strbw(const char * a,const char * b)53*cb174861Sjoyce mcintosh uu_strbw(const char *a, const char *b)
54*cb174861Sjoyce mcintosh {
55*cb174861Sjoyce mcintosh 	return (strncmp(a, b, strlen(b)) == 0);
56*cb174861Sjoyce mcintosh }
57